These days ppl often (usually?) simply ask an LLM to replce something rather than debugging it (or if they ask the LLM to debug they get a different snarl of code).
So rather than debug a steaming pile of code you might be be able to treat it as a greenfield opportunity.