9

What process can be used to convert assembly code into equivalent C code? What kind of tools can be leveraged for higher result accuracy?

Madhav Datt
  • 1,065
  • 2
  • 10
  • 25
Brian
  • 107
  • 1
  • 2
  • 8
  • 2
    Yes, there is. Was that all you wanted to know? Or was there more to your question? – S.Lott Nov 02 '10 at 19:24
  • "<>" is not a question! And your description is not much better. This is not a forum! EDIT* Much better :) – Adam Harte Nov 02 '10 at 19:26
  • He might want a term to google for so he can find it... – Burton Samograd Nov 02 '10 at 19:26
  • 1
    http://stackoverflow.com/questions/560344/how-does-one-disassemble-proc-c-programs – jball Nov 02 '10 at 19:27
  • yeah, that's all i wanted. can U tell me the name of the software? thx – Brian Nov 02 '10 at 19:28
  • 2
    @Brian: "U"? "thx"? What are those words? Please continue to **update** your question to clarify whatever it is you're looking for. Please **fix** your question. – S.Lott Nov 02 '10 at 19:32
  • 1
    **while searching:** It's called reverse engineering. Pretty straight-forward and the converter tool is the brain. – Naveed Nov 02 '10 at 19:33
  • If its not reverse engineering related, then is a possible duplicate of: http://stackoverflow.com/questions/1376856/convert-asm-to-c-not-reverse-engineer – karlphillip Nov 02 '10 at 19:40
  • What you are probably looking for is a Decompiler. Now usually, decompilers aren't able to rebuild the original source files and some outputs might even be unintelligible. To ensure a better outcome, compile your program with debugging information (the `-g` flag with the `g++` compiler). You may still have to put in a lot of manual labor reversing the code. Snowman, Boomerang, IDA Pro are some tools/ – Madhav Datt Dec 29 '15 at 21:04

5 Answers5

6

You cannot go backward to the original C but can do a static binary translation into C that is equivalent to the machine instruction.

old_timer
  • 69,149
  • 8
  • 89
  • 168
4

Wiki Link to disassemblers

Dani
  • 14,639
  • 11
  • 62
  • 110
  • I need a software to convert assembly code to C, not machine code to assembly codes. thx. – Brian Nov 02 '10 at 19:33
  • 5
    @Brian: Please actually read the actual link actually provided. Decompilers are on that page also. – S.Lott Nov 02 '10 at 19:38
3

The term you are looking for is 'decompiler'. Check here for a discussion:

http://en.wikibooks.org/wiki/X86_Disassembly/Disassemblers_and_Decompilers#Decompilers

Burton Samograd
  • 3,652
  • 19
  • 21
1

I used IDAPro in the past and it does a pretty good job doing what you need.

Check it out.

http://www.hex-rays.com/idapro/

istudy0
  • 1,313
  • 5
  • 14
  • 22
-1

If you have an entire application originally written in Assembly, you could look for an automated tool that can convert the entire code base. One that does Assembler conversions that might want to take a look at is Datatek:

Datatek has developed a sophisticated tool-set and a highly customizable process for the automated conversion of Assembler to high-level languages such as C, C++, COBOL, C#, Java, etc.

Full disclosure: I work for Datatek, and personally think we provide a useful service.

Joshua Horn
  • 247
  • 1
  • 11