5.123 · exercise

Predict: input and output

What printf, scanf, read and write hand back in w0 or x0, and what a specifier that does not match its slot leaves behind.

0 of 5 correct

Predict the result

        .data
fmt_m:  .string "%d cats\n"

        .text
        ldr     x0, =fmt_m
        mov     w1, 12
        bl      printf

Predict the result

        .data
fmt_m:  .string "%d %d"

        .bss
        .balign 4
a_n:    .skip 4
b_n:    .skip 4

        .text
        ldr     x0, =fmt_m
        ldr     x1, =a_n
        ldr     x2, =b_n
        bl      scanf

Predict the result

        .data
ok_m:   .string "ok\n"
ok_len = . - ok_m

        .text
        mov     x8, 64
        mov     x0, 1
        ldr     x1, =ok_m
        mov     x2, ok_len
        svc     0

Predict the result

        .bss
buf_m:  .skip 16

        .text
        mov     x0, 0
        ldr     x1, =buf_m
        mov     x2, 16
        mov     x8, 63
        svc     0

Predict the result

        .data
fmt_m:  .string "%d"

        .bss
        .balign 8
n_n:    .skip 8

        .text
        ldr     x0, =fmt_m
        ldr     x1, =n_n
        bl      scanf
        ldr     x9, =n_n
        ldr     x19, [x9]