x86 Dissassembly

Purpose of this assignment is to reverse engineer x86 assembly language of C code.

#include <stdio.h>
#include <stdlib.h>

int sum(int a, int b) {
    return a + b;

void print_the_value(int value) {
    printf("%d", value);

int entry_point() {
    int a = rand(); 
    int b = rand(); 
    int result = sum(b, a);


  1. Copy and paste the code below to https://godbolt.org
  2. Use the following compiler for the ASM code generation: x86-64 gcc 12.2
  3. Under the compiler options, use -Os 
  4. Explain each and every single line of the ASM program
    • You do not have to explain the C code
    • Attempt to provide the WHY rather than the WHAT. For example, do not just say "Moving R1 to R0" but state that "Moving R1 to R0 such that we can pass that as the first parameter to printf"
Back to top