Is there an easy way (like a free program) that can covert c/c++ code to x86 assembly?
I know that any c compiler does something very similar and that I can just compile
Gcc can do it with the -S switch, but it will be disgustingly ugly at&t syntax.
The lcc compiler is a multiplatform cross-compiler. You can get it to produce Intel syntax assembly code by
lcc -S -Wf-target=x86/win32 foo.c
I find assembly code from lcc
significantly easier to read than what gcc
spits out nowawadays.
Your compiler is already doing that as you've stated, and most likely will have an option to stop before assembling.
For GCC, add the -S
flag.
gcc -S x.c
cat x.s
Edit: If your program is pretty short, you could use the online service at https://gcc.godbolt.org/.
GCC can output Intel syntax assembly using the following command line:
gcc -S input.c -o output.asm -masm=intel
gcc will generate assembly if you pass it the -S
option on the command line.
Microsoft Visual C++ will do the same with the /FAs
option.
notice every architecture has its own unique names and even build differently now when you know the stacks involved using asm volatile would b the perfect solution