sysy-data/functional_c/asm/94_nested_loops.s

778 lines
12 KiB
ArmAsm

.text
.attribute 4, 16
.attribute 5, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
.file "94_nested_loops.sy"
.globl loop1
.p2align 1
.type loop1,@function
loop1:
addi sp, sp, -64
sd s0, 56(sp)
sd s1, 48(sp)
sd s2, 40(sp)
sd s3, 32(sp)
sd s4, 24(sp)
sd s5, 16(sp)
sd s6, 8(sp)
sd s7, 0(sp)
slti a2, a0, 1
slti a3, a1, 1
or a2, a2, a3
bnez a2, .LBB0_11
addiw a2, a1, -1
addiw a3, a0, -1
bltu a2, a3, .LBB0_3
mv a2, a3
.LBB0_3:
li t1, 0
addw a7, a1, a0
addiw a0, a2, 1
slli a0, a0, 32
srli t0, a0, 32
lui a0, %hi(arr1+120)
addi t4, a0, %lo(arr1+120)
lui a6, 1
addiw t2, a6, -1216
li s5, 4
li t6, 3
.LBB0_4:
li a0, 0
addw t3, a7, t1
li t5, 1
.LBB0_5:
li s4, 0
addw s2, t3, a0
mul a0, a0, t2
add s3, t4, a0
.LBB0_6:
li s7, 0
addw s6, s2, s4
mv s0, s3
.LBB0_7:
addw s1, s6, s7
sw s1, -120(s0)
addiw a1, s1, 1
sw a1, -116(s0)
sw a1, -112(s0)
addiw a3, s1, 2
sw a3, -108(s0)
sw a3, -104(s0)
addiw a5, s1, 3
sw a5, -100(s0)
sw a5, -96(s0)
addiw a4, s1, 4
sw a4, -92(s0)
sw a4, -88(s0)
addiw a0, s1, 5
sw a0, -84(s0)
sw a0, -80(s0)
addiw a2, s1, 6
sw a2, -76(s0)
sw a1, -72(s0)
sw a3, -68(s0)
sw a3, -64(s0)
sw a5, -60(s0)
sw a5, -56(s0)
sw a4, -52(s0)
sw a4, -48(s0)
sw a0, -44(s0)
sw a0, -40(s0)
sw a2, -36(s0)
sw a2, -32(s0)
addiw a1, s1, 7
sw a1, -28(s0)
sw a3, -24(s0)
sw a5, -20(s0)
sw a5, -16(s0)
sw a4, -12(s0)
sw a4, -8(s0)
sw a0, -4(s0)
sw a0, 0(s0)
sw a2, 4(s0)
sw a2, 8(s0)
sw a1, 12(s0)
sw a1, 16(s0)
addiw a3, s1, 8
sw a3, 20(s0)
sw a5, 24(s0)
sw a4, 28(s0)
sw a4, 32(s0)
sw a0, 36(s0)
sw a0, 40(s0)
sw a2, 44(s0)
sw a2, 48(s0)
sw a1, 52(s0)
sw a1, 56(s0)
sw a3, 60(s0)
sw a3, 64(s0)
addiw a5, s1, 9
sw a5, 68(s0)
sw a4, 72(s0)
sw a0, 76(s0)
sw a0, 80(s0)
sw a2, 84(s0)
sw a2, 88(s0)
sw a1, 92(s0)
sw a1, 96(s0)
sw a3, 100(s0)
sw a3, 104(s0)
sw a5, 108(s0)
sw a5, 112(s0)
addiw a0, s1, 10
sw a0, 116(s0)
addi s7, s7, 1
addi s0, s0, 240
bne s7, s5, .LBB0_7
addi s4, s4, 1
addi s3, s3, 960
bne s4, t6, .LBB0_6
andi a1, t5, 1
li a0, 1
li t5, 0
bnez a1, .LBB0_5
addi t1, t1, 1
addiw a0, a6, 1664
add t4, t4, a0
bne t1, t0, .LBB0_4
.LBB0_11:
ld s0, 56(sp)
ld s1, 48(sp)
ld s2, 40(sp)
ld s3, 32(sp)
ld s4, 24(sp)
ld s5, 16(sp)
ld s6, 8(sp)
ld s7, 0(sp)
addi sp, sp, 64
ret
.Lfunc_end0:
.size loop1, .Lfunc_end0-loop1
.globl loop2
.p2align 1
.type loop2,@function
loop2:
addi sp, sp, -64
sd s0, 56(sp)
sd s1, 48(sp)
sd s2, 40(sp)
sd s3, 32(sp)
sd s4, 24(sp)
sd s5, 16(sp)
sd s6, 8(sp)
sd s7, 0(sp)
li t3, 0
lui a0, %hi(arr2)
addi a0, a0, %lo(arr2)
addi t1, a0, 112
addi t2, a0, 896
lui a0, 1
addiw t0, a0, 1280
li s2, 896
li t5, 3
lui a0, 3
addiw a6, a0, -1536
li a7, 10
.LBB1_1:
li a0, 0
li t4, 1
.LBB1_2:
li t6, 0
add s3, a0, t3
addiw s6, s3, 1
addiw a3, s3, 2
addiw a5, s3, 3
addiw a1, s3, 4
addiw s0, s3, 5
addiw s1, s3, 6
addi s7, s3, 1
addiw a2, s3, 7
mul a0, a0, t0
add s4, t1, a0
add s5, t2, a0
.LBB1_3:
li a0, 0
.LBB1_4:
add a4, s4, a0
sw s3, -112(a4)
sw s6, -108(a4)
sw a3, -104(a4)
sw a5, -100(a4)
sw a1, -96(a4)
sw s0, -92(a4)
sw s1, -88(a4)
sw s3, -84(a4)
sw s6, -80(a4)
sw a3, -76(a4)
sw a5, -72(a4)
sw a1, -68(a4)
sw s0, -64(a4)
sw s1, -60(a4)
sw s3, -56(a4)
sw s6, -52(a4)
sw a3, -48(a4)
sw a5, -44(a4)
sw a1, -40(a4)
sw s0, -36(a4)
sw s1, -32(a4)
sw s3, -28(a4)
sw s6, -24(a4)
sw a3, -20(a4)
sw a5, -16(a4)
sw a1, -12(a4)
sw s0, -8(a4)
sw s1, -4(a4)
sw s3, 0(a4)
sw s6, 4(a4)
sw a3, 8(a4)
sw a5, 12(a4)
sw a1, 16(a4)
sw s0, 20(a4)
sw s1, 24(a4)
sw s3, 28(a4)
sw s6, 32(a4)
sw a3, 36(a4)
sw a5, 40(a4)
sw a1, 44(a4)
sw s0, 48(a4)
sw s1, 52(a4)
sw s3, 56(a4)
sw s6, 60(a4)
sw a3, 64(a4)
sw a5, 68(a4)
sw a1, 72(a4)
sw s0, 76(a4)
sw s1, 80(a4)
sw s3, 84(a4)
sw s6, 88(a4)
sw a3, 92(a4)
sw a5, 96(a4)
sw a1, 100(a4)
sw s0, 104(a4)
addi a0, a0, 224
sw s1, 108(a4)
bne a0, s2, .LBB1_4
li a0, 0
.LBB1_6:
add a4, s5, a0
sw s7, 0(a4)
sw a3, 4(a4)
sw a5, 8(a4)
sw a1, 12(a4)
sw s0, 16(a4)
sw s1, 20(a4)
sw a2, 24(a4)
sw s7, 28(a4)
sw a3, 32(a4)
sw a5, 36(a4)
sw a1, 40(a4)
sw s0, 44(a4)
sw s1, 48(a4)
sw a2, 52(a4)
sw s7, 56(a4)
sw a3, 60(a4)
sw a5, 64(a4)
sw a1, 68(a4)
sw s0, 72(a4)
sw s1, 76(a4)
sw a2, 80(a4)
sw s7, 84(a4)
sw a3, 88(a4)
sw a5, 92(a4)
sw a1, 96(a4)
sw s0, 100(a4)
sw s1, 104(a4)
sw a2, 108(a4)
sw s7, 112(a4)
sw a3, 116(a4)
sw a5, 120(a4)
sw a1, 124(a4)
sw s0, 128(a4)
sw s1, 132(a4)
sw a2, 136(a4)
sw s7, 140(a4)
sw a3, 144(a4)
sw a5, 148(a4)
sw a1, 152(a4)
sw s0, 156(a4)
sw s1, 160(a4)
sw a2, 164(a4)
sw s7, 168(a4)
sw a3, 172(a4)
sw a5, 176(a4)
sw a1, 180(a4)
sw s0, 184(a4)
sw s1, 188(a4)
sw a2, 192(a4)
sw s7, 196(a4)
sw a3, 200(a4)
sw a5, 204(a4)
sw a1, 208(a4)
sw s0, 212(a4)
sw s1, 216(a4)
addi a0, a0, 224
sw a2, 220(a4)
bne a0, s2, .LBB1_6
addi t6, t6, 1
addi s4, s4, 1792
addi s5, s5, 1792
bne t6, t5, .LBB1_3
andi a1, t4, 1
li a0, 1
li t4, 0
bnez a1, .LBB1_2
addi t3, t3, 1
add t1, t1, a6
add t2, t2, a6
bne t3, a7, .LBB1_1
ld s0, 56(sp)
ld s1, 48(sp)
ld s2, 40(sp)
ld s3, 32(sp)
ld s4, 24(sp)
ld s5, 16(sp)
ld s6, 8(sp)
ld s7, 0(sp)
addi sp, sp, 64
ret
.Lfunc_end1:
.size loop2, .Lfunc_end1-loop2
.globl loop3
.p2align 1
.type loop3,@function
loop3:
addi sp, sp, -208
sd ra, 200(sp)
sd s0, 192(sp)
sd s1, 184(sp)
sd s2, 176(sp)
sd s3, 168(sp)
sd s4, 160(sp)
sd s5, 152(sp)
sd s6, 144(sp)
sd s7, 136(sp)
sd s8, 128(sp)
sd s9, 120(sp)
sd s10, 112(sp)
sd s11, 104(sp)
sd a2, 80(sp)
sd a1, 48(sp)
sd a0, 8(sp)
li a1, 0
li a7, 0
lui a0, %hi(arr1)
addi s4, a0, %lo(arr1)
lui a0, %hi(arr2)
addi t1, a0, %lo(arr2)
lui a0, 657125
addiw t2, a0, -1067
li t3, 817
lui a0, 2441
addiw t4, a0, 1663
lui a0, 244
addiw t5, a0, 575
lui a0, 24
addiw t6, a0, 1695
lui a0, 2
addiw ra, a0, 1807
lui a0, 1
addiw a0, a0, 1280
sd a0, 40(sp)
lui a0, 3
addiw a0, a0, -1536
sd a0, 0(sp)
.LBB2_1:
sd a1, 16(sp)
li a1, 0
sd t1, 24(sp)
sd s4, 32(sp)
.LBB2_2:
sd a1, 56(sp)
li a1, 0
sd t1, 72(sp)
sd s4, 64(sp)
.LBB2_3:
sd a1, 88(sp)
li s2, 0
sd t1, 96(sp)
mv t0, s4
.LBB2_4:
li s3, 0
mv s8, t1
mv s6, t0
.LBB2_5:
li s5, 0
mv s9, s8
mv s11, s6
.LBB2_6:
li s7, 0
mv s0, s9
mv s1, s11
.LBB2_7:
mul a1, a7, t2
srli a1, a1, 32
addw a1, a1, a7
srliw s10, a1, 31
sraiw a1, a1, 9
addw a1, a1, s10
lw a2, 0(s1)
lw a0, 0(s0)
mulw a1, a1, t3
subw a1, a7, a1
addw a1, a1, a2
addw a7, a1, a0
sltu a0, s7, t4
addi s7, s7, 1
slt a1, s7, a6
and a0, a0, a1
addi s1, s1, 4
addi s0, s0, 4
bnez a0, .LBB2_7
sltu a0, s5, t5
addi s5, s5, 1
slt a1, s5, a5
and a0, a0, a1
addi s11, s11, 8
addi s9, s9, 28
bnez a0, .LBB2_6
sltu a0, s3, t6
addi s3, s3, 1
slt a1, s3, a4
and a0, a0, a1
addi s6, s6, 48
addi s8, s8, 224
bnez a0, .LBB2_5
sltu a0, s2, ra
addi s2, s2, 1
slt a1, s2, a3
and a0, a0, a1
addi t0, t0, 240
addi t1, t1, 896
bnez a0, .LBB2_4
ld a1, 88(sp)
sltiu a0, a1, 999
addi a1, a1, 1
ld a2, 80(sp)
slt a2, a1, a2
and a0, a0, a2
addi s4, s4, 960
ld t1, 96(sp)
addi t1, t1, 1792
bnez a0, .LBB2_3
ld a1, 56(sp)
sltiu a0, a1, 99
addi a1, a1, 1
ld a2, 48(sp)
slt a2, a1, a2
and a0, a0, a2
ld a2, 64(sp)
addi a2, a2, 1440
addi s4, a2, 1440
ld a2, 40(sp)
ld t1, 72(sp)
add t1, t1, a2
bnez a0, .LBB2_2
ld a1, 16(sp)
sltiu a0, a1, 9
addi a1, a1, 1
ld a2, 8(sp)
slt a2, a1, a2
and a0, a0, a2
lui a2, 1
addiw a2, a2, 1664
ld s4, 32(sp)
add s4, s4, a2
ld t1, 24(sp)
ld s0, 0(sp)
add t1, t1, s0
bnez a0, .LBB2_1
mv a0, a7
ld ra, 200(sp)
ld s0, 192(sp)
ld s1, 184(sp)
ld s2, 176(sp)
ld s3, 168(sp)
ld s4, 160(sp)
ld s5, 152(sp)
ld s6, 144(sp)
ld s7, 136(sp)
ld s8, 128(sp)
ld s9, 120(sp)
ld s10, 112(sp)
ld s11, 104(sp)
addi sp, sp, 208
ret
.Lfunc_end2:
.size loop3, .Lfunc_end2-loop3
.globl main
.p2align 1
.type main,@function
main:
addi sp, sp, -208
sd ra, 200(sp)
sd s0, 192(sp)
sd s1, 184(sp)
sd s2, 176(sp)
sd s3, 168(sp)
sd s4, 160(sp)
sd s5, 152(sp)
sd s6, 144(sp)
sd s7, 136(sp)
sd s8, 128(sp)
sd s9, 120(sp)
sd s10, 112(sp)
sd s11, 104(sp)
call getint
mv s7, a0
call getint
mv s8, a0
call getint
sd a0, 8(sp)
call getint
sd a0, 48(sp)
call getint
sd a0, 80(sp)
call getint
mv s5, a0
call getint
mv s6, a0
call getint
mv s10, a0
call getint
mv s0, a0
mv a0, s7
mv a1, s8
call loop1
call loop2
li s1, 0
li a0, 0
lui a1, %hi(arr2)
addi t4, a1, %lo(arr2)
lui a1, %hi(arr1)
addi a7, a1, %lo(arr1)
lui a1, 657125
addiw a3, a1, -1067
li a4, 817
lui a1, 2441
addiw a5, a1, 1663
lui a1, 244
addiw s2, a1, 575
lui a2, 24
addiw t3, a2, 1695
lui a2, 2
addiw t1, a2, 1807
lui a1, 1
addiw a1, a1, 1280
sd a1, 40(sp)
lui a2, 3
addiw a1, a2, -1536
sd a1, 0(sp)
.LBB3_1:
sd s1, 16(sp)
li a2, 0
sd a7, 24(sp)
sd t4, 32(sp)
.LBB3_2:
sd a2, 56(sp)
li a2, 0
sd a7, 64(sp)
sd t4, 72(sp)
.LBB3_3:
sd a2, 88(sp)
li t2, 0
sd a7, 96(sp)
mv a6, t4
.LBB3_4:
li t0, 0
mv t6, a7
mv t5, a6
.LBB3_5:
li s3, 0
mv s8, t6
mv s9, t5
.LBB3_6:
li s7, 0
mv s11, s8
mv ra, s9
.LBB3_7:
mul a2, a0, a3
srli a2, a2, 32
addw a2, a2, a0
srliw s4, a2, 31
sraiw a2, a2, 9
addw a2, a2, s4
lw s1, 0(s11)
lw a1, 0(ra)
mulw a2, a2, a4
subw a0, a0, a2
addw a0, a0, s1
addw a0, a0, a1
sltu a1, s7, a5
addi s7, s7, 1
slt a2, s7, s0
and a1, a1, a2
addi ra, ra, 4
addi s11, s11, 4
bnez a1, .LBB3_7
sltu a1, s3, s2
addi s3, s3, 1
slt a2, s3, s10
and a1, a1, a2
addi s9, s9, 28
addi s8, s8, 8
bnez a1, .LBB3_6
sltu a1, t0, t3
addi t0, t0, 1
slt a2, t0, s6
and a1, a1, a2
addi t5, t5, 224
addi t6, t6, 48
bnez a1, .LBB3_5
sltu a1, t2, t1
addi t2, t2, 1
slt a2, t2, s5
and a1, a1, a2
addi a6, a6, 896
addi a7, a7, 240
bnez a1, .LBB3_4
ld a2, 88(sp)
sltiu a1, a2, 999
addi a2, a2, 1
ld s1, 80(sp)
slt s1, a2, s1
and a1, a1, s1
addi t4, t4, 1792
ld a7, 96(sp)
addi a7, a7, 960
bnez a1, .LBB3_3
ld a2, 56(sp)
sltiu a1, a2, 99
addi a2, a2, 1
ld s1, 48(sp)
slt s1, a2, s1
and a1, a1, s1
ld s1, 40(sp)
ld t4, 72(sp)
add t4, t4, s1
ld s1, 64(sp)
addi s1, s1, 1440
addi a7, s1, 1440
bnez a1, .LBB3_2
ld a2, 16(sp)
sltiu a1, a2, 9
addi a2, a2, 1
ld s1, 8(sp)
slt s1, a2, s1
and a1, a1, s1
ld t4, 32(sp)
ld s1, 0(sp)
add t4, t4, s1
lui s1, 1
addiw s1, s1, 1664
ld a7, 24(sp)
add a7, a7, s1
mv s1, a2
bnez a1, .LBB3_1
ld ra, 200(sp)
ld s0, 192(sp)
ld s1, 184(sp)
ld s2, 176(sp)
ld s3, 168(sp)
ld s4, 160(sp)
ld s5, 152(sp)
ld s6, 144(sp)
ld s7, 136(sp)
ld s8, 128(sp)
ld s9, 120(sp)
ld s10, 112(sp)
ld s11, 104(sp)
addi sp, sp, 208
ret
.Lfunc_end3:
.size main, .Lfunc_end3-main
.type arr1,@object
.bss
.globl arr1
.p2align 2
arr1:
.zero 57600
.size arr1, 57600
.type arr2,@object
.globl arr2
.p2align 2
arr2:
.zero 107520
.size arr2, 107520
.type _sysy_start,@object
.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