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

539 lines
7.2 KiB
ArmAsm

.file "09_BFS.sy"
.option pic
.attribute arch, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.attribute unaligned_access, 0
.attribute stack_align, 16
.text
.align 1
.globl quick_read
.type quick_read, @function
quick_read:
addi sp,sp,-32
sd s2,0(sp)
sd ra,24(sp)
sd s0,16(sp)
sd s1,8(sp)
call getch@plt
addiw a4,a0,-48
li a5,9
li s2,0
bleu a4,a5,.L2
li s1,45
li s0,9
.L4:
bne a0,s1,.L3
li s2,1
.L3:
call getch@plt
addiw a5,a0,-48
bgtu a5,s0,.L4
.L2:
li a5,0
li s1,9
.L5:
slliw s0,a5,2
addw s0,s0,a5
slliw s0,s0,1
addw s0,s0,a0
call getch@plt
addiw a4,a0,-48
addiw a5,s0,-48
bleu a4,s1,.L5
beq s2,zero,.L6
li a5,48
subw a5,a5,s0
.L6:
ld ra,24(sp)
ld s0,16(sp)
ld s1,8(sp)
ld s2,0(sp)
mv a0,a5
addi sp,sp,32
jr ra
.size quick_read, .-quick_read
.align 1
.globl add_edge
.type add_edge, @function
add_edge:
lla t1,.LANCHOR0
lw a5,0(t1)
lla a4,head
slli a3,a0,2
add a3,a4,a3
slli a2,a1,2
lw t5,0(a3)
add a4,a4,a2
sw a5,0(a3)
addiw a6,a5,1
slli a7,a5,2
lw t4,0(a4)
lla a2,to
lla a3,next
add t6,a2,a7
mv t3,a6
add a7,a3,a7
slli a6,a6,2
sw a1,0(t6)
sw t5,0(a7)
add a2,a2,a6
add a3,a3,a6
addiw a5,a5,2
sw a0,0(a2)
sw t4,0(a3)
sw t3,0(a4)
sw a5,0(t1)
ret
.size add_edge, .-add_edge
.align 1
.globl init
.type init, @function
init:
li a2,4096
addi a2,a2,-76
li a1,255
lla a0,head
tail memset@plt
.size init, .-init
.align 1
.globl inqueue
.type inqueue, @function
inqueue:
lla a1,.LANCHOR0
lw a5,4(a1)
slli a4,a0,2
lla a3,inq
addiw a2,a5,1
mv a5,a2
add a3,a3,a4
slli a2,a2,2
lla a4,que
add a4,a4,a2
li a2,1
sw a2,0(a3)
sw a5,4(a1)
sw a0,0(a4)
ret
.size inqueue, .-inqueue
.align 1
.globl pop_queue
.type pop_queue, @function
pop_queue:
lla a2,.LANCHOR0
lw a5,8(a2)
lla a4,que
addiw a3,a5,1
mv a5,a3
slli a3,a3,2
add a4,a4,a3
lw a0,0(a4)
sw a5,8(a2)
ret
.size pop_queue, .-pop_queue
.align 1
.globl same
.type same, @function
same:
addi sp,sp,-48
slli a5,a0,2
lla t3,inq
sd s1,32(sp)
sd s2,24(sp)
sd s3,16(sp)
sd s4,8(sp)
sd s5,0(sp)
sd s0,40(sp)
li a4,1
lla s3,.LANCHOR0
add a5,t3,a5
lla t6,que
lla s4,que+4
mv s1,a1
sw a0,4(t6)
sw a4,4(s3)
sw zero,.LANCHOR0+8,a3
sw a4,0(a5)
mv a1,s4
li s5,0
li a7,1
li a0,0
li t2,0
lla s2,head
li t0,1
li t4,-1
lla t5,to
lla a2,next
.L26:
lw a5,0(a1)
addiw t2,t2,1
mv s0,t2
bne s1,a5,.L21
li a0,1
.L21:
slli a5,a5,2
add a5,s2,a5
.L40:
lw a5,0(a5)
beq a5,t4,.L22
.L25:
slli a5,a5,2
add a4,t5,a5
lw a3,0(a4)
add t1,a2,a5
mv a5,t1
slli a4,a3,2
add a4,t3,a4
lw a6,0(a4)
bne a6,zero,.L40
addiw a7,a7,1
slli a6,a7,2
lw a5,0(t1)
add a6,t6,a6
sw t0,0(a4)
sw a3,0(a6)
li s5,1
bne a5,t4,.L25
.L22:
addi a1,a1,4
blt t2,a7,.L26
sw s0,8(s3)
beq s5,zero,.L27
sw a7,4(s3)
.L27:
slli a3,a7,2
lla a4,que
add a3,a3,s4
blt a7,zero,.L38
.L29:
lw a5,0(a4)
addi a4,a4,4
slli a5,a5,2
add a5,t3,a5
sw zero,0(a5)
bne a3,a4,.L29
.L38:
ld s0,40(sp)
ld s1,32(sp)
ld s2,24(sp)
ld s3,16(sp)
ld s4,8(sp)
ld s5,0(sp)
addi sp,sp,48
jr ra
.size same, .-same
.section .text.startup,"ax",@progbits
.align 1
.globl main
.type main, @function
main:
addi sp,sp,-96
sd ra,88(sp)
sd s0,80(sp)
sd s2,64(sp)
sd s1,72(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)
lla s2,.LANCHOR0
call quick_read
sw a0,12(s2)
call quick_read
li a2,4096
mv s0,a0
addi a2,a2,-76
li a1,255
lla a0,head
sw s0,16(s2)
call memset@plt
beq s0,zero,.L42
li s0,81
li s1,85
lla s5,to
lla s4,next
lla s3,head
j .L67
.L106:
beq a0,s1,.L44
.L67:
call getch@plt
bne a0,s0,.L106
call getch@plt
addiw a4,a0,-48
li a5,9
li s8,0
li s7,45
li s6,9
bleu a4,a5,.L47
.L46:
bne a0,s7,.L50
li s8,1
.L50:
call getch@plt
addiw a5,a0,-48
bgtu a5,s6,.L46
.L47:
li s6,0
li s9,9
.L51:
slliw s7,s6,2
addw s7,s7,s6
slliw s7,s7,1
addw s7,s7,a0
call getch@plt
addiw a5,a0,-48
addiw s6,s7,-48
bleu a5,s9,.L51
beq s8,zero,.L52
li s6,48
subw s6,s6,s7
.L52:
call getch@plt
addiw a4,a0,-48
li a5,9
li s8,0
bleu a4,a5,.L53
li s9,45
li s7,9
.L55:
bne a0,s9,.L54
li s8,1
.L54:
call getch@plt
addiw a5,a0,-48
bgtu a5,s7,.L55
.L53:
li a1,0
li s9,9
.L56:
slliw s7,a1,2
addw s7,s7,a1
slliw s7,s7,1
addw s7,s7,a0
call getch@plt
addiw a5,a0,-48
addiw a1,s7,-48
bleu a5,s9,.L56
beq s8,zero,.L57
li a1,48
subw a1,a1,s7
.L57:
mv a0,s6
call same
call putint@plt
li a0,10
call putch@plt
.L58:
lw a5,16(s2)
addiw a4,a5,-1
sw a4,16(s2)
bne a4,zero,.L67
.L42:
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)
li a0,0
addi sp,sp,96
jr ra
.L44:
call getch@plt
addiw a4,a0,-48
li a5,9
li s8,0
li s7,45
li s6,9
bleu a4,a5,.L49
.L48:
bne a0,s7,.L59
li s8,1
.L59:
call getch@plt
addiw a5,a0,-48
bgtu a5,s6,.L48
.L49:
li s6,0
li s9,9
.L60:
slliw s7,s6,2
addw s7,s7,s6
slliw s7,s7,1
addw s7,s7,a0
call getch@plt
addiw a5,a0,-48
addiw s6,s7,-48
bleu a5,s9,.L60
beq s8,zero,.L61
li s6,48
subw s6,s6,s7
.L61:
call getch@plt
addiw a4,a0,-48
li a5,9
li s8,0
bleu a4,a5,.L62
li s9,45
li s7,9
.L64:
bne a0,s9,.L63
li s8,1
.L63:
call getch@plt
addiw a5,a0,-48
bgtu a5,s7,.L64
.L62:
li a5,0
li s9,9
.L65:
slliw s7,a5,2
addw s7,s7,a5
slliw s7,s7,1
addw s7,s7,a0
call getch@plt
addiw a4,a0,-48
addiw a5,s7,-48
bleu a4,s9,.L65
beq s8,zero,.L66
li a5,48
subw a5,a5,s7
.L66:
lw a4,0(s2)
slli a3,s6,2
add a3,s3,a3
slli a2,a5,2
lw a7,0(a3)
addiw a0,a4,1
sw a4,0(a3)
add a2,s3,a2
slli a1,a4,2
lw a6,0(a2)
sext.w a3,a0
slli a3,a3,2
add t1,s5,a1
add a1,s4,a1
sw a5,0(t1)
sw a7,0(a1)
add a5,s5,a3
addiw a4,a4,2
add a3,s4,a3
sw s6,0(a5)
sw a6,0(a3)
sw a0,0(a2)
sw a4,0(s2)
j .L58
.size main, .-main
.globl inq
.globl tail
.globl h
.globl que
.globl cnt
.globl head
.globl next
.globl to
.globl m
.globl n
.globl _sysy_idx
.globl _sysy_us
.globl _sysy_s
.globl _sysy_m
.globl _sysy_h
.globl _sysy_l2
.globl _sysy_l1
.globl _sysy_end
.globl _sysy_start
.bss
.align 3
.set .LANCHOR0,. + 0
.type cnt, @object
.size cnt, 4
cnt:
.zero 4
.type tail, @object
.size tail, 4
tail:
.zero 4
.type h, @object
.size h, 4
h:
.zero 4
.type n, @object
.size n, 4
n:
.zero 4
.type m, @object
.size m, 4
m:
.zero 4
.zero 4
.type inq, @object
.size inq, 4020
inq:
.zero 4020
.zero 4
.type que, @object
.size que, 4020
que:
.zero 4020
.zero 4
.type head, @object
.size head, 4020
head:
.zero 4020
.zero 4
.type next, @object
.size next, 20020
next:
.zero 20020
.zero 4
.type to, @object
.size to, 20020
to:
.zero 20020
.type _sysy_idx, @object
.size _sysy_idx, 4
_sysy_idx:
.zero 4
.type _sysy_us, @object
.size _sysy_us, 4096
_sysy_us:
.zero 4096
.type _sysy_s, @object
.size _sysy_s, 4096
_sysy_s:
.zero 4096
.type _sysy_m, @object
.size _sysy_m, 4096
_sysy_m:
.zero 4096
.type _sysy_h, @object
.size _sysy_h, 4096
_sysy_h:
.zero 4096
.type _sysy_l2, @object
.size _sysy_l2, 4096
_sysy_l2:
.zero 4096
.type _sysy_l1, @object
.size _sysy_l1, 4096
_sysy_l1:
.zero 4096
.type _sysy_end, @object
.size _sysy_end, 16
_sysy_end:
.zero 16
.type _sysy_start, @object
.size _sysy_start, 16
_sysy_start:
.zero 16
.ident "GCC: (Debian 12.2.0-13) 12.2.0"
.section .note.GNU-stack,"",@progbits