641 lines
8.4 KiB
ArmAsm
641 lines
8.4 KiB
ArmAsm
.file "19_search.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 search
|
|
.type search, @function
|
|
search:
|
|
li a5,10
|
|
bgt a2,a5,.L51
|
|
addi sp,sp,-128
|
|
sd s4,80(sp)
|
|
slli s4,a0,4
|
|
sub s4,s4,a0
|
|
slli s4,s4,1
|
|
add s4,s4,a1
|
|
sd s3,88(sp)
|
|
slli s4,s4,2
|
|
lla s3,a
|
|
add s4,s3,s4
|
|
lw a5,0(s4)
|
|
sd s1,104(sp)
|
|
sd s2,96(sp)
|
|
sd s5,72(sp)
|
|
sd s6,64(sp)
|
|
sd s7,56(sp)
|
|
sd s8,48(sp)
|
|
sd s9,40(sp)
|
|
sd s10,32(sp)
|
|
lla s5,.LANCHOR0
|
|
sd ra,120(sp)
|
|
sd s0,112(sp)
|
|
sd s11,24(sp)
|
|
li s2,1
|
|
mv s8,a1
|
|
mv s9,a2
|
|
lw a1,12(s5)
|
|
mv s7,a0
|
|
lla s1,.LANCHOR1
|
|
li s6,1
|
|
li a7,1073741824
|
|
li s10,4
|
|
beq a5,s2,.L52
|
|
.L20:
|
|
lw a0,0(s5)
|
|
mv s11,s8
|
|
mv s0,s7
|
|
li a6,0
|
|
.L6:
|
|
beq a1,s0,.L53
|
|
.L4:
|
|
lw a4,0(s1)
|
|
lw a3,4(s1)
|
|
addiw a6,a6,1
|
|
addw s0,a4,s0
|
|
slli t1,s0,4
|
|
sub a5,t1,s0
|
|
addw s11,a3,s11
|
|
slli a5,a5,1
|
|
add a5,a5,s11
|
|
slli a5,a5,2
|
|
add a5,s3,a5
|
|
lw a2,0(a5)
|
|
mv a4,s0
|
|
mv a3,s11
|
|
bne a2,s2,.L6
|
|
beq a1,s0,.L54
|
|
.L10:
|
|
beq a6,s2,.L55
|
|
beq s0,zero,.L15
|
|
lw a5,4(s5)
|
|
addiw a5,a5,1
|
|
beq a5,s0,.L15
|
|
beq s11,zero,.L15
|
|
lw a5,8(s5)
|
|
addiw a5,a5,1
|
|
beq a5,s11,.L15
|
|
sub a5,t1,s0
|
|
lw a1,4(s1)
|
|
lw a0,0(s1)
|
|
slli a5,a5,1
|
|
add a5,a5,s11
|
|
slli a5,a5,2
|
|
add a5,s3,a5
|
|
subw a0,a4,a0
|
|
addiw a2,s9,1
|
|
subw a1,a3,a1
|
|
sd a7,8(sp)
|
|
sd t1,0(sp)
|
|
sw zero,0(a5)
|
|
call search
|
|
ld a7,8(sp)
|
|
addiw a5,a0,1
|
|
ld t1,0(sp)
|
|
mv a4,a5
|
|
ble a5,a7,.L16
|
|
mv a4,a7
|
|
.L16:
|
|
sub a5,t1,s0
|
|
slli a5,a5,1
|
|
add a5,a5,s11
|
|
slli a5,a5,2
|
|
add a5,s3,a5
|
|
sext.w a7,a4
|
|
li a4,1
|
|
sw a4,0(a5)
|
|
.L15:
|
|
beq s6,s10,.L12
|
|
.L25:
|
|
lw a5,0(s4)
|
|
lw a1,12(s5)
|
|
addiw s6,s6,1
|
|
addi s1,s1,8
|
|
bne a5,s2,.L20
|
|
.L52:
|
|
beq s7,a1,.L56
|
|
.L42:
|
|
li a4,4
|
|
beq s6,a4,.L12
|
|
lw a4,12(s5)
|
|
beq a4,s7,.L57
|
|
.L12:
|
|
li a5,10
|
|
ble a7,a5,.L32
|
|
.L58:
|
|
li a7,1073741824
|
|
j .L32
|
|
.L54:
|
|
bne a0,s11,.L10
|
|
.L31:
|
|
li a7,1
|
|
.L32:
|
|
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)
|
|
mv a0,a7
|
|
addi sp,sp,128
|
|
jr ra
|
|
.L53:
|
|
bne a0,s11,.L4
|
|
j .L31
|
|
.L55:
|
|
li a5,4
|
|
bne s6,a5,.L25
|
|
li a5,10
|
|
ble a7,a5,.L32
|
|
j .L58
|
|
.L51:
|
|
li a7,1073741824
|
|
mv a0,a7
|
|
ret
|
|
.L57:
|
|
lw a4,0(s5)
|
|
bne a4,s8,.L12
|
|
mv a7,a5
|
|
j .L32
|
|
.L56:
|
|
lw a4,0(s5)
|
|
bne a4,s8,.L42
|
|
j .L31
|
|
.size search, .-search
|
|
.section .text.startup,"ax",@progbits
|
|
.align 1
|
|
.globl main
|
|
.type main, @function
|
|
main:
|
|
addi sp,sp,-208
|
|
sd ra,200(sp)
|
|
sd s11,104(sp)
|
|
sd s0,192(sp)
|
|
lla s11,.LANCHOR0
|
|
sd s1,184(sp)
|
|
sd s2,176(sp)
|
|
sd s3,168(sp)
|
|
sd s4,160(sp)
|
|
sd s5,152(sp)
|
|
sd s6,144(sp)
|
|
sd s7,136(sp)
|
|
sd s8,128(sp)
|
|
sd s9,120(sp)
|
|
sd s10,112(sp)
|
|
call getint@plt
|
|
sw a0,8(s11)
|
|
call getint@plt
|
|
lw a4,8(s11)
|
|
sw a0,4(s11)
|
|
beq a4,zero,.L116
|
|
li s10,1
|
|
li a5,1073741824
|
|
slli s0,s10,32
|
|
addi a5,a5,1
|
|
mv a3,a0
|
|
lla s9,a
|
|
addi s0,s0,1
|
|
sd a5,16(sp)
|
|
.L60:
|
|
lla a5,a
|
|
.L62:
|
|
sd s0,0(a5)
|
|
sd s0,8(a5)
|
|
sd s0,16(a5)
|
|
sd s0,24(a5)
|
|
sd s0,32(a5)
|
|
sd s0,40(a5)
|
|
sd s0,48(a5)
|
|
sd s0,56(a5)
|
|
sd s0,64(a5)
|
|
sd s0,72(a5)
|
|
sd s0,80(a5)
|
|
sd s0,88(a5)
|
|
sd s0,96(a5)
|
|
sd s0,104(a5)
|
|
sd s0,112(a5)
|
|
lla a2,a+3600
|
|
addi a5,a5,120
|
|
bne a2,a5,.L62
|
|
lla s4,a+120
|
|
li s3,1
|
|
ble a3,zero,.L64
|
|
ble a4,zero,.L64
|
|
.L105:
|
|
mv s2,s4
|
|
li s1,1
|
|
j .L67
|
|
.L65:
|
|
li a5,3
|
|
bne a0,a5,.L66
|
|
sw s1,0(s11)
|
|
sw s3,12(s11)
|
|
.L66:
|
|
lw a4,8(s11)
|
|
addiw s1,s1,1
|
|
addi s2,s2,4
|
|
blt a4,s1,.L153
|
|
.L67:
|
|
call getint@plt
|
|
sw a0,4(s2)
|
|
li a5,2
|
|
bne a0,a5,.L65
|
|
lw a4,8(s11)
|
|
sw s1,20(s11)
|
|
sw s3,16(s11)
|
|
addiw s1,s1,1
|
|
addi s2,s2,4
|
|
bge a4,s1,.L67
|
|
.L153:
|
|
lw a5,4(s11)
|
|
addiw s3,s3,1
|
|
blt a5,s3,.L64
|
|
addi s4,s4,120
|
|
bgt a4,zero,.L105
|
|
.L64:
|
|
lw t0,16(s11)
|
|
lw t2,20(s11)
|
|
li s5,1
|
|
slli a5,t0,4
|
|
sub a5,a5,t0
|
|
slli a5,a5,1
|
|
add a5,a5,t2
|
|
slli a5,a5,2
|
|
lla s7,.LANCHOR1
|
|
li t3,1073741824
|
|
add a5,s9,a5
|
|
li t5,5
|
|
mv s6,s5
|
|
.L69:
|
|
lw a4,0(a5)
|
|
lw a2,12(s11)
|
|
beq a4,s10,.L154
|
|
lw a1,0(s11)
|
|
mv s4,t2
|
|
mv s1,t0
|
|
li a3,0
|
|
.L72:
|
|
beq s1,a2,.L155
|
|
.L70:
|
|
lw s2,0(s7)
|
|
lw s3,4(s7)
|
|
addiw a3,a3,1
|
|
addw s1,s2,s1
|
|
slli s8,s1,4
|
|
sub a4,s8,s1
|
|
addw s4,s3,s4
|
|
slli a4,a4,1
|
|
add a4,a4,s4
|
|
slli a4,a4,2
|
|
add a4,s9,a4
|
|
lw a4,0(a4)
|
|
mv s2,s1
|
|
mv s3,s4
|
|
bne a4,s10,.L72
|
|
beq s1,a2,.L156
|
|
.L76:
|
|
beq a3,s10,.L75
|
|
beq s1,zero,.L75
|
|
lw a4,4(s11)
|
|
addiw a4,a4,1
|
|
beq a4,s1,.L75
|
|
beq s4,zero,.L75
|
|
lw a4,8(s11)
|
|
addiw a4,a4,1
|
|
beq a4,s4,.L75
|
|
lw a3,0(s7)
|
|
lw a1,4(s7)
|
|
sub a4,s8,s1
|
|
subw s2,s2,a3
|
|
slli a3,s2,4
|
|
slli a4,a4,1
|
|
sub a3,a3,s2
|
|
subw s3,s3,a1
|
|
add a4,a4,s4
|
|
slli a3,a3,1
|
|
add a3,a3,s3
|
|
slli a4,a4,2
|
|
add a4,s9,a4
|
|
slli a3,a3,2
|
|
sw zero,0(a4)
|
|
add a4,s9,a3
|
|
sd a4,8(sp)
|
|
ld a4,8(sp)
|
|
mv a6,s7
|
|
mv t1,s8
|
|
lw a4,0(a4)
|
|
mv s8,s4
|
|
lla a7,.LANCHOR1
|
|
mv s4,s3
|
|
li t4,1
|
|
li t6,1073741824
|
|
mv s7,s1
|
|
mv s3,s2
|
|
beq a4,s10,.L157
|
|
.L93:
|
|
lw ra,0(s11)
|
|
mv s1,s4
|
|
mv s5,s3
|
|
li a0,0
|
|
.L80:
|
|
beq a2,s5,.L158
|
|
.L78:
|
|
lw a3,0(a7)
|
|
lw a1,4(a7)
|
|
addiw a0,a0,1
|
|
addw s5,a3,s5
|
|
slli s2,s5,4
|
|
sub a4,s2,s5
|
|
addw s1,a1,s1
|
|
slli a4,a4,1
|
|
add a4,a4,s1
|
|
slli a4,a4,2
|
|
add a4,s9,a4
|
|
lw a4,0(a4)
|
|
mv a3,s5
|
|
mv a1,s1
|
|
bne a4,s10,.L80
|
|
beq a2,s5,.L159
|
|
.L84:
|
|
beq a0,s10,.L89
|
|
beq s5,zero,.L89
|
|
lw a4,4(s11)
|
|
addiw a4,a4,1
|
|
beq a4,s5,.L89
|
|
beq s1,zero,.L89
|
|
lw a4,8(s11)
|
|
addiw a4,a4,1
|
|
beq a4,s1,.L89
|
|
sub a4,s2,s5
|
|
lw ra,4(a7)
|
|
lw a0,0(a7)
|
|
slli a4,a4,1
|
|
add a4,a4,s1
|
|
slli a4,a4,2
|
|
add a4,s9,a4
|
|
subw a0,a3,a0
|
|
li a2,3
|
|
subw a1,a1,ra
|
|
sd t1,88(sp)
|
|
sd a5,80(sp)
|
|
sd t6,72(sp)
|
|
sd t4,64(sp)
|
|
sd a6,56(sp)
|
|
sd t3,48(sp)
|
|
sd t2,40(sp)
|
|
sd t0,32(sp)
|
|
sd a7,24(sp)
|
|
sw zero,0(a4)
|
|
call search
|
|
ld t6,72(sp)
|
|
addiw a4,a0,1
|
|
ld a7,24(sp)
|
|
ld t0,32(sp)
|
|
ld t2,40(sp)
|
|
ld t3,48(sp)
|
|
ld a6,56(sp)
|
|
ld t4,64(sp)
|
|
ld a5,80(sp)
|
|
ld t1,88(sp)
|
|
mv a3,a4
|
|
li t5,5
|
|
ble a4,t6,.L90
|
|
mv a3,t6
|
|
.L90:
|
|
sub a4,s2,s5
|
|
slli a4,a4,1
|
|
add a4,a4,s1
|
|
slli a4,a4,2
|
|
add a4,s9,a4
|
|
sext.w t6,a3
|
|
sw s10,0(a4)
|
|
.L89:
|
|
li a4,4
|
|
beq t4,a4,.L160
|
|
ld a4,8(sp)
|
|
lw a2,12(s11)
|
|
addiw t4,t4,1
|
|
lw a4,0(a4)
|
|
addi a7,a7,8
|
|
bne a4,s10,.L93
|
|
.L157:
|
|
mv s2,s3
|
|
mv s1,s7
|
|
mv s3,s4
|
|
mv s7,a6
|
|
mv s4,s8
|
|
mv s8,t1
|
|
beq s2,a2,.L161
|
|
.L141:
|
|
li a4,4
|
|
beq t4,a4,.L86
|
|
lw a4,12(s11)
|
|
bne s2,a4,.L86
|
|
lw a4,0(s11)
|
|
bne a4,s3,.L86
|
|
li a4,2
|
|
j .L79
|
|
.L156:
|
|
bne a1,s4,.L76
|
|
.L115:
|
|
li t3,1
|
|
.L71:
|
|
mv a0,t3
|
|
call putint@plt
|
|
li a0,10
|
|
call putch@plt
|
|
.L100:
|
|
call getint@plt
|
|
sw a0,8(s11)
|
|
call getint@plt
|
|
lw a4,8(s11)
|
|
sw a0,4(s11)
|
|
mv a3,a0
|
|
bne a4,zero,.L60
|
|
.L116:
|
|
ld ra,200(sp)
|
|
ld s0,192(sp)
|
|
ld s1,184(sp)
|
|
ld s2,176(sp)
|
|
ld s3,168(sp)
|
|
ld s4,160(sp)
|
|
ld s5,152(sp)
|
|
ld s6,144(sp)
|
|
ld s7,136(sp)
|
|
ld s8,128(sp)
|
|
ld s9,120(sp)
|
|
ld s10,112(sp)
|
|
ld s11,104(sp)
|
|
li a0,0
|
|
addi sp,sp,208
|
|
jr ra
|
|
.L159:
|
|
bne ra,s1,.L84
|
|
.L109:
|
|
mv s1,s7
|
|
mv s4,s8
|
|
mv s7,a6
|
|
mv s8,t1
|
|
li a4,2
|
|
.L79:
|
|
mv a3,t3
|
|
ble t3,a4,.L95
|
|
mv a3,a4
|
|
.L95:
|
|
sub a4,s8,s1
|
|
slli a4,a4,1
|
|
add a4,a4,s4
|
|
slli a4,a4,2
|
|
add a4,s9,a4
|
|
sext.w t3,a3
|
|
sw s10,0(a4)
|
|
.L75:
|
|
addiw s6,s6,1
|
|
addi s7,s7,8
|
|
bne s6,t5,.L69
|
|
li a5,10
|
|
ble t3,a5,.L71
|
|
li a0,-1
|
|
call putint@plt
|
|
li a0,10
|
|
call putch@plt
|
|
j .L100
|
|
.L155:
|
|
bne a1,s4,.L70
|
|
j .L115
|
|
.L158:
|
|
bne ra,s1,.L78
|
|
j .L109
|
|
.L160:
|
|
mv s1,s7
|
|
mv s4,s8
|
|
mv s7,a6
|
|
mv s8,t1
|
|
.L86:
|
|
li a3,10
|
|
ld a4,16(sp)
|
|
bgt t6,a3,.L79
|
|
addiw a4,t6,1
|
|
j .L79
|
|
.L154:
|
|
bne t0,a2,.L75
|
|
lw a4,0(s11)
|
|
bne a4,t2,.L75
|
|
j .L115
|
|
.L161:
|
|
lw a4,0(s11)
|
|
bne a4,s3,.L141
|
|
li a4,2
|
|
j .L79
|
|
.size main, .-main
|
|
.globl y_1
|
|
.globl x_1
|
|
.globl y_0
|
|
.globl x_0
|
|
.globl h
|
|
.globl w
|
|
.globl step
|
|
.globl a
|
|
.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
|
|
.data
|
|
.align 3
|
|
.set .LANCHOR1,. + 0
|
|
.type step, @object
|
|
.size step, 32
|
|
step:
|
|
.word 1
|
|
.word 0
|
|
.word -1
|
|
.word 0
|
|
.word 0
|
|
.word 1
|
|
.word 0
|
|
.word -1
|
|
.bss
|
|
.align 3
|
|
.set .LANCHOR0,. + 0
|
|
.type y_1, @object
|
|
.size y_1, 4
|
|
y_1:
|
|
.zero 4
|
|
.type h, @object
|
|
.size h, 4
|
|
h:
|
|
.zero 4
|
|
.type w, @object
|
|
.size w, 4
|
|
w:
|
|
.zero 4
|
|
.type x_1, @object
|
|
.size x_1, 4
|
|
x_1:
|
|
.zero 4
|
|
.type x_0, @object
|
|
.size x_0, 4
|
|
x_0:
|
|
.zero 4
|
|
.type y_0, @object
|
|
.size y_0, 4
|
|
y_0:
|
|
.zero 4
|
|
.type a, @object
|
|
.size a, 3600
|
|
a:
|
|
.zero 3600
|
|
.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
|