C is a popular programming language mostly used for writing system softwares. C is a compiled language. The C compiler compiles C code to produce machine instruction which can directly be run by CPU.

A typical way of compiling a C program is to run the compiler on C code. The compiler will generate assembly language code and run assembler to get CPU instruction code. The translation of C code into assembly language is dependent on compiler. Different compilers may use different strategies. But the differences are not much and there is a common pattern that every compiler follow.

This book describes how a C code is translated into assembly language using gcc compiler on i386 platform. It describes translation of almost all language construct of C.

Pre req: C and little bit of assembly language.

Assembly language syntax

Please note that the assembly language syntax used in this book is GNU assembler(GAS) syntax. The syntax is different than the MASM or NASM syntax.

Here is the major difference:

NASM or MASM:

instruction dest, src

GAS:

instruction src, dest



Readers should get familiar with the GNU assembler syntax before reading this book.



Who should read this