Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi... anyone knows how to convert an assembly program into a .c file? i haf a sample code in .asm but i m supposed to program a similar code in c. i m rather weak in assembly, hence, i m not too sure what r the equivalent commands/syntax in c programming. hope that somebody can help me cos i m stuck at this phase for a mth.

hello,
i am not sure whether i am right or not: if there is a program which can convert any assembly code (say, Win32 running on Intel) to c code, that means that any programming can be reverse engineered and give high level language code. as i know, this is not possible at the moment.
like to hear from any other people as well, and please correct me if i am wrong.
wtk =)

================================================================
No, this can not, in any practicle sense, be done. Every compiler that builds a .exe/.com (executable) program creates code very differently for each and every function.Even if this where not the case and there was some kind of standard for all compilers to follow for at least core library function, the optimization, debug, stack, near/far call and any other compile related options would all have to be taken into account. These options can and do alter the method/approach of the operand and operator pairs used in most instructions not to mention the data types used, word (16 bit) alignment rather than byte (8 bit), debug and program header information, stack order (this differs depending upon whether certain modifiers are used in a functions header/declaration), method of parameter invocation for any given function (by value, reference or inferance) etc....
So, for a program to recognize any given number of instructions accurately, it would, at bare minimum, have to know in advance what compiler options where used, what compiler the program was compiled with, what code that specific compiler generates for any core functions and have a database of code for each function with all possible combinations of settings that could change that code (this works out to be a little over eight thousand sets of instructions for each function) not to mention that each of these 8k sets of instructions would have any number of operator/operand pairs or double/long pairs for every one of the 8k. This is just for one function. Now, I don't know exactly how many core library functions there actually are, but for argument sake lets throw the number 1000 out there. Let's also say that the average number of bytes in asm for each of the 8k per function comes out to 200. We would now have a database containing information for about 1000 core library functions. Each of these 1000 functions in the database have a set of 8000 sets of code containing an average of 200 bytes each. The math: 1000 functions multiplied by 8000 sets of code for each multiplied by 200 bytes each = 1,600,000,000 bytes or 1.6 gigs of data. This is impracticle to say the least but we haven't even discussed the method for identifying the appropriate function within the asm code, analysing what optimization and parameter switches or modifiers or code variances or what compiler was used or what debug information (if any) is present and at what level etc., etc., etc....None of this information is stored within the executable anywhere. A few of these could be predictively analysed but almost nothing of use.
So, the bottom line is that, until the companies (all of them) that make compilers come up with a compiler standard that every company uses this reverse engineering to a naitive source is impossible. The powers that be within these companies are not going to do this because it would then make it a very simple matter of stealing technology from a company and using it for your own financial gain. If I was buying a compiler that did this I would want my money back and so would just about every other customer. It is for these reasons that this kind of project will never be done and even if it could, the industry would not allow it to succeed (yes, the major software companies would resort to ANY means to prevent such a product from reaching its market).
borelli35
ps. I have only mentioned about half of the issues involved.

oic.
ok, thanks. because i don't really understand the .asm code that i have. heard that its possible to include some assembly code in a c program. may i know how to go abt doing it?
i m quite desperate now cos i cannot make head or tail of the .asm code that i have. any experts in .asm programming?

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |