Rewrite or Refactor?
makecheck: If it is modular, reimplement one module in parallel and test.  If there are no tests, add those first.  If it is not modular, make it so, first.If a single module can be ported to sane code successfully, you have a chance to fix the rest.  If not, start reimplementing the whole thing in parallel.  If you have no parallel test environment, create one first (so you can "deploy" your copy as if it were real).It's all about the order in which you tinker with it. :)