647 lines
9.1 KiB
ArmAsm
647 lines
9.1 KiB
ArmAsm
.text
|
|
.attribute 4, 16
|
|
.attribute 5, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
|
|
.file "20_sort.sy"
|
|
.globl quick_read
|
|
.p2align 1
|
|
.type quick_read,@function
|
|
quick_read:
|
|
addi sp, sp, -48
|
|
sd ra, 40(sp)
|
|
sd s0, 32(sp)
|
|
sd s1, 24(sp)
|
|
sd s2, 16(sp)
|
|
sd s3, 8(sp)
|
|
call getch
|
|
addiw a1, a0, -58
|
|
li a2, -11
|
|
bltu a2, a1, .LBB0_5
|
|
li a1, 0
|
|
li s2, 45
|
|
li s0, -10
|
|
j .LBB0_3
|
|
.LBB0_2:
|
|
call getch
|
|
addiw a2, a0, -58
|
|
mv a1, s3
|
|
bgeu a2, s0, .LBB0_6
|
|
.LBB0_3:
|
|
sext.w a0, a0
|
|
li s3, 1
|
|
beq a0, s2, .LBB0_2
|
|
mv s3, a1
|
|
j .LBB0_2
|
|
.LBB0_5:
|
|
li s3, 0
|
|
.LBB0_6:
|
|
li s0, 0
|
|
li s1, 10
|
|
.LBB0_7:
|
|
mulw a1, s0, s1
|
|
addw a0, a0, a1
|
|
addiw s0, a0, -48
|
|
call getch
|
|
addiw a1, a0, -48
|
|
bltu a1, s1, .LBB0_7
|
|
beqz s3, .LBB0_10
|
|
negw s0, s0
|
|
.LBB0_10:
|
|
mv a0, s0
|
|
ld ra, 40(sp)
|
|
ld s0, 32(sp)
|
|
ld s1, 24(sp)
|
|
ld s2, 16(sp)
|
|
ld s3, 8(sp)
|
|
addi sp, sp, 48
|
|
ret
|
|
.Lfunc_end0:
|
|
.size quick_read, .Lfunc_end0-quick_read
|
|
|
|
.globl sortA
|
|
.p2align 1
|
|
.type sortA,@function
|
|
sortA:
|
|
lui a6, %hi(n)
|
|
lw t2, %lo(n)(a6)
|
|
blez t2, .LBB1_8
|
|
li a7, 0
|
|
addi t0, a0, 4
|
|
li t1, 2
|
|
j .LBB1_3
|
|
.LBB1_2:
|
|
addi t0, t0, 4
|
|
addi t1, t1, 1
|
|
bge a7, t2, .LBB1_8
|
|
.LBB1_3:
|
|
mv a1, a7
|
|
addi a7, a7, 1
|
|
bge a7, t2, .LBB1_2
|
|
slli a1, a1, 2
|
|
add a1, a1, a0
|
|
mv a4, t1
|
|
mv a3, t0
|
|
j .LBB1_6
|
|
.LBB1_5:
|
|
sext.w a2, a4
|
|
addi a3, a3, 4
|
|
addi a4, a4, 1
|
|
bge a2, t2, .LBB1_2
|
|
.LBB1_6:
|
|
lw a5, 0(a1)
|
|
lw a2, 0(a3)
|
|
bge a2, a5, .LBB1_5
|
|
sw a2, 0(a1)
|
|
sw a5, 0(a3)
|
|
lw t2, %lo(n)(a6)
|
|
j .LBB1_5
|
|
.LBB1_8:
|
|
ret
|
|
.Lfunc_end1:
|
|
.size sortA, .Lfunc_end1-sortA
|
|
|
|
.globl sortB
|
|
.p2align 1
|
|
.type sortB,@function
|
|
sortB:
|
|
lui a1, %hi(n)
|
|
lw a1, %lo(n)(a1)
|
|
blez a1, .LBB2_11
|
|
slli a1, a1, 32
|
|
srli a1, a1, 32
|
|
li a2, 1
|
|
slli a2, a2, 32
|
|
addi a3, a2, -100
|
|
lui a2, %hi(cnt)
|
|
addi a6, a2, %lo(cnt)
|
|
mv a4, a0
|
|
j .LBB2_3
|
|
.LBB2_2:
|
|
sext.w a3, a5
|
|
addi a1, a1, -1
|
|
addi a4, a4, 4
|
|
beqz a1, .LBB2_5
|
|
.LBB2_3:
|
|
lw a5, 0(a4)
|
|
slli a5, a5, 2
|
|
add a5, a5, a6
|
|
lw a2, 0(a5)
|
|
addiw a2, a2, 1
|
|
sw a2, 0(a5)
|
|
lw a5, 0(a4)
|
|
sext.w a2, a3
|
|
blt a2, a5, .LBB2_2
|
|
mv a5, a3
|
|
j .LBB2_2
|
|
.LBB2_5:
|
|
bltz a3, .LBB2_11
|
|
li a1, 0
|
|
li a2, 0
|
|
addiw a3, a3, 1
|
|
slli a3, a3, 32
|
|
srli a6, a3, 32
|
|
lui a3, %hi(cnt)
|
|
addi a4, a3, %lo(cnt)
|
|
j .LBB2_8
|
|
.LBB2_7:
|
|
addi a1, a1, 1
|
|
beq a1, a6, .LBB2_11
|
|
.LBB2_8:
|
|
slli a3, a1, 2
|
|
add a3, a3, a4
|
|
lw a5, 0(a3)
|
|
beqz a5, .LBB2_7
|
|
sext.w a2, a2
|
|
slli a3, a2, 2
|
|
add a3, a3, a0
|
|
.LBB2_10:
|
|
sw a1, 0(a3)
|
|
addi a2, a2, 1
|
|
addiw a5, a5, -1
|
|
addi a3, a3, 4
|
|
bnez a5, .LBB2_10
|
|
j .LBB2_7
|
|
.LBB2_11:
|
|
ret
|
|
.Lfunc_end2:
|
|
.size sortB, .Lfunc_end2-sortB
|
|
|
|
.globl sortC
|
|
.p2align 1
|
|
.type sortC,@function
|
|
sortC:
|
|
lui a6, %hi(n)
|
|
lw a1, %lo(n)(a6)
|
|
blez a1, .LBB3_8
|
|
li t2, 0
|
|
addi t0, a0, 4
|
|
li t1, 1
|
|
j .LBB3_3
|
|
.LBB3_2:
|
|
slli a1, t2, 2
|
|
add a1, a1, a0
|
|
sext.w a2, t4
|
|
slli a2, a2, 2
|
|
add a2, a2, a0
|
|
lw a3, 0(a2)
|
|
lw a4, 0(a1)
|
|
sw a3, 0(a1)
|
|
sw a4, 0(a2)
|
|
lw a1, %lo(n)(a6)
|
|
addi t1, t1, 1
|
|
addi t0, t0, 4
|
|
mv t2, a7
|
|
bge a7, a1, .LBB3_8
|
|
.LBB3_3:
|
|
addi a7, t2, 1
|
|
mv t4, t2
|
|
bge a7, a1, .LBB3_2
|
|
slli a1, a1, 32
|
|
srli t3, a1, 32
|
|
mv a2, t0
|
|
mv a3, t1
|
|
mv a5, t2
|
|
j .LBB3_6
|
|
.LBB3_5:
|
|
addi a3, a3, 1
|
|
addi a2, a2, 4
|
|
mv a5, t4
|
|
beq t3, a3, .LBB3_2
|
|
.LBB3_6:
|
|
lw a1, 0(a2)
|
|
sext.w a4, a5
|
|
slli a4, a4, 2
|
|
add a4, a4, a0
|
|
lw a4, 0(a4)
|
|
mv t4, a3
|
|
blt a1, a4, .LBB3_5
|
|
mv t4, a5
|
|
j .LBB3_5
|
|
.LBB3_8:
|
|
ret
|
|
.Lfunc_end3:
|
|
.size sortC, .Lfunc_end3-sortC
|
|
|
|
.globl main
|
|
.p2align 1
|
|
.type main,@function
|
|
main:
|
|
addi sp, sp, -96
|
|
sd ra, 88(sp)
|
|
sd s0, 80(sp)
|
|
sd s1, 72(sp)
|
|
sd s2, 64(sp)
|
|
sd s3, 56(sp)
|
|
sd s4, 48(sp)
|
|
sd s5, 40(sp)
|
|
sd s6, 32(sp)
|
|
sd s7, 24(sp)
|
|
sd s8, 16(sp)
|
|
sd s9, 8(sp)
|
|
sd s10, 0(sp)
|
|
call getch
|
|
addiw a1, a0, -58
|
|
li a2, -11
|
|
bltu a2, a1, .LBB4_5
|
|
li a1, 0
|
|
li s2, 45
|
|
li s1, -10
|
|
j .LBB4_3
|
|
.LBB4_2:
|
|
call getch
|
|
addiw a2, a0, -58
|
|
mv a1, s3
|
|
bgeu a2, s1, .LBB4_6
|
|
.LBB4_3:
|
|
sext.w a0, a0
|
|
li s3, 1
|
|
beq a0, s2, .LBB4_2
|
|
mv s3, a1
|
|
j .LBB4_2
|
|
.LBB4_5:
|
|
li s3, 0
|
|
.LBB4_6:
|
|
li s1, 0
|
|
li s0, 10
|
|
.LBB4_7:
|
|
mulw a1, s1, s0
|
|
addw a0, a0, a1
|
|
addiw s1, a0, -48
|
|
call getch
|
|
addiw a1, a0, -48
|
|
bltu a1, s0, .LBB4_7
|
|
beqz s3, .LBB4_10
|
|
negw s1, s1
|
|
.LBB4_10:
|
|
lui s2, %hi(n)
|
|
sw s1, %lo(n)(s2)
|
|
beqz s1, .LBB4_56
|
|
li s4, 0
|
|
li s3, -11
|
|
li s5, 45
|
|
li s9, -10
|
|
li s10, 10
|
|
lui a0, %hi(a)
|
|
addi s6, a0, %lo(a)
|
|
lui a0, %hi(b)
|
|
addi s7, a0, %lo(b)
|
|
lui a0, %hi(c)
|
|
addi s8, a0, %lo(c)
|
|
j .LBB4_13
|
|
.LBB4_12:
|
|
slli a0, s4, 2
|
|
add a1, a0, s6
|
|
sw s0, 0(a1)
|
|
add a1, a0, s7
|
|
lwu t0, %lo(n)(s2)
|
|
sw s0, 0(a1)
|
|
add a0, a0, s8
|
|
addi s4, s4, 1
|
|
sw s0, 0(a0)
|
|
beq s4, t0, .LBB4_23
|
|
.LBB4_13:
|
|
call getch
|
|
addiw a1, a0, -58
|
|
bltu s3, a1, .LBB4_18
|
|
li a1, 0
|
|
j .LBB4_16
|
|
.LBB4_15:
|
|
call getch
|
|
addiw a2, a0, -58
|
|
mv a1, s1
|
|
bgeu a2, s9, .LBB4_19
|
|
.LBB4_16:
|
|
sext.w a0, a0
|
|
li s1, 1
|
|
beq a0, s5, .LBB4_15
|
|
mv s1, a1
|
|
j .LBB4_15
|
|
.LBB4_18:
|
|
li s1, 0
|
|
.LBB4_19:
|
|
li s0, 0
|
|
.LBB4_20:
|
|
mulw a1, s0, s10
|
|
addw a0, a0, a1
|
|
addiw s0, a0, -48
|
|
call getch
|
|
addiw a1, a0, -48
|
|
bltu a1, s10, .LBB4_20
|
|
beqz s1, .LBB4_12
|
|
negw s0, s0
|
|
j .LBB4_12
|
|
.LBB4_23:
|
|
sext.w a7, t0
|
|
blez a7, .LBB4_48
|
|
li a5, 0
|
|
li a2, 2
|
|
lui a0, %hi(a)
|
|
addi a6, a0, %lo(a)
|
|
addi s0, a6, 4
|
|
j .LBB4_26
|
|
.LBB4_25:
|
|
addi s0, s0, 4
|
|
addi a2, a2, 1
|
|
bge a5, a7, .LBB4_31
|
|
.LBB4_26:
|
|
mv a0, a5
|
|
addi a5, a5, 1
|
|
bge a5, a7, .LBB4_25
|
|
slli a0, a0, 2
|
|
add s1, a0, a6
|
|
mv a1, a2
|
|
mv a4, s0
|
|
j .LBB4_29
|
|
.LBB4_28:
|
|
sext.w a0, a1
|
|
addi a4, a4, 4
|
|
addi a1, a1, 1
|
|
bge a0, a7, .LBB4_25
|
|
.LBB4_29:
|
|
lw a0, 0(s1)
|
|
lw a3, 0(a4)
|
|
bge a3, a0, .LBB4_28
|
|
sw a3, 0(s1)
|
|
sw a0, 0(a4)
|
|
j .LBB4_28
|
|
.LBB4_31:
|
|
lui a0, %hi(b)
|
|
addi a2, a0, %lo(b)
|
|
li a0, 1
|
|
slli a0, a0, 32
|
|
addi a4, a0, -100
|
|
lui a0, %hi(cnt)
|
|
addi a3, a0, %lo(cnt)
|
|
mv a5, t0
|
|
j .LBB4_33
|
|
.LBB4_32:
|
|
sext.w a4, a0
|
|
addi a5, a5, -1
|
|
addi a2, a2, 4
|
|
beqz a5, .LBB4_35
|
|
.LBB4_33:
|
|
lw a0, 0(a2)
|
|
slli a1, a0, 2
|
|
add a1, a1, a3
|
|
lw s1, 0(a1)
|
|
addiw s1, s1, 1
|
|
sext.w s0, a4
|
|
sw s1, 0(a1)
|
|
blt s0, a0, .LBB4_32
|
|
mv a0, a4
|
|
j .LBB4_32
|
|
.LBB4_35:
|
|
bltz a4, .LBB4_41
|
|
li a2, 0
|
|
li a3, 0
|
|
addiw a0, a4, 1
|
|
slli a0, a0, 32
|
|
srli a4, a0, 32
|
|
lui a0, %hi(cnt)
|
|
addi a5, a0, %lo(cnt)
|
|
lui a0, %hi(b)
|
|
addi s1, a0, %lo(b)
|
|
j .LBB4_38
|
|
.LBB4_37:
|
|
addi a2, a2, 1
|
|
beq a2, a4, .LBB4_41
|
|
.LBB4_38:
|
|
slli a0, a2, 2
|
|
add a0, a0, a5
|
|
lw s0, 0(a0)
|
|
beqz s0, .LBB4_37
|
|
sext.w a3, a3
|
|
slli a0, a3, 2
|
|
add a1, a0, s1
|
|
.LBB4_40:
|
|
sw a2, 0(a1)
|
|
addi a3, a3, 1
|
|
addiw s0, s0, -1
|
|
addi a1, a1, 4
|
|
bnez s0, .LBB4_40
|
|
j .LBB4_37
|
|
.LBB4_41:
|
|
li a0, 0
|
|
li t1, 1
|
|
lui a1, %hi(c)
|
|
addi a3, a1, %lo(c)
|
|
addi t2, a3, 4
|
|
j .LBB4_43
|
|
.LBB4_42:
|
|
slli a0, a0, 2
|
|
add a0, a0, a3
|
|
sext.w a1, a1
|
|
slli a1, a1, 2
|
|
add a1, a1, a3
|
|
lw a2, 0(a1)
|
|
lw a4, 0(a0)
|
|
sw a2, 0(a0)
|
|
sw a4, 0(a1)
|
|
addi t1, t1, 1
|
|
addi t2, t2, 4
|
|
mv a0, a6
|
|
beq a6, a7, .LBB4_48
|
|
.LBB4_43:
|
|
addi a6, a0, 1
|
|
mv a1, a0
|
|
bge a6, a7, .LBB4_42
|
|
mv a4, t2
|
|
mv a2, t1
|
|
mv a5, a0
|
|
j .LBB4_46
|
|
.LBB4_45:
|
|
addi a2, a2, 1
|
|
addi a4, a4, 4
|
|
mv a5, a1
|
|
beq t0, a2, .LBB4_42
|
|
.LBB4_46:
|
|
lw s1, 0(a4)
|
|
sext.w a1, a5
|
|
slli a1, a1, 2
|
|
add a1, a1, a3
|
|
lw s0, 0(a1)
|
|
mv a1, a2
|
|
blt s1, s0, .LBB4_45
|
|
mv a1, a5
|
|
j .LBB4_45
|
|
.LBB4_48:
|
|
beqz a7, .LBB4_56
|
|
lui a0, %hi(c)
|
|
addi a2, a0, %lo(c)
|
|
lui a0, %hi(a)
|
|
addi a3, a0, %lo(a)
|
|
lui a0, %hi(b)
|
|
addi a4, a0, %lo(b)
|
|
mv a5, t0
|
|
.LBB4_50:
|
|
lw a0, 0(a4)
|
|
lw a1, 0(a3)
|
|
lw s1, 0(a2)
|
|
subw a1, a0, a1
|
|
sw a1, 0(a4)
|
|
subw a0, s1, a0
|
|
sw a0, 0(a2)
|
|
addi a2, a2, 4
|
|
addi a3, a3, 4
|
|
addi a5, a5, -1
|
|
addi a4, a4, 4
|
|
bnez a5, .LBB4_50
|
|
li a0, 1
|
|
slli a0, a0, 32
|
|
addi a2, a0, -123
|
|
beqz a7, .LBB4_57
|
|
lui a0, %hi(c)
|
|
addi a1, a0, %lo(c)
|
|
lui a0, %hi(b)
|
|
addi a3, a0, %lo(b)
|
|
.LBB4_53:
|
|
lw a0, 0(a3)
|
|
bnez a0, .LBB4_58
|
|
lw a0, 0(a1)
|
|
bnez a0, .LBB4_59
|
|
addi a1, a1, 4
|
|
addi t0, t0, -1
|
|
addi a3, a3, 4
|
|
bnez t0, .LBB4_53
|
|
j .LBB4_57
|
|
.LBB4_56:
|
|
li a0, 1
|
|
slli a0, a0, 32
|
|
addi a2, a0, -123
|
|
.LBB4_57:
|
|
sext.w a0, a2
|
|
ld ra, 88(sp)
|
|
ld s0, 80(sp)
|
|
ld s1, 72(sp)
|
|
ld s2, 64(sp)
|
|
ld s3, 56(sp)
|
|
ld s4, 48(sp)
|
|
ld s5, 40(sp)
|
|
ld s6, 32(sp)
|
|
ld s7, 24(sp)
|
|
ld s8, 16(sp)
|
|
ld s9, 8(sp)
|
|
ld s10, 0(sp)
|
|
addi sp, sp, 96
|
|
ret
|
|
.LBB4_58:
|
|
li a2, 1
|
|
j .LBB4_57
|
|
.LBB4_59:
|
|
li a2, 2
|
|
j .LBB4_57
|
|
.Lfunc_end4:
|
|
.size main, .Lfunc_end4-main
|
|
|
|
.type n,@object
|
|
.section .sbss,"aw",@nobits
|
|
.globl n
|
|
.p2align 2
|
|
n:
|
|
.word 0
|
|
.size n, 4
|
|
|
|
.type cnt,@object
|
|
.bss
|
|
.globl cnt
|
|
.p2align 2
|
|
cnt:
|
|
.zero 1600080
|
|
.size cnt, 1600080
|
|
|
|
.type a,@object
|
|
.globl a
|
|
.p2align 2
|
|
a:
|
|
.zero 400020
|
|
.size a, 400020
|
|
|
|
.type b,@object
|
|
.globl b
|
|
.p2align 2
|
|
b:
|
|
.zero 400020
|
|
.size b, 400020
|
|
|
|
.type c,@object
|
|
.globl c
|
|
.p2align 2
|
|
c:
|
|
.zero 400020
|
|
.size c, 400020
|
|
|
|
.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
|
|
|
|
.type x,@object
|
|
.bss
|
|
.globl x
|
|
.p2align 2
|
|
x:
|
|
.zero 400020
|
|
.size x, 400020
|
|
|
|
.ident "Debian clang version 14.0.6"
|
|
.section ".note.GNU-stack","",@progbits
|
|
.addrsig
|