LOGBOOK

HELP

Quiz Entry - updated: 2026.07.14

Which assembly mechanisms implement the various C control-flow constructs?

Conditional jumps build if/loops, indirect jumps (through a jump table) build dense switches, and conditional moves build branch-free ?:.

Every high-level control structure boils down to just three machine-level techniques:

C construct Assembly mechanism
if-then-else cmp/test + conditional jump (jl, je, …)
do-while cmp + conditional jump back to the body
while, for Same as do-while, plus an initial guard test
switch (dense) Indirect jump through a jump table — O(1)
switch (sparse) Decision tree or if-else chain
ternary ?: (and simple ifs) Conditional move (cmov) when it's safe to evaluate both sides

The unifying idea: assembly has no structured control flow. The compiler synthesizes all of it from comparisons and jumps. Standard rules of thumb worth memorizing: all loops become do-while, large switches become jump tables, and cheap branchless choices become cmov.

Go deeper:

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