1423 lines
20 KiB
ArmAsm
1423 lines
20 KiB
ArmAsm
.text
|
|
.attribute 4, 16
|
|
.attribute 5, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
|
|
.file "85_long_code.sy"
|
|
.globl bubblesort
|
|
.p2align 1
|
|
.type bubblesort,@function
|
|
bubblesort:
|
|
lui a7, %hi(n)
|
|
lw a2, %lo(n)(a7)
|
|
li a1, 2
|
|
blt a2, a1, .LBB0_8
|
|
li t0, 0
|
|
addi a6, a0, 4
|
|
j .LBB0_3
|
|
.LBB0_2:
|
|
addiw t0, t0, 1
|
|
addiw a1, a2, -1
|
|
bge t0, a1, .LBB0_8
|
|
.LBB0_3:
|
|
not t1, t0
|
|
addw a1, a2, t1
|
|
blez a1, .LBB0_2
|
|
lw a5, 0(a0)
|
|
li a1, 0
|
|
mv a3, a6
|
|
j .LBB0_6
|
|
.LBB0_5:
|
|
sw a5, 0(a3)
|
|
sw a4, -4(a3)
|
|
lw a2, %lo(n)(a7)
|
|
addi a1, a1, 1
|
|
addw a4, a2, t1
|
|
addi a3, a3, 4
|
|
bge a1, a4, .LBB0_2
|
|
.LBB0_6:
|
|
lw a4, 0(a3)
|
|
blt a4, a5, .LBB0_5
|
|
mv a5, a4
|
|
addi a1, a1, 1
|
|
addw a4, a2, t1
|
|
addi a3, a3, 4
|
|
blt a1, a4, .LBB0_6
|
|
j .LBB0_2
|
|
.LBB0_8:
|
|
li a0, 0
|
|
ret
|
|
.Lfunc_end0:
|
|
.size bubblesort, .Lfunc_end0-bubblesort
|
|
|
|
.globl insertsort
|
|
.p2align 1
|
|
.type insertsort,@function
|
|
insertsort:
|
|
lui a6, %hi(n)
|
|
lw a1, %lo(n)(a6)
|
|
li a2, 2
|
|
blt a1, a2, .LBB1_8
|
|
li a7, 0
|
|
li a1, -1
|
|
srli a3, a1, 32
|
|
addi t0, a0, 4
|
|
li t1, 1
|
|
li t2, 1
|
|
j .LBB1_4
|
|
.LBB1_2:
|
|
addi a4, a5, 1
|
|
.LBB1_3:
|
|
slli a1, a4, 32
|
|
srai a1, a1, 30
|
|
add a1, a1, a0
|
|
sw a2, 0(a1)
|
|
lw a1, %lo(n)(a6)
|
|
addi t2, t2, 1
|
|
addi a7, a7, 1
|
|
addi t0, t0, 4
|
|
bge t2, a1, .LBB1_8
|
|
.LBB1_4:
|
|
slli a1, t2, 2
|
|
add a1, a1, a0
|
|
lw a2, 0(a1)
|
|
mv a4, t0
|
|
mv a5, a7
|
|
.LBB1_5:
|
|
add a1, a3, a5
|
|
addi a1, a1, 1
|
|
and a1, a1, a3
|
|
slli a1, a1, 2
|
|
add a1, a1, a0
|
|
lw a1, 0(a1)
|
|
bge a2, a1, .LBB1_2
|
|
sw a1, 0(a4)
|
|
addi a1, a5, 1
|
|
addi a5, a5, -1
|
|
addi a4, a4, -4
|
|
blt t1, a1, .LBB1_5
|
|
li a4, 0
|
|
j .LBB1_3
|
|
.LBB1_8:
|
|
li a0, 0
|
|
ret
|
|
.Lfunc_end1:
|
|
.size insertsort, .Lfunc_end1-insertsort
|
|
|
|
.globl QuickSort
|
|
.p2align 1
|
|
.type QuickSort,@function
|
|
QuickSort:
|
|
addi sp, sp, -32
|
|
sd ra, 24(sp)
|
|
sd s0, 16(sp)
|
|
sd s1, 8(sp)
|
|
sd s2, 0(sp)
|
|
bge a1, a2, .LBB2_20
|
|
mv s2, a2
|
|
mv s0, a1
|
|
mv s1, a0
|
|
j .LBB2_4
|
|
.LBB2_2:
|
|
mv a2, a1
|
|
.LBB2_3:
|
|
slli a2, a2, 2
|
|
add a2, a2, s1
|
|
sw a0, 0(a2)
|
|
addiw a2, s0, -1
|
|
mv a0, s1
|
|
call QuickSort
|
|
addiw s0, s0, 1
|
|
bge s0, s2, .LBB2_20
|
|
.LBB2_4:
|
|
sext.w a1, s0
|
|
slli a0, a1, 2
|
|
add a0, a0, s1
|
|
lw a0, 0(a0)
|
|
bge a1, s2, .LBB2_2
|
|
mv a2, s2
|
|
j .LBB2_8
|
|
.LBB2_6:
|
|
slli a4, a4, 2
|
|
add a4, a4, s1
|
|
sw s0, 0(a4)
|
|
addiw a2, a2, -1
|
|
mv s0, a3
|
|
.LBB2_7:
|
|
sext.w a3, a2
|
|
sext.w a4, s0
|
|
bge a4, a3, .LBB2_19
|
|
.LBB2_8:
|
|
sext.w a3, a2
|
|
sext.w a4, s0
|
|
bge a4, a3, .LBB2_14
|
|
slli a2, a3, 2
|
|
add a2, a2, s1
|
|
.LBB2_10:
|
|
lw a5, 0(a2)
|
|
blt a5, a0, .LBB2_12
|
|
addi a3, a3, -1
|
|
addi a2, a2, -4
|
|
blt a4, a3, .LBB2_10
|
|
j .LBB2_13
|
|
.LBB2_12:
|
|
slli a2, a4, 2
|
|
add a2, a2, s1
|
|
sw a5, 0(a2)
|
|
addiw s0, s0, 1
|
|
.LBB2_13:
|
|
mv a2, a3
|
|
.LBB2_14:
|
|
sext.w a4, a2
|
|
sext.w a3, s0
|
|
bge a3, a4, .LBB2_7
|
|
slli a5, a3, 2
|
|
add a5, a5, s1
|
|
.LBB2_16:
|
|
lw s0, 0(a5)
|
|
bge s0, a0, .LBB2_6
|
|
addiw s0, a3, 1
|
|
addi a3, a3, 1
|
|
addi a5, a5, 4
|
|
bne a4, s0, .LBB2_16
|
|
mv s0, a2
|
|
.LBB2_19:
|
|
sext.w a2, s0
|
|
j .LBB2_3
|
|
.LBB2_20:
|
|
li a0, 0
|
|
ld ra, 24(sp)
|
|
ld s0, 16(sp)
|
|
ld s1, 8(sp)
|
|
ld s2, 0(sp)
|
|
addi sp, sp, 32
|
|
ret
|
|
.Lfunc_end2:
|
|
.size QuickSort, .Lfunc_end2-QuickSort
|
|
|
|
.globl getMid
|
|
.p2align 1
|
|
.type getMid,@function
|
|
getMid:
|
|
lui a1, %hi(n)
|
|
lwu a3, %lo(n)(a1)
|
|
mv a1, a0
|
|
srli a0, a3, 31
|
|
addw a0, a0, a3
|
|
sraiw a0, a0, 1
|
|
slli a2, a0, 2
|
|
add a0, a1, a2
|
|
lw a0, 0(a0)
|
|
andi a3, a3, 1
|
|
bnez a3, .LBB3_2
|
|
add a1, a1, a2
|
|
lw a1, -4(a1)
|
|
addw a0, a0, a1
|
|
srliw a1, a0, 31
|
|
addw a0, a0, a1
|
|
sraiw a0, a0, 1
|
|
.LBB3_2:
|
|
ret
|
|
.Lfunc_end3:
|
|
.size getMid, .Lfunc_end3-getMid
|
|
|
|
.globl getMost
|
|
.p2align 1
|
|
.type getMost,@function
|
|
getMost:
|
|
addi sp, sp, -2032
|
|
sd ra, 2024(sp)
|
|
sd s0, 2016(sp)
|
|
sd s1, 2008(sp)
|
|
sd s2, 2000(sp)
|
|
addi sp, sp, -2016
|
|
mv s0, a0
|
|
lui a0, 1
|
|
addiw a2, a0, -96
|
|
addi a0, sp, 16
|
|
addi s2, sp, 16
|
|
li a1, 0
|
|
call memset@plt
|
|
lui a0, %hi(n)
|
|
lwu a0, %lo(n)(a0)
|
|
sext.w a1, a0
|
|
blez a1, .LBB4_5
|
|
li a2, 0
|
|
j .LBB4_3
|
|
.LBB4_2:
|
|
addi a0, a0, -1
|
|
addi s0, s0, 4
|
|
beqz a0, .LBB4_6
|
|
.LBB4_3:
|
|
lw a3, 0(s0)
|
|
slli a4, a3, 2
|
|
add a5, s2, a4
|
|
lw s1, 0(a5)
|
|
addiw a4, s1, 1
|
|
sw a4, 0(a5)
|
|
blt s1, a2, .LBB4_2
|
|
mv a2, a4
|
|
mv a1, a3
|
|
j .LBB4_2
|
|
.LBB4_5:
|
|
.LBB4_6:
|
|
sext.w a0, a1
|
|
addi sp, sp, 2016
|
|
ld ra, 2024(sp)
|
|
ld s0, 2016(sp)
|
|
ld s1, 2008(sp)
|
|
ld s2, 2000(sp)
|
|
addi sp, sp, 2032
|
|
ret
|
|
.Lfunc_end4:
|
|
.size getMost, .Lfunc_end4-getMost
|
|
|
|
.globl revert
|
|
.p2align 1
|
|
.type revert,@function
|
|
revert:
|
|
li a0, 0
|
|
ret
|
|
.Lfunc_end5:
|
|
.size revert, .Lfunc_end5-revert
|
|
|
|
.globl arrCopy
|
|
.p2align 1
|
|
.type arrCopy,@function
|
|
arrCopy:
|
|
lui a2, %hi(n)
|
|
lw a3, %lo(n)(a2)
|
|
blez a3, .LBB6_3
|
|
li a3, 0
|
|
.LBB6_2:
|
|
lw a4, 0(a0)
|
|
sw a4, 0(a1)
|
|
lw a4, %lo(n)(a2)
|
|
addi a3, a3, 1
|
|
addi a1, a1, 4
|
|
addi a0, a0, 4
|
|
blt a3, a4, .LBB6_2
|
|
.LBB6_3:
|
|
li a0, 0
|
|
ret
|
|
.Lfunc_end6:
|
|
.size arrCopy, .Lfunc_end6-arrCopy
|
|
|
|
.globl calSum
|
|
.p2align 1
|
|
.type calSum,@function
|
|
calSum:
|
|
lui a6, %hi(n)
|
|
lw a2, %lo(n)(a6)
|
|
blez a2, .LBB7_6
|
|
li a3, 0
|
|
li a2, 0
|
|
addiw a7, a1, -1
|
|
j .LBB7_4
|
|
.LBB7_2:
|
|
li a5, 0
|
|
.LBB7_3:
|
|
sw a5, 0(a0)
|
|
lw a4, %lo(n)(a6)
|
|
addi a3, a3, 1
|
|
addi a0, a0, 4
|
|
bge a3, a4, .LBB7_6
|
|
.LBB7_4:
|
|
lw a5, 0(a0)
|
|
remw a4, a3, a1
|
|
addw a2, a2, a5
|
|
bne a4, a7, .LBB7_2
|
|
mv a5, a2
|
|
li a2, 0
|
|
j .LBB7_3
|
|
.LBB7_6:
|
|
li a0, 0
|
|
ret
|
|
.Lfunc_end7:
|
|
.size calSum, .Lfunc_end7-calSum
|
|
|
|
.globl avgPooling
|
|
.p2align 1
|
|
.type avgPooling,@function
|
|
avgPooling:
|
|
lui a7, %hi(n)
|
|
lw a4, %lo(n)(a7)
|
|
blez a4, .LBB8_8
|
|
li a3, 0
|
|
li a5, 0
|
|
addiw t2, a1, -1
|
|
li a2, 1
|
|
subw a6, a2, a1
|
|
slli a2, t2, 32
|
|
srli t0, a2, 32
|
|
mv a2, a0
|
|
j .LBB8_4
|
|
.LBB8_2:
|
|
lw a4, 0(a2)
|
|
addw a5, a5, a4
|
|
.LBB8_3:
|
|
lw a4, %lo(n)(a7)
|
|
addi a3, a3, 1
|
|
addi a2, a2, 4
|
|
bge a3, a4, .LBB8_8
|
|
.LBB8_4:
|
|
blt a3, t2, .LBB8_2
|
|
bne t0, a3, .LBB8_7
|
|
lw t1, 0(a0)
|
|
divw a4, a5, a1
|
|
sw a4, 0(a0)
|
|
j .LBB8_3
|
|
.LBB8_7:
|
|
lw t3, 0(a2)
|
|
subw a5, a5, t1
|
|
addw a4, a6, a3
|
|
slli a4, a4, 2
|
|
add t4, a0, a4
|
|
lw t1, 0(t4)
|
|
addw a5, a5, t3
|
|
divw a4, a5, a1
|
|
sw a4, 0(t4)
|
|
j .LBB8_3
|
|
.LBB8_8:
|
|
subw a1, a4, a1
|
|
addiw a1, a1, 1
|
|
bge a1, a4, .LBB8_11
|
|
slli a2, a1, 2
|
|
add a0, a0, a2
|
|
lui a2, %hi(n)
|
|
.LBB8_10:
|
|
sw zero, 0(a0)
|
|
lw a3, %lo(n)(a2)
|
|
addi a1, a1, 1
|
|
addi a0, a0, 4
|
|
blt a1, a3, .LBB8_10
|
|
.LBB8_11:
|
|
li a0, 0
|
|
ret
|
|
.Lfunc_end8:
|
|
.size avgPooling, .Lfunc_end8-avgPooling
|
|
|
|
.globl main
|
|
.p2align 1
|
|
.type main,@function
|
|
main:
|
|
addi sp, sp, -2032
|
|
sd ra, 2024(sp)
|
|
sd s0, 2016(sp)
|
|
sd s1, 2008(sp)
|
|
sd s2, 2000(sp)
|
|
sd s3, 1992(sp)
|
|
sd s4, 1984(sp)
|
|
sd s5, 1976(sp)
|
|
sd s6, 1968(sp)
|
|
sd s7, 1960(sp)
|
|
sd s8, 1952(sp)
|
|
sd s9, 1944(sp)
|
|
sd s10, 1936(sp)
|
|
sd s11, 1928(sp)
|
|
lui a0, 1
|
|
addiw a0, a0, -1600
|
|
sub sp, sp, a0
|
|
lui a1, %hi(n)
|
|
li a0, 32
|
|
sw a0, %lo(n)(a1)
|
|
li a0, 7
|
|
sw a0, 296(sp)
|
|
li a0, 23
|
|
sw a0, 300(sp)
|
|
li a0, 89
|
|
sw a0, 304(sp)
|
|
li a0, 26
|
|
sw a0, 308(sp)
|
|
li a0, 282
|
|
sw a0, 312(sp)
|
|
li a0, 254
|
|
sw a0, 316(sp)
|
|
li a0, 27
|
|
sw a0, 320(sp)
|
|
li a0, 5
|
|
sw a0, 324(sp)
|
|
li a0, 83
|
|
sw a0, 328(sp)
|
|
li a0, 273
|
|
sw a0, 332(sp)
|
|
li a0, 574
|
|
sw a0, 336(sp)
|
|
li a0, 905
|
|
sw a0, 340(sp)
|
|
li a0, 354
|
|
sw a0, 344(sp)
|
|
li a0, 657
|
|
sw a0, 348(sp)
|
|
li a0, 935
|
|
sw a0, 352(sp)
|
|
li a0, 264
|
|
sw a0, 356(sp)
|
|
li a0, 639
|
|
sw a0, 360(sp)
|
|
li a0, 459
|
|
sw a0, 364(sp)
|
|
li a0, 29
|
|
sw a0, 368(sp)
|
|
li a0, 68
|
|
sw a0, 372(sp)
|
|
li a0, 929
|
|
sw a0, 376(sp)
|
|
li a0, 756
|
|
sw a0, 380(sp)
|
|
li a0, 452
|
|
sw a0, 384(sp)
|
|
li a0, 279
|
|
sw a0, 388(sp)
|
|
li a0, 58
|
|
sw a0, 392(sp)
|
|
li a0, 87
|
|
sw a0, 396(sp)
|
|
li a0, 96
|
|
sw a0, 400(sp)
|
|
li a0, 36
|
|
sw a0, 404(sp)
|
|
li a0, 39
|
|
sw a0, 408(sp)
|
|
li a0, 28
|
|
sw a0, 412(sp)
|
|
li a0, 1
|
|
sw a0, 416(sp)
|
|
li a0, 290
|
|
sw a0, 420(sp)
|
|
addi a0, sp, 168
|
|
addi a1, sp, 296
|
|
li a2, 128
|
|
call memcpy@plt
|
|
lw s11, 168(sp)
|
|
mv a0, s11
|
|
call putint
|
|
lw a0, 172(sp)
|
|
sd a0, 160(sp)
|
|
call putint
|
|
lw a0, 176(sp)
|
|
sd a0, 152(sp)
|
|
call putint
|
|
lw a0, 180(sp)
|
|
sd a0, 144(sp)
|
|
call putint
|
|
lw a0, 184(sp)
|
|
sd a0, 136(sp)
|
|
call putint
|
|
lw a0, 188(sp)
|
|
sd a0, 128(sp)
|
|
call putint
|
|
lw a0, 192(sp)
|
|
sd a0, 120(sp)
|
|
call putint
|
|
lw a0, 196(sp)
|
|
sd a0, 112(sp)
|
|
call putint
|
|
lw a0, 200(sp)
|
|
sd a0, 104(sp)
|
|
call putint
|
|
lw a0, 204(sp)
|
|
sd a0, 96(sp)
|
|
call putint
|
|
lw a0, 208(sp)
|
|
sd a0, 88(sp)
|
|
call putint
|
|
lw a0, 212(sp)
|
|
sd a0, 80(sp)
|
|
call putint
|
|
lw a0, 216(sp)
|
|
sd a0, 72(sp)
|
|
call putint
|
|
lw a0, 220(sp)
|
|
sd a0, 64(sp)
|
|
call putint
|
|
lw a0, 224(sp)
|
|
sd a0, 56(sp)
|
|
call putint
|
|
lw a0, 228(sp)
|
|
sd a0, 48(sp)
|
|
call putint
|
|
lw a0, 232(sp)
|
|
sd a0, 40(sp)
|
|
call putint
|
|
lw a0, 236(sp)
|
|
sd a0, 32(sp)
|
|
call putint
|
|
lw a0, 240(sp)
|
|
sd a0, 24(sp)
|
|
call putint
|
|
lw a0, 244(sp)
|
|
sd a0, 16(sp)
|
|
call putint
|
|
lw a0, 248(sp)
|
|
sd a0, 8(sp)
|
|
call putint
|
|
lw s0, 252(sp)
|
|
mv a0, s0
|
|
call putint
|
|
lw s1, 256(sp)
|
|
mv a0, s1
|
|
call putint
|
|
lw s2, 260(sp)
|
|
mv a0, s2
|
|
call putint
|
|
lw s3, 264(sp)
|
|
mv a0, s3
|
|
call putint
|
|
lw s4, 268(sp)
|
|
mv a0, s4
|
|
call putint
|
|
lw s5, 272(sp)
|
|
mv a0, s5
|
|
call putint
|
|
lw s6, 276(sp)
|
|
mv a0, s6
|
|
call putint
|
|
lw s7, 280(sp)
|
|
mv a0, s7
|
|
call putint
|
|
lw s8, 284(sp)
|
|
mv a0, s8
|
|
call putint
|
|
lw s9, 288(sp)
|
|
mv a0, s9
|
|
call putint
|
|
lw s10, 292(sp)
|
|
mv a0, s10
|
|
call putint
|
|
lui a0, %hi(n)
|
|
lw a0, %lo(n)(a0)
|
|
li a1, 2
|
|
blt a0, a1, .LBB9_9
|
|
li a1, 0
|
|
addiw a2, a0, -1
|
|
addi a6, sp, 172
|
|
mv a4, a2
|
|
j .LBB9_3
|
|
.LBB9_2:
|
|
addiw a1, a1, 1
|
|
addiw a4, a4, -1
|
|
bge a1, a2, .LBB9_8
|
|
.LBB9_3:
|
|
not a3, a1
|
|
addw a3, a3, a0
|
|
blez a3, .LBB9_2
|
|
lw s0, 168(sp)
|
|
mv a5, a4
|
|
mv a3, a6
|
|
j .LBB9_6
|
|
.LBB9_5:
|
|
sw s0, 0(a3)
|
|
sw s1, -4(a3)
|
|
addi a5, a5, -1
|
|
addi a3, a3, 4
|
|
beqz a5, .LBB9_2
|
|
.LBB9_6:
|
|
lw s1, 0(a3)
|
|
blt s1, s0, .LBB9_5
|
|
mv s0, s1
|
|
addi a5, a5, -1
|
|
addi a3, a3, 4
|
|
bnez a5, .LBB9_6
|
|
j .LBB9_2
|
|
.LBB9_8:
|
|
lw s11, 168(sp)
|
|
lw a0, 172(sp)
|
|
sd a0, 160(sp)
|
|
lw a0, 176(sp)
|
|
sd a0, 152(sp)
|
|
lw a0, 180(sp)
|
|
sd a0, 144(sp)
|
|
lw a0, 184(sp)
|
|
sd a0, 136(sp)
|
|
lw a0, 188(sp)
|
|
sd a0, 128(sp)
|
|
lw a0, 192(sp)
|
|
sd a0, 120(sp)
|
|
lw a0, 196(sp)
|
|
sd a0, 112(sp)
|
|
lw a0, 200(sp)
|
|
sd a0, 104(sp)
|
|
lw a0, 204(sp)
|
|
sd a0, 96(sp)
|
|
lw a0, 208(sp)
|
|
sd a0, 88(sp)
|
|
lw a0, 212(sp)
|
|
sd a0, 80(sp)
|
|
lw a0, 216(sp)
|
|
sd a0, 72(sp)
|
|
lw a0, 220(sp)
|
|
sd a0, 64(sp)
|
|
lw a0, 224(sp)
|
|
sd a0, 56(sp)
|
|
lw a0, 228(sp)
|
|
sd a0, 48(sp)
|
|
lw a0, 232(sp)
|
|
sd a0, 40(sp)
|
|
lw a0, 236(sp)
|
|
sd a0, 32(sp)
|
|
lw a0, 240(sp)
|
|
sd a0, 24(sp)
|
|
lw a0, 244(sp)
|
|
sd a0, 16(sp)
|
|
lw a0, 248(sp)
|
|
sd a0, 8(sp)
|
|
lw s0, 252(sp)
|
|
lw s1, 256(sp)
|
|
lw s2, 260(sp)
|
|
lw s3, 264(sp)
|
|
lw s4, 268(sp)
|
|
lw s5, 272(sp)
|
|
lw s6, 276(sp)
|
|
lw s7, 280(sp)
|
|
lw s8, 284(sp)
|
|
lw s9, 288(sp)
|
|
lw s10, 292(sp)
|
|
.LBB9_9:
|
|
mv a0, s11
|
|
call putint
|
|
ld a0, 160(sp)
|
|
call putint
|
|
ld a0, 152(sp)
|
|
call putint
|
|
ld a0, 144(sp)
|
|
call putint
|
|
ld a0, 136(sp)
|
|
call putint
|
|
ld a0, 128(sp)
|
|
call putint
|
|
ld a0, 120(sp)
|
|
call putint
|
|
ld a0, 112(sp)
|
|
call putint
|
|
ld a0, 104(sp)
|
|
call putint
|
|
ld a0, 96(sp)
|
|
call putint
|
|
ld a0, 88(sp)
|
|
call putint
|
|
ld a0, 80(sp)
|
|
call putint
|
|
ld a0, 72(sp)
|
|
call putint
|
|
ld a0, 64(sp)
|
|
call putint
|
|
ld a0, 56(sp)
|
|
call putint
|
|
ld a0, 48(sp)
|
|
call putint
|
|
ld a0, 40(sp)
|
|
call putint
|
|
ld a0, 32(sp)
|
|
call putint
|
|
ld a0, 24(sp)
|
|
call putint
|
|
ld a0, 16(sp)
|
|
call putint
|
|
ld a0, 8(sp)
|
|
call putint
|
|
mv a0, s0
|
|
call putint
|
|
mv a0, s1
|
|
call putint
|
|
mv a0, s2
|
|
call putint
|
|
mv a0, s3
|
|
call putint
|
|
mv a0, s4
|
|
call putint
|
|
mv a0, s5
|
|
call putint
|
|
mv a0, s6
|
|
call putint
|
|
mv a0, s7
|
|
call putint
|
|
mv a0, s8
|
|
call putint
|
|
mv a0, s9
|
|
call putint
|
|
mv a0, s10
|
|
call putint
|
|
lui a0, %hi(n)
|
|
lwu a2, %lo(n)(a0)
|
|
srli a0, a2, 31
|
|
addw a0, a0, a2
|
|
sraiw a0, a0, 1
|
|
slli a1, a0, 2
|
|
addi a0, sp, 168
|
|
add a0, a0, a1
|
|
lw a0, 0(a0)
|
|
andi a2, a2, 1
|
|
bnez a2, .LBB9_11
|
|
addi a2, sp, 168
|
|
add a1, a1, a2
|
|
lw a1, -4(a1)
|
|
addw a0, a0, a1
|
|
srliw a1, a0, 31
|
|
addw a0, a0, a1
|
|
sraiw a0, a0, 1
|
|
.LBB9_11:
|
|
call putint
|
|
lui a0, 1
|
|
addiw a2, a0, -96
|
|
addi a0, sp, 424
|
|
addi s1, sp, 424
|
|
li a1, 0
|
|
call memset@plt
|
|
slli a0, s11, 2
|
|
add a2, s1, a0
|
|
lw a3, 0(a2)
|
|
lui s2, %hi(n)
|
|
lwu a1, %lo(n)(s2)
|
|
addiw a0, a3, 1
|
|
li a4, 1
|
|
sw a0, 0(a2)
|
|
bne a1, a4, .LBB9_30
|
|
.LBB9_12:
|
|
mv a0, s11
|
|
call putint
|
|
lwu a0, %lo(n)(s2)
|
|
sext.w s0, a0
|
|
blez s0, .LBB9_14
|
|
slli a2, a0, 2
|
|
addi a0, sp, 168
|
|
addi a1, sp, 296
|
|
call memcpy@plt
|
|
li a0, 1
|
|
bne s0, a0, .LBB9_40
|
|
.LBB9_14:
|
|
lw a0, 168(sp)
|
|
call putint
|
|
lw a0, 172(sp)
|
|
call putint
|
|
lw a0, 176(sp)
|
|
call putint
|
|
lw a0, 180(sp)
|
|
call putint
|
|
lw a0, 184(sp)
|
|
call putint
|
|
lw a0, 188(sp)
|
|
call putint
|
|
lw a0, 192(sp)
|
|
call putint
|
|
lw a0, 196(sp)
|
|
call putint
|
|
lw a0, 200(sp)
|
|
call putint
|
|
lw a0, 204(sp)
|
|
call putint
|
|
lw a0, 208(sp)
|
|
call putint
|
|
lw a0, 212(sp)
|
|
call putint
|
|
lw a0, 216(sp)
|
|
call putint
|
|
lw a0, 220(sp)
|
|
call putint
|
|
lw a0, 224(sp)
|
|
call putint
|
|
lw a0, 228(sp)
|
|
call putint
|
|
lw a0, 232(sp)
|
|
call putint
|
|
lw a0, 236(sp)
|
|
call putint
|
|
lw a0, 240(sp)
|
|
call putint
|
|
lw a0, 244(sp)
|
|
call putint
|
|
lw a0, 248(sp)
|
|
call putint
|
|
lw a0, 252(sp)
|
|
call putint
|
|
lw a0, 256(sp)
|
|
call putint
|
|
lw a0, 260(sp)
|
|
call putint
|
|
lw a0, 264(sp)
|
|
call putint
|
|
lw a0, 268(sp)
|
|
call putint
|
|
lw a0, 272(sp)
|
|
call putint
|
|
lw a0, 276(sp)
|
|
call putint
|
|
lw a0, 280(sp)
|
|
call putint
|
|
lw a0, 284(sp)
|
|
call putint
|
|
lw a0, 288(sp)
|
|
call putint
|
|
lw a0, 292(sp)
|
|
call putint
|
|
lui s2, %hi(n)
|
|
lwu s3, %lo(n)(s2)
|
|
sext.w s1, s3
|
|
blez s1, .LBB9_16
|
|
slli a2, s3, 2
|
|
addi a0, sp, 168
|
|
addi a1, sp, 296
|
|
addi s0, sp, 168
|
|
call memcpy@plt
|
|
li a7, 1
|
|
bne s1, a7, .LBB9_47
|
|
.LBB9_16:
|
|
lw a0, 168(sp)
|
|
call putint
|
|
lw a0, 172(sp)
|
|
call putint
|
|
lw a0, 176(sp)
|
|
call putint
|
|
lw a0, 180(sp)
|
|
call putint
|
|
lw a0, 184(sp)
|
|
call putint
|
|
lw a0, 188(sp)
|
|
call putint
|
|
lw a0, 192(sp)
|
|
call putint
|
|
lw a0, 196(sp)
|
|
call putint
|
|
lw a0, 200(sp)
|
|
call putint
|
|
lw a0, 204(sp)
|
|
call putint
|
|
lw a0, 208(sp)
|
|
call putint
|
|
lw a0, 212(sp)
|
|
call putint
|
|
lw a0, 216(sp)
|
|
call putint
|
|
lw a0, 220(sp)
|
|
call putint
|
|
lw a0, 224(sp)
|
|
call putint
|
|
lw a0, 228(sp)
|
|
call putint
|
|
lw a0, 232(sp)
|
|
call putint
|
|
lw a0, 236(sp)
|
|
call putint
|
|
lw a0, 240(sp)
|
|
call putint
|
|
lw a0, 244(sp)
|
|
call putint
|
|
lw a0, 248(sp)
|
|
call putint
|
|
lw a0, 252(sp)
|
|
call putint
|
|
lw a0, 256(sp)
|
|
call putint
|
|
lw a0, 260(sp)
|
|
call putint
|
|
lw a0, 264(sp)
|
|
call putint
|
|
lw a0, 268(sp)
|
|
call putint
|
|
lw a0, 272(sp)
|
|
call putint
|
|
lw a0, 276(sp)
|
|
call putint
|
|
lw a0, 280(sp)
|
|
call putint
|
|
lw a0, 284(sp)
|
|
call putint
|
|
lw a0, 288(sp)
|
|
call putint
|
|
lw a0, 292(sp)
|
|
call putint
|
|
lw a0, %lo(n)(s2)
|
|
blez a0, .LBB9_18
|
|
slli a0, a0, 32
|
|
srli a0, a0, 32
|
|
slli a2, a0, 2
|
|
addi a0, sp, 168
|
|
addi a1, sp, 296
|
|
call memcpy@plt
|
|
.LBB9_18:
|
|
addi a0, sp, 168
|
|
li a2, 31
|
|
addi s0, sp, 168
|
|
li a1, 0
|
|
call QuickSort
|
|
lw a0, 168(sp)
|
|
call putint
|
|
lw a0, 172(sp)
|
|
call putint
|
|
lw a0, 176(sp)
|
|
call putint
|
|
lw a0, 180(sp)
|
|
call putint
|
|
lw a0, 184(sp)
|
|
call putint
|
|
lw a0, 188(sp)
|
|
call putint
|
|
lw a0, 192(sp)
|
|
call putint
|
|
lw a0, 196(sp)
|
|
call putint
|
|
lw a0, 200(sp)
|
|
call putint
|
|
lw a0, 204(sp)
|
|
call putint
|
|
lw a0, 208(sp)
|
|
call putint
|
|
lw a0, 212(sp)
|
|
call putint
|
|
lw a0, 216(sp)
|
|
call putint
|
|
lw a0, 220(sp)
|
|
call putint
|
|
lw a0, 224(sp)
|
|
call putint
|
|
lw a0, 228(sp)
|
|
call putint
|
|
lw a0, 232(sp)
|
|
call putint
|
|
lw a0, 236(sp)
|
|
call putint
|
|
lw a0, 240(sp)
|
|
call putint
|
|
lw a0, 244(sp)
|
|
call putint
|
|
lw a0, 248(sp)
|
|
call putint
|
|
lw a0, 252(sp)
|
|
call putint
|
|
lw a0, 256(sp)
|
|
call putint
|
|
lw a0, 260(sp)
|
|
call putint
|
|
lw a0, 264(sp)
|
|
call putint
|
|
lw a0, 268(sp)
|
|
call putint
|
|
lw a0, 272(sp)
|
|
call putint
|
|
lw a0, 276(sp)
|
|
call putint
|
|
lw a0, 280(sp)
|
|
call putint
|
|
lw a0, 284(sp)
|
|
call putint
|
|
lw a0, 288(sp)
|
|
call putint
|
|
lw a0, 292(sp)
|
|
call putint
|
|
lui s2, %hi(n)
|
|
lw a0, %lo(n)(s2)
|
|
blez a0, .LBB9_23
|
|
slli a0, a0, 32
|
|
srli s1, a0, 32
|
|
slli a2, s1, 2
|
|
addi a0, sp, 168
|
|
addi a1, sp, 296
|
|
call memcpy@plt
|
|
li a0, 0
|
|
li a2, 0
|
|
li a1, 3
|
|
j .LBB9_21
|
|
.LBB9_20:
|
|
li a3, 0
|
|
sw a3, 0(s0)
|
|
addi a0, a0, 1
|
|
addi s0, s0, 4
|
|
beq s1, a0, .LBB9_23
|
|
.LBB9_21:
|
|
lw a3, 0(s0)
|
|
sraiw a4, a0, 31
|
|
srliw a4, a4, 30
|
|
add a4, a4, a0
|
|
andi a4, a4, -4
|
|
subw a4, a0, a4
|
|
addw a2, a2, a3
|
|
bne a4, a1, .LBB9_20
|
|
mv a3, a2
|
|
li a2, 0
|
|
sw a3, 0(s0)
|
|
addi a0, a0, 1
|
|
addi s0, s0, 4
|
|
bne s1, a0, .LBB9_21
|
|
.LBB9_23:
|
|
lw a0, 168(sp)
|
|
call putint
|
|
lw a0, 172(sp)
|
|
call putint
|
|
lw a0, 176(sp)
|
|
call putint
|
|
lw a0, 180(sp)
|
|
call putint
|
|
lw a0, 184(sp)
|
|
call putint
|
|
lw a0, 188(sp)
|
|
call putint
|
|
lw a0, 192(sp)
|
|
call putint
|
|
lw a0, 196(sp)
|
|
call putint
|
|
lw a0, 200(sp)
|
|
call putint
|
|
lw a0, 204(sp)
|
|
call putint
|
|
lw a0, 208(sp)
|
|
call putint
|
|
lw a0, 212(sp)
|
|
call putint
|
|
lw a0, 216(sp)
|
|
call putint
|
|
lw a0, 220(sp)
|
|
call putint
|
|
lw a0, 224(sp)
|
|
call putint
|
|
lw a0, 228(sp)
|
|
call putint
|
|
lw a0, 232(sp)
|
|
call putint
|
|
lw a0, 236(sp)
|
|
call putint
|
|
lw a0, 240(sp)
|
|
call putint
|
|
lw a0, 244(sp)
|
|
call putint
|
|
lw a0, 248(sp)
|
|
call putint
|
|
lw a0, 252(sp)
|
|
call putint
|
|
lw a0, 256(sp)
|
|
call putint
|
|
lw a0, 260(sp)
|
|
call putint
|
|
lw a0, 264(sp)
|
|
call putint
|
|
lw a0, 268(sp)
|
|
call putint
|
|
lw a0, 272(sp)
|
|
call putint
|
|
lw a0, 276(sp)
|
|
call putint
|
|
lw a0, 280(sp)
|
|
call putint
|
|
lw a0, 284(sp)
|
|
call putint
|
|
lw a0, 288(sp)
|
|
call putint
|
|
lw a0, 292(sp)
|
|
call putint
|
|
lwu s2, %lo(n)(s2)
|
|
sext.w s3, s2
|
|
blez s3, .LBB9_36
|
|
slli a2, s2, 2
|
|
addi a0, sp, 168
|
|
addi a1, sp, 296
|
|
call memcpy@plt
|
|
li a3, 1
|
|
beq s3, a3, .LBB9_37
|
|
li a3, 2
|
|
beq s3, a3, .LBB9_37
|
|
lw a2, 168(sp)
|
|
lw a0, 172(sp)
|
|
addw a0, a0, a2
|
|
lui a1, 349525
|
|
addiw a7, a1, 1366
|
|
mul a3, a0, a7
|
|
srli a4, a3, 63
|
|
srli a3, a3, 32
|
|
addw a4, a4, a3
|
|
li a3, 3
|
|
sw a4, 168(sp)
|
|
beq s3, a3, .LBB9_37
|
|
li a3, 1
|
|
slli t0, a3, 32
|
|
addi a4, sp, 180
|
|
addi a5, s2, -3
|
|
addi a6, sp, 168
|
|
mv a3, t0
|
|
.LBB9_28:
|
|
lw a1, 0(a4)
|
|
subw a0, a0, a2
|
|
addw a0, a0, a1
|
|
srai a1, a3, 30
|
|
add a1, a1, a6
|
|
lw a2, 0(a1)
|
|
mul s0, a0, a7
|
|
srli s1, s0, 63
|
|
srli s0, s0, 32
|
|
addw s1, s1, s0
|
|
sw s1, 0(a1)
|
|
add a3, a3, t0
|
|
addi a5, a5, -1
|
|
addi a4, a4, 4
|
|
bnez a5, .LBB9_28
|
|
mv a3, s2
|
|
j .LBB9_37
|
|
.LBB9_30:
|
|
li a2, 0
|
|
slti a4, a3, 0
|
|
addi a1, a1, -1
|
|
addi a3, sp, 172
|
|
j .LBB9_32
|
|
.LBB9_31:
|
|
slt a4, a5, a2
|
|
addi a1, a1, -1
|
|
addi a3, a3, 4
|
|
beqz a1, .LBB9_12
|
|
.LBB9_32:
|
|
andi a4, a4, 1
|
|
bnez a4, .LBB9_34
|
|
mv a2, a0
|
|
.LBB9_34:
|
|
lw a4, 0(a3)
|
|
slli a0, a4, 2
|
|
add s0, s1, a0
|
|
lw a5, 0(s0)
|
|
addiw a0, a5, 1
|
|
sw a0, 0(s0)
|
|
blt a5, a2, .LBB9_31
|
|
mv s11, a4
|
|
j .LBB9_31
|
|
.LBB9_36:
|
|
mv a3, s3
|
|
.LBB9_37:
|
|
addiw a1, s3, -2
|
|
slli a0, a1, 2
|
|
addi a4, sp, 168
|
|
addi a2, a1, 1
|
|
add a0, a0, a4
|
|
blt a3, a2, .LBB9_39
|
|
mv a2, a3
|
|
.LBB9_39:
|
|
sub a1, a2, a1
|
|
slli a2, a1, 2
|
|
li a1, 0
|
|
call memset@plt
|
|
lw a0, 168(sp)
|
|
call putint
|
|
lw a0, 172(sp)
|
|
call putint
|
|
lw a0, 176(sp)
|
|
call putint
|
|
lw a0, 180(sp)
|
|
call putint
|
|
lw a0, 184(sp)
|
|
call putint
|
|
lw a0, 188(sp)
|
|
call putint
|
|
lw a0, 192(sp)
|
|
call putint
|
|
lw a0, 196(sp)
|
|
call putint
|
|
lw a0, 200(sp)
|
|
call putint
|
|
lw a0, 204(sp)
|
|
call putint
|
|
lw a0, 208(sp)
|
|
call putint
|
|
lw a0, 212(sp)
|
|
call putint
|
|
lw a0, 216(sp)
|
|
call putint
|
|
lw a0, 220(sp)
|
|
call putint
|
|
lw a0, 224(sp)
|
|
call putint
|
|
lw a0, 228(sp)
|
|
call putint
|
|
lw a0, 232(sp)
|
|
call putint
|
|
lw a0, 236(sp)
|
|
call putint
|
|
lw a0, 240(sp)
|
|
call putint
|
|
lw a0, 244(sp)
|
|
call putint
|
|
lw a0, 248(sp)
|
|
call putint
|
|
lw a0, 252(sp)
|
|
call putint
|
|
lw a0, 256(sp)
|
|
call putint
|
|
lw a0, 260(sp)
|
|
call putint
|
|
lw a0, 264(sp)
|
|
call putint
|
|
lw a0, 268(sp)
|
|
call putint
|
|
lw a0, 272(sp)
|
|
call putint
|
|
lw a0, 276(sp)
|
|
call putint
|
|
lw a0, 280(sp)
|
|
call putint
|
|
lw a0, 284(sp)
|
|
call putint
|
|
lw a0, 288(sp)
|
|
call putint
|
|
lw a0, 292(sp)
|
|
call putint
|
|
li a0, 0
|
|
lui a1, 1
|
|
addiw a1, a1, -1600
|
|
add sp, sp, a1
|
|
ld ra, 2024(sp)
|
|
ld s0, 2016(sp)
|
|
ld s1, 2008(sp)
|
|
ld s2, 2000(sp)
|
|
ld s3, 1992(sp)
|
|
ld s4, 1984(sp)
|
|
ld s5, 1976(sp)
|
|
ld s6, 1968(sp)
|
|
ld s7, 1960(sp)
|
|
ld s8, 1952(sp)
|
|
ld s9, 1944(sp)
|
|
ld s10, 1936(sp)
|
|
ld s11, 1928(sp)
|
|
addi sp, sp, 2032
|
|
ret
|
|
.LBB9_40:
|
|
li a0, 0
|
|
addiw a1, s0, -1
|
|
addi a6, sp, 172
|
|
mv a3, a1
|
|
j .LBB9_42
|
|
.LBB9_41:
|
|
addiw a0, a0, 1
|
|
addiw a3, a3, -1
|
|
bge a0, a1, .LBB9_14
|
|
.LBB9_42:
|
|
not a2, a0
|
|
addw a2, a2, s0
|
|
blez a2, .LBB9_41
|
|
lw s1, 168(sp)
|
|
mv a4, a3
|
|
mv a2, a6
|
|
j .LBB9_45
|
|
.LBB9_44:
|
|
sw s1, 0(a2)
|
|
sw a5, -4(a2)
|
|
addi a4, a4, -1
|
|
addi a2, a2, 4
|
|
beqz a4, .LBB9_41
|
|
.LBB9_45:
|
|
lw a5, 0(a2)
|
|
blt a5, s1, .LBB9_44
|
|
mv s1, a5
|
|
addi a4, a4, -1
|
|
addi a2, a2, 4
|
|
bnez a4, .LBB9_45
|
|
j .LBB9_41
|
|
.LBB9_47:
|
|
li a6, 0
|
|
slli a2, a7, 32
|
|
addi t0, sp, 172
|
|
addi a4, a2, -1
|
|
li a5, 1
|
|
j .LBB9_50
|
|
.LBB9_48:
|
|
addi a1, a1, 1
|
|
.LBB9_49:
|
|
slli a0, a1, 32
|
|
srai a0, a0, 30
|
|
add a0, a0, s0
|
|
sw s1, 0(a0)
|
|
addi a5, a5, 1
|
|
addi t0, t0, 4
|
|
addi a6, a6, 1
|
|
beq a5, s3, .LBB9_16
|
|
.LBB9_50:
|
|
slli a0, a5, 2
|
|
add a0, a0, s0
|
|
lw s1, 0(a0)
|
|
mv a1, a6
|
|
mv a3, t0
|
|
.LBB9_51:
|
|
add a0, a1, a2
|
|
and a0, a0, a4
|
|
slli a0, a0, 2
|
|
add a0, a0, s0
|
|
lw a0, 0(a0)
|
|
bge s1, a0, .LBB9_48
|
|
sw a0, 0(a3)
|
|
addi a0, a1, 1
|
|
addi a1, a1, -1
|
|
addi a3, a3, -4
|
|
blt a7, a0, .LBB9_51
|
|
li a1, 0
|
|
j .LBB9_49
|
|
.Lfunc_end9:
|
|
.size main, .Lfunc_end9-main
|
|
|
|
.type n,@object
|
|
.section .sbss,"aw",@nobits
|
|
.globl n
|
|
.p2align 2
|
|
n:
|
|
.word 0
|
|
.size n, 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
|