Exercise 2: What Breaks Without the Leading ADD R1, R1, #0 — Possible Solution ==================================================================== WHAT THE LEADING INSTRUCTION IS ACTUALLY FOR ------------------------------ Per the chapter's own explanation, ADD R1, R1, #0 doesn't change R1's value at all (adding zero is a no-op arithmetically) -- its real purpose is to force a fresh condition-code update based on R1's CURRENT value, immediately before the BRz that depends on it. WHAT COULD GO WRONG IF IT WERE REMOVED ------------------------------ Per assembly1-4's own warn-box, condition codes reflect only the MOST RECENT register-writing instruction -- not necessarily the register you actually care about. If R1's value was set several instructions earlier (for example, loaded from memory, or computed as part of some unrelated setup), and any OTHER register-writing instruction executed in between -- even one that never touches R1 itself, like an LEA into a completely different register -- the condition codes at the moment BRz runs would reflect that other, unrelated instruction's result, not R1's value at all. Concretely: if the condition codes happened to already show Z set (zero) for some unrelated reason at that point in the program, BRz would incorrectly branch to ISZERO even if R1 is not actually zero. Or the reverse: if R1 truly is zero but the condition codes currently reflect some other nonzero result, the program would incorrectly fall through to the NEG100 branch instead of taking the ISZERO path. Either way, the branch would be making a decision based on stale, unrelated condition codes instead of R1's actual current value. WHY THIS WORKS AS AN ANSWER ------------------------------ It explains the leading instruction's real purpose (forcing a fresh, correct condition-code read on R1 specifically), then ties the failure mode directly to assembly1-4's own stated rule -- condition codes reflect only the last register write, regardless of which register was written -- with a concrete example of the wrong branch being taken as a result.