The workplace problem
The management already made their decision. Which leaves you with a simple choice: take it or leave it.
The technical problem
You have to maintain or rewrite a software that you do not understand. You already study the code and it is hopeless.
Then change the approach: find (i.e., create) the requirements of the software. Or better requirements. Start with the main stakeholders for you: the management. What do they actually want? The exact same behavior? Or just a similar enough behavior? What improvements do they expect compared to what is already implemented?
Once you do that, you might find out that you can completely rewrite the software, and even make it better.
You can also infer requirements through usage and testing. "If I do this, I get that". Write that down, they will be very useful in the future.
Regarding the code, change it step by step. Start with what you understand, and gradually move towards the things that you do not understand so well. You might be able to find tools to reverse engineer the software for you, and present you with valuable information: classes, methods, data structures, call graphs, caller graphs...
Static analysis tools might come in handy to spot bugs or code structures that can be beautified and simplified.
But the most important, start with the requirements.