506 lines
7.1 KiB
ArmAsm
506 lines
7.1 KiB
ArmAsm
|
.text
|
||
|
.attribute 4, 16
|
||
|
.attribute 5, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
|
||
|
.file "12_DSU.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 init
|
||
|
.p2align 1
|
||
|
.type init,@function
|
||
|
init:
|
||
|
lui a0, %hi(n)
|
||
|
lw a0, %lo(n)(a0)
|
||
|
blez a0, .LBB1_3
|
||
|
addiw a0, a0, 1
|
||
|
slli a0, a0, 32
|
||
|
srli a0, a0, 32
|
||
|
li a1, 1
|
||
|
lui a2, %hi(fa+4)
|
||
|
addi a2, a2, %lo(fa+4)
|
||
|
.LBB1_2:
|
||
|
sw a1, 0(a2)
|
||
|
addi a1, a1, 1
|
||
|
addi a2, a2, 4
|
||
|
bne a0, a1, .LBB1_2
|
||
|
.LBB1_3:
|
||
|
ret
|
||
|
.Lfunc_end1:
|
||
|
.size init, .Lfunc_end1-init
|
||
|
|
||
|
.globl find
|
||
|
.p2align 1
|
||
|
.type find,@function
|
||
|
find:
|
||
|
addi sp, sp, -16
|
||
|
sd ra, 8(sp)
|
||
|
sd s0, 0(sp)
|
||
|
lui a1, %hi(fa)
|
||
|
addi a1, a1, %lo(fa)
|
||
|
slli a2, a0, 2
|
||
|
add s0, a2, a1
|
||
|
lw a1, 0(s0)
|
||
|
beq a1, a0, .LBB2_2
|
||
|
mv a0, a1
|
||
|
call find
|
||
|
sw a0, 0(s0)
|
||
|
.LBB2_2:
|
||
|
ld ra, 8(sp)
|
||
|
ld s0, 0(sp)
|
||
|
addi sp, sp, 16
|
||
|
ret
|
||
|
.Lfunc_end2:
|
||
|
.size find, .Lfunc_end2-find
|
||
|
|
||
|
.globl same
|
||
|
.p2align 1
|
||
|
.type same,@function
|
||
|
same:
|
||
|
addi sp, sp, -32
|
||
|
sd ra, 24(sp)
|
||
|
sd s0, 16(sp)
|
||
|
sd s1, 8(sp)
|
||
|
mv s0, a1
|
||
|
call find
|
||
|
mv s1, a0
|
||
|
mv a0, s0
|
||
|
call find
|
||
|
xor a0, a0, s1
|
||
|
seqz a0, a0
|
||
|
ld ra, 24(sp)
|
||
|
ld s0, 16(sp)
|
||
|
ld s1, 8(sp)
|
||
|
addi sp, sp, 32
|
||
|
ret
|
||
|
.Lfunc_end3:
|
||
|
.size same, .Lfunc_end3-same
|
||
|
|
||
|
.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)
|
||
|
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
|
||
|
neg s1, s1
|
||
|
.LBB4_10:
|
||
|
lui a0, %hi(n)
|
||
|
sw s1, %lo(n)(a0)
|
||
|
call getch
|
||
|
addiw a1, a0, -58
|
||
|
li a2, -11
|
||
|
bltu a2, a1, .LBB4_15
|
||
|
li a1, 0
|
||
|
li s2, 45
|
||
|
li s0, -10
|
||
|
j .LBB4_13
|
||
|
.LBB4_12:
|
||
|
call getch
|
||
|
addiw a2, a0, -58
|
||
|
mv a1, s3
|
||
|
bgeu a2, s0, .LBB4_16
|
||
|
.LBB4_13:
|
||
|
sext.w a0, a0
|
||
|
li s3, 1
|
||
|
beq a0, s2, .LBB4_12
|
||
|
mv s3, a1
|
||
|
j .LBB4_12
|
||
|
.LBB4_15:
|
||
|
li s3, 0
|
||
|
.LBB4_16:
|
||
|
li s0, 0
|
||
|
li s1, 10
|
||
|
.LBB4_17:
|
||
|
mulw a1, s0, s1
|
||
|
addw a0, a0, a1
|
||
|
addiw s0, a0, -48
|
||
|
call getch
|
||
|
addiw a1, a0, -48
|
||
|
bltu a1, s1, .LBB4_17
|
||
|
beqz s3, .LBB4_20
|
||
|
negw s0, s0
|
||
|
.LBB4_20:
|
||
|
lui a0, %hi(n)
|
||
|
lw a0, %lo(n)(a0)
|
||
|
lui a1, %hi(m)
|
||
|
sw s0, %lo(m)(a1)
|
||
|
blez a0, .LBB4_23
|
||
|
addiw a0, a0, 1
|
||
|
slli a0, a0, 32
|
||
|
srli a0, a0, 32
|
||
|
li a1, 1
|
||
|
lui a2, %hi(fa+4)
|
||
|
addi a2, a2, %lo(fa+4)
|
||
|
.LBB4_22:
|
||
|
sw a1, 0(a2)
|
||
|
addi a1, a1, 1
|
||
|
addi a2, a2, 4
|
||
|
bne a0, a1, .LBB4_22
|
||
|
.LBB4_23:
|
||
|
beqz s0, .LBB4_69
|
||
|
li s2, 81
|
||
|
li s3, -11
|
||
|
li s4, 45
|
||
|
li s5, -10
|
||
|
li s6, 10
|
||
|
lui s7, %hi(m)
|
||
|
lui a0, %hi(fa)
|
||
|
addi s8, a0, %lo(fa)
|
||
|
j .LBB4_26
|
||
|
.LBB4_25:
|
||
|
mv a0, s1
|
||
|
call find
|
||
|
slli a1, s9, 2
|
||
|
add a1, a1, s8
|
||
|
sw a0, 0(a1)
|
||
|
lw a0, %lo(m)(s7)
|
||
|
addiw a0, a0, -1
|
||
|
sw a0, %lo(m)(s7)
|
||
|
beqz a0, .LBB4_69
|
||
|
.LBB4_26:
|
||
|
call getch
|
||
|
mv s0, a0
|
||
|
andi a0, a0, -5
|
||
|
bne a0, s2, .LBB4_26
|
||
|
call getch
|
||
|
addiw a1, a0, -58
|
||
|
bne s0, s2, .LBB4_33
|
||
|
bltu s3, a1, .LBB4_38
|
||
|
li a1, 0
|
||
|
j .LBB4_31
|
||
|
.LBB4_30:
|
||
|
call getch
|
||
|
addiw a2, a0, -58
|
||
|
mv a1, s1
|
||
|
bgeu a2, s5, .LBB4_39
|
||
|
.LBB4_31:
|
||
|
sext.w a0, a0
|
||
|
li s1, 1
|
||
|
beq a0, s4, .LBB4_30
|
||
|
mv s1, a1
|
||
|
j .LBB4_30
|
||
|
.LBB4_33:
|
||
|
bltu s3, a1, .LBB4_48
|
||
|
li a1, 0
|
||
|
j .LBB4_36
|
||
|
.LBB4_35:
|
||
|
call getch
|
||
|
addiw a2, a0, -58
|
||
|
mv a1, s1
|
||
|
bgeu a2, s5, .LBB4_49
|
||
|
.LBB4_36:
|
||
|
sext.w a0, a0
|
||
|
li s1, 1
|
||
|
beq a0, s4, .LBB4_35
|
||
|
mv s1, a1
|
||
|
j .LBB4_35
|
||
|
.LBB4_38:
|
||
|
li s1, 0
|
||
|
.LBB4_39:
|
||
|
li s0, 0
|
||
|
.LBB4_40:
|
||
|
mulw a1, s0, s6
|
||
|
addw a0, a0, a1
|
||
|
addiw s0, a0, -48
|
||
|
call getch
|
||
|
addiw a1, a0, -48
|
||
|
bltu a1, s6, .LBB4_40
|
||
|
beqz s1, .LBB4_43
|
||
|
negw s0, s0
|
||
|
.LBB4_43:
|
||
|
call getch
|
||
|
addiw a1, a0, -58
|
||
|
bltu s3, a1, .LBB4_58
|
||
|
li a1, 0
|
||
|
j .LBB4_46
|
||
|
.LBB4_45:
|
||
|
call getch
|
||
|
addiw a2, a0, -58
|
||
|
mv a1, s9
|
||
|
bgeu a2, s5, .LBB4_59
|
||
|
.LBB4_46:
|
||
|
sext.w a0, a0
|
||
|
li s9, 1
|
||
|
beq a0, s4, .LBB4_45
|
||
|
mv s9, a1
|
||
|
j .LBB4_45
|
||
|
.LBB4_48:
|
||
|
li s1, 0
|
||
|
.LBB4_49:
|
||
|
li s0, 0
|
||
|
.LBB4_50:
|
||
|
mulw a1, s0, s6
|
||
|
addw a0, a0, a1
|
||
|
addiw s0, a0, -48
|
||
|
call getch
|
||
|
addiw a1, a0, -48
|
||
|
bltu a1, s6, .LBB4_50
|
||
|
beqz s1, .LBB4_53
|
||
|
negw s0, s0
|
||
|
.LBB4_53:
|
||
|
mv a0, s0
|
||
|
call find
|
||
|
mv s9, a0
|
||
|
call getch
|
||
|
addiw a1, a0, -58
|
||
|
bltu s3, a1, .LBB4_64
|
||
|
li a1, 0
|
||
|
j .LBB4_56
|
||
|
.LBB4_55:
|
||
|
call getch
|
||
|
addiw a2, a0, -58
|
||
|
mv a1, s0
|
||
|
bgeu a2, s5, .LBB4_65
|
||
|
.LBB4_56:
|
||
|
sext.w a0, a0
|
||
|
li s0, 1
|
||
|
beq a0, s4, .LBB4_55
|
||
|
mv s0, a1
|
||
|
j .LBB4_55
|
||
|
.LBB4_58:
|
||
|
li s9, 0
|
||
|
.LBB4_59:
|
||
|
li s1, 0
|
||
|
.LBB4_60:
|
||
|
mulw a1, s1, s6
|
||
|
addw a0, a0, a1
|
||
|
addiw s1, a0, -48
|
||
|
call getch
|
||
|
addiw a1, a0, -48
|
||
|
bltu a1, s6, .LBB4_60
|
||
|
beqz s9, .LBB4_63
|
||
|
negw s1, s1
|
||
|
.LBB4_63:
|
||
|
mv a0, s0
|
||
|
call find
|
||
|
mv s0, a0
|
||
|
mv a0, s1
|
||
|
call find
|
||
|
xor a0, a0, s0
|
||
|
seqz a0, a0
|
||
|
call putint
|
||
|
li a0, 10
|
||
|
call putch
|
||
|
lw a0, %lo(m)(s7)
|
||
|
addiw a0, a0, -1
|
||
|
sw a0, %lo(m)(s7)
|
||
|
bnez a0, .LBB4_26
|
||
|
j .LBB4_69
|
||
|
.LBB4_64:
|
||
|
li s0, 0
|
||
|
.LBB4_65:
|
||
|
li s1, 0
|
||
|
.LBB4_66:
|
||
|
mulw a1, s1, s6
|
||
|
addw a0, a0, a1
|
||
|
addiw s1, a0, -48
|
||
|
call getch
|
||
|
addiw a1, a0, -48
|
||
|
bltu a1, s6, .LBB4_66
|
||
|
beqz s0, .LBB4_25
|
||
|
negw s1, s1
|
||
|
j .LBB4_25
|
||
|
.LBB4_69:
|
||
|
li a0, 0
|
||
|
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)
|
||
|
addi sp, sp, 96
|
||
|
ret
|
||
|
.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 fa,@object
|
||
|
.bss
|
||
|
.globl fa
|
||
|
.p2align 2
|
||
|
fa:
|
||
|
.zero 400020
|
||
|
.size fa, 400020
|
||
|
|
||
|
.type m,@object
|
||
|
.section .sbss,"aw",@nobits
|
||
|
.globl m
|
||
|
.p2align 2
|
||
|
m:
|
||
|
.word 0
|
||
|
.size m, 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
|