.text .attribute 4, 16 .attribute 5, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0" .file "median2.sy" .globl meanless_calculation .p2align 1 .type meanless_calculation,@function meanless_calculation: slti a2, a0, 1 slti a3, a1, 1 or a3, a3, a2 li a2, 0 bnez a3, .LBB0_4 addiw a1, a1, -1 addiw a2, a0, -1 bltu a1, a2, .LBB0_3 mv a1, a2 .LBB0_3: addiw a2, a0, 2 mulw a2, a1, a2 addw a0, a0, a2 addiw a2, a1, -1 slli a1, a1, 32 slli a2, a2, 32 mulhu a1, a1, a2 srli a1, a1, 1 addw a0, a0, a1 addiw a2, a0, 1 .LBB0_4: mv a0, a2 ret .Lfunc_end0: .size meanless_calculation, .Lfunc_end0-meanless_calculation .globl swap .p2align 1 .type swap,@function swap: mv a6, a0 li a0, 0 slli a4, a2, 2 add a4, a4, a6 lw a5, 0(a4) slli a3, a1, 2 add a3, a3, a6 lw a6, 0(a3) sw a5, 0(a3) slti a3, a1, 1 slti a5, a2, 1 or a3, a3, a5 sw a6, 0(a4) bnez a3, .LBB1_4 addiw a0, a2, -1 addiw a2, a1, -1 bltu a0, a2, .LBB1_3 mv a0, a2 .LBB1_3: addiw a2, a1, 2 mulw a2, a0, a2 addiw a3, a0, -1 slli a0, a0, 32 slli a3, a3, 32 mulhu a0, a3, a0 srli a0, a0, 1 addw a1, a1, a2 addw a0, a0, a1 addiw a0, a0, 1 .LBB1_4: ret .Lfunc_end1: .size swap, .Lfunc_end1-swap .globl median .p2align 1 .type median,@function median: addi sp, sp, -16 sd s0, 8(sp) sd s1, 0(sp) addi a6, a0, -4 addi a7, a0, 4 .LBB2_1: sext.w a4, a1 slli a4, a4, 2 add t0, a0, a4 mv t1, a2 .LBB2_2: lw t3, 0(t0) li t4, 0 mv a2, t1 addiw t1, t1, 1 mv t2, a1 sext.w a4, t1 sext.w s1, t2 bge s1, a4, .LBB2_7 .LBB2_3: sext.w t5, t2 addw a5, t1, t4 subw t1, a5, t2 slli a5, a4, 2 add a5, a5, a6 .LBB2_4: lw s0, 0(a5) blt s0, t3, .LBB2_11 addi a4, a4, -1 addiw t4, t4, 1 addi a5, a5, -4 blt t5, a4, .LBB2_4 mv t4, t1 mv t1, t2 .LBB2_7: sext.w t5, t1 bge s1, t5, .LBB2_12 .LBB2_8: slli a4, s1, 2 add a4, a4, a7 mv t6, t4 .LBB2_9: lw a5, 0(a4) bge a5, t3, .LBB2_13 addi s1, s1, 1 addiw t6, t6, -1 addi a4, a4, 4 bne t5, s1, .LBB2_9 j .LBB2_15 .LBB2_11: addi t1, a4, -1 sext.w t5, t1 blt s1, t5, .LBB2_8 .LBB2_12: mv t6, t4 sext.w a4, t2 bne a4, t5, .LBB2_14 j .LBB2_16 .LBB2_13: addi t2, s1, 1 sext.w a4, t2 beq a4, t5, .LBB2_16 .LBB2_14: slli a4, a4, 2 add a4, a4, a0 slli a5, t5, 2 add a5, a5, a0 lw s1, 0(a5) lw s0, 0(a4) sw s1, 0(a4) sw s0, 0(a5) mv t4, t6 sext.w a4, t1 sext.w s1, t2 blt s1, a4, .LBB2_3 j .LBB2_7 .LBB2_15: addw a4, t4, t2 subw t6, a4, t1 .LBB2_16: sw t3, 0(t0) slli a4, t5, 2 add a4, a4, a0 lw a5, 0(a4) sw a5, 0(t0) sw t3, 0(a4) blt a3, t5, .LBB2_2 addiw a1, t1, 1 blt t5, a3, .LBB2_1 mv a0, t6 ld s0, 8(sp) ld s1, 0(sp) addi sp, sp, 16 ret .Lfunc_end2: .size median, .Lfunc_end2-median .globl main .p2align 1 .type main,@function main: addi sp, sp, -32 sd ra, 24(sp) sd s0, 16(sp) sd s1, 8(sp) lui a0, %hi(a) addi s0, a0, %lo(a) mv a0, s0 call getarray lui s1, %hi(n) sw a0, %lo(n)(s1) li a0, 60 call _sysy_starttime lwu a0, %lo(n)(s1) li a7, 0 srli a1, a0, 31 addw a1, a1, a0 addiw t0, a0, -1 sraiw a6, a1, 1 j .LBB3_2 .LBB3_1: sext.w a0, a5 addiw a7, a5, 1 bge a0, a6, .LBB3_18 .LBB3_2: slli a0, a7, 2 add t1, a0, s0 mv a5, t0 j .LBB3_5 .LBB3_3: mv a1, a2 .LBB3_4: sw a4, 0(t1) slli a0, a1, 2 add a0, a0, s0 lw a1, 0(a0) sw a1, 0(t1) sw a4, 0(a0) bge a6, a2, .LBB3_1 .LBB3_5: lw a4, 0(t1) mv t0, a5 addiw a5, a5, 1 mv a1, a7 sext.w a2, a5 sext.w a0, a1 bge a0, a2, .LBB3_10 .LBB3_6: sext.w a5, a1 slli a3, a2, 2 add a3, a3, s0 addi a3, a3, -4 .LBB3_7: lw s1, 0(a3) blt s1, a4, .LBB3_12 addi a2, a2, -1 addi a3, a3, -4 blt a5, a2, .LBB3_7 mv a5, a1 .LBB3_10: sext.w a2, a5 blt a0, a2, .LBB3_13 .LBB3_11: sext.w a0, a1 bne a0, a2, .LBB3_17 j .LBB3_3 .LBB3_12: addi a5, a2, -1 sext.w a2, a5 bge a0, a2, .LBB3_11 .LBB3_13: sext.w a1, a5 slli a3, a0, 2 add a3, a3, s0 addi a3, a3, 4 .LBB3_14: lw s1, 0(a3) bge s1, a4, .LBB3_16 addi a0, a0, 1 addi a3, a3, 4 bne a1, a0, .LBB3_14 j .LBB3_4 .LBB3_16: addi a1, a0, 1 sext.w a0, a1 beq a0, a2, .LBB3_3 .LBB3_17: slli a0, a0, 2 add a0, a0, s0 slli a2, a2, 2 add a2, a2, s0 lw a3, 0(a2) lw s1, 0(a0) sw a3, 0(a0) sw s1, 0(a2) sext.w a2, a5 sext.w a0, a1 blt a0, a2, .LBB3_6 j .LBB3_10 .LBB3_18: li a0, 62 call _sysy_stoptime lui s1, %hi(n) lw a0, %lo(n)(s1) lui a1, %hi(a) addi s0, a1, %lo(a) mv a1, s0 call putarray lwu a0, %lo(n)(s1) srli a1, a0, 31 addw a0, a0, a1 slli a0, a0, 1 andi a0, a0, -4 add a0, a0, s0 lw a0, 0(a0) sraiw a1, a0, 31 srliw a1, a1, 24 add a1, a1, a0 andi a1, a1, -256 subw a0, a0, a1 ld ra, 24(sp) ld s0, 16(sp) ld s1, 8(sp) addi sp, sp, 32 ret .Lfunc_end3: .size main, .Lfunc_end3-main .type a,@object .bss .globl a .p2align 2 a: .zero 40000000 .size a, 40000000 .type n,@object .section .sbss,"aw",@nobits .globl n .p2align 2 n: .word 0 .size n, 4 .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 .addrsig_sym a