LOGBOOK

HELP

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.

Nested loop: outer picks element Ai, inner compares against every other Aj; a match branches to explode_bomb, otherwise all pairs are distinct and the check passes.

* 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:

  1. Two nested loops (two sets of increment + compare + jump back)
  2. Inner loop compares one element against each other element
  3. 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:

From Quiz: REVE1 / Assembly Patterns & GDB | Updated: Jul 06, 2026