← Back to archive

Stdle #95 · memory · 2026-09-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, #-32]!
adrp x8, str@PAGE
add x8, x8, str@PAGEOFF
mov w9, #0
len_loop:
ldrb w10, [x8], #1
cbz w10, len_done
add w9, w9, #1
b len_loop
len_done:
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 __TEXT,__cstring
str: .asciz "hello"
fmt: .asciz "%d\n"
Memory
4 attempts left

Answer & explanation