sysy-data/functional_c/asm/62_percolation.s

364 lines
5.2 KiB
ArmAsm

.text
.attribute 4, 16
.attribute 5, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
.file "62_percolation.sy"
.globl init
.p2align 1
.type init,@function
init:
addi sp, sp, -16
sd ra, 8(sp)
mulw a0, a0, a0
slli a0, a0, 32
srli a0, a0, 30
addi a2, a0, 4
lui a0, %hi(array+4)
addi a0, a0, %lo(array+4)
li a1, 255
call memset@plt
ld ra, 8(sp)
addi sp, sp, 16
ret
.Lfunc_end0:
.size init, .Lfunc_end0-init
.globl findfa
.p2align 1
.type findfa,@function
findfa:
addi sp, sp, -16
sd ra, 8(sp)
sd s0, 0(sp)
lui a1, %hi(array)
addi a1, a1, %lo(array)
slli a2, a0, 2
add s0, a2, a1
lw a1, 0(s0)
beq a1, a0, .LBB1_2
mv a0, a1
call findfa
sw a0, 0(s0)
.LBB1_2:
ld ra, 8(sp)
ld s0, 0(sp)
addi sp, sp, 16
ret
.Lfunc_end1:
.size findfa, .Lfunc_end1-findfa
.globl mmerge
.p2align 1
.type mmerge,@function
mmerge:
addi sp, sp, -32
sd ra, 24(sp)
sd s0, 16(sp)
sd s1, 8(sp)
mv s1, a1
call findfa
mv s0, a0
mv a0, s1
call findfa
beq s0, a0, .LBB2_2
lui a1, %hi(array)
addi a1, a1, %lo(array)
slli a2, s0, 2
add a1, a1, a2
sw a0, 0(a1)
.LBB2_2:
ld ra, 24(sp)
ld s0, 16(sp)
ld s1, 8(sp)
addi sp, sp, 32
ret
.Lfunc_end2:
.size mmerge, .Lfunc_end2-mmerge
.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)
lui s5, %hi(n)
li a0, 4
sw a0, %lo(n)(s5)
lui a0, %hi(array)
addi s7, a0, %lo(array)
addi a0, s7, 4
li a1, 255
li a2, 68
call memset@plt
li a0, 0
li a1, 0
li s11, 2
li s9, 9
j .LBB3_3
.LBB3_1:
li a1, 0
.LBB3_2:
addiw a0, s8, 1
bgeu s8, s9, .LBB3_29
.LBB3_3:
mv s1, a1
mv s8, a0
call getint
mv s6, a0
call getint
li s0, 0
li a1, 1
bnez s1, .LBB3_2
mv s10, a0
lw a0, %lo(n)(s5)
addiw a1, s6, -1
mulw a0, a0, a1
addw s2, a0, s10
slli a0, s2, 2
add a0, a0, s7
sw s2, 0(a0)
li a0, 1
bne s6, a0, .LBB3_7
lui a0, %hi(array)
sw zero, %lo(array)(a0)
mv a0, s2
call findfa
mv s3, a0
li a0, 0
call findfa
beq s3, a0, .LBB3_7
slli a1, s3, 2
add a1, a1, s7
sw a0, 0(a1)
.LBB3_7:
lw a0, %lo(n)(s5)
bne s6, a0, .LBB3_10
li a0, 17
sw a0, 68(s7)
mv a0, s2
call findfa
mv s3, a0
li a0, 17
call findfa
beq s3, a0, .LBB3_10
slli a1, s3, 2
add a1, a1, s7
sw a0, 0(a1)
.LBB3_10:
lw a0, %lo(n)(s5)
bge s10, a0, .LBB3_14
addiw s3, s2, 1
slli a0, s3, 2
add a0, a0, s7
lw a0, 0(a0)
li a1, -1
beq a0, a1, .LBB3_14
mv a0, s2
call findfa
mv s4, a0
mv a0, s3
call findfa
beq s4, a0, .LBB3_14
slli a1, s4, 2
add a1, a1, s7
sw a0, 0(a1)
.LBB3_14:
blt s10, s11, .LBB3_18
addiw s1, s2, -1
slli a0, s1, 2
add a0, a0, s7
lw a0, 0(a0)
li a1, -1
beq a0, a1, .LBB3_18
mv a0, s2
call findfa
mv s3, a0
mv a0, s1
call findfa
beq s3, a0, .LBB3_18
slli a1, s3, 2
add a1, a1, s7
sw a0, 0(a1)
.LBB3_18:
lw a0, %lo(n)(s5)
bge s6, a0, .LBB3_22
addw s1, a0, s2
slli a0, s1, 2
add a0, a0, s7
lw a0, 0(a0)
li a1, -1
beq a0, a1, .LBB3_22
mv a0, s2
call findfa
mv s3, a0
mv a0, s1
call findfa
beq s3, a0, .LBB3_22
slli a1, s3, 2
add a1, a1, s7
sw a0, 0(a1)
.LBB3_22:
blt s6, s11, .LBB3_26
lw a0, %lo(n)(s5)
subw s0, s2, a0
slli a0, s0, 2
add a0, a0, s7
lw a0, 0(a0)
li a1, -1
beq a0, a1, .LBB3_26
mv a0, s2
call findfa
mv s1, a0
mv a0, s0
call findfa
beq s1, a0, .LBB3_26
slli a1, s1, 2
add a1, a1, s7
sw a0, 0(a1)
.LBB3_26:
lui a0, %hi(array)
lw a0, %lo(array)(a0)
lw a2, 68(s7)
addi a0, a0, 1
seqz a0, a0
addi a2, a2, 1
seqz a2, a2
or a0, a0, a2
li s0, 1
bnez a0, .LBB3_1
li a0, 0
call findfa
mv s1, a0
li a0, 17
call findfa
li a1, 0
bne s1, a0, .LBB3_2
addiw a0, s8, 1
call putint
li a0, 10
call putch
li s0, 0
li a1, 1
j .LBB3_2
.LBB3_29:
beqz s0, .LBB3_31
li a0, -1
call putint
li a0, 10
call putch
.LBB3_31:
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_end3:
.size main, .Lfunc_end3-main
.type array,@object
.bss
.globl array
.p2align 2
array:
.zero 440
.size array, 440
.type n,@object
.section .sbss,"aw",@nobits
.globl n
.p2align 2
n:
.word 0
.size n, 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