Quiz Entry - updated: 2026.07.06
How do you recognize a uniqueness check (all values must be different) in assembly?
Look for a nested loop where the inner loop compares one element against every other, branching to a failure path on any match.
* Compare-all-pairs nested loop; any equal pair fails. *
# Outer loop: for each element
outer:
mov (%r12), %eax
# Inner loop: compare with all others
inner:
cmp %eax, 0x0(%rbp)
jne .L_ok
call <explode_bomb>
.L_ok:
add $0x4, %rbp
cmp %r13, %rbp
jne inner
add $0x4, %r12
...
jne outer
The pattern:
- Two nested loops (two sets of increment + compare + jump back)
- Inner loop compares one element against each other element
- If any pair matches → fail (explode, error, etc.)
Common context: Validating that N input numbers are all unique (e.g., permutations of 1-N in bomb lab phase 6).
Go deeper: