← Back to archive

Stdle #33 · stack · 2026-07-09

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]!
mov w8, #20
mov w9, #8
mov w10, #5
mov w11, #3
str w8, [sp, #16]
str w9, [sp, #20]
str w10, [sp, #24]
str w11, [sp, #28]
ldr w12, [sp, #16]
ldr w13, [sp, #20]
ldr w14, [sp, #24]
ldr w15, [sp, #28]
sub w12, w12, w13
sub w14, w14, w15
sub w12, w12, w14
sub sp, sp, #16
str x12, [sp]
adrp x0, fmt@PAGE
add x0, x0, fmt@PAGEOFF
bl _printf
add sp, sp, #16
ldp x29, x30, [sp], #48
mov w0, #0
ret
.section __TEXT,__cstring
fmt: .asciz "%d\n"
Stack
4 attempts left

Answer & explanation