LOGBOOK

HELP

Quiz Entry - updated: 2026.07.10

What are the big-picture takeaways for how C is translated into assembly?

Assembly has no high-level constructs at all — every loop, branch, and data structure dissolves into compares, jumps, and fixed memory offsets that the compiler computes ahead of time.

The whole topic reduces to three lessons about what disappears when C becomes machine code:

Control flow — none of it survives as keywords:

  • No if/while/for/switch exist as instructions.
  • Everything is built from cmp/test + conditional jump (jcc).
  • Loops collapse to one form: forwhiledo-while → assembly.
  • Dense switches become jump tables (O(1)); sparse ones become decision trees.

Composite data — no arrays, structs, or unions either:

  • All become offsets into linear memory, computed at compile time.
  • arr[i]base + i*size; s.memberbase + offset.

Calling conventions — how functions talk:

  • x86_64 passes the first 6 args in registers (%rdi,%rsi,%rdx,%rcx,%r8,%r9); IA32 uses the stack.
  • You must track which registers are caller-saved vs callee-saved.

The unifying mental model: the compiler is a translator that flattens structured, typed C into a flat sequence of bytes addressed by numbers — and reverse engineering is reading that flattening backwards.

Go deeper:

From Quiz: REVE1 / Translation of C to Assembly | Updated: Jul 10, 2026