.file "brainfuck-bootstrap.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 get_bf_char .type get_bf_char, @function get_bf_char: addi sp,sp,-16 sd s0,0(sp) sd ra,8(sp) call getch@plt li a5,62 li s0,58 beq a0,a5,.L5 .L2: addiw a5,a0,-35 sext.w a4,a5 bgtu a4,s0,.L4 slli a3,a5,32 lla a4,.L6 srli a5,a3,30 add a5,a5,a4 lw a5,0(a5) add a5,a5,a4 jr a5 .section .rodata .align 2 .align 2 .L6: .word .L3-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L3-.L6 .word .L3-.L6 .word .L3-.L6 .word .L3-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L3-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L4-.L6 .word .L3-.L6 .word .L4-.L6 .word .L3-.L6 .text .L4: call getch@plt li a5,62 bne a0,a5,.L2 .L5: li a0,62 .L3: ld ra,8(sp) ld s0,0(sp) addi sp,sp,16 jr ra .size get_bf_char, .-get_bf_char .align 1 .globl read_program .type read_program, @function read_program: addi sp,sp,-48 sd s0,32(sp) sd ra,40(sp) sd s1,24(sp) sd s2,16(sp) sd s3,8(sp) sd s4,0(sp) call getch@plt li a5,62 li s0,58 beq a0,a5,.L13 .L12: addiw a5,a0,-35 sext.w a4,a5 bgtu a4,s0,.L14 slli a3,a5,32 lla a4,.L16 srli a5,a3,30 add a5,a5,a4 lw a5,0(a5) add a5,a5,a4 jr a5 .section .rodata .align 2 .align 2 .L16: .word .L17-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L13-.L16 .word .L13-.L16 .word .L13-.L16 .word .L13-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L13-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L14-.L16 .word .L13-.L16 .word .L14-.L16 .word .L13-.L16 .text .L14: call getch@plt li a5,62 bne a0,a5,.L12 .L13: lla s0,.LANCHOR0 lw a5,0(s0) lla s4,program lla s1,.L22 li s2,62 li s3,58 .L24: slli a5,a5,2 add a5,s4,a5 sw a0,0(a5) call getch@plt beq a0,s2,.L19 .L18: addiw a5,a0,-35 sext.w a4,a5 bgtu a4,s3,.L20 slli a4,a5,32 srli a5,a4,30 add a5,s1,a5 lw a5,0(a5) add a5,s1,a5 jr a5 .section .rodata .align 2 .align 2 .L22: .word .L23-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L21-.L22 .word .L21-.L22 .word .L21-.L22 .word .L21-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L21-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L20-.L22 .word .L21-.L22 .word .L20-.L22 .word .L21-.L22 .text .L20: call getch@plt bne a0,s2,.L18 .L19: li a0,62 .L21: lw a4,0(s0) addiw a5,a4,1 sw a5,0(s0) j .L24 .L23: lw a5,0(s0) addiw a5,a5,1 sw a5,0(s0) .L17: call getch@plt li a5,105 beq a0,a5,.L33 .L11: 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 .L33: call getint@plt lla s0,.LANCHOR0 sw a0,4(s0) call getch@plt lw a5,4(s0) ble a5,zero,.L11 lla s2,input li s1,0 .L27: call getch@plt lw a5,4(s0) sw a0,0(s2) addiw s1,s1,1 addi s2,s2,4 bgt a5,s1,.L27 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 .size read_program, .-read_program .align 1 .globl run_program .type run_program, @function run_program: addi sp,sp,-32 sd ra,24(sp) li a2,4096 addi sp,sp,-2032 li a1,0 addi a2,a2,-2048 mv a0,sp call memset@plt lla t3,.LANCHOR0 lw a1,0(t3) sw zero,.LANCHOR0+8,a5 ble a1,zero,.L34 li t4,0 li t5,0 li a3,0 li a4,0 lla a0,program li a6,62 li t1,50 lla a7,.L40 .L35: slli a5,a4,2 add a5,a0,a5 lw a5,0(a5) beq a5,a6,.L61 addiw a5,a5,-43 sext.w a2,a5 bgtu a2,t1,.L37 slli a2,a5,32 srli a5,a2,30 add a5,a5,a7 lw a5,0(a5) add a5,a5,a7 jr a5 .section .rodata .align 2 .align 2 .L40: .word .L46-.L40 .word .L45-.L40 .word .L44-.L40 .word .L43-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L42-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L37-.L40 .word .L41-.L40 .word .L37-.L40 .word .L39-.L40 .text .L61: addiw a3,a3,1 .L37: addiw a4,a4,1 blt a4,a1,.L35 .L34: addi sp,sp,2032 ld ra,24(sp) addi sp,sp,32 jr ra .L39: slli a2,a3,2 lla a5,tape add a5,a5,a2 lw a2,0(a5) addiw a5,t4,-1 bne a2,zero,.L62 addiw a4,a4,1 mv t4,a5 blt a4,a1,.L35 j .L34 .L41: slli a2,a3,2 lla a5,tape add a5,a5,a2 lw a5,0(a5) beq a5,zero,.L47 li a2,4096 slli a5,t4,2 addi a2,a2,-2048 add a2,a2,a5 add a5,a2,sp sw a4,-2048(a5) addiw a4,a4,1 addiw t4,t4,1 blt a4,a1,.L35 j .L34 .L42: addiw a4,a4,1 addiw a3,a3,-1 blt a4,a1,.L35 j .L34 .L43: lw a5,8(t3) slli t6,a3,2 lla a2,tape add a2,a2,t6 lw t6,0(a2) slli t0,a5,2 lla a2,output add a2,a2,t0 addiw a5,a5,1 sw t6,0(a2) sw a5,8(t3) addiw a4,a4,1 blt a4,a1,.L35 j .L34 .L44: slli a2,a3,2 lla a5,tape add a5,a5,a2 lw a2,0(a5) addiw a4,a4,1 addiw a2,a2,-1 sw a2,0(a5) blt a4,a1,.L35 j .L34 .L45: lw a5,4(t3) bgt a5,t5,.L52 slli a2,a3,2 lla a5,tape add a5,a5,a2 sw zero,0(a5) addiw a4,a4,1 blt a4,a1,.L35 j .L34 .L46: slli a2,a3,2 lla a5,tape add a5,a5,a2 lw a2,0(a5) addiw a4,a4,1 addiw a2,a2,1 sw a2,0(a5) blt a4,a1,.L35 j .L34 .L62: li a4,4096 slli a5,a5,2 addi a4,a4,-2048 add a4,a4,a5 add a5,a4,sp lw a4,-2048(a5) addiw a4,a4,1 blt a4,a1,.L35 j .L34 .L52: slli a2,t5,2 lla a5,input add a5,a5,a2 lw a2,0(a5) slli t6,a3,2 lla a5,tape add a5,a5,t6 sw a2,0(a5) addiw a4,a4,1 addiw t5,t5,1 blt a4,a1,.L35 j .L34 .L47: addiw a5,a4,1 mv a4,a5 slli a5,a5,2 add a5,a0,a5 lw a2,0(a5) li t0,93 li t6,1 li t2,91 beq a2,t0,.L63 .L48: bne a2,t2,.L50 addiw t6,t6,1 addi a5,a5,4 addiw a4,a4,1 .L64: lw a2,0(a5) bne a2,t0,.L48 .L63: addiw t6,t6,-1 beq t6,zero,.L37 .L50: addi a5,a5,4 addiw a4,a4,1 j .L64 .size run_program, .-run_program .align 1 .globl output_ .type output_, @function output_: addi sp,sp,-32 sd s2,0(sp) lla s2,.LANCHOR0 lw a5,8(s2) sd ra,24(sp) sd s0,16(sp) sd s1,8(sp) ble a5,zero,.L65 lla s1,output li s0,0 .L67: lw a0,0(s1) addiw s0,s0,1 addi s1,s1,4 call putch@plt lw a5,8(s2) bgt a5,s0,.L67 .L65: ld ra,24(sp) ld s0,16(sp) ld s1,8(sp) ld s2,0(sp) addi sp,sp,32 jr ra .size output_, .-output_ .section .text.startup,"ax",@progbits .align 1 .globl main .type main, @function main: addi sp,sp,-32 sd ra,24(sp) sd s2,0(sp) sd s0,16(sp) sd s1,8(sp) call read_program li a0,122 call _sysy_starttime@plt call run_program li a0,124 lla s2,.LANCHOR0 call _sysy_stoptime@plt lw a5,8(s2) ble a5,zero,.L71 lla s1,output li s0,0 .L72: lw a0,0(s1) addiw s0,s0,1 addi s1,s1,4 call putch@plt lw a5,8(s2) bgt a5,s0,.L72 .L71: ld ra,24(sp) ld s0,16(sp) ld s1,8(sp) ld s2,0(sp) li a0,0 addi sp,sp,32 jr ra .size main, .-main .globl output_length .globl output .globl input_length .globl input .globl tape .globl program .globl program_length .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 program_length, @object .size program_length, 4 program_length: .zero 4 .type input_length, @object .size input_length, 4 input_length: .zero 4 .type output_length, @object .size output_length, 4 output_length: .zero 4 .zero 4 .type output, @object .size output, 262144 output: .zero 262144 .type input, @object .size input, 262144 input: .zero 262144 .type tape, @object .size tape, 262144 tape: .zero 262144 .type program, @object .size program, 262144 program: .zero 262144 .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