Code
Port legacy code
Rewrite it in a modern language and prove the behaviour is identical.
Fill it in
Where it is and what language.
The target language and runtime.
Run both against the same inputs and diff the outputs.
Your prompt
Port [the code] to [your to]. Build the equivalence harness BEFORE writing any of the new code: run both against the same inputs and diff the outputs. Without it this is a rewrite with a hope attached, and legacy code is full of behaviour nobody documented and everybody depends on. Preserve the bugs until someone decides otherwise. Rounding that is wrong by a cent, a date boundary that is off by a day: those are load-bearing after twenty years, and "fixing" them silently during a port is how a migration breaks a reconciliation nobody was watching. List every behaviour you found and could not explain. That list is the real output, and it is what a domain expert needs to look at. Match the structure to the target language rather than transliterating.
Use Port legacy codeOpens with everything above already filled in.
Why this works
Rounding that is wrong by a cent and a date boundary off by a day are load-bearing after twenty years, and fixing them silently during a port breaks a reconciliation nobody was watching. This builds the equivalence harness first and preserves the bugs until someone decides otherwise.