5.19 · exercise
the vanishing value
warning
This program is broken. Find the bug and fix it so the checks pass.
This program swaps two registers, then prints them in their new order. At least, that was the plan. Run it: one of the values has vanished, and the other now appears twice.
Trace the two mov instructions of the swap by hand and watch where the first value goes. Fix the swap so both values survive; the starter even aliases a spare register if you want one, though there are other ways.
what is checked
- both values appear, in swapped order
- the program exits cleanly
Specification
args
stdoutprints the expected output
exitexits with the expected code
Checked by running your program against expected behavior, never by matching a stored solution.
loading editor...