logoalt Hacker News

gavinsyancey • yesterday at 6:02 PM • 1 reply • view on HN

IMO there are two things that decompiling is useful for:

1. Understanding how the program works. But for this you need a good decompilation, not just "portable assembly in C"

2. Porting to a new platform. Once you have something that builds with a C compiler, you can rebuild it for a different platform, usually more performantly than running in an emulator. And it's often doable (if a lot of work) to also swap out graphics APIs, etc. But I'm not sure there's anyone who would care to run Borland DOS compilers on e.g. apple-aarch64, and DOSbox is more than good enough for anyone who does.


Replies

mlyle • today at 12:20 AM

Portable assembly in C is a good first step. Then you can start to name leaf functions and variables… and look for common inlined bits. You can confirm all your higher level transformations continue to produce equivalent bits.

You can leave a model to crank on this for a couple of days and get something much closer to idiomatic source.

It will not be THE source but it will be readable source that produces the same bits.