You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
846 B

.text
.globl reverse
.p2align 2
reverse:
.L.reverse.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
sub sp, sp, #32
str x20, [sp, #0]
str x19, [sp, #8]
mov w19, w0
mov w8, #1
cmp w19, w8
b.le .L.reverse.1
b .L.reverse.2
.L.reverse.1:
bl getint
mov w8, w0
mov w0, w8
bl putint
b .L.reverse.3
.L.reverse.2:
bl getint
mov w20, w0
mov w8, #1
sub w8, w19, w8
mov w0, w8
bl reverse
mov w0, w20
bl putint
b .L.reverse.3
.L.reverse.3:
ldr x20, [sp, #0]
ldr x19, [sp, #8]
add sp, sp, #32
ldp x29, x30, [sp], #16
ret
.text
.globl main
.p2align 2
main:
.L.main.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
mov w8, #200
mov w0, w8
bl reverse
mov w8, #0
mov w0, w8
ldp x29, x30, [sp], #16
ret