← Back to archive

Stdle #60 · addressing · 2026-08-05

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, #-48]!
stp x19, x20, [sp, #16]
adrp x19, arr@PAGE
add x19, x19, arr@PAGEOFF
add x19, x19, #8
ldr w8, [x19], #-4
ldr w9, [x19]
add w8, w8, w9
sub sp, sp, #16
str x8, [sp]
adrp x0, fmt@PAGE
add x0, x0, fmt@PAGEOFF
bl _printf
add sp, sp, #16
ldp x19, x20, [sp, #16]
ldp x29, x30, [sp], #48
mov w0, #0
ret
.section __DATA,__data
.align 2
arr: .long 10, 20, 30, 40
.section __TEXT,__cstring
fmt: .asciz "%d\n"
Addressing
4 attempts left

Answer & explanation