1150 lines
15 KiB
ArmAsm
1150 lines
15 KiB
ArmAsm
.file "13_LCA.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 a2,0(t1)
|
|
slli a5,a0,2
|
|
lla a4,head
|
|
add a4,a4,a5
|
|
slli a5,a1,2
|
|
slli a3,a2,2
|
|
lw t4,0(a4)
|
|
add a5,a5,a1
|
|
lla a7,to
|
|
lla a6,next
|
|
add a7,a7,a3
|
|
add a6,a6,a3
|
|
slli a5,a5,4
|
|
lla a3,f
|
|
addiw t3,a2,1
|
|
add a5,a3,a5
|
|
sw a1,0(a7)
|
|
sw t4,0(a6)
|
|
sw a2,0(a4)
|
|
sw t3,0(t1)
|
|
sw a0,0(a5)
|
|
ret
|
|
.size add_edge, .-add_edge
|
|
.align 1
|
|
.globl init
|
|
.type init, @function
|
|
init:
|
|
li a5,1061109760
|
|
addi a5,a5,-193
|
|
sw a5,dep,a4
|
|
lw a2,.LANCHOR0+4
|
|
ble a2,zero,.L17
|
|
slli a5,a2,32
|
|
srli a2,a5,30
|
|
li a1,255
|
|
lla a0,head+4
|
|
tail memset@plt
|
|
.L17:
|
|
ret
|
|
.size init, .-init
|
|
.align 1
|
|
.globl tree
|
|
.type tree, @function
|
|
tree:
|
|
slli a4,a0,2
|
|
addi sp,sp,-224
|
|
add a3,a4,a0
|
|
sd s0,208(sp)
|
|
slli a3,a3,4
|
|
lla s0,f
|
|
add a3,s0,a3
|
|
sd s7,152(sp)
|
|
lw a5,0(a3)
|
|
lla s7,dep
|
|
add a2,s7,a4
|
|
sd ra,216(sp)
|
|
sd s1,200(sp)
|
|
sd s2,192(sp)
|
|
sd s3,184(sp)
|
|
sd s4,176(sp)
|
|
sd s5,168(sp)
|
|
sd s6,160(sp)
|
|
sd s8,144(sp)
|
|
sd s9,136(sp)
|
|
sd s10,128(sp)
|
|
sd s11,120(sp)
|
|
sw a1,0(a2)
|
|
mv a0,a5
|
|
li a2,0
|
|
beq a5,zero,.L24
|
|
.L23:
|
|
slli a5,a0,2
|
|
add a5,a5,a0
|
|
slli a5,a5,2
|
|
add a5,a5,a2
|
|
slli a5,a5,2
|
|
add a5,s0,a5
|
|
lw a0,0(a5)
|
|
addi a3,a3,4
|
|
addiw a2,a2,1
|
|
sw a0,0(a3)
|
|
bne a0,zero,.L23
|
|
.L24:
|
|
lla s6,head
|
|
add a4,s6,a4
|
|
lw s1,0(a4)
|
|
li a5,-1
|
|
beq s1,a5,.L19
|
|
addiw a5,a1,9
|
|
addiw s9,a1,1
|
|
lla s5,to
|
|
lla s4,next
|
|
sd a5,8(sp)
|
|
mv s3,a1
|
|
.L30:
|
|
slli s2,s1,2
|
|
add a5,s5,s2
|
|
lw a5,0(a5)
|
|
li a2,0
|
|
slli a4,a5,2
|
|
add a3,a4,a5
|
|
slli a3,a3,4
|
|
add a3,s0,a3
|
|
lw a5,0(a3)
|
|
add a1,s7,a4
|
|
sw s9,0(a1)
|
|
mv a1,a5
|
|
beq a5,zero,.L29
|
|
.L28:
|
|
slli a5,a1,2
|
|
add a5,a5,a1
|
|
slli a5,a5,2
|
|
add a5,a5,a2
|
|
slli a5,a5,2
|
|
add a5,s0,a5
|
|
lw a1,0(a5)
|
|
addi a3,a3,4
|
|
addiw a2,a2,1
|
|
sw a1,0(a3)
|
|
bne a1,zero,.L28
|
|
.L29:
|
|
add a4,s6,a4
|
|
lw s10,0(a4)
|
|
li a5,-1
|
|
addiw s1,s3,2
|
|
addiw a2,s3,3
|
|
beq s10,a5,.L27
|
|
mv a5,s3
|
|
mv s8,s10
|
|
mv s3,s9
|
|
mv s11,a2
|
|
mv s10,s2
|
|
mv s9,a5
|
|
.L36:
|
|
slli s8,s8,2
|
|
add a5,s5,s8
|
|
lw a5,0(a5)
|
|
li a2,0
|
|
slli a4,a5,2
|
|
add a3,a4,a5
|
|
slli a3,a3,4
|
|
add a3,s0,a3
|
|
lw a5,0(a3)
|
|
add a1,s7,a4
|
|
sw s1,0(a1)
|
|
mv a1,a5
|
|
beq a5,zero,.L35
|
|
.L34:
|
|
slli a5,a1,2
|
|
add a5,a5,a1
|
|
slli a5,a5,2
|
|
add a5,a5,a2
|
|
slli a5,a5,2
|
|
add a5,s0,a5
|
|
lw a1,0(a5)
|
|
addi a3,a3,4
|
|
addiw a2,a2,1
|
|
sw a1,0(a3)
|
|
bne a1,zero,.L34
|
|
.L35:
|
|
add a4,s6,a4
|
|
lw s2,0(a4)
|
|
li a5,-1
|
|
beq s2,a5,.L33
|
|
addiw a0,s9,8
|
|
mv a1,s8
|
|
addiw a2,s9,4
|
|
mv s8,s10
|
|
mv s10,a0
|
|
.L42:
|
|
slli a6,s2,2
|
|
add a5,s5,a6
|
|
lw a5,0(a5)
|
|
li a0,0
|
|
slli a4,a5,2
|
|
add a3,a4,a5
|
|
slli a3,a3,4
|
|
add a3,s0,a3
|
|
lw a5,0(a3)
|
|
add a7,s7,a4
|
|
sw s11,0(a7)
|
|
mv a7,a5
|
|
beq a5,zero,.L41
|
|
.L40:
|
|
slli a5,a7,2
|
|
add a5,a5,a7
|
|
slli a5,a5,2
|
|
add a5,a5,a0
|
|
slli a5,a5,2
|
|
add a5,s0,a5
|
|
lw a7,0(a5)
|
|
addi a3,a3,4
|
|
addiw a0,a0,1
|
|
sw a7,0(a3)
|
|
bne a7,zero,.L40
|
|
.L41:
|
|
add a4,s6,a4
|
|
lw s2,0(a4)
|
|
li a5,-1
|
|
sext.w a7,s10
|
|
beq s2,a5,.L39
|
|
mv a5,s8
|
|
mv t4,s2
|
|
mv s8,s11
|
|
mv s2,s1
|
|
mv s11,a2
|
|
mv a0,s10
|
|
mv a2,a5
|
|
.L48:
|
|
slli t4,t4,2
|
|
add a5,s5,t4
|
|
lw a5,0(a5)
|
|
li t1,0
|
|
slli a4,a5,2
|
|
add a3,a4,a5
|
|
slli a3,a3,4
|
|
add a3,s0,a3
|
|
lw a5,0(a3)
|
|
add t3,s7,a4
|
|
sw s11,0(t3)
|
|
mv t3,a5
|
|
beq a5,zero,.L47
|
|
.L46:
|
|
slli a5,t3,2
|
|
add a5,a5,t3
|
|
slli a5,a5,2
|
|
add a5,a5,t1
|
|
slli a5,a5,2
|
|
add a5,s0,a5
|
|
lw t3,0(a5)
|
|
addi a3,a3,4
|
|
addiw t1,t1,1
|
|
sw t3,0(a3)
|
|
bne t3,zero,.L46
|
|
.L47:
|
|
add a4,s6,a4
|
|
lw s1,0(a4)
|
|
li a5,-1
|
|
addiw t1,s9,5
|
|
addiw s10,s9,6
|
|
beq s1,a5,.L45
|
|
mv a5,s9
|
|
mv t3,a2
|
|
mv s9,t1
|
|
mv a2,s3
|
|
mv t1,s8
|
|
mv s8,s11
|
|
mv s11,a5
|
|
.L54:
|
|
slli s3,s1,2
|
|
add a5,s5,s3
|
|
lw a5,0(a5)
|
|
li a3,0
|
|
slli t5,a5,2
|
|
add a4,t5,a5
|
|
slli a4,a4,4
|
|
add a4,s0,a4
|
|
lw a5,0(a4)
|
|
add t6,s7,t5
|
|
sw s9,0(t6)
|
|
beq a5,zero,.L53
|
|
.L52:
|
|
slli t6,a5,2
|
|
add a5,t6,a5
|
|
slli a5,a5,2
|
|
add a5,a5,a3
|
|
slli a5,a5,2
|
|
add a5,s0,a5
|
|
lw a5,0(a5)
|
|
addi a4,a4,4
|
|
addiw a3,a3,1
|
|
sw a5,0(a4)
|
|
bne a5,zero,.L52
|
|
.L53:
|
|
add t5,s6,t5
|
|
lw s1,0(t5)
|
|
li a5,-1
|
|
addiw t0,s11,7
|
|
beq s1,a5,.L51
|
|
mv a5,a7
|
|
mv t2,a2
|
|
mv t6,t1
|
|
mv a7,s9
|
|
mv t1,s11
|
|
mv a2,s8
|
|
mv s11,t0
|
|
mv t5,s3
|
|
mv s9,a5
|
|
.L60:
|
|
slli s1,s1,2
|
|
add a5,s5,s1
|
|
lw a5,0(a5)
|
|
li t0,0
|
|
slli a3,a5,2
|
|
add a4,a3,a5
|
|
slli a4,a4,4
|
|
add a4,s0,a4
|
|
lw a5,0(a4)
|
|
add s3,s7,a3
|
|
sw s10,0(s3)
|
|
beq a5,zero,.L59
|
|
.L58:
|
|
slli s3,a5,2
|
|
add a5,s3,a5
|
|
slli a5,a5,2
|
|
add a5,a5,t0
|
|
slli a5,a5,2
|
|
add a5,s0,a5
|
|
lw a5,0(a5)
|
|
addi a4,a4,4
|
|
addiw t0,t0,1
|
|
sw a5,0(a4)
|
|
bne a5,zero,.L58
|
|
.L59:
|
|
add a3,s6,a3
|
|
lw s3,0(a3)
|
|
li a5,-1
|
|
li s8,-1
|
|
beq s3,a5,.L57
|
|
sd s10,16(sp)
|
|
mv t0,a0
|
|
mv s10,t6
|
|
mv t6,s1
|
|
mv s1,t2
|
|
mv t2,a2
|
|
mv a2,a1
|
|
.L66:
|
|
slli a3,s3,2
|
|
add a5,s5,a3
|
|
lw a5,0(a5)
|
|
li a1,0
|
|
slli a0,a5,2
|
|
add a4,a0,a5
|
|
slli a4,a4,4
|
|
add a4,s0,a4
|
|
lw a5,0(a4)
|
|
add s3,s7,a0
|
|
sw s11,0(s3)
|
|
beq a5,zero,.L65
|
|
.L64:
|
|
slli s3,a5,2
|
|
add a5,s3,a5
|
|
slli a5,a5,2
|
|
add a5,a5,a1
|
|
slli a5,a5,2
|
|
add a5,s0,a5
|
|
lw a5,0(a5)
|
|
addi a4,a4,4
|
|
addiw a1,a1,1
|
|
sw a5,0(a4)
|
|
bne a5,zero,.L64
|
|
.L65:
|
|
add a0,s6,a0
|
|
lw s3,0(a0)
|
|
beq s3,s8,.L63
|
|
sd a3,0(sp)
|
|
.L72:
|
|
slli s3,s3,2
|
|
add a5,s5,s3
|
|
lw a5,0(a5)
|
|
li a0,0
|
|
slli a1,a5,2
|
|
add a4,a1,a5
|
|
slli a4,a4,4
|
|
add a4,s0,a4
|
|
lw a5,0(a4)
|
|
add a3,s7,a1
|
|
sw s9,0(a3)
|
|
mv a3,a5
|
|
beq a5,zero,.L71
|
|
.L70:
|
|
slli a5,a3,2
|
|
add a5,a5,a3
|
|
slli a5,a5,2
|
|
add a5,a5,a0
|
|
slli a5,a5,2
|
|
add a5,s0,a5
|
|
lw a3,0(a5)
|
|
addi a4,a4,4
|
|
addiw a0,a0,1
|
|
sw a3,0(a4)
|
|
bne a3,zero,.L70
|
|
.L71:
|
|
add a1,s6,a1
|
|
lw a5,0(a1)
|
|
beq a5,s8,.L69
|
|
.L73:
|
|
slli a5,a5,2
|
|
add a4,s5,a5
|
|
lw a0,0(a4)
|
|
ld a1,8(sp)
|
|
sw t0,108(sp)
|
|
sd t6,96(sp)
|
|
sd t5,88(sp)
|
|
sd t4,80(sp)
|
|
sd a6,72(sp)
|
|
sd a2,64(sp)
|
|
sd t3,56(sp)
|
|
sd t1,48(sp)
|
|
sd a7,40(sp)
|
|
sd t2,32(sp)
|
|
sd a5,24(sp)
|
|
call tree
|
|
ld a5,24(sp)
|
|
ld t2,32(sp)
|
|
ld a7,40(sp)
|
|
add a5,s4,a5
|
|
lw a5,0(a5)
|
|
ld t1,48(sp)
|
|
ld t3,56(sp)
|
|
ld a2,64(sp)
|
|
ld a6,72(sp)
|
|
ld t4,80(sp)
|
|
ld t5,88(sp)
|
|
ld t6,96(sp)
|
|
lw t0,108(sp)
|
|
bne a5,s8,.L73
|
|
.L69:
|
|
add a5,s4,s3
|
|
lw s3,0(a5)
|
|
bne s3,s8,.L72
|
|
ld a3,0(sp)
|
|
.L63:
|
|
add a5,s4,a3
|
|
lw s3,0(a5)
|
|
bne s3,s8,.L66
|
|
mv a1,a2
|
|
mv a2,t2
|
|
mv t2,s1
|
|
mv s1,t6
|
|
mv t6,s10
|
|
ld s10,16(sp)
|
|
mv a0,t0
|
|
.L57:
|
|
add s1,s4,s1
|
|
lw s1,0(s1)
|
|
li a5,-1
|
|
bne s1,a5,.L60
|
|
mv a5,s9
|
|
mv s8,a2
|
|
mv s11,t1
|
|
mv s9,a7
|
|
mv a2,t2
|
|
mv t1,t6
|
|
mv s3,t5
|
|
mv a7,a5
|
|
.L51:
|
|
add s3,s4,s3
|
|
lw s1,0(s3)
|
|
li a5,-1
|
|
bne s1,a5,.L54
|
|
mv s3,a2
|
|
mv s9,s11
|
|
mv a2,t3
|
|
mv s11,s8
|
|
mv s8,t1
|
|
.L45:
|
|
add a5,s4,t4
|
|
lw t4,0(a5)
|
|
li a5,-1
|
|
bne t4,a5,.L48
|
|
mv a5,a2
|
|
mv s1,s2
|
|
mv a2,s11
|
|
mv s10,a0
|
|
mv s11,s8
|
|
mv s8,a5
|
|
.L39:
|
|
add a5,s4,a6
|
|
lw s2,0(a5)
|
|
li a5,-1
|
|
bne s2,a5,.L42
|
|
mv s10,s8
|
|
mv s8,a1
|
|
.L33:
|
|
add s8,s4,s8
|
|
lw s8,0(s8)
|
|
li a5,-1
|
|
bne s8,a5,.L36
|
|
mv a5,s9
|
|
mv s2,s10
|
|
mv s9,s3
|
|
mv s3,a5
|
|
.L27:
|
|
add s2,s4,s2
|
|
lw s1,0(s2)
|
|
li a5,-1
|
|
bne s1,a5,.L30
|
|
.L19:
|
|
ld ra,216(sp)
|
|
ld s0,208(sp)
|
|
ld s1,200(sp)
|
|
ld s2,192(sp)
|
|
ld s3,184(sp)
|
|
ld s4,176(sp)
|
|
ld s5,168(sp)
|
|
ld s6,160(sp)
|
|
ld s7,152(sp)
|
|
ld s8,144(sp)
|
|
ld s9,136(sp)
|
|
ld s10,128(sp)
|
|
ld s11,120(sp)
|
|
addi sp,sp,224
|
|
jr ra
|
|
.size tree, .-tree
|
|
.align 1
|
|
.globl LCA
|
|
.type LCA, @function
|
|
LCA:
|
|
lla t3,dep
|
|
slli a7,a0,2
|
|
slli a3,a1,2
|
|
add a5,t3,a3
|
|
add a7,t3,a7
|
|
lw t1,0(a5)
|
|
lw a7,0(a7)
|
|
mv a6,a0
|
|
mv a5,t1
|
|
blt a7,t1,.L127
|
|
ble a7,t1,.L136
|
|
mv a4,a1
|
|
mv t1,a7
|
|
mv a1,a0
|
|
mv a6,a4
|
|
mv a7,a5
|
|
slli a3,a0,2
|
|
.L127:
|
|
li a2,19
|
|
lla a0,f
|
|
.L130:
|
|
add a5,a3,a1
|
|
slli a5,a5,2
|
|
add a5,a5,a2
|
|
slli a5,a5,2
|
|
add a5,a0,a5
|
|
lw a4,0(a5)
|
|
addiw a2,a2,-1
|
|
slli a5,a4,2
|
|
add a5,t3,a5
|
|
beq a4,zero,.L129
|
|
lw a5,0(a5)
|
|
blt a5,a7,.L129
|
|
mv t1,a5
|
|
mv a1,a4
|
|
.L129:
|
|
bge a7,t1,.L128
|
|
slli a3,a1,2
|
|
j .L130
|
|
.L136:
|
|
mv a5,a1
|
|
mv a6,a5
|
|
mv a1,a0
|
|
.L128:
|
|
mv a0,a6
|
|
beq a6,a1,.L131
|
|
li a2,19
|
|
slli a7,a6,2
|
|
slli a3,a1,2
|
|
lla a0,f
|
|
li t1,-1
|
|
.L135:
|
|
add a4,a3,a1
|
|
add a5,a7,a6
|
|
slli a4,a4,2
|
|
slli a5,a5,2
|
|
add a4,a4,a2
|
|
add a5,a5,a2
|
|
slli a4,a4,2
|
|
slli a5,a5,2
|
|
add a4,a0,a4
|
|
add a5,a0,a5
|
|
lw a4,0(a4)
|
|
lw a5,0(a5)
|
|
addiw a2,a2,-1
|
|
beq a4,a5,.L132
|
|
mv a6,a5
|
|
mv a1,a4
|
|
beq a2,t1,.L134
|
|
slli a7,a5,2
|
|
slli a3,a4,2
|
|
j .L135
|
|
.L132:
|
|
bne a2,t1,.L135
|
|
mv a4,a1
|
|
.L134:
|
|
slli a5,a4,2
|
|
add a5,a5,a4
|
|
slli a5,a5,4
|
|
add a0,a0,a5
|
|
lw a0,0(a0)
|
|
.L131:
|
|
ret
|
|
.size LCA, .-LCA
|
|
.section .text.startup,"ax",@progbits
|
|
.align 1
|
|
.globl main
|
|
.type main, @function
|
|
main:
|
|
addi sp,sp,-128
|
|
sd ra,120(sp)
|
|
sd s0,112(sp)
|
|
sd s7,56(sp)
|
|
sd s11,24(sp)
|
|
sd s1,104(sp)
|
|
lla s11,.LANCHOR0
|
|
sd s2,96(sp)
|
|
sd s3,88(sp)
|
|
sd s4,80(sp)
|
|
sd s5,72(sp)
|
|
sd s6,64(sp)
|
|
sd s8,48(sp)
|
|
sd s9,40(sp)
|
|
sd s10,32(sp)
|
|
call quick_read
|
|
sw a0,4(s11)
|
|
call quick_read
|
|
li a5,1061109760
|
|
lw s0,4(s11)
|
|
lla s7,dep
|
|
addi a5,a5,-193
|
|
sw a0,8(s11)
|
|
sw a5,0(s7)
|
|
ble s0,zero,.L145
|
|
slli a5,s0,32
|
|
srli a2,a5,30
|
|
li a1,255
|
|
lla a0,head+4
|
|
call memset@plt
|
|
li a5,1
|
|
lla s6,head
|
|
lla s2,f
|
|
beq s0,a5,.L146
|
|
.L145:
|
|
li s9,1
|
|
lla s4,to
|
|
lla s3,next
|
|
lla s6,head
|
|
lla s2,f
|
|
li s0,9
|
|
li s5,45
|
|
.L158:
|
|
call getch@plt
|
|
addiw a5,a0,-48
|
|
li s8,0
|
|
bleu a5,s0,.L147
|
|
.L149:
|
|
bne a0,s5,.L148
|
|
li s8,1
|
|
.L148:
|
|
call getch@plt
|
|
addiw a5,a0,-48
|
|
bgtu a5,s0,.L149
|
|
.L147:
|
|
li s1,0
|
|
.L150:
|
|
slliw a5,s1,2
|
|
addw a5,a5,s1
|
|
slliw a5,a5,1
|
|
addw s10,a5,a0
|
|
call getch@plt
|
|
addiw a4,a0,-48
|
|
addiw s1,s10,-48
|
|
bleu a4,s0,.L150
|
|
beq s8,zero,.L151
|
|
li a5,48
|
|
subw s1,a5,s10
|
|
.L151:
|
|
call getch@plt
|
|
addiw a5,a0,-48
|
|
li s8,0
|
|
bleu a5,s0,.L152
|
|
.L154:
|
|
bne a0,s5,.L153
|
|
li s8,1
|
|
.L153:
|
|
call getch@plt
|
|
addiw a5,a0,-48
|
|
bgtu a5,s0,.L154
|
|
.L152:
|
|
li a4,0
|
|
.L155:
|
|
slliw a5,a4,2
|
|
addw a5,a5,a4
|
|
slliw a5,a5,1
|
|
addw s10,a5,a0
|
|
call getch@plt
|
|
addiw a4,s10,-48
|
|
addiw a2,a0,-48
|
|
mv a3,a4
|
|
bleu a2,s0,.L155
|
|
beq s8,zero,.L156
|
|
li a5,48
|
|
lw a1,0(s11)
|
|
subw a2,a5,s10
|
|
slli a3,s1,2
|
|
add a3,s6,a3
|
|
slli a4,a2,2
|
|
lw a7,0(a3)
|
|
add a4,a4,a2
|
|
mv a5,a2
|
|
slli a4,a4,4
|
|
slli a2,a1,2
|
|
lw a0,4(s11)
|
|
add t1,s4,a2
|
|
addiw a6,a1,1
|
|
add a2,s3,a2
|
|
add a4,s2,a4
|
|
sw a5,0(t1)
|
|
sw a7,0(a2)
|
|
sw a1,0(a3)
|
|
sw a6,0(s11)
|
|
sw s1,0(a4)
|
|
addiw s9,s9,1
|
|
bne a0,s9,.L158
|
|
.L146:
|
|
lw a4,80(s2)
|
|
li a5,1
|
|
sw a5,4(s7)
|
|
beq a4,zero,.L159
|
|
lla a2,f+84
|
|
li a3,0
|
|
.L160:
|
|
slli a5,a4,2
|
|
add a5,a5,a4
|
|
slli a5,a5,2
|
|
add a5,a5,a3
|
|
slli a5,a5,2
|
|
add a5,s2,a5
|
|
lw a4,0(a5)
|
|
addi a2,a2,4
|
|
addiw a3,a3,1
|
|
sw a4,-4(a2)
|
|
bne a4,zero,.L160
|
|
.L159:
|
|
lw a5,4(s6)
|
|
li a4,-1
|
|
beq a5,a4,.L161
|
|
lla s4,to
|
|
lla s3,next
|
|
li s1,-1
|
|
.L178:
|
|
slli a5,a5,2
|
|
sd a5,8(sp)
|
|
add a5,s4,a5
|
|
lw a5,0(a5)
|
|
li a2,2
|
|
slli a1,a5,2
|
|
add a3,a1,a5
|
|
slli a3,a3,4
|
|
add a3,s2,a3
|
|
lw a4,0(a3)
|
|
add a5,s7,a1
|
|
sw a2,0(a5)
|
|
beq a4,zero,.L162
|
|
li a2,0
|
|
.L163:
|
|
slli a5,a4,2
|
|
add a5,a5,a4
|
|
slli a5,a5,2
|
|
add a5,a5,a2
|
|
slli a5,a5,2
|
|
add a5,s2,a5
|
|
lw a4,0(a5)
|
|
addi a3,a3,4
|
|
addiw a2,a2,1
|
|
sw a4,0(a3)
|
|
bne a4,zero,.L163
|
|
.L162:
|
|
add a1,s6,a1
|
|
lw s9,0(a1)
|
|
beq s9,s1,.L164
|
|
li s8,5
|
|
.L177:
|
|
slli a5,s9,2
|
|
sd a5,0(sp)
|
|
add a5,s4,a5
|
|
lw a5,0(a5)
|
|
li a2,3
|
|
slli a1,a5,2
|
|
add a3,a1,a5
|
|
slli a3,a3,4
|
|
add a3,s2,a3
|
|
lw a4,0(a3)
|
|
add a5,s7,a1
|
|
sw a2,0(a5)
|
|
beq a4,zero,.L165
|
|
li a2,0
|
|
.L166:
|
|
slli a5,a4,2
|
|
add a5,a5,a4
|
|
slli a5,a5,2
|
|
add a5,a5,a2
|
|
slli a5,a5,2
|
|
add a5,s2,a5
|
|
lw a4,0(a5)
|
|
addi a3,a3,4
|
|
addiw a2,a2,1
|
|
sw a4,0(a3)
|
|
bne a4,zero,.L166
|
|
.L165:
|
|
add a1,s6,a1
|
|
lw s5,0(a1)
|
|
beq s5,s1,.L167
|
|
li s10,4
|
|
.L176:
|
|
slli s5,s5,2
|
|
add a5,s4,s5
|
|
lw a5,0(a5)
|
|
slli a1,a5,2
|
|
add a3,a1,a5
|
|
slli a3,a3,4
|
|
add a3,s2,a3
|
|
lw a4,0(a3)
|
|
add a5,s7,a1
|
|
sw s10,0(a5)
|
|
beq a4,zero,.L168
|
|
li a2,0
|
|
.L169:
|
|
slli a5,a4,2
|
|
add a5,a5,a4
|
|
slli a5,a5,2
|
|
add a5,a5,a2
|
|
slli a5,a5,2
|
|
add a5,s2,a5
|
|
lw a4,0(a5)
|
|
addi a3,a3,4
|
|
addiw a2,a2,1
|
|
sw a4,0(a3)
|
|
bne a4,zero,.L169
|
|
.L168:
|
|
add a1,s6,a1
|
|
lw s0,0(a1)
|
|
beq s0,s1,.L170
|
|
.L175:
|
|
slli s0,s0,2
|
|
add a5,s4,s0
|
|
lw a5,0(a5)
|
|
slli a3,a5,2
|
|
add a5,a3,a5
|
|
slli a5,a5,4
|
|
add a5,s2,a5
|
|
lw a2,0(a5)
|
|
add a4,s7,a3
|
|
sw s8,0(a4)
|
|
beq a2,zero,.L171
|
|
li a1,0
|
|
.L172:
|
|
slli a4,a2,2
|
|
add a4,a4,a2
|
|
slli a4,a4,2
|
|
add a4,a4,a1
|
|
slli a4,a4,2
|
|
add a4,s2,a4
|
|
lw a2,0(a4)
|
|
addi a5,a5,4
|
|
addiw a1,a1,1
|
|
sw a2,0(a5)
|
|
bne a2,zero,.L172
|
|
.L171:
|
|
add a3,s6,a3
|
|
lw a5,0(a3)
|
|
beq a5,s1,.L173
|
|
.L174:
|
|
slli s9,a5,2
|
|
add a4,s4,s9
|
|
lw a0,0(a4)
|
|
li a1,6
|
|
call tree
|
|
add a5,s3,s9
|
|
lw a5,0(a5)
|
|
bne a5,s1,.L174
|
|
.L173:
|
|
add s0,s3,s0
|
|
lw s0,0(s0)
|
|
bne s0,s1,.L175
|
|
.L170:
|
|
add s5,s3,s5
|
|
lw s5,0(s5)
|
|
bne s5,s1,.L176
|
|
.L167:
|
|
ld a5,0(sp)
|
|
add s9,s3,a5
|
|
lw s9,0(s9)
|
|
bne s9,s1,.L177
|
|
.L164:
|
|
ld a5,8(sp)
|
|
add a5,s3,a5
|
|
lw a5,0(a5)
|
|
bne a5,s1,.L178
|
|
.L161:
|
|
lw a5,8(s11)
|
|
beq a5,zero,.L179
|
|
li s0,9
|
|
li s1,45
|
|
li s2,48
|
|
.L191:
|
|
call getch@plt
|
|
addiw a5,a0,-48
|
|
li s5,0
|
|
bleu a5,s0,.L180
|
|
.L182:
|
|
bne a0,s1,.L181
|
|
li s5,1
|
|
.L181:
|
|
call getch@plt
|
|
addiw a5,a0,-48
|
|
bgtu a5,s0,.L182
|
|
.L180:
|
|
li s4,0
|
|
.L183:
|
|
slliw s3,s4,2
|
|
addw s3,s3,s4
|
|
slliw s3,s3,1
|
|
addw s3,s3,a0
|
|
call getch@plt
|
|
addiw a5,a0,-48
|
|
addiw s4,s3,-48
|
|
bleu a5,s0,.L183
|
|
beq s5,zero,.L184
|
|
subw s4,s2,s3
|
|
.L184:
|
|
call getch@plt
|
|
addiw a5,a0,-48
|
|
li s5,0
|
|
bleu a5,s0,.L185
|
|
.L187:
|
|
bne a0,s1,.L186
|
|
li s5,1
|
|
.L186:
|
|
call getch@plt
|
|
addiw a5,a0,-48
|
|
bgtu a5,s0,.L187
|
|
.L185:
|
|
li a1,0
|
|
.L188:
|
|
slliw a5,a1,2
|
|
addw s3,a5,a1
|
|
slliw s3,s3,1
|
|
addw s3,s3,a0
|
|
call getch@plt
|
|
addiw a5,a0,-48
|
|
addiw a1,s3,-48
|
|
bleu a5,s0,.L188
|
|
beq s5,zero,.L189
|
|
subw a1,s2,s3
|
|
.L189:
|
|
mv a0,s4
|
|
call LCA
|
|
call putint@plt
|
|
li a0,10
|
|
call putch@plt
|
|
lw a5,8(s11)
|
|
addiw a4,a5,-1
|
|
sw a4,8(s11)
|
|
bne a4,zero,.L191
|
|
.L179:
|
|
ld ra,120(sp)
|
|
ld s0,112(sp)
|
|
ld s1,104(sp)
|
|
ld s2,96(sp)
|
|
ld s3,88(sp)
|
|
ld s4,80(sp)
|
|
ld s5,72(sp)
|
|
ld s6,64(sp)
|
|
ld s7,56(sp)
|
|
ld s8,48(sp)
|
|
ld s9,40(sp)
|
|
ld s10,32(sp)
|
|
ld s11,24(sp)
|
|
li a0,0
|
|
addi sp,sp,128
|
|
jr ra
|
|
.L156:
|
|
lw a1,0(s11)
|
|
slli a2,s1,2
|
|
add a2,s6,a2
|
|
slli a5,a4,2
|
|
lw a7,0(a2)
|
|
add a5,a5,a4
|
|
slli a5,a5,4
|
|
slli a4,a1,2
|
|
lw a0,4(s11)
|
|
add t1,s4,a4
|
|
addiw a6,a1,1
|
|
add a4,s3,a4
|
|
add a5,s2,a5
|
|
sw a3,0(t1)
|
|
sw a7,0(a4)
|
|
sw a1,0(a2)
|
|
sw a6,0(s11)
|
|
sw s1,0(a5)
|
|
addiw s9,s9,1
|
|
bne a0,s9,.L158
|
|
j .L146
|
|
.size main, .-main
|
|
.globl cnt
|
|
.globl head
|
|
.globl next
|
|
.globl to
|
|
.globl dep
|
|
.globl f
|
|
.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 n, @object
|
|
.size n, 4
|
|
n:
|
|
.zero 4
|
|
.type m, @object
|
|
.size m, 4
|
|
m:
|
|
.zero 4
|
|
.zero 4
|
|
.type head, @object
|
|
.size head, 40020
|
|
head:
|
|
.zero 40020
|
|
.zero 4
|
|
.type next, @object
|
|
.size next, 40020
|
|
next:
|
|
.zero 40020
|
|
.zero 4
|
|
.type to, @object
|
|
.size to, 40020
|
|
to:
|
|
.zero 40020
|
|
.zero 4
|
|
.type dep, @object
|
|
.size dep, 40020
|
|
dep:
|
|
.zero 40020
|
|
.zero 4
|
|
.type f, @object
|
|
.size f, 800400
|
|
f:
|
|
.zero 800400
|
|
.type _sysy_idx, @object
|
|
.size _sysy_idx, 4
|
|
_sysy_idx:
|
|
.zero 4
|
|
.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
|