The first decision is rarely “rewrite or not?”
A useful investigation separates immediate continuity from long-term architecture. First preserve the working evidence. Then identify the failure layer and recover the knowledge needed to choose repair, isolation, migration or replacement.
Repair
When a bounded dependency or configuration failure prevents an otherwise useful system from operating.
Preserve
When the system works but its hardware, build environment, installer or operational knowledge is becoming scarce.
Reverse engineer
When behavior, data or interfaces must be understood and documentation or source cannot answer the question.
Modernize
When ongoing change, compatibility or security risk exceeds what controlled support can contain.
Start from the problem you actually have
If a critical application has no editable source, use the no-source-code decision framework. If ownership and build knowledge disappeared with a developer, begin with software rescue after developer loss. Unknown data files require a different first step from an unknown device protocol.