327 lines
4.7 KiB
ArmAsm
327 lines
4.7 KiB
ArmAsm
|
.text
|
||
|
.attribute 4, 16
|
||
|
.attribute 5, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
|
||
|
.file "76_n_queens.sy"
|
||
|
.globl printans
|
||
|
.p2align 1
|
||
|
.type printans,@function
|
||
|
printans:
|
||
|
addi sp, sp, -32
|
||
|
sd ra, 24(sp)
|
||
|
sd s0, 16(sp)
|
||
|
sd s1, 8(sp)
|
||
|
sd s2, 0(sp)
|
||
|
lui a0, %hi(sum)
|
||
|
lw a1, %lo(sum)(a0)
|
||
|
lui s2, %hi(n)
|
||
|
lw a2, %lo(n)(s2)
|
||
|
addiw a1, a1, 1
|
||
|
sw a1, %lo(sum)(a0)
|
||
|
blez a2, .LBB0_4
|
||
|
li s1, 0
|
||
|
lui a0, %hi(ans+4)
|
||
|
addi s0, a0, %lo(ans+4)
|
||
|
.LBB0_2:
|
||
|
lw a0, 0(s0)
|
||
|
addi s1, s1, 1
|
||
|
call putint
|
||
|
lwu a0, %lo(n)(s2)
|
||
|
beq s1, a0, .LBB0_5
|
||
|
li a0, 32
|
||
|
call putch
|
||
|
lw a0, %lo(n)(s2)
|
||
|
addi s0, s0, 4
|
||
|
blt s1, a0, .LBB0_2
|
||
|
.LBB0_4:
|
||
|
ld ra, 24(sp)
|
||
|
ld s0, 16(sp)
|
||
|
ld s1, 8(sp)
|
||
|
ld s2, 0(sp)
|
||
|
addi sp, sp, 32
|
||
|
ret
|
||
|
.LBB0_5:
|
||
|
li a0, 10
|
||
|
ld ra, 24(sp)
|
||
|
ld s0, 16(sp)
|
||
|
ld s1, 8(sp)
|
||
|
ld s2, 0(sp)
|
||
|
addi sp, sp, 32
|
||
|
tail putch
|
||
|
.Lfunc_end0:
|
||
|
.size printans, .Lfunc_end0-printans
|
||
|
|
||
|
.globl f
|
||
|
.p2align 1
|
||
|
.type f,@function
|
||
|
f:
|
||
|
addi sp, sp, -144
|
||
|
sd ra, 136(sp)
|
||
|
sd s0, 128(sp)
|
||
|
sd s1, 120(sp)
|
||
|
sd s2, 112(sp)
|
||
|
sd s3, 104(sp)
|
||
|
sd s4, 96(sp)
|
||
|
sd s5, 88(sp)
|
||
|
sd s6, 80(sp)
|
||
|
sd s7, 72(sp)
|
||
|
sd s8, 64(sp)
|
||
|
sd s9, 56(sp)
|
||
|
sd s10, 48(sp)
|
||
|
sd s11, 40(sp)
|
||
|
lui s4, %hi(n)
|
||
|
lw a1, %lo(n)(s4)
|
||
|
blez a1, .LBB1_13
|
||
|
mv s10, a0
|
||
|
lui a0, %hi(ans)
|
||
|
addi a2, a0, %lo(ans)
|
||
|
slli a0, s10, 2
|
||
|
add a0, a0, a2
|
||
|
sd a0, 32(sp)
|
||
|
addiw a0, s10, 1
|
||
|
sd a0, 24(sp)
|
||
|
li s5, 1
|
||
|
li a0, -1
|
||
|
srli a0, a0, 32
|
||
|
lui a3, %hi(row)
|
||
|
addi s11, a3, %lo(row)
|
||
|
lui a3, %hi(line1)
|
||
|
addi s6, a3, %lo(line1)
|
||
|
lui a3, %hi(line2)
|
||
|
addi s2, a3, %lo(line2)
|
||
|
addi a2, a2, 4
|
||
|
sd a2, 8(sp)
|
||
|
li a2, 1
|
||
|
li s0, 1
|
||
|
sd s2, 16(sp)
|
||
|
j .LBB1_5
|
||
|
.LBB1_2:
|
||
|
li a0, 10
|
||
|
call putch
|
||
|
lw a1, %lo(n)(s4)
|
||
|
.LBB1_3:
|
||
|
sw s5, 0(s8)
|
||
|
sw s5, 0(s9)
|
||
|
addw a0, s3, a1
|
||
|
slli a0, a0, 2
|
||
|
ld s2, 16(sp)
|
||
|
add a0, a0, s2
|
||
|
sw s5, 0(a0)
|
||
|
ld a0, 24(sp)
|
||
|
call f
|
||
|
lw a1, %lo(n)(s4)
|
||
|
sw zero, 0(s8)
|
||
|
sw zero, 0(s9)
|
||
|
addw a0, s3, a1
|
||
|
slli a0, a0, 2
|
||
|
add a0, a0, s2
|
||
|
sw zero, 0(a0)
|
||
|
.LBB1_4:
|
||
|
not a0, s0
|
||
|
addiw s0, s0, 1
|
||
|
addi a2, s1, 1
|
||
|
bge s1, a1, .LBB1_13
|
||
|
.LBB1_5:
|
||
|
mv s1, a2
|
||
|
slli a2, a2, 2
|
||
|
add s8, a2, s11
|
||
|
lw a2, 0(s8)
|
||
|
beq a2, s5, .LBB1_4
|
||
|
add a2, s1, s10
|
||
|
slli a2, a2, 2
|
||
|
add s9, a2, s6
|
||
|
lw a2, 0(s9)
|
||
|
bnez a2, .LBB1_4
|
||
|
addw s3, a0, s10
|
||
|
addw a0, s3, a1
|
||
|
slli a0, a0, 2
|
||
|
add a0, a0, s2
|
||
|
lw a0, 0(a0)
|
||
|
bnez a0, .LBB1_4
|
||
|
ld a0, 32(sp)
|
||
|
sw s1, 0(a0)
|
||
|
bne a1, s10, .LBB1_3
|
||
|
lui a1, %hi(sum)
|
||
|
lw a0, %lo(sum)(a1)
|
||
|
addiw a0, a0, 1
|
||
|
sw a0, %lo(sum)(a1)
|
||
|
mv a1, s10
|
||
|
blez s10, .LBB1_3
|
||
|
li s2, 0
|
||
|
ld s7, 8(sp)
|
||
|
.LBB1_11:
|
||
|
lw a0, 0(s7)
|
||
|
addi s2, s2, 1
|
||
|
call putint
|
||
|
lwu a0, %lo(n)(s4)
|
||
|
beq s2, a0, .LBB1_2
|
||
|
li a0, 32
|
||
|
call putch
|
||
|
lw a1, %lo(n)(s4)
|
||
|
addi s7, s7, 4
|
||
|
blt s2, a1, .LBB1_11
|
||
|
j .LBB1_3
|
||
|
.LBB1_13:
|
||
|
ld ra, 136(sp)
|
||
|
ld s0, 128(sp)
|
||
|
ld s1, 120(sp)
|
||
|
ld s2, 112(sp)
|
||
|
ld s3, 104(sp)
|
||
|
ld s4, 96(sp)
|
||
|
ld s5, 88(sp)
|
||
|
ld s6, 80(sp)
|
||
|
ld s7, 72(sp)
|
||
|
ld s8, 64(sp)
|
||
|
ld s9, 56(sp)
|
||
|
ld s10, 48(sp)
|
||
|
ld s11, 40(sp)
|
||
|
addi sp, sp, 144
|
||
|
ret
|
||
|
.Lfunc_end1:
|
||
|
.size f, .Lfunc_end1-f
|
||
|
|
||
|
.globl main
|
||
|
.p2align 1
|
||
|
.type main,@function
|
||
|
main:
|
||
|
addi sp, sp, -32
|
||
|
sd ra, 24(sp)
|
||
|
sd s0, 16(sp)
|
||
|
sd s1, 8(sp)
|
||
|
sd s2, 0(sp)
|
||
|
call getint
|
||
|
blez a0, .LBB2_3
|
||
|
mv s0, a0
|
||
|
lui s2, %hi(n)
|
||
|
li s1, 1
|
||
|
.LBB2_2:
|
||
|
call getint
|
||
|
sw a0, %lo(n)(s2)
|
||
|
li a0, 1
|
||
|
call f
|
||
|
sext.w a0, s0
|
||
|
addiw s0, s0, -1
|
||
|
bltu s1, a0, .LBB2_2
|
||
|
.LBB2_3:
|
||
|
lui a0, %hi(sum)
|
||
|
lw a0, %lo(sum)(a0)
|
||
|
ld ra, 24(sp)
|
||
|
ld s0, 16(sp)
|
||
|
ld s1, 8(sp)
|
||
|
ld s2, 0(sp)
|
||
|
addi sp, sp, 32
|
||
|
ret
|
||
|
.Lfunc_end2:
|
||
|
.size main, .Lfunc_end2-main
|
||
|
|
||
|
.type sum,@object
|
||
|
.section .sbss,"aw",@nobits
|
||
|
.globl sum
|
||
|
.p2align 2
|
||
|
sum:
|
||
|
.word 0
|
||
|
.size sum, 4
|
||
|
|
||
|
.type n,@object
|
||
|
.globl n
|
||
|
.p2align 2
|
||
|
n:
|
||
|
.word 0
|
||
|
.size n, 4
|
||
|
|
||
|
.type ans,@object
|
||
|
.bss
|
||
|
.globl ans
|
||
|
.p2align 2
|
||
|
ans:
|
||
|
.zero 200
|
||
|
.size ans, 200
|
||
|
|
||
|
.type row,@object
|
||
|
.globl row
|
||
|
.p2align 2
|
||
|
row:
|
||
|
.zero 200
|
||
|
.size row, 200
|
||
|
|
||
|
.type line1,@object
|
||
|
.globl line1
|
||
|
.p2align 2
|
||
|
line1:
|
||
|
.zero 200
|
||
|
.size line1, 200
|
||
|
|
||
|
.type line2,@object
|
||
|
.globl line2
|
||
|
.p2align 2
|
||
|
line2:
|
||
|
.zero 400
|
||
|
.size line2, 400
|
||
|
|
||
|
.type _sysy_start,@object
|
||
|
.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
|