sysy-data/hidden_functional_c/asm/24_array_only.s

317 lines
4.5 KiB
ArmAsm
Raw Normal View History

2024-06-14 13:34:46 +08:00
.text
.attribute 4, 16
.attribute 5, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
.file "24_array_only.sy"
.globl inc_impl
.p2align 1
.type inc_impl,@function
inc_impl:
lw a2, 0(a0)
beqz a1, .LBB0_2
.LBB0_1:
addiw a1, a1, -1
slliw a2, a2, 1
bnez a1, .LBB0_1
.LBB0_2:
addiw a1, a2, 1
sw a1, 0(a0)
ret
.Lfunc_end0:
.size inc_impl, .Lfunc_end0-inc_impl
.globl inc
.p2align 1
.type inc,@function
inc:
lui a1, %hi(k)
lw a2, %lo(k)(a1)
lw a1, 0(a0)
beqz a2, .LBB1_2
.LBB1_1:
addiw a2, a2, -1
slliw a1, a1, 1
bnez a2, .LBB1_1
.LBB1_2:
addiw a1, a1, 1
sw a1, 0(a0)
ret
.Lfunc_end1:
.size inc, .Lfunc_end1-inc
.globl add_impl
.p2align 1
.type add_impl,@function
add_impl:
lw a3, 0(a0)
beqz a2, .LBB2_3
.LBB2_1:
addiw a2, a2, -1
slliw a3, a3, 1
bnez a2, .LBB2_1
sw a3, 0(a0)
.LBB2_3:
lw a1, 0(a1)
addw a1, a1, a3
sw a1, 0(a0)
ret
.Lfunc_end2:
.size add_impl, .Lfunc_end2-add_impl
.globl add
.p2align 1
.type add,@function
add:
lui a2, %hi(k)
lw a3, %lo(k)(a2)
lw a2, 0(a0)
beqz a3, .LBB3_3
.LBB3_1:
addiw a3, a3, -1
slliw a2, a2, 1
bnez a3, .LBB3_1
sw a2, 0(a0)
.LBB3_3:
lw a1, 0(a1)
addw a1, a1, a2
sw a1, 0(a0)
ret
.Lfunc_end3:
.size add, .Lfunc_end3-add
.globl sub_impl
.p2align 1
.type sub_impl,@function
sub_impl:
lw a3, 0(a0)
beqz a2, .LBB4_3
.LBB4_1:
addiw a2, a2, -1
slliw a3, a3, 1
bnez a2, .LBB4_1
sw a3, 0(a0)
.LBB4_3:
lw a1, 0(a1)
subw a1, a3, a1
sw a1, 0(a0)
ret
.Lfunc_end4:
.size sub_impl, .Lfunc_end4-sub_impl
.globl sub
.p2align 1
.type sub,@function
sub:
lui a2, %hi(k)
lw a3, %lo(k)(a2)
lw a2, 0(a0)
beqz a3, .LBB5_3
.LBB5_1:
addiw a3, a3, -1
slliw a2, a2, 1
bnez a3, .LBB5_1
sw a2, 0(a0)
.LBB5_3:
lw a1, 0(a1)
subw a1, a2, a1
sw a1, 0(a0)
ret
.Lfunc_end5:
.size sub, .Lfunc_end5-sub
.globl main
.p2align 1
.type main,@function
main:
addi sp, sp, -64
sd ra, 56(sp)
sd s0, 48(sp)
sd s1, 40(sp)
sd s2, 32(sp)
sd s3, 24(sp)
sd s4, 16(sp)
sd s5, 8(sp)
li a0, -1
srli a0, a0, 32
sd a0, 0(sp)
call getint
lui a1, %hi(k)
sw a0, %lo(k)(a1)
call getint
mv s0, a0
mv a0, sp
call getarray
beqz s0, .LBB6_23
lw a1, 0(sp)
li s2, 4
blt s2, a1, .LBB6_22
lui s3, %hi(i)
lui s4, %hi(k)
li s5, 5
j .LBB6_5
.LBB6_3:
addiw a2, a2, 1
.LBB6_4:
lw a0, 4(sp)
addw a2, a2, a1
sw a2, %lo(i)(s3)
beq a2, a0, .LBB6_23
.LBB6_5:
blt s2, a1, .LBB6_16
mv s1, a1
j .LBB6_9
.LBB6_7:
addw a1, a1, s0
.LBB6_8:
addw s1, s1, s0
subw a1, a1, s0
sw a1, 0(sp)
bge s1, s5, .LBB6_17
.LBB6_9:
lw a0, %lo(i)(s3)
call putint
mv a0, s1
call putint
mv a0, s0
call putint
lw a0, 0(sp)
call putint
lw a0, %lo(k)(s4)
lw a1, 0(sp)
beqz a0, .LBB6_7
mv a2, a0
.LBB6_11:
addiw a2, a2, -1
slliw a1, a1, 1
bnez a2, .LBB6_11
addw a1, a1, s0
mv a2, a0
.LBB6_13:
addiw a2, a2, -1
slliw s1, s1, 1
bnez a2, .LBB6_13
mv a2, a0
.LBB6_15:
addiw a2, a2, -1
slliw a1, a1, 1
bnez a2, .LBB6_15
j .LBB6_8
.LBB6_16:
lw a0, %lo(k)(s4)
.LBB6_17:
lw a2, %lo(i)(s3)
beqz a0, .LBB6_3
mv a3, a0
.LBB6_19:
addiw a3, a3, -1
slliw a2, a2, 1
bnez a3, .LBB6_19
ori a2, a2, 1
.LBB6_21:
addiw a0, a0, -1
slliw a2, a2, 1
bnez a0, .LBB6_21
j .LBB6_4
.LBB6_22:
lw a0, 4(sp)
lui a1, %hi(i)
sw a0, %lo(i)(a1)
.LBB6_23:
li a0, 10
call putch
li a0, 0
ld ra, 56(sp)
ld s0, 48(sp)
ld s1, 40(sp)
ld s2, 32(sp)
ld s3, 24(sp)
ld s4, 16(sp)
ld s5, 8(sp)
addi sp, sp, 64
ret
.Lfunc_end6:
.size main, .Lfunc_end6-main
.type k,@object
.section .sbss,"aw",@nobits
.globl k
.p2align 2
k:
.zero 4
.size k, 4
.type i,@object
.globl i
.p2align 2
i:
.zero 4
.size i, 4
.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