section my Tools for examining different parts of compiling C page for more information on objump and other tools for examinging binary code, and also some gcc compilation flags for production. Imull $100, %eax, %eax # into R store result of x*100 Will give you something like this (I've annotated some of theĪssembly code with its corresponding code from the C program): You can compare this to the assembly file: To see the machine code and assembly code mappings in the. Gcc -m32 -o simpleops simpleops.o # creates a 32-bit executable file Gcc -m32 -c simpleops.s # compiles to a relocatable object binary file (.o) Gcc -m32 -S simpleops.c # just runs the assembler to create a. For instance, just under 2 of version 4.9 of the Linux kernel source code is written in assembly more than 97 is written in C. To compile to the 32-bit version of x86 instructions, use the -m32įlag (and version 4.4 generates easier to read IA32 code): o file, and to an executable fileĪnd compare the assembly code in each one: Using this very simple C program as an example: