427 lines
6.3 KiB
ArmAsm
427 lines
6.3 KiB
ArmAsm
.text
|
|
.attribute 4, 16
|
|
.attribute 5, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
|
|
.file "77_substr.sy"
|
|
.globl MAX
|
|
.p2align 1
|
|
.type MAX,@function
|
|
MAX:
|
|
blt a0, a1, .LBB0_2
|
|
mv a1, a0
|
|
.LBB0_2:
|
|
mv a0, a1
|
|
ret
|
|
.Lfunc_end0:
|
|
.size MAX, .Lfunc_end0-MAX
|
|
|
|
.globl max_sum_nonadjacent
|
|
.p2align 1
|
|
.type max_sum_nonadjacent,@function
|
|
max_sum_nonadjacent:
|
|
addi sp, sp, -96
|
|
sd ra, 88(sp)
|
|
sd s0, 80(sp)
|
|
sd s1, 72(sp)
|
|
sd s2, 64(sp)
|
|
mv s2, a1
|
|
mv s0, a0
|
|
addi s1, sp, 8
|
|
li a2, 56
|
|
mv a0, s1
|
|
li a1, 0
|
|
call memset@plt
|
|
lw a0, 0(s0)
|
|
sw a0, 0(sp)
|
|
lw a1, 4(s0)
|
|
blt a0, a1, .LBB1_2
|
|
mv a1, a0
|
|
.LBB1_2:
|
|
li a2, 3
|
|
sw a1, 4(sp)
|
|
blt s2, a2, .LBB1_7
|
|
slli a2, s2, 32
|
|
srli a3, a2, 32
|
|
addi a2, s0, 8
|
|
addi a3, a3, -2
|
|
j .LBB1_5
|
|
.LBB1_4:
|
|
sw a1, 0(s1)
|
|
addi s1, s1, 4
|
|
addi a3, a3, -1
|
|
addi a2, a2, 4
|
|
beqz a3, .LBB1_7
|
|
.LBB1_5:
|
|
lw a4, 0(a2)
|
|
addw a4, a4, a0
|
|
mv a0, a1
|
|
blt a4, a1, .LBB1_4
|
|
mv a1, a4
|
|
j .LBB1_4
|
|
.LBB1_7:
|
|
addiw a0, s2, -1
|
|
slli a0, a0, 2
|
|
mv a1, sp
|
|
add a0, a0, a1
|
|
lw a0, 0(a0)
|
|
ld ra, 88(sp)
|
|
ld s0, 80(sp)
|
|
ld s1, 72(sp)
|
|
ld s2, 64(sp)
|
|
addi sp, sp, 96
|
|
ret
|
|
.Lfunc_end1:
|
|
.size max_sum_nonadjacent, .Lfunc_end1-max_sum_nonadjacent
|
|
|
|
.globl longest_common_subseq
|
|
.p2align 1
|
|
.type longest_common_subseq,@function
|
|
longest_common_subseq:
|
|
addi sp, sp, -1104
|
|
sd ra, 1096(sp)
|
|
sd s0, 1088(sp)
|
|
sd s1, 1080(sp)
|
|
sd s2, 1072(sp)
|
|
sd s3, 1064(sp)
|
|
sd s4, 1056(sp)
|
|
sd s5, 1048(sp)
|
|
sd s6, 1040(sp)
|
|
mv s2, a3
|
|
mv s5, a2
|
|
mv s3, a1
|
|
mv s6, a0
|
|
addi a0, sp, 16
|
|
li a2, 1024
|
|
addi s4, sp, 16
|
|
li a1, 0
|
|
call memset@plt
|
|
slti a0, s3, 1
|
|
slti a1, s2, 1
|
|
or a0, a0, a1
|
|
beqz a0, .LBB2_2
|
|
.LBB2_1:
|
|
slli a0, s3, 6
|
|
add a0, a0, s4
|
|
slli a1, s2, 2
|
|
add a0, a0, a1
|
|
lw a0, 0(a0)
|
|
ld ra, 1096(sp)
|
|
ld s0, 1088(sp)
|
|
ld s1, 1080(sp)
|
|
ld s2, 1072(sp)
|
|
ld s3, 1064(sp)
|
|
ld s4, 1056(sp)
|
|
ld s5, 1048(sp)
|
|
ld s6, 1040(sp)
|
|
addi sp, sp, 1104
|
|
ret
|
|
.LBB2_2:
|
|
addiw a0, s2, 1
|
|
addiw a1, s3, 1
|
|
slli a1, a1, 32
|
|
srli a6, a1, 32
|
|
slli a0, a0, 32
|
|
srli a0, a0, 32
|
|
addi a7, a0, -1
|
|
addi a2, sp, 84
|
|
li a3, 1
|
|
j .LBB2_4
|
|
.LBB2_3:
|
|
addi a3, a3, 1
|
|
addi a2, a2, 64
|
|
beq a3, a6, .LBB2_1
|
|
.LBB2_4:
|
|
slli a0, a3, 2
|
|
add a0, a0, s6
|
|
lw a4, -4(a0)
|
|
mv a5, a2
|
|
mv s0, s5
|
|
mv a1, a7
|
|
j .LBB2_7
|
|
.LBB2_5:
|
|
lw a0, -68(a5)
|
|
addiw a0, a0, 1
|
|
.LBB2_6:
|
|
sw a0, 0(a5)
|
|
addi a1, a1, -1
|
|
addi s0, s0, 4
|
|
addi a5, a5, 4
|
|
beqz a1, .LBB2_3
|
|
.LBB2_7:
|
|
lw a0, 0(s0)
|
|
beq a4, a0, .LBB2_5
|
|
lw s1, -64(a5)
|
|
lw a0, -4(a5)
|
|
blt s1, a0, .LBB2_6
|
|
mv a0, s1
|
|
j .LBB2_6
|
|
.Lfunc_end2:
|
|
.size longest_common_subseq, .Lfunc_end2-longest_common_subseq
|
|
|
|
.globl main
|
|
.p2align 1
|
|
.type main,@function
|
|
main:
|
|
addi sp, sp, -1072
|
|
sd ra, 1064(sp)
|
|
sd s0, 1056(sp)
|
|
sd s1, 1048(sp)
|
|
sd s2, 1040(sp)
|
|
li a0, 43
|
|
call putint
|
|
li a0, 10
|
|
li s2, 10
|
|
call putch
|
|
addi a0, sp, 16
|
|
li a2, 1024
|
|
li a1, 0
|
|
call memset@plt
|
|
addi a0, sp, 80
|
|
li a6, 1
|
|
li t4, 13
|
|
lui a1, 2
|
|
addiw a3, a1, 34
|
|
li t5, 3
|
|
li a5, 2
|
|
li a7, 5
|
|
li t0, 6
|
|
li t3, 16
|
|
li t1, 12
|
|
li t2, 9
|
|
li a1, 1
|
|
j .LBB3_2
|
|
.LBB3_1:
|
|
sw s0, 52(a0)
|
|
addi a1, a1, 1
|
|
addi a0, a0, 64
|
|
beq a1, t3, .LBB3_53
|
|
.LBB3_2:
|
|
beq a1, t4, .LBB3_4
|
|
bne a1, s2, .LBB3_7
|
|
.LBB3_4:
|
|
lw a2, -64(a0)
|
|
addiw s0, a2, 1
|
|
sw s0, 4(a0)
|
|
.LBB3_5:
|
|
lw a2, -56(a0)
|
|
blt a2, s0, .LBB3_11
|
|
mv s0, a2
|
|
j .LBB3_11
|
|
.LBB3_7:
|
|
lw a2, -60(a0)
|
|
lw s0, 0(a0)
|
|
blt a2, s0, .LBB3_9
|
|
mv s0, a2
|
|
.LBB3_9:
|
|
sw s0, 4(a0)
|
|
bne a1, t2, .LBB3_5
|
|
lw a2, -60(a0)
|
|
addiw s0, a2, 1
|
|
.LBB3_11:
|
|
addi a2, a1, -1
|
|
srl a4, a3, a2
|
|
andi a4, a4, 1
|
|
sw s0, 8(a0)
|
|
bnez a4, .LBB3_16
|
|
lw s1, -52(a0)
|
|
blt s1, s0, .LBB3_14
|
|
mv s0, s1
|
|
.LBB3_14:
|
|
andi s1, a2, -5
|
|
sw s0, 12(a0)
|
|
bne s1, t5, .LBB3_17
|
|
.LBB3_15:
|
|
lw a4, -52(a0)
|
|
addiw s0, a4, 1
|
|
j .LBB3_19
|
|
.LBB3_16:
|
|
lw a4, -56(a0)
|
|
addiw s0, a4, 1
|
|
andi s1, a2, -5
|
|
sw s0, 12(a0)
|
|
beq s1, t5, .LBB3_15
|
|
.LBB3_17:
|
|
lw a4, -48(a0)
|
|
blt a4, s0, .LBB3_19
|
|
mv s0, a4
|
|
.LBB3_19:
|
|
andi a2, a2, -9
|
|
sw s0, 16(a0)
|
|
bne a2, a5, .LBB3_21
|
|
lw a4, -48(a0)
|
|
addiw s0, a4, 1
|
|
j .LBB3_23
|
|
.LBB3_21:
|
|
lw a4, -44(a0)
|
|
blt a4, s0, .LBB3_23
|
|
mv s0, a4
|
|
.LBB3_23:
|
|
sw s0, 20(a0)
|
|
bne a1, a7, .LBB3_25
|
|
lw a4, -44(a0)
|
|
addiw s0, a4, 1
|
|
j .LBB3_27
|
|
.LBB3_25:
|
|
lw a4, -40(a0)
|
|
blt a4, s0, .LBB3_27
|
|
mv s0, a4
|
|
.LBB3_27:
|
|
sw s0, 24(a0)
|
|
bne a2, a5, .LBB3_29
|
|
lw a4, -40(a0)
|
|
addiw s0, a4, 1
|
|
j .LBB3_31
|
|
.LBB3_29:
|
|
lw a4, -36(a0)
|
|
blt a4, s0, .LBB3_31
|
|
mv s0, a4
|
|
.LBB3_31:
|
|
sw s0, 28(a0)
|
|
beq a1, s2, .LBB3_33
|
|
bne a1, t4, .LBB3_48
|
|
.LBB3_33:
|
|
lw a4, -36(a0)
|
|
addiw s0, a4, 1
|
|
.LBB3_34:
|
|
lw a4, -28(a0)
|
|
sw s0, 32(a0)
|
|
bge a4, s0, .LBB3_36
|
|
sw s0, 36(a0)
|
|
bne a1, a6, .LBB3_37
|
|
j .LBB3_38
|
|
.LBB3_36:
|
|
mv s0, a4
|
|
sw s0, 36(a0)
|
|
beq a1, a6, .LBB3_38
|
|
.LBB3_37:
|
|
bne a1, t1, .LBB3_50
|
|
.LBB3_38:
|
|
lw a4, -28(a0)
|
|
addiw s0, a4, 1
|
|
.LBB3_39:
|
|
sw s0, 40(a0)
|
|
bne a2, t0, .LBB3_41
|
|
lw a2, -24(a0)
|
|
addiw s0, a2, 1
|
|
j .LBB3_43
|
|
.LBB3_41:
|
|
lw a2, -20(a0)
|
|
blt a2, s0, .LBB3_43
|
|
mv s0, a2
|
|
.LBB3_43:
|
|
sw s0, 44(a0)
|
|
bne s1, t5, .LBB3_45
|
|
lw a2, -20(a0)
|
|
addiw s0, a2, 1
|
|
lw a2, -12(a0)
|
|
sw s0, 48(a0)
|
|
blt a2, s0, .LBB3_1
|
|
j .LBB3_47
|
|
.LBB3_45:
|
|
lw a2, -16(a0)
|
|
bge a2, s0, .LBB3_52
|
|
lw a2, -12(a0)
|
|
sw s0, 48(a0)
|
|
blt a2, s0, .LBB3_1
|
|
.LBB3_47:
|
|
mv s0, a2
|
|
j .LBB3_1
|
|
.LBB3_48:
|
|
lw a4, -32(a0)
|
|
blt a4, s0, .LBB3_34
|
|
mv s0, a4
|
|
j .LBB3_34
|
|
.LBB3_50:
|
|
lw a4, -24(a0)
|
|
blt a4, s0, .LBB3_39
|
|
mv s0, a4
|
|
j .LBB3_39
|
|
.LBB3_52:
|
|
mv s0, a2
|
|
lw a2, -12(a0)
|
|
sw s0, 48(a0)
|
|
blt a2, s0, .LBB3_1
|
|
j .LBB3_47
|
|
.LBB3_53:
|
|
lw a0, 1028(sp)
|
|
call putint
|
|
li a0, 10
|
|
call putch
|
|
li a0, 0
|
|
ld ra, 1064(sp)
|
|
ld s0, 1056(sp)
|
|
ld s1, 1048(sp)
|
|
ld s2, 1040(sp)
|
|
addi sp, sp, 1072
|
|
ret
|
|
.Lfunc_end3:
|
|
.size main, .Lfunc_end3-main
|
|
|
|
.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
|