633 lines
9.0 KiB
ArmAsm
633 lines
9.0 KiB
ArmAsm
.text
|
|
.attribute 4, 16
|
|
.attribute 5, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
|
|
.file "10_DFS.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 add_edge
|
|
.p2align 1
|
|
.type add_edge,@function
|
|
add_edge:
|
|
lui a6, %hi(cnt)
|
|
lw a3, %lo(cnt)(a6)
|
|
lui a4, %hi(to)
|
|
addi a7, a4, %lo(to)
|
|
slli a5, a3, 2
|
|
add a2, a5, a7
|
|
sw a1, 0(a2)
|
|
lui a2, %hi(head)
|
|
addi t1, a2, %lo(head)
|
|
slli a4, a0, 2
|
|
add a4, a4, t1
|
|
lw t0, 0(a4)
|
|
lui a2, %hi(next)
|
|
addi t2, a2, %lo(next)
|
|
add a5, a5, t2
|
|
sw t0, 0(a5)
|
|
sw a3, 0(a4)
|
|
addiw a4, a3, 1
|
|
slli a5, a4, 2
|
|
slli a1, a1, 2
|
|
add a1, a1, t1
|
|
lw t0, 0(a1)
|
|
add a2, a5, a7
|
|
sw a0, 0(a2)
|
|
add a0, a5, t2
|
|
sw t0, 0(a0)
|
|
sw a4, 0(a1)
|
|
addiw a0, a3, 2
|
|
sw a0, %lo(cnt)(a6)
|
|
ret
|
|
.Lfunc_end1:
|
|
.size add_edge, .Lfunc_end1-add_edge
|
|
|
|
.globl init
|
|
.p2align 1
|
|
.type init,@function
|
|
init:
|
|
addi sp, sp, -16
|
|
sd ra, 8(sp)
|
|
lui a0, %hi(head)
|
|
addi a0, a0, %lo(head)
|
|
lui a1, 1
|
|
addiw a2, a1, -76
|
|
li a1, 255
|
|
call memset@plt
|
|
ld ra, 8(sp)
|
|
addi sp, sp, 16
|
|
ret
|
|
.Lfunc_end2:
|
|
.size init, .Lfunc_end2-init
|
|
|
|
.globl clear
|
|
.p2align 1
|
|
.type clear,@function
|
|
clear:
|
|
addi sp, sp, -16
|
|
sd ra, 8(sp)
|
|
lui a0, %hi(n)
|
|
lw a0, %lo(n)(a0)
|
|
blez a0, .LBB3_2
|
|
slli a0, a0, 32
|
|
srli a0, a0, 32
|
|
slli a2, a0, 2
|
|
lui a0, %hi(vis+4)
|
|
addi a0, a0, %lo(vis+4)
|
|
li a1, 0
|
|
call memset@plt
|
|
.LBB3_2:
|
|
ld ra, 8(sp)
|
|
addi sp, sp, 16
|
|
ret
|
|
.Lfunc_end3:
|
|
.size clear, .Lfunc_end3-clear
|
|
|
|
.globl same
|
|
.p2align 1
|
|
.type same,@function
|
|
same:
|
|
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)
|
|
sd s6, 0(sp)
|
|
mv s3, a1
|
|
lui a1, %hi(vis)
|
|
addi a2, a1, %lo(vis)
|
|
slli a1, a0, 2
|
|
add a2, a2, a1
|
|
li s2, 1
|
|
sw s2, 0(a2)
|
|
beq a0, s3, .LBB4_7
|
|
lui a0, %hi(head)
|
|
addi a0, a0, %lo(head)
|
|
add a0, a0, a1
|
|
lw a0, 0(a0)
|
|
li s4, -1
|
|
beq a0, s4, .LBB4_6
|
|
lui a1, %hi(to)
|
|
addi s5, a1, %lo(to)
|
|
lui a1, %hi(vis)
|
|
addi s6, a1, %lo(vis)
|
|
lui a1, %hi(next)
|
|
addi s1, a1, %lo(next)
|
|
j .LBB4_4
|
|
.LBB4_3:
|
|
add a0, s0, s1
|
|
lw a0, 0(a0)
|
|
beq a0, s4, .LBB4_6
|
|
.LBB4_4:
|
|
slli s0, a0, 2
|
|
add a0, s0, s5
|
|
lw a0, 0(a0)
|
|
slli a1, a0, 2
|
|
add a1, a1, s6
|
|
lw a1, 0(a1)
|
|
bnez a1, .LBB4_3
|
|
mv a1, s3
|
|
call same
|
|
beqz a0, .LBB4_3
|
|
j .LBB4_7
|
|
.LBB4_6:
|
|
li s2, 0
|
|
.LBB4_7:
|
|
mv a0, s2
|
|
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)
|
|
ld s6, 0(sp)
|
|
addi sp, sp, 64
|
|
ret
|
|
.Lfunc_end4:
|
|
.size same, .Lfunc_end4-same
|
|
|
|
.globl main
|
|
.p2align 1
|
|
.type main,@function
|
|
main:
|
|
addi sp, sp, -112
|
|
sd ra, 104(sp)
|
|
sd s0, 96(sp)
|
|
sd s1, 88(sp)
|
|
sd s2, 80(sp)
|
|
sd s3, 72(sp)
|
|
sd s4, 64(sp)
|
|
sd s5, 56(sp)
|
|
sd s6, 48(sp)
|
|
sd s7, 40(sp)
|
|
sd s8, 32(sp)
|
|
sd s9, 24(sp)
|
|
sd s10, 16(sp)
|
|
sd s11, 8(sp)
|
|
call getch
|
|
addiw a1, a0, -58
|
|
li a2, -11
|
|
bltu a2, a1, .LBB5_5
|
|
li a1, 0
|
|
li s2, 45
|
|
li s1, -10
|
|
j .LBB5_3
|
|
.LBB5_2:
|
|
call getch
|
|
addiw a2, a0, -58
|
|
mv a1, s3
|
|
bgeu a2, s1, .LBB5_6
|
|
.LBB5_3:
|
|
sext.w a0, a0
|
|
li s3, 1
|
|
beq a0, s2, .LBB5_2
|
|
mv s3, a1
|
|
j .LBB5_2
|
|
.LBB5_5:
|
|
li s3, 0
|
|
.LBB5_6:
|
|
li s1, 0
|
|
li s0, 10
|
|
.LBB5_7:
|
|
mulw a1, s1, s0
|
|
addw a0, a0, a1
|
|
addiw s1, a0, -48
|
|
call getch
|
|
addiw a1, a0, -48
|
|
bltu a1, s0, .LBB5_7
|
|
beqz s3, .LBB5_10
|
|
neg s1, s1
|
|
.LBB5_10:
|
|
lui a0, %hi(n)
|
|
sw s1, %lo(n)(a0)
|
|
call getch
|
|
addiw a1, a0, -58
|
|
li a2, -11
|
|
bltu a2, a1, .LBB5_15
|
|
li a1, 0
|
|
li s2, 45
|
|
li s1, -10
|
|
j .LBB5_13
|
|
.LBB5_12:
|
|
call getch
|
|
addiw a2, a0, -58
|
|
mv a1, s3
|
|
bgeu a2, s1, .LBB5_16
|
|
.LBB5_13:
|
|
sext.w a0, a0
|
|
li s3, 1
|
|
beq a0, s2, .LBB5_12
|
|
mv s3, a1
|
|
j .LBB5_12
|
|
.LBB5_15:
|
|
li s3, 0
|
|
.LBB5_16:
|
|
li s1, 0
|
|
li s0, 10
|
|
.LBB5_17:
|
|
mulw a1, s1, s0
|
|
addw a0, a0, a1
|
|
addiw s1, a0, -48
|
|
call getch
|
|
addiw a1, a0, -48
|
|
bltu a1, s0, .LBB5_17
|
|
beqz s3, .LBB5_20
|
|
negw s1, s1
|
|
.LBB5_20:
|
|
lui s4, %hi(m)
|
|
sw s1, %lo(m)(s4)
|
|
lui a0, %hi(head)
|
|
addi s3, a0, %lo(head)
|
|
lui a0, 1
|
|
addiw a2, a0, -76
|
|
li a1, 255
|
|
mv a0, s3
|
|
call memset@plt
|
|
beqz s1, .LBB5_68
|
|
li s5, 81
|
|
li s6, -11
|
|
li s7, 45
|
|
li s8, -10
|
|
li s9, 10
|
|
lui a0, %hi(vis+4)
|
|
addi a0, a0, %lo(vis+4)
|
|
sd a0, 0(sp)
|
|
lui a0, %hi(to)
|
|
addi s10, a0, %lo(to)
|
|
lui a0, %hi(next)
|
|
addi s2, a0, %lo(next)
|
|
j .LBB5_23
|
|
.LBB5_22:
|
|
lui a6, %hi(cnt)
|
|
lw a0, %lo(cnt)(a6)
|
|
slli a1, a0, 2
|
|
slli a2, s0, 2
|
|
add a2, a2, s3
|
|
lw a3, 0(a2)
|
|
add a4, a1, s10
|
|
sw s1, 0(a4)
|
|
add a1, a1, s2
|
|
sw a3, 0(a1)
|
|
sw a0, 0(a2)
|
|
addiw a1, a0, 1
|
|
slli a2, a1, 2
|
|
add a3, a2, s10
|
|
slli a4, s1, 2
|
|
add a4, a4, s3
|
|
lw a5, 0(a4)
|
|
sw s0, 0(a3)
|
|
addi a3, a6, %lo(cnt)
|
|
add a2, a2, s2
|
|
sw a5, 0(a2)
|
|
sw a1, 0(a4)
|
|
addiw a0, a0, 2
|
|
sw a0, 0(a3)
|
|
lw a0, %lo(m)(s4)
|
|
addiw a0, a0, -1
|
|
sw a0, %lo(m)(s4)
|
|
beqz a0, .LBB5_68
|
|
.LBB5_23:
|
|
call getch
|
|
mv s0, a0
|
|
andi a0, a0, -5
|
|
bne a0, s5, .LBB5_23
|
|
call getch
|
|
addiw a1, a0, -58
|
|
bne s0, s5, .LBB5_30
|
|
bltu s6, a1, .LBB5_35
|
|
li a1, 0
|
|
j .LBB5_28
|
|
.LBB5_27:
|
|
call getch
|
|
addiw a2, a0, -58
|
|
mv a1, s0
|
|
bgeu a2, s8, .LBB5_36
|
|
.LBB5_28:
|
|
sext.w a0, a0
|
|
li s0, 1
|
|
beq a0, s7, .LBB5_27
|
|
mv s0, a1
|
|
j .LBB5_27
|
|
.LBB5_30:
|
|
bltu s6, a1, .LBB5_45
|
|
li a1, 0
|
|
j .LBB5_33
|
|
.LBB5_32:
|
|
call getch
|
|
addiw a2, a0, -58
|
|
mv a1, s1
|
|
bgeu a2, s8, .LBB5_46
|
|
.LBB5_33:
|
|
sext.w a0, a0
|
|
li s1, 1
|
|
beq a0, s7, .LBB5_32
|
|
mv s1, a1
|
|
j .LBB5_32
|
|
.LBB5_35:
|
|
li s0, 0
|
|
.LBB5_36:
|
|
li s1, 0
|
|
.LBB5_37:
|
|
mulw a1, s1, s9
|
|
addw a0, a0, a1
|
|
addiw s1, a0, -48
|
|
call getch
|
|
addiw a1, a0, -48
|
|
bltu a1, s9, .LBB5_37
|
|
beqz s0, .LBB5_40
|
|
negw s1, s1
|
|
.LBB5_40:
|
|
call getch
|
|
addiw a1, a0, -58
|
|
bltu s6, a1, .LBB5_55
|
|
li a1, 0
|
|
j .LBB5_43
|
|
.LBB5_42:
|
|
call getch
|
|
addiw a2, a0, -58
|
|
mv a1, s11
|
|
bgeu a2, s8, .LBB5_56
|
|
.LBB5_43:
|
|
sext.w a0, a0
|
|
li s11, 1
|
|
beq a0, s7, .LBB5_42
|
|
mv s11, a1
|
|
j .LBB5_42
|
|
.LBB5_45:
|
|
li s1, 0
|
|
.LBB5_46:
|
|
li s0, 0
|
|
.LBB5_47:
|
|
mulw a1, s0, s9
|
|
addw a0, a0, a1
|
|
addiw s0, a0, -48
|
|
call getch
|
|
addiw a1, a0, -48
|
|
bltu a1, s9, .LBB5_47
|
|
beqz s1, .LBB5_50
|
|
negw s0, s0
|
|
.LBB5_50:
|
|
call getch
|
|
addiw a1, a0, -58
|
|
bltu s6, a1, .LBB5_63
|
|
li a1, 0
|
|
j .LBB5_53
|
|
.LBB5_52:
|
|
call getch
|
|
addiw a2, a0, -58
|
|
mv a1, s11
|
|
bgeu a2, s8, .LBB5_64
|
|
.LBB5_53:
|
|
sext.w a0, a0
|
|
li s11, 1
|
|
beq a0, s7, .LBB5_52
|
|
mv s11, a1
|
|
j .LBB5_52
|
|
.LBB5_55:
|
|
li s11, 0
|
|
.LBB5_56:
|
|
li s0, 0
|
|
.LBB5_57:
|
|
mulw a1, s0, s9
|
|
addw a0, a0, a1
|
|
addiw s0, a0, -48
|
|
call getch
|
|
addiw a1, a0, -48
|
|
bltu a1, s9, .LBB5_57
|
|
beqz s11, .LBB5_60
|
|
negw s0, s0
|
|
.LBB5_60:
|
|
lui a0, %hi(n)
|
|
lw a0, %lo(n)(a0)
|
|
blez a0, .LBB5_62
|
|
slli a0, a0, 32
|
|
srli a0, a0, 32
|
|
slli a2, a0, 2
|
|
ld a0, 0(sp)
|
|
li a1, 0
|
|
call memset@plt
|
|
.LBB5_62:
|
|
mv a0, s1
|
|
mv a1, s0
|
|
call same
|
|
call putint
|
|
li a0, 10
|
|
call putch
|
|
lw a0, %lo(m)(s4)
|
|
addiw a0, a0, -1
|
|
sw a0, %lo(m)(s4)
|
|
bnez a0, .LBB5_23
|
|
j .LBB5_68
|
|
.LBB5_63:
|
|
li s11, 0
|
|
.LBB5_64:
|
|
li s1, 0
|
|
.LBB5_65:
|
|
mulw a1, s1, s9
|
|
addw a0, a0, a1
|
|
addiw s1, a0, -48
|
|
call getch
|
|
addiw a1, a0, -48
|
|
bltu a1, s9, .LBB5_65
|
|
beqz s11, .LBB5_22
|
|
negw s1, s1
|
|
j .LBB5_22
|
|
.LBB5_68:
|
|
li a0, 0
|
|
ld ra, 104(sp)
|
|
ld s0, 96(sp)
|
|
ld s1, 88(sp)
|
|
ld s2, 80(sp)
|
|
ld s3, 72(sp)
|
|
ld s4, 64(sp)
|
|
ld s5, 56(sp)
|
|
ld s6, 48(sp)
|
|
ld s7, 40(sp)
|
|
ld s8, 32(sp)
|
|
ld s9, 24(sp)
|
|
ld s10, 16(sp)
|
|
ld s11, 8(sp)
|
|
addi sp, sp, 112
|
|
ret
|
|
.Lfunc_end5:
|
|
.size main, .Lfunc_end5-main
|
|
|
|
.type cnt,@object
|
|
.section .sbss,"aw",@nobits
|
|
.globl cnt
|
|
.p2align 2
|
|
cnt:
|
|
.word 0
|
|
.size cnt, 4
|
|
|
|
.type to,@object
|
|
.bss
|
|
.globl to
|
|
.p2align 2
|
|
to:
|
|
.zero 20020
|
|
.size to, 20020
|
|
|
|
.type head,@object
|
|
.globl head
|
|
.p2align 2
|
|
head:
|
|
.zero 4020
|
|
.size head, 4020
|
|
|
|
.type next,@object
|
|
.globl next
|
|
.p2align 2
|
|
next:
|
|
.zero 20020
|
|
.size next, 20020
|
|
|
|
.type n,@object
|
|
.section .sbss,"aw",@nobits
|
|
.globl n
|
|
.p2align 2
|
|
n:
|
|
.word 0
|
|
.size n, 4
|
|
|
|
.type vis,@object
|
|
.bss
|
|
.globl vis
|
|
.p2align 2
|
|
vis:
|
|
.zero 4020
|
|
.size vis, 4020
|
|
|
|
.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
|