• LLMs can do this, probably, but the wisdom here is much more interesting. Indeed I just clicked through to the “Abstract” at the top and read the Algorithm header:

      The first step is to replace dispatching by opcode with dispatching by the address of the opcode: A program must be written that takes the original object code as input and outputs C code with an infinite loop containing a single big switch statement that has a case for every code address. Each case implements the instruction that is found at that address. Subsequent steps optimize the resulting code: one case runs into the next; the switch statement (dispatcher) is replaced by using gotos, updating of the program counter is removed, unnecessary labels are removed (-> basic blocks), until the resulting code looks more and more like the C transcription of the original code.

      This is really clever! And not only that, I can see it working really well if you implement the mentioned optimisations. Surprisingly well, in fact. I do imagine the process will break with self-modifying code, and possibly with overlapping instructions (which are tricks employed as copy protection in some games).

      This idea now lives in my brain and who knows, I may find an unrelated usecase for something like this at some point! And this is only the very high-level abstract!

      Comparatively, using an LLM gets you a result but nothing at all was learned.


      score 1 · canonical