Looking around for IR's used for reverse engineering, I find quite a few interesting ones. Assuming that I have a function that I'm trying to reverse engineer, I'm considering the following approach.

Lift the assembly to an IR, run an optimisation pass on it and convert it back into assembly. How hard would it be to implement something like this? Are there any IRs that you'd recommend. I'm guessing that being able to lift the assembly code into an LLVM IR would be pretty useful and one could run the LLVM optimisation passes on it.

Do you have any suggestions on this?

2 Answers 2


mcsema ('MC-Semantics') translates x86 to LLVM IR so that all the LLVM IR tools can be applied for analysis. It came up in the related topic Recompiling/optimizing redundant code to make analysis easier, which also has pointers to further work/papers.


You can try the Miasm framework which is written in python and has all the capabilities you require. Other than this you have metasm, written in pure ruby with no dependencies. These frameworks implement their own IR which is different from LLVM.

The book Practical Reverse Engineering has tutorials on the usage of the frameworks.

  • I had come across the Miasm framework earlier; from what I see, it provides a means to lift assembly to IR and perform symbolic execution -- but not do optimisation passes on it? Just to be clear. Thanks!
    – user1743
    Commented Jan 27, 2015 at 8:17
  • It really depends on what you call optimization. Miasm can remove some obfuscation at the assembly level. Is that what you mean by optimization? Commented Jan 27, 2015 at 13:47
  • @Dillinur Hi, thanks for commenting. I mainly meant dead code elimination and being able to reduce the number of instructions required to perform a particular operation. I'm also curious if miasm/metasm can work with instruction traces(as opposed to binaries).
    – user1743
    Commented May 7, 2015 at 18:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.