Skip to main content

Practice · 1 of 4

Folding Leaves No Multiply

CHALLENGE
Difficulty: advanced+25 XP

Implement int folded_const(void) returning 21 * 2 via two automatic locals, and int folded_param(int x) returning x * 2. The first's dump must contain no runtime multiply (the test verifies the *value* 42 and that repeated calls agree — folding is transparent to behavior); the second cannot fold (its argument is runtime data). Explain the difference in your hint text.

Back to lesson: Practice: Assembly Evidence Drills