sysy-data/hidden_functional_c/asm/12_DSU.s

866 lines
11 KiB
ArmAsm

.file "12_DSU.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 init
.type init, @function
init:
lw a3,.LANCHOR0
ble a3,zero,.L16
lla a4,fa+4
addiw a3,a3,1
li a5,1
.L18:
sw a5,0(a4)
addiw a5,a5,1
addi a4,a4,4
bne a5,a3,.L18
.L16:
ret
.size init, .-init
.align 1
.globl find
.type find, @function
find:
addi sp,sp,-48
sd s0,32(sp)
sd s1,24(sp)
lla s0,fa
slli s1,a0,2
add a5,s0,s1
lw a5,0(a5)
sd ra,40(sp)
sd s2,16(sp)
sd s3,8(sp)
sd s4,0(sp)
bne a5,a0,.L26
ld ra,40(sp)
ld s0,32(sp)
ld s1,24(sp)
ld s2,16(sp)
ld s3,8(sp)
ld s4,0(sp)
addi sp,sp,48
jr ra
.L26:
slli s2,a5,2
add a4,s0,s2
lw a0,0(a4)
beq a5,a0,.L22
slli s3,a0,2
add a5,s0,s3
lw a5,0(a5)
bne a0,a5,.L27
.L23:
add s2,s0,s2
sw a5,0(s2)
mv a0,a5
.L22:
add s0,s0,s1
ld ra,40(sp)
sw a0,0(s0)
ld s0,32(sp)
ld s1,24(sp)
ld s2,16(sp)
ld s3,8(sp)
ld s4,0(sp)
addi sp,sp,48
jr ra
.L27:
slli s4,a5,2
add s4,s0,s4
lw a0,0(s4)
beq a5,a0,.L24
call find
sw a0,0(s4)
.L24:
add s3,s0,s3
sw a0,0(s3)
mv a5,a0
j .L23
.size find, .-find
.align 1
.globl same
.type same, @function
same:
addi sp,sp,-112
sd s0,96(sp)
sd s1,88(sp)
lla s0,fa
slli s1,a0,2
add a5,s0,s1
sd s2,80(sp)
lw s2,0(a5)
sd ra,104(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)
bne a0,s2,.L46
slli s1,a1,2
add a5,s0,s1
lw a0,0(a5)
bne a1,a0,.L47
.L37:
ld ra,104(sp)
ld s0,96(sp)
sub a0,a0,s2
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)
seqz a0,a0
addi sp,sp,112
jr ra
.L46:
slli s3,s2,2
add a5,s0,s3
lw a5,0(a5)
beq s2,a5,.L30
slli s2,a5,2
add a4,s0,s2
lw a4,0(a4)
bne a5,a4,.L48
.L31:
add s3,s0,s3
sw a4,0(s3)
mv a5,a4
.L30:
add s1,s0,s1
sw a5,0(s1)
slli s1,a1,2
mv s2,a5
add a5,s0,s1
lw a0,0(a5)
beq a1,a0,.L37
.L47:
slli s3,a0,2
add a5,s0,s3
lw a5,0(a5)
beq a0,a5,.L38
slli s4,a5,2
add a4,s0,s4
lw a4,0(a4)
bne a5,a4,.L49
.L39:
add s3,s0,s3
sw a4,0(s3)
mv a5,a4
.L38:
add s0,s0,s1
sw a5,0(s0)
mv a0,a5
j .L37
.L49:
slli s5,a4,2
add a5,s0,s5
lw a5,0(a5)
beq a4,a5,.L40
slli s6,a5,2
add a4,s0,s6
lw a4,0(a4)
bne a5,a4,.L50
.L41:
add s5,s0,s5
sw a4,0(s5)
mv a5,a4
.L40:
add s4,s0,s4
sw a5,0(s4)
mv a4,a5
j .L39
.L48:
slli s4,a4,2
add a5,s0,s4
lw a5,0(a5)
beq a4,a5,.L32
slli s5,a5,2
add a4,s0,s5
lw a4,0(a4)
bne a5,a4,.L51
.L33:
add s4,s0,s4
sw a4,0(s4)
mv a5,a4
.L32:
add s2,s0,s2
sw a5,0(s2)
mv a4,a5
j .L31
.L51:
slli s6,a4,2
add a5,s0,s6
lw a5,0(a5)
beq a4,a5,.L34
slli s7,a5,2
add a4,s0,s7
lw a4,0(a4)
beq a5,a4,.L35
slli s8,a4,2
add s8,s0,s8
lw a0,0(s8)
beq a4,a0,.L36
sd a1,8(sp)
call find
ld a1,8(sp)
sw a0,0(s8)
.L36:
add s7,s0,s7
sw a0,0(s7)
mv a4,a0
.L35:
add s6,s0,s6
sw a4,0(s6)
mv a5,a4
.L34:
add s5,s0,s5
sw a5,0(s5)
mv a4,a5
j .L33
.L50:
slli s7,a4,2
add a5,s0,s7
lw a5,0(a5)
beq a4,a5,.L42
slli s8,a5,2
add a4,s0,s8
lw a4,0(a4)
beq a5,a4,.L43
slli s9,a4,2
add s9,s0,s9
lw a0,0(s9)
beq a4,a0,.L44
call find
sw a0,0(s9)
.L44:
add s8,s0,s8
sw a0,0(s8)
mv a4,a0
.L43:
add s7,s0,s7
sw a4,0(s7)
mv a5,a4
.L42:
add s6,s0,s6
sw a5,0(s6)
mv a4,a5
j .L41
.size same, .-same
.section .text.startup,"ax",@progbits
.align 1
.globl main
.type main, @function
main:
addi sp,sp,-144
sd ra,136(sp)
sd s5,88(sp)
sd s0,128(sp)
lla s5,.LANCHOR0
sd s1,120(sp)
sd s2,112(sp)
sd s3,104(sp)
sd s4,96(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)
call quick_read
sw a0,0(s5)
call quick_read
lw a3,0(s5)
sw a0,4(s5)
ble a3,zero,.L53
lla a4,fa+4
addiw a3,a3,1
li a5,1
.L54:
sw a5,0(a4)
addiw a5,a5,1
addi a4,a4,4
bne a5,a3,.L54
.L53:
beq a0,zero,.L55
lla s4,fa
li s2,81
li s0,9
li s1,45
li s3,85
j .L114
.L156:
beq a0,s3,.L57
.L114:
call getch@plt
bne a0,s2,.L156
call getch@plt
addiw a5,a0,-48
li s8,0
bleu a5,s0,.L60
.L59:
bne a0,s1,.L63
li s8,1
.L63:
call getch@plt
addiw a5,a0,-48
bgtu a5,s0,.L59
.L60:
li s6,0
.L64:
slliw s7,s6,2
addw s7,s7,s6
slliw s7,s7,1
addw s7,s7,a0
call getch@plt
addiw a5,a0,-48
addiw s6,s7,-48
bleu a5,s0,.L64
beq s8,zero,.L65
li s6,48
subw s6,s6,s7
.L65:
call getch@plt
addiw a5,a0,-48
li s8,0
bleu a5,s0,.L66
.L68:
bne a0,s1,.L67
li s8,1
.L67:
call getch@plt
addiw a5,a0,-48
bgtu a5,s0,.L68
.L66:
li s9,0
.L69:
slliw s7,s9,2
addw s7,s7,s9
slliw s7,s7,1
addw s7,s7,a0
call getch@plt
addiw a5,a0,-48
addiw s9,s7,-48
bleu a5,s0,.L69
beq s8,zero,.L70
li s9,48
subw s9,s9,s7
.L70:
slli s7,s6,2
add a5,s4,s7
lw a5,0(a5)
beq a5,s6,.L71
slli s8,a5,2
add a4,s4,s8
lw s6,0(a4)
beq a5,s6,.L72
slli s10,s6,2
add a5,s4,s10
lw a5,0(a5)
bne s6,a5,.L157
.L73:
add s8,s4,s8
sw a5,0(s8)
mv s6,a5
.L72:
add s7,s4,s7
sw s6,0(s7)
.L71:
slli s7,s9,2
add a5,s4,s7
lw a5,0(a5)
beq a5,s9,.L79
slli s8,a5,2
add a4,s4,s8
lw s9,0(a4)
beq a5,s9,.L80
slli s10,s9,2
add a5,s4,s10
lw a5,0(a5)
bne s9,a5,.L158
.L81:
add s8,s4,s8
sw a5,0(s8)
mv s9,a5
.L80:
add s7,s4,s7
sw s9,0(s7)
.L79:
sub a0,s9,s6
seqz a0,a0
call putint@plt
li a0,10
call putch@plt
.L87:
lw a5,4(s5)
addiw a4,a5,-1
sw a4,4(s5)
bne a4,zero,.L114
.L55:
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)
li a0,0
addi sp,sp,144
jr ra
.L57:
call getch@plt
addiw a5,a0,-48
li s7,0
bleu a5,s0,.L62
.L61:
bne a0,s1,.L88
li s7,1
.L88:
call getch@plt
addiw a5,a0,-48
bgtu a5,s0,.L61
.L62:
li a5,0
.L89:
slliw s6,a5,2
addw s6,s6,a5
slliw s6,s6,1
addw s6,s6,a0
call getch@plt
addiw a4,a0,-48
addiw a5,s6,-48
bleu a4,s0,.L89
beq s7,zero,.L90
li a5,48
subw a5,a5,s6
.L90:
slli s7,a5,2
add a4,s4,s7
lw a4,0(a4)
beq a4,a5,.L91
slli s6,a4,2
add a5,s4,s6
lw a5,0(a5)
beq a4,a5,.L92
slli s8,a5,2
add a4,s4,s8
lw a4,0(a4)
beq a5,a4,.L93
slli s9,a4,2
add a5,s4,s9
lw a5,0(a5)
bne a4,a5,.L159
.L94:
add s8,s4,s8
sw a5,0(s8)
.L93:
add s6,s4,s6
sw a5,0(s6)
.L92:
add s7,s4,s7
sw a5,0(s7)
slli s7,a5,2
.L91:
call getch@plt
addiw a5,a0,-48
li s8,0
bleu a5,s0,.L100
.L102:
bne a0,s1,.L101
li s8,1
.L101:
call getch@plt
addiw a5,a0,-48
bgtu a5,s0,.L102
.L100:
li a5,0
.L103:
slliw s6,a5,2
addw s6,s6,a5
slliw s6,s6,1
addw s6,s6,a0
call getch@plt
addiw a4,a0,-48
addiw a5,s6,-48
bleu a4,s0,.L103
beq s8,zero,.L104
li a5,48
subw a5,a5,s6
.L104:
slli s6,a5,2
add a4,s4,s6
lw a4,0(a4)
beq a4,a5,.L105
slli s8,a4,2
add a5,s4,s8
lw a5,0(a5)
beq a4,a5,.L106
slli s9,a5,2
add a4,s4,s9
lw a4,0(a4)
beq a5,a4,.L107
slli s10,a4,2
add a5,s4,s10
lw a5,0(a5)
bne a4,a5,.L160
.L108:
add s9,s4,s9
sw a5,0(s9)
.L107:
add s8,s4,s8
sw a5,0(s8)
.L106:
add s6,s4,s6
sw a5,0(s6)
.L105:
add s7,s4,s7
sw a5,0(s7)
j .L87
.L158:
slli s9,a5,2
add a4,s4,s9
lw a4,0(a4)
bne a5,a4,.L161
.L82:
add s10,s4,s10
sw a4,0(s10)
mv a5,a4
j .L81
.L157:
slli s6,a5,2
add a4,s4,s6
lw a4,0(a4)
bne a5,a4,.L162
.L74:
add s10,s4,s10
sw a4,0(s10)
mv a5,a4
j .L73
.L160:
slli s11,a5,2
add a4,s4,s11
lw a4,0(a4)
bne a5,a4,.L163
.L109:
add s10,s4,s10
sw a4,0(s10)
mv a5,a4
j .L108
.L159:
slli s10,a5,2
add a4,s4,s10
lw a4,0(a4)
bne a5,a4,.L164
.L95:
add s9,s4,s9
sw a4,0(s9)
mv a5,a4
j .L94
.L162:
slli s11,a4,2
add a5,s4,s11
lw a5,0(a5)
beq a4,a5,.L75
slli a3,a5,2
add a4,s4,a3
lw a4,0(a4)
bne a5,a4,.L165
.L76:
add s11,s4,s11
sw a4,0(s11)
mv a5,a4
.L75:
add s6,s4,s6
sw a5,0(s6)
mv a4,a5
j .L74
.L161:
slli s11,a4,2
add a5,s4,s11
lw a5,0(a5)
beq a4,a5,.L83
slli a3,a5,2
add a4,s4,a3
lw a4,0(a4)
bne a5,a4,.L166
.L84:
add s11,s4,s11
sw a4,0(s11)
mv a5,a4
.L83:
add s9,s4,s9
sw a5,0(s9)
mv a4,a5
j .L82
.L164:
slli s11,a4,2
add a5,s4,s11
lw a5,0(a5)
beq a4,a5,.L96
slli a3,a5,2
add a4,s4,a3
lw a4,0(a4)
bne a5,a4,.L167
.L97:
add s11,s4,s11
sw a4,0(s11)
mv a5,a4
.L96:
add s10,s4,s10
sw a5,0(s10)
mv a4,a5
j .L95
.L163:
slli a3,a4,2
add a5,s4,a3
lw a5,0(a5)
beq a4,a5,.L110
slli a2,a5,2
add a4,s4,a2
lw a4,0(a4)
bne a5,a4,.L168
.L111:
add a3,s4,a3
sw a4,0(a3)
mv a5,a4
.L110:
add s11,s4,s11
sw a5,0(s11)
mv a4,a5
j .L109
.L168:
slli a1,a4,2
add a5,s4,a1
lw a5,0(a5)
beq a4,a5,.L112
slli a4,a5,2
add a4,s4,a4
lw a0,0(a4)
sd a4,24(sp)
beq a5,a0,.L113
sd a1,16(sp)
sd a2,8(sp)
sd a3,0(sp)
call find
ld a4,24(sp)
ld a1,16(sp)
ld a2,8(sp)
ld a3,0(sp)
sw a0,0(a4)
.L113:
add a1,s4,a1
sw a0,0(a1)
mv a5,a0
.L112:
add a2,s4,a2
sw a5,0(a2)
mv a4,a5
j .L111
.L167:
slli a2,a4,2
add a5,s4,a2
lw a5,0(a5)
beq a4,a5,.L98
slli a4,a5,2
add a4,s4,a4
lw a0,0(a4)
sd a4,16(sp)
beq a5,a0,.L99
sd a2,8(sp)
sd a3,0(sp)
call find
ld a4,16(sp)
ld a2,8(sp)
ld a3,0(sp)
sw a0,0(a4)
.L99:
add a2,s4,a2
sw a0,0(a2)
mv a5,a0
.L98:
add a3,s4,a3
sw a5,0(a3)
mv a4,a5
j .L97
.L166:
slli a2,a4,2
add a5,s4,a2
lw a5,0(a5)
beq a4,a5,.L85
slli a4,a5,2
add a4,s4,a4
lw a0,0(a4)
sd a4,16(sp)
beq a5,a0,.L86
sd a2,8(sp)
sd a3,0(sp)
call find
ld a4,16(sp)
ld a2,8(sp)
ld a3,0(sp)
sw a0,0(a4)
.L86:
add a2,s4,a2
sw a0,0(a2)
mv a5,a0
.L85:
add a3,s4,a3
sw a5,0(a3)
mv a4,a5
j .L84
.L165:
slli a2,a4,2
add a5,s4,a2
lw a5,0(a5)
beq a4,a5,.L77
slli a4,a5,2
add a4,s4,a4
lw a0,0(a4)
sd a4,16(sp)
beq a5,a0,.L78
sd a3,8(sp)
sd a2,0(sp)
call find
ld a4,16(sp)
ld a3,8(sp)
ld a2,0(sp)
sw a0,0(a4)
.L78:
add a2,s4,a2
sw a0,0(a2)
mv a5,a0
.L77:
add a3,s4,a3
sw a5,0(a3)
mv a4,a5
j .L76
.size main, .-main
.globl fa
.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 n, @object
.size n, 4
n:
.zero 4
.type m, @object
.size m, 4
m:
.zero 4
.type fa, @object
.size fa, 400020
fa:
.zero 400020
.type _sysy_idx, @object
.size _sysy_idx, 4
_sysy_idx:
.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