← Back to archive

Stdle #22 · memory · 2026-06-28

What does this Assembly snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

.global _main
.align 2
_main:
stp x29, x30, [sp, #-32]!
adrp x8, arr@PAGE
add x8, x8, arr@PAGEOFF
ldr w9, [x8]
ldr w10, [x8, #4]
ldr w11, [x8, #8]
mov w12, #0
mov w13, #1
mov w14, #2
mul w9, w9, w12
mul w10, w10, w13
mul w11, w11, w14
add w9, w9, w10
add w9, w9, w11
sub sp, sp, #16
str x9, [sp]
adrp x0, fmt@PAGE
add x0, x0, fmt@PAGEOFF
bl _printf
add sp, sp, #16
ldp x29, x30, [sp], #32
mov w0, #0
ret
.section __DATA,__data
.align 2
arr: .long 5, 6, 7
.section __TEXT,__cstring
fmt: .asciz "%d\n"
Memory
4 attempts left

Answer & explanation