Translate C code to assembly language

Learn about mapping C function calls, loops and conditional statements to assembly

EventHelix
Software Design
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:

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.

--

--