sysy-data/functional_c/asm/70_dijkstra.s

455 lines
6.3 KiB
ArmAsm

.text
.attribute 4, 16
.attribute 5, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
.file "70_dijkstra.sy"
.globl Dijkstra
.p2align 1
.type Dijkstra,@function
Dijkstra:
addi sp, sp, -80
sd ra, 72(sp)
sd s0, 64(sp)
sd s1, 56(sp)
sd s2, 48(sp)
sd s3, 40(sp)
sd s4, 32(sp)
sd s5, 24(sp)
sd s6, 16(sp)
sd s7, 8(sp)
sd s8, 0(sp)
lui a0, %hi(n)
lwu a0, %lo(n)(a0)
sext.w s6, a0
blez s6, .LBB0_15
slli s2, a0, 2
lui a0, %hi(book)
addi s4, a0, %lo(book)
addi s3, s4, 4
mv a0, s3
li a1, 0
mv a2, s2
call memset@plt
lui a0, %hi(dis)
addi s5, a0, %lo(dis)
addi s8, s5, 4
lui a0, %hi(e)
addi s7, a0, %lo(e)
addi a1, s7, 68
mv a0, s8
mv a2, s2
call memcpy@plt
li a6, 1
sw a6, 4(s4)
beq s6, a6, .LBB0_16
addiw a0, s6, 1
slli a0, a0, 32
srli t2, a0, 32
addi a7, t2, -1
lui a0, 16
addiw t0, a0, -1
addiw t3, a0, -2
li t1, 1
j .LBB0_4
.LBB0_3:
addiw t1, t1, 1
bge t1, s6, .LBB0_16
.LBB0_4:
li a1, 0
li a0, 1
mv s1, s8
mv a2, s3
mv a5, t0
j .LBB0_7
.LBB0_5:
mv a5, s0
mv a1, a3
.LBB0_6:
addi a0, a0, 1
addi a2, a2, 4
addi s1, s1, 4
beq t2, a0, .LBB0_10
.LBB0_7:
lw s0, 0(s1)
bge s0, a5, .LBB0_6
lw a4, 0(a2)
mv a3, a0
beqz a4, .LBB0_5
mv s0, a5
mv a3, a1
j .LBB0_5
.LBB0_10:
sext.w a1, a1
slli a0, a1, 2
add a2, a0, s4
sw a6, 0(a2)
add a0, a0, s5
slli a1, a1, 6
add a1, a1, s7
addi a2, a1, 4
mv a3, a7
mv s1, s8
j .LBB0_12
.LBB0_11:
addi s1, s1, 4
addi a3, a3, -1
addi a2, a2, 4
beqz a3, .LBB0_3
.LBB0_12:
lw a1, 0(a2)
blt t3, a1, .LBB0_11
lw a4, 0(a0)
lw a5, 0(s1)
addw a1, a1, a4
bge a1, a5, .LBB0_11
sw a1, 0(s1)
j .LBB0_11
.LBB0_15:
lui a0, %hi(book+4)
li a1, 1
sw a1, %lo(book+4)(a0)
.LBB0_16:
ld ra, 72(sp)
ld s0, 64(sp)
ld s1, 56(sp)
ld s2, 48(sp)
ld s3, 40(sp)
ld s4, 32(sp)
ld s5, 24(sp)
ld s6, 16(sp)
ld s7, 8(sp)
ld s8, 0(sp)
addi sp, sp, 80
ret
.Lfunc_end0:
.size Dijkstra, .Lfunc_end0-Dijkstra
.globl main
.p2align 1
.type main,@function
main:
addi sp, sp, -80
sd ra, 72(sp)
sd s0, 64(sp)
sd s1, 56(sp)
sd s2, 48(sp)
sd s3, 40(sp)
sd s4, 32(sp)
sd s5, 24(sp)
sd s6, 16(sp)
sd s7, 8(sp)
sd s8, 0(sp)
call getint
lui s0, %hi(n)
sw a0, %lo(n)(s0)
call getint
lw s3, %lo(n)(s0)
lui a1, %hi(m)
sw a0, %lo(m)(a1)
blez s3, .LBB1_7
li t0, 0
addiw a1, s3, 1
slli a1, a1, 32
srli a7, a1, 32
addi a6, a7, -1
li a4, 1
lui a1, %hi(e+68)
addi a2, a1, %lo(e+68)
lui a1, 16
addiw s0, a1, -1
j .LBB1_3
.LBB1_2:
addi a4, a4, 1
addi a2, a2, 64
addi t0, t0, 1
beq a4, a7, .LBB1_7
.LBB1_3:
mv a3, a6
mv a1, t0
mv a5, a2
j .LBB1_5
.LBB1_4:
sw s1, 0(a5)
addi a5, a5, 4
addi a3, a3, -1
addi a1, a1, -1
beqz a3, .LBB1_2
.LBB1_5:
li s1, 0
beqz a1, .LBB1_4
mv s1, s0
j .LBB1_4
.LBB1_7:
blez a0, .LBB1_11
li a0, 1
lui a1, %hi(e)
addi s2, a1, %lo(e)
lui s3, %hi(m)
.LBB1_9:
mv s0, a0
call getint
mv s4, a0
call getint
mv s1, a0
call getint
slli a1, s4, 6
slli a2, s1, 2
lw a3, %lo(m)(s3)
add a1, a1, a2
add a1, a1, s2
sw a0, 0(a1)
addiw a0, s0, 1
blt s0, a3, .LBB1_9
lui a0, %hi(n)
lw s3, %lo(n)(a0)
.LBB1_11:
blez s3, .LBB1_26
slli a0, s3, 32
srli s2, a0, 30
lui a0, %hi(book)
addi s6, a0, %lo(book)
addi s4, s6, 4
mv a0, s4
li a1, 0
mv a2, s2
call memset@plt
lui a0, %hi(dis)
addi s5, a0, %lo(dis)
addi s8, s5, 4
lui a0, %hi(e)
addi s7, a0, %lo(e)
addi a1, s7, 68
mv a0, s8
mv a2, s2
call memcpy@plt
li a6, 1
sw a6, 4(s6)
beq s3, a6, .LBB1_28
addiw a0, s3, 1
slli a0, a0, 32
srli t2, a0, 32
addi a7, t2, -1
lui a0, 16
addiw t0, a0, -1
addiw t3, a0, -2
li t1, 1
j .LBB1_15
.LBB1_14:
addiw t1, t1, 1
bge t1, s3, .LBB1_27
.LBB1_15:
li a1, 0
li a0, 1
mv s1, s8
mv a2, s4
mv a5, t0
j .LBB1_18
.LBB1_16:
mv a5, s0
mv a1, a3
.LBB1_17:
addi a0, a0, 1
addi a2, a2, 4
addi s1, s1, 4
beq t2, a0, .LBB1_21
.LBB1_18:
lw s0, 0(s1)
bge s0, a5, .LBB1_17
lw a4, 0(a2)
mv a3, a0
beqz a4, .LBB1_16
mv s0, a5
mv a3, a1
j .LBB1_16
.LBB1_21:
sext.w a1, a1
slli a0, a1, 2
add a2, a0, s6
sw a6, 0(a2)
add a0, a0, s5
slli a1, a1, 6
add a1, a1, s7
addi a2, a1, 4
mv a3, a7
mv s1, s8
j .LBB1_23
.LBB1_22:
addi s1, s1, 4
addi a3, a3, -1
addi a2, a2, 4
beqz a3, .LBB1_14
.LBB1_23:
lw a1, 0(a2)
blt t3, a1, .LBB1_22
lw a4, 0(a0)
lw a5, 0(s1)
addw a1, a1, a4
bge a1, a5, .LBB1_22
sw a1, 0(s1)
j .LBB1_22
.LBB1_26:
lui a0, %hi(book+4)
li a1, 1
sw a1, %lo(book+4)(a0)
j .LBB1_30
.LBB1_27:
blez s3, .LBB1_30
.LBB1_28:
li s0, 0
addi s1, s5, 4
lui s2, %hi(n)
.LBB1_29:
lw a0, 0(s1)
call putint
li a0, 32
call putch
lw a0, %lo(n)(s2)
addi s0, s0, 1
addi s1, s1, 4
blt s0, a0, .LBB1_29
.LBB1_30:
li a0, 10
call putch
li a0, 0
ld ra, 72(sp)
ld s0, 64(sp)
ld s1, 56(sp)
ld s2, 48(sp)
ld s3, 40(sp)
ld s4, 32(sp)
ld s5, 24(sp)
ld s6, 16(sp)
ld s7, 8(sp)
ld s8, 0(sp)
addi sp, sp, 80
ret
.Lfunc_end1:
.size main, .Lfunc_end1-main
.type n,@object
.section .sbss,"aw",@nobits
.globl n
.p2align 2
n:
.word 0
.size n, 4
.type e,@object
.bss
.globl e
.p2align 2
e:
.zero 1024
.size e, 1024
.type dis,@object
.globl dis
.p2align 2
dis:
.zero 64
.size dis, 64
.type book,@object
.globl book
.p2align 2
book:
.zero 64
.size book, 64
.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
.type v1,@object
.globl v1
.p2align 2
v1:
.word 0
.size v1, 4
.type v2,@object
.globl v2
.p2align 2
v2:
.word 0
.size v2, 4
.type w,@object
.globl w
.p2align 2
w:
.word 0
.size w, 4
.ident "Debian clang version 14.0.6"
.section ".note.GNU-stack","",@progbits
.addrsig