283 lines
4.2 KiB
ArmAsm
283 lines
4.2 KiB
ArmAsm
.text
|
|
.attribute 4, 16
|
|
.attribute 5, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
|
|
.file "73_int_io.sy"
|
|
.globl my_getint
|
|
.p2align 1
|
|
.type my_getint,@function
|
|
my_getint:
|
|
addi sp, sp, -32
|
|
sd ra, 24(sp)
|
|
sd s0, 16(sp)
|
|
sd s1, 8(sp)
|
|
li s0, -10
|
|
.LBB0_1:
|
|
call getch
|
|
addiw a1, a0, -58
|
|
bltu a1, s0, .LBB0_1
|
|
addiw s0, a0, -48
|
|
call getch
|
|
addiw a0, a0, -48
|
|
li a1, 9
|
|
bltu a1, a0, .LBB0_5
|
|
li s1, 10
|
|
.LBB0_4:
|
|
mulw a1, s0, s1
|
|
addw s0, a0, a1
|
|
call getch
|
|
addiw a0, a0, -48
|
|
bltu a0, s1, .LBB0_4
|
|
.LBB0_5:
|
|
mv a0, s0
|
|
ld ra, 24(sp)
|
|
ld s0, 16(sp)
|
|
ld s1, 8(sp)
|
|
addi sp, sp, 32
|
|
ret
|
|
.Lfunc_end0:
|
|
.size my_getint, .Lfunc_end0-my_getint
|
|
|
|
.globl my_putint
|
|
.p2align 1
|
|
.type my_putint,@function
|
|
my_putint:
|
|
addi sp, sp, -112
|
|
sd ra, 104(sp)
|
|
sd s0, 96(sp)
|
|
sd s1, 88(sp)
|
|
sd s2, 80(sp)
|
|
sd s3, 72(sp)
|
|
blez a0, .LBB1_6
|
|
li s0, 0
|
|
li a5, 1
|
|
addi a1, sp, 8
|
|
lui a2, 838861
|
|
addiw a2, a2, -819
|
|
slli a3, a2, 32
|
|
li a6, 10
|
|
.LBB1_2:
|
|
mv a2, a5
|
|
sext.w s1, a0
|
|
slli a5, a0, 32
|
|
mulhu a5, a5, a3
|
|
srli a4, a5, 35
|
|
mul a5, a4, a6
|
|
sub a0, a0, a5
|
|
ori a0, a0, 48
|
|
sw a0, 0(a1)
|
|
addi s0, s0, 1
|
|
addiw a5, a2, 1
|
|
addi a1, a1, 4
|
|
mv a0, a4
|
|
bgeu s1, a6, .LBB1_2
|
|
sext.w a0, s0
|
|
blez a0, .LBB1_6
|
|
slli a0, a2, 32
|
|
srli a0, a0, 32
|
|
addi s1, a0, 1
|
|
addi s2, sp, 8
|
|
li s3, 1
|
|
.LBB1_5:
|
|
addiw s0, s0, -1
|
|
slli a0, s0, 32
|
|
srli a0, a0, 30
|
|
add a0, a0, s2
|
|
lw a0, 0(a0)
|
|
call putch
|
|
addi s1, s1, -1
|
|
bltu s3, s1, .LBB1_5
|
|
.LBB1_6:
|
|
ld ra, 104(sp)
|
|
ld s0, 96(sp)
|
|
ld s1, 88(sp)
|
|
ld s2, 80(sp)
|
|
ld s3, 72(sp)
|
|
addi sp, sp, 112
|
|
ret
|
|
.Lfunc_end1:
|
|
.size my_putint, .Lfunc_end1-my_putint
|
|
|
|
.globl main
|
|
.p2align 1
|
|
.type main,@function
|
|
main:
|
|
addi sp, sp, -144
|
|
sd ra, 136(sp)
|
|
sd s0, 128(sp)
|
|
sd s1, 120(sp)
|
|
sd s2, 112(sp)
|
|
sd s3, 104(sp)
|
|
sd s4, 96(sp)
|
|
sd s5, 88(sp)
|
|
sd s6, 80(sp)
|
|
sd s7, 72(sp)
|
|
sd s8, 64(sp)
|
|
li s0, -10
|
|
.LBB2_1:
|
|
call getch
|
|
addiw a1, a0, -58
|
|
bltu a1, s0, .LBB2_1
|
|
addiw s0, a0, -48
|
|
call getch
|
|
addiw a0, a0, -48
|
|
li a1, 9
|
|
bltu a1, a0, .LBB2_5
|
|
li s1, 10
|
|
.LBB2_4:
|
|
mulw a1, s0, s1
|
|
addw s0, a1, a0
|
|
call getch
|
|
addiw a0, a0, -48
|
|
bltu a0, s1, .LBB2_4
|
|
.LBB2_5:
|
|
blez s0, .LBB2_18
|
|
li s3, -10
|
|
li s2, 9
|
|
li s8, 10
|
|
lui a0, 838861
|
|
addiw a0, a0, -819
|
|
slli s7, a0, 32
|
|
mv s4, sp
|
|
li s5, 1
|
|
j .LBB2_8
|
|
.LBB2_7:
|
|
li a0, 10
|
|
call putch
|
|
addiw s0, s6, -1
|
|
bge s5, s6, .LBB2_18
|
|
.LBB2_8:
|
|
mv s6, s0
|
|
.LBB2_9:
|
|
call getch
|
|
addiw a1, a0, -58
|
|
bltu a1, s3, .LBB2_9
|
|
addiw s0, a0, -48
|
|
call getch
|
|
addiw a0, a0, -48
|
|
bltu s2, a0, .LBB2_12
|
|
.LBB2_11:
|
|
mulw a1, s0, s8
|
|
addw s0, a1, a0
|
|
call getch
|
|
addiw a0, a0, -48
|
|
bltu a0, s8, .LBB2_11
|
|
.LBB2_12:
|
|
blez s0, .LBB2_7
|
|
li s1, 0
|
|
mv a1, sp
|
|
li a2, 1
|
|
.LBB2_14:
|
|
mv a3, s0
|
|
mv a0, a2
|
|
slli a2, s0, 32
|
|
mulhu a2, a2, s7
|
|
srli s0, a2, 35
|
|
mul a2, s0, s8
|
|
sub a2, a3, a2
|
|
ori a2, a2, 48
|
|
sw a2, 0(a1)
|
|
addi s1, s1, 1
|
|
addi a1, a1, 4
|
|
addiw a2, a0, 1
|
|
bgeu a3, s8, .LBB2_14
|
|
sext.w a1, s1
|
|
blez a1, .LBB2_7
|
|
slli a0, a0, 32
|
|
srli a0, a0, 32
|
|
addi s0, a0, 1
|
|
.LBB2_17:
|
|
addiw s1, s1, -1
|
|
slli a0, s1, 32
|
|
srli a0, a0, 30
|
|
add a0, a0, s4
|
|
lw a0, 0(a0)
|
|
call putch
|
|
addi s0, s0, -1
|
|
bltu s5, s0, .LBB2_17
|
|
j .LBB2_7
|
|
.LBB2_18:
|
|
li a0, 0
|
|
ld ra, 136(sp)
|
|
ld s0, 128(sp)
|
|
ld s1, 120(sp)
|
|
ld s2, 112(sp)
|
|
ld s3, 104(sp)
|
|
ld s4, 96(sp)
|
|
ld s5, 88(sp)
|
|
ld s6, 80(sp)
|
|
ld s7, 72(sp)
|
|
ld s8, 64(sp)
|
|
addi sp, sp, 144
|
|
ret
|
|
.Lfunc_end2:
|
|
.size main, .Lfunc_end2-main
|
|
|
|
.type _sysy_start,@object
|
|
.bss
|
|
.globl _sysy_start
|
|
.p2align 3
|
|
_sysy_start:
|
|
.zero 16
|
|
.size _sysy_start, 16
|
|
|
|
.type _sysy_end,@object
|
|
.globl _sysy_end
|
|
.p2align 3
|
|
_sysy_end:
|
|
.zero 16
|
|
.size _sysy_end, 16
|
|
|
|
.type _sysy_l1,@object
|
|
.globl _sysy_l1
|
|
.p2align 2
|
|
_sysy_l1:
|
|
.zero 4096
|
|
.size _sysy_l1, 4096
|
|
|
|
.type _sysy_l2,@object
|
|
.globl _sysy_l2
|
|
.p2align 2
|
|
_sysy_l2:
|
|
.zero 4096
|
|
.size _sysy_l2, 4096
|
|
|
|
.type _sysy_h,@object
|
|
.globl _sysy_h
|
|
.p2align 2
|
|
_sysy_h:
|
|
.zero 4096
|
|
.size _sysy_h, 4096
|
|
|
|
.type _sysy_m,@object
|
|
.globl _sysy_m
|
|
.p2align 2
|
|
_sysy_m:
|
|
.zero 4096
|
|
.size _sysy_m, 4096
|
|
|
|
.type _sysy_s,@object
|
|
.globl _sysy_s
|
|
.p2align 2
|
|
_sysy_s:
|
|
.zero 4096
|
|
.size _sysy_s, 4096
|
|
|
|
.type _sysy_us,@object
|
|
.globl _sysy_us
|
|
.p2align 2
|
|
_sysy_us:
|
|
.zero 4096
|
|
.size _sysy_us, 4096
|
|
|
|
.type _sysy_idx,@object
|
|
.section .sbss,"aw",@nobits
|
|
.globl _sysy_idx
|
|
.p2align 2
|
|
_sysy_idx:
|
|
.word 0
|
|
.size _sysy_idx, 4
|
|
|
|
.ident "Debian clang version 14.0.6"
|
|
.section ".note.GNU-stack","",@progbits
|
|
.addrsig
|