Translate C code to assembly language
Learn about mapping C function calls, loops and conditional statements to assembly
Published in
2 min readMar 25, 2018
Mapping from C to generic assembly code
Learn the basics of mapping from C to a generic assembly language. The following link covers:
- C function call and stack frame management for keeping track of parameters and local variables
- Code generated for while loops, for loops and structure access
- Assembly code for handling conditional statements in C
x86 assembly basics
The following video covers the basics on x86 assembly language.
- Understand the basic register set on x86 processors.
- Learn how a stack frame is managed.
- Learn assembly language basics with move, add, sub, push, pop, lea (load effective address), cmp, jmp, call, leave and return
Understanding the x86 assembly code generated from a C program
The following video maps a C program that calculates Fibonacci numbers into x86 assembly code. You will learn:
- Accessing local variables with address offsets from the base pointer register (rbp)
- Passing parameters to a function via the stack
- Calling a C function.
- Removing the parameters from the stack.
- Implementing a while loop in assembly.
- Performing arithmetic operations.
Use the interactive online compiler to high level languages like C, C++ into assembly
Compare the assembly code generated from high level languages for different compilers and processor architectures using the Compiler Explorer.