sysy-data/hidden_functional_c/asm/09_BFS.s

756 lines
11 KiB
ArmAsm
Raw Permalink Normal View History

2024-06-14 13:34:46 +08:00
.text
.attribute 4, 16
.attribute 5, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
.file "09_BFS.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 inqueue
.p2align 1
.type inqueue,@function
inqueue:
lui a1, %hi(inq)
addi a1, a1, %lo(inq)
slli a2, a0, 2
lui a3, %hi(tail)
lw a4, %lo(tail)(a3)
add a1, a1, a2
li a2, 1
sw a2, 0(a1)
addiw a1, a4, 1
sw a1, %lo(tail)(a3)
lui a2, %hi(que)
addi a2, a2, %lo(que)
slli a1, a1, 2
add a1, a1, a2
sw a0, 0(a1)
ret
.Lfunc_end3:
.size inqueue, .Lfunc_end3-inqueue
.globl pop_queue
.p2align 1
.type pop_queue,@function
pop_queue:
lui a1, %hi(h)
lw a0, %lo(h)(a1)
addiw a2, a0, 1
lui a0, %hi(que)
addi a0, a0, %lo(que)
slli a3, a2, 2
add a0, a0, a3
lw a0, 0(a0)
sw a2, %lo(h)(a1)
ret
.Lfunc_end4:
.size pop_queue, .Lfunc_end4-pop_queue
.globl same
.p2align 1
.type same,@function
same:
addi sp, sp, -16
sd s0, 8(sp)
mv a6, a0
li t1, 0
li a0, 0
lui a2, %hi(inq)
addi t4, a2, %lo(inq)
slli a2, a6, 2
add a2, a2, t4
li a7, 1
sw a7, 0(a2)
lui t0, %hi(tail)
sw a7, %lo(tail)(t0)
lui a2, %hi(que)
addi t2, a2, %lo(que)
sw a6, 4(t2)
lui a2, %hi(head)
addi a6, a2, %lo(head)
li t3, -1
lui a2, %hi(to)
addi t5, a2, %lo(to)
lui a2, %hi(next)
addi t6, a2, %lo(next)
li a2, 1
j .LBB5_2
.LBB5_1:
bge t1, a2, .LBB5_8
.LBB5_2:
addi t1, t1, 1
slli a3, t1, 2
add a3, a3, t2
lw a4, 0(a3)
li a5, 1
beq a4, a1, .LBB5_4
mv a5, a0
.LBB5_4:
slli a0, a4, 2
add a0, a0, a6
lw a4, 0(a0)
mv a0, a5
bne a4, t3, .LBB5_6
j .LBB5_1
.LBB5_5:
add a3, a4, t6
lw a4, 0(a3)
beq a4, t3, .LBB5_1
.LBB5_6:
slli a4, a4, 2
add a3, a4, t5
lw a5, 0(a3)
slli a3, a5, 2
add a3, a3, t4
lw s0, 0(a3)
bnez s0, .LBB5_5
sw a7, 0(a3)
addiw a2, a2, 1
sw a2, %lo(tail)(t0)
slli a3, a2, 2
add a3, a3, t2
sw a5, 0(a3)
j .LBB5_5
.LBB5_8:
lui a1, %hi(h)
sw t1, %lo(h)(a1)
bltz a2, .LBB5_11
addiw a2, a2, 1
lui a1, %hi(que)
addi a1, a1, %lo(que)
slli a2, a2, 32
srli a2, a2, 32
lui a3, %hi(inq)
addi a3, a3, %lo(inq)
.LBB5_10:
lw a4, 0(a1)
slli a4, a4, 2
add a4, a4, a3
sw zero, 0(a4)
addi a2, a2, -1
addi a1, a1, 4
bnez a2, .LBB5_10
.LBB5_11:
ld s0, 8(sp)
addi sp, sp, 16
ret
.Lfunc_end5:
.size same, .Lfunc_end5-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, .LBB6_5
li a1, 0
li s2, 45
li s1, -10
j .LBB6_3
.LBB6_2:
call getch
addiw a2, a0, -58
mv a1, s3
bgeu a2, s1, .LBB6_6
.LBB6_3:
sext.w a0, a0
li s3, 1
beq a0, s2, .LBB6_2
mv s3, a1
j .LBB6_2
.LBB6_5:
li s3, 0
.LBB6_6:
li s1, 0
li s0, 10
.LBB6_7:
mulw a1, s1, s0
addw a0, a0, a1
addiw s1, a0, -48
call getch
addiw a1, a0, -48
bltu a1, s0, .LBB6_7
beqz s3, .LBB6_10
neg s1, s1
.LBB6_10:
lui a0, %hi(n)
sw s1, %lo(n)(a0)
call getch
addiw a1, a0, -58
li a2, -11
bltu a2, a1, .LBB6_15
li a1, 0
li s2, 45
li s1, -10
j .LBB6_13
.LBB6_12:
call getch
addiw a2, a0, -58
mv a1, s3
bgeu a2, s1, .LBB6_16
.LBB6_13:
sext.w a0, a0
li s3, 1
beq a0, s2, .LBB6_12
mv s3, a1
j .LBB6_12
.LBB6_15:
li s3, 0
.LBB6_16:
li s1, 0
li s0, 10
.LBB6_17:
mulw a1, s1, s0
addw a0, a0, a1
addiw s1, a0, -48
call getch
addiw a1, a0, -48
bltu a1, s0, .LBB6_17
beqz s3, .LBB6_20
negw s1, s1
.LBB6_20:
lui a0, %hi(m)
sw s1, %lo(m)(a0)
lui a0, %hi(head)
addi s7, a0, %lo(head)
lui a0, 1
addiw a2, a0, -76
li a1, 255
mv a0, s7
call memset@plt
beqz s1, .LBB6_78
li s5, 81
li s8, 10
lui a0, %hi(inq)
addi s0, a0, %lo(inq)
lui s9, %hi(tail)
lui a0, %hi(que)
addi s10, a0, %lo(que)
li s11, -1
lui a0, %hi(to)
addi s4, a0, %lo(to)
li s2, 1
lui a0, %hi(next)
addi s3, a0, %lo(next)
j .LBB6_24
.LBB6_22:
li s5, 81
lui a6, %hi(cnt)
lw a0, %lo(cnt)(a6)
slli a1, a0, 2
slli a2, s6, 2
add a2, a2, s7
lw a3, 0(a2)
add a4, a1, s4
sw s1, 0(a4)
add a1, a1, s3
sw a3, 0(a1)
sw a0, 0(a2)
addiw a1, a0, 1
slli a2, a1, 2
add a3, a2, s4
slli a4, s1, 2
add a4, a4, s7
lw a5, 0(a4)
sw s6, 0(a3)
addi a3, a6, %lo(cnt)
add a2, a2, s3
sw a5, 0(a2)
sw a1, 0(a4)
addiw a0, a0, 2
sw a0, 0(a3)
.LBB6_23:
lui a1, %hi(m)
lw a0, %lo(m)(a1)
addiw a0, a0, -1
sw a0, %lo(m)(a1)
beqz a0, .LBB6_78
.LBB6_24:
call getch
mv s1, a0
andi a0, a0, -5
bne a0, s5, .LBB6_24
call getch
addiw a1, a0, -58
li a2, -11
bne s1, s5, .LBB6_31
bltu a2, a1, .LBB6_36
li a1, 0
j .LBB6_29
.LBB6_28:
call getch
addiw a2, a0, -58
mv a1, s5
li a3, -10
bgeu a2, a3, .LBB6_37
.LBB6_29:
sext.w a0, a0
li s5, 1
li a2, 45
beq a0, a2, .LBB6_28
mv s5, a1
j .LBB6_28
.LBB6_31:
bltu a2, a1, .LBB6_46
li a1, 0
j .LBB6_34
.LBB6_33:
call getch
addiw a2, a0, -58
mv a1, s5
li a3, -10
bgeu a2, a3, .LBB6_47
.LBB6_34:
sext.w a0, a0
li s5, 1
li a2, 45
beq a0, a2, .LBB6_33
mv s5, a1
j .LBB6_33
.LBB6_36:
li s5, 0
.LBB6_37:
li s1, 0
.LBB6_38:
mulw a1, s1, s8
addw a0, a0, a1
addiw s1, a0, -48
call getch
addiw a1, a0, -48
bltu a1, s8, .LBB6_38
beqz s5, .LBB6_41
negw s1, s1
.LBB6_41:
call getch
addiw a1, a0, -58
li a2, -11
bltu a2, a1, .LBB6_56
li a1, 0
j .LBB6_44
.LBB6_43:
call getch
addiw a2, a0, -58
mv a1, s6
li a3, -10
bgeu a2, a3, .LBB6_57
.LBB6_44:
sext.w a0, a0
li s6, 1
li a2, 45
beq a0, a2, .LBB6_43
mv s6, a1
j .LBB6_43
.LBB6_46:
li s5, 0
.LBB6_47:
li s6, 0
.LBB6_48:
mulw a1, s6, s8
addw a0, a0, a1
addiw s6, a0, -48
call getch
addiw a1, a0, -48
bltu a1, s8, .LBB6_48
beqz s5, .LBB6_51
negw s6, s6
.LBB6_51:
call getch
addiw a1, a0, -58
li a2, -11
bltu a2, a1, .LBB6_73
li a1, 0
j .LBB6_54
.LBB6_53:
call getch
addiw a2, a0, -58
mv a1, s5
li a3, -10
bgeu a2, a3, .LBB6_74
.LBB6_54:
sext.w a0, a0
li s5, 1
li a2, 45
beq a0, a2, .LBB6_53
mv s5, a1
j .LBB6_53
.LBB6_56:
li s6, 0
.LBB6_57:
li s5, 0
.LBB6_58:
mulw a1, s5, s8
addw a0, a0, a1
addiw s5, a0, -48
call getch
addiw a1, a0, -48
bltu a1, s8, .LBB6_58
beqz s6, .LBB6_61
negw s5, s5
.LBB6_61:
li a2, 0
li a0, 0
slli a1, s1, 2
add a3, a1, s0
li a1, 1
sw a1, 0(a3)
sw s1, 4(s10)
sw a1, %lo(tail)(s9)
j .LBB6_63
.LBB6_62:
bge a2, a1, .LBB6_69
.LBB6_63:
addi a2, a2, 1
slli a3, a2, 2
add a3, a3, s10
lw a3, 0(a3)
li a4, 1
beq a3, s5, .LBB6_65
mv a4, a0
.LBB6_65:
slli a0, a3, 2
add a0, a0, s7
lw a3, 0(a0)
mv a0, a4
bne a3, s11, .LBB6_67
j .LBB6_62
.LBB6_66:
add a3, a3, s3
lw a3, 0(a3)
beq a3, s11, .LBB6_62
.LBB6_67:
slli a3, a3, 2
add a4, a3, s4
lw a4, 0(a4)
slli a5, a4, 2
add a5, a5, s0
lw s1, 0(a5)
bnez s1, .LBB6_66
sw s2, 0(a5)
addiw a1, a1, 1
sw a1, %lo(tail)(s9)
slli a5, a1, 2
add a5, a5, s10
sw a4, 0(a5)
j .LBB6_66
.LBB6_69:
lui a3, %hi(h)
sw a2, %lo(h)(a3)
bltz a1, .LBB6_72
addiw a1, a1, 1
slli a1, a1, 32
srli a1, a1, 32
mv a2, s10
.LBB6_71:
lw a3, 0(a2)
slli a3, a3, 2
add a3, a3, s0
sw zero, 0(a3)
addi a1, a1, -1
addi a2, a2, 4
bnez a1, .LBB6_71
.LBB6_72:
call putint
li a0, 10
call putch
li s5, 81
j .LBB6_23
.LBB6_73:
li s5, 0
.LBB6_74:
li s1, 0
.LBB6_75:
mulw a1, s1, s8
addw a0, a0, a1
addiw s1, a0, -48
call getch
addiw a1, a0, -48
bltu a1, s8, .LBB6_75
beqz s5, .LBB6_22
negw s1, s1
j .LBB6_22
.LBB6_78:
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_end6:
.size main, .Lfunc_end6-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 inq,@object
.globl inq
.p2align 2
inq:
.zero 4020
.size inq, 4020
.type tail,@object
.section .sbss,"aw",@nobits
.globl tail
.p2align 2
tail:
.word 0
.size tail, 4
.type que,@object
.bss
.globl que
.p2align 2
que:
.zero 4020
.size que, 4020
.type h,@object
.section .sbss,"aw",@nobits
.globl h
.p2align 2
h:
.word 0
.size h, 4
.type n,@object
.globl n
.p2align 2
n:
.word 0
.size n, 4
.type m,@object
.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