diff options
Diffstat (limited to 'output/LinearSearch.s')
-rw-r--r-- | output/LinearSearch.s | 931 |
1 files changed, 931 insertions, 0 deletions
diff --git a/output/LinearSearch.s b/output/LinearSearch.s new file mode 100644 index 0000000..b320fd7 --- /dev/null +++ b/output/LinearSearch.s @@ -0,0 +1,931 @@ +.data +functable_LS: + LS_Start + LS_Print + LS_Search + LS_Init +.text +jal Main +li $v0 10 +syscall +Main: + sw $fp -8($sp) + move $fp $sp + subu $sp $sp 64 + sw $ra -4($fp) + sw $s0 -12($fp) + sw $s1 -16($fp) + sw $s2 -20($fp) + sw $s3 -24($fp) + sw $s4 -28($fp) + sw $s5 -32($fp) + sw $s6 -36($fp) + sw $s7 -40($fp) + li $a0 24 + jal _heapAlloc + move $s7 $v0 + la $t9 functable_LS + sw $t9 0($s7) + move $s6 $s7 + move $s7 $s6 + lw $s6 0($s7) + lw $s5 0($s6) + li $s6 10 + move $s4 $s6 + sw $t3 -44($fp) + sw $t4 -48($fp) + sw $t5 -52($fp) + sw $t6 -56($fp) + sw $t7 -60($fp) + sw $t8 -64($fp) + move $a0 $s7 + move $a1 $s4 + jalr $s5 + lw $t3 -44($fp) + lw $t4 -48($fp) + lw $t5 -52($fp) + lw $t6 -56($fp) + lw $t7 -60($fp) + lw $t8 -64($fp) + move $s6 $v0 + move $s4 $s6 + move $s6 $s4 + move $a0 $s6 + jal _print + lw $s0 -12($fp) + lw $s1 -16($fp) + lw $s2 -20($fp) + lw $s3 -24($fp) + lw $s4 -28($fp) + lw $s5 -32($fp) + lw $s6 -36($fp) + lw $s7 -40($fp) + lw $ra -4($fp) + lw $fp -8($fp) + addu $sp $sp 64 + jr $ra +LS_Start: + sw $fp -8($sp) + move $fp $sp + subu $sp $sp 64 + sw $ra -4($fp) + sw $s0 -12($fp) + sw $s1 -16($fp) + sw $s2 -20($fp) + sw $s3 -24($fp) + sw $s4 -28($fp) + sw $s5 -32($fp) + sw $s6 -36($fp) + sw $s7 -40($fp) + move $s6 $a0 + move $s7 $a1 + move $s5 $s6 + lw $s5 0($s6) + move $s4 $s7 + move $s7 $s4 + lw $s5 0($s5) + sw $t3 -44($fp) + sw $t4 -48($fp) + sw $t5 -52($fp) + sw $t6 -56($fp) + sw $t7 -60($fp) + sw $t8 -64($fp) + move $a0 $s6 + move $a1 $s7 + jalr $s5 + lw $t3 -44($fp) + lw $t4 -48($fp) + lw $t5 -52($fp) + lw $t6 -56($fp) + lw $t7 -60($fp) + lw $t8 -64($fp) + move $s4 $v0 + move $s7 $s4 + move $s4 $s7 + move $s4 $s6 + lw $s4 0($s6) + lw $s4 0($s4) + sw $t3 -44($fp) + sw $t4 -48($fp) + sw $t5 -52($fp) + sw $t6 -56($fp) + sw $t7 -60($fp) + sw $t8 -64($fp) + move $a0 $s6 + jalr $s4 + lw $t3 -44($fp) + lw $t4 -48($fp) + lw $t5 -52($fp) + lw $t6 -56($fp) + lw $t7 -60($fp) + lw $t8 -64($fp) + move $s7 $v0 + move $s4 $s7 + move $s7 $s4 + li $s7 9999 + move $s4 $s7 + move $s7 $s4 + move $a0 $s7 + jal _print + move $s7 $s6 + lw $s7 0($s6) + li $s4 8 + move $s5 $s4 + lw $s7 0($s7) + sw $t3 -44($fp) + sw $t4 -48($fp) + sw $t5 -52($fp) + sw $t6 -56($fp) + sw $t7 -60($fp) + sw $t8 -64($fp) + move $a0 $s6 + move $a1 $s5 + jalr $s7 + lw $t3 -44($fp) + lw $t4 -48($fp) + lw $t5 -52($fp) + lw $t6 -56($fp) + lw $t7 -60($fp) + lw $t8 -64($fp) + move $s4 $v0 + move $s5 $s4 + move $s4 $s5 + move $a0 $s4 + jal _print + move $s4 $s6 + lw $s4 0($s6) + li $s5 12 + move $s7 $s5 + lw $s4 0($s4) + sw $t3 -44($fp) + sw $t4 -48($fp) + sw $t5 -52($fp) + sw $t6 -56($fp) + sw $t7 -60($fp) + sw $t8 -64($fp) + move $a0 $s6 + move $a1 $s7 + jalr $s4 + lw $t3 -44($fp) + lw $t4 -48($fp) + lw $t5 -52($fp) + lw $t6 -56($fp) + lw $t7 -60($fp) + lw $t8 -64($fp) + move $s5 $v0 + move $s7 $s5 + move $s5 $s7 + move $a0 $s5 + jal _print + move $s5 $s6 + lw $s5 0($s6) + li $s7 17 + move $s4 $s7 + lw $s5 0($s5) + sw $t3 -44($fp) + sw $t4 -48($fp) + sw $t5 -52($fp) + sw $t6 -56($fp) + sw $t7 -60($fp) + sw $t8 -64($fp) + move $a0 $s6 + move $a1 $s4 + jalr $s5 + lw $t3 -44($fp) + lw $t4 -48($fp) + lw $t5 -52($fp) + lw $t6 -56($fp) + lw $t7 -60($fp) + lw $t8 -64($fp) + move $s7 $v0 + move $s4 $s7 + move $s7 $s4 + move $a0 $s7 + jal _print + move $s7 $s6 + lw $s7 0($s6) + li $s4 50 + move $s5 $s4 + lw $s7 0($s7) + sw $t3 -44($fp) + sw $t4 -48($fp) + sw $t5 -52($fp) + sw $t6 -56($fp) + sw $t7 -60($fp) + sw $t8 -64($fp) + move $a0 $s6 + move $a1 $s5 + jalr $s7 + lw $t3 -44($fp) + lw $t4 -48($fp) + lw $t5 -52($fp) + lw $t6 -56($fp) + lw $t7 -60($fp) + lw $t8 -64($fp) + move $s4 $v0 + move $s5 $s4 + move $s4 $s5 + move $a0 $s4 + jal _print + li $s4 55 + move $s5 $s4 + move $s4 $s5 + move $v0 $s4 + lw $s0 -12($fp) + lw $s1 -16($fp) + lw $s2 -20($fp) + lw $s3 -24($fp) + lw $s4 -28($fp) + lw $s5 -32($fp) + lw $s6 -36($fp) + lw $s7 -40($fp) + lw $ra -4($fp) + lw $fp -8($fp) + addu $sp $sp 64 + jr $ra +LS_Print: + sw $fp -8($sp) + move $fp $sp + subu $sp $sp 92 + sw $ra -4($fp) + sw $s0 -12($fp) + sw $s1 -16($fp) + sw $s2 -20($fp) + sw $s3 -24($fp) + sw $s4 -28($fp) + sw $s5 -32($fp) + sw $s6 -36($fp) + sw $s7 -40($fp) + move $s6 $a0 + li $s7 1 + move $s5 $s7 + move $s7 $s5 +while55_test: + move $s5 $s7 + lw $t0 -76($fp) + lw $t0 0($s6) + sw $t0 -76($fp) + lw $t0 -84($fp) + lw $t1 -76($fp) + move $t0 $t1 + sw $t1 -76($fp) + sw $t0 -84($fp) + lw $t0 -80($fp) + lw $t1 -84($fp) + move $t0 $t1 + sw $t1 -84($fp) + sw $t0 -80($fp) + lw $t0 -72($fp) + lw $t1 -80($fp) + move $a0 $s5 + move $t9 $t1 + slt $t0 $a0 $t9 + sw $t1 -80($fp) + sw $t0 -72($fp) + lw $t0 -92($fp) + lw $t1 -72($fp) + move $t0 $t1 + sw $t1 -72($fp) + sw $t0 -92($fp) + lw $t0 -88($fp) + lw $t1 -92($fp) + move $t0 $t1 + sw $t1 -92($fp) + sw $t0 -88($fp) + lw $t0 -88($fp) + beqz $t0 while55_end + sw $t0 -88($fp) +while55_body: + lw $t6 0($s6) + move $t5 $t6 + move $s4 $s7 + move $a0 $s4 + li $t9 4 + mul $s3 $a0 $t9 + move $a0 $s3 + li $t9 4 + add $s3 $a0 $t9 + move $a0 $t5 + move $t9 $s3 + add $s3 $a0 $t9 + lw $s0 0($s3) + move $s1 $s0 + move $s2 $s1 + move $a0 $s2 + jal _print + move $t4 $s7 + lw $t0 -68($fp) + li $t0 1 + sw $t0 -68($fp) + lw $t0 -68($fp) + move $a0 $t4 + move $t9 $t0 + add $t3 $a0 $t9 + sw $t0 -68($fp) + move $t7 $t3 + move $s7 $t7 + j while55_test +while55_end: + li $t3 0 + move $t4 $t3 + move $t3 $t4 + move $v0 $t3 + lw $s0 -12($fp) + lw $s1 -16($fp) + lw $s2 -20($fp) + lw $s3 -24($fp) + lw $s4 -28($fp) + lw $s5 -32($fp) + lw $s6 -36($fp) + lw $s7 -40($fp) + lw $ra -4($fp) + lw $fp -8($fp) + addu $sp $sp 92 + jr $ra +LS_Search: + sw $fp -8($sp) + move $fp $sp + subu $sp $sp 228 + sw $ra -4($fp) + sw $s0 -12($fp) + sw $s1 -16($fp) + sw $s2 -20($fp) + sw $s3 -24($fp) + sw $s4 -28($fp) + sw $s5 -32($fp) + sw $s6 -36($fp) + sw $s7 -40($fp) + move $s6 $a0 + move $s7 $a1 + li $s5 1 + move $s4 $s5 + move $s5 $s4 + li $s4 0 + move $s3 $s4 + move $s4 $s3 + li $s3 0 + move $s2 $s3 + lw $t0 -68($fp) + move $t0 $s2 + sw $t0 -68($fp) +while83_test: + move $s2 $s5 + lw $t0 -216($fp) + lw $t0 0($s6) + sw $t0 -216($fp) + lw $t0 -188($fp) + lw $t1 -216($fp) + move $t0 $t1 + sw $t1 -216($fp) + sw $t0 -188($fp) + lw $t0 -180($fp) + lw $t1 -188($fp) + move $t0 $t1 + sw $t1 -188($fp) + sw $t0 -180($fp) + lw $t0 -200($fp) + lw $t1 -180($fp) + move $a0 $s2 + move $t9 $t1 + slt $t0 $a0 $t9 + sw $t1 -180($fp) + sw $t0 -200($fp) + lw $t0 -196($fp) + lw $t1 -200($fp) + move $t0 $t1 + sw $t1 -200($fp) + sw $t0 -196($fp) + lw $t0 -192($fp) + lw $t1 -196($fp) + move $t0 $t1 + sw $t1 -196($fp) + sw $t0 -192($fp) + lw $t0 -192($fp) + beqz $t0 while83_end + sw $t0 -192($fp) +while83_body: + lw $t0 -140($fp) + lw $t0 0($s6) + sw $t0 -140($fp) + lw $t0 -160($fp) + lw $t1 -140($fp) + move $t0 $t1 + sw $t1 -140($fp) + sw $t0 -160($fp) + lw $t0 -148($fp) + move $t0 $s5 + sw $t0 -148($fp) + lw $t0 -136($fp) + lw $t1 -148($fp) + move $a0 $t1 + li $t9 4 + mul $t0 $a0 $t9 + sw $t1 -148($fp) + sw $t0 -136($fp) + lw $t0 -136($fp) + lw $t1 -136($fp) + move $a0 $t1 + li $t9 4 + add $t0 $a0 $t9 + sw $t1 -136($fp) + sw $t0 -136($fp) + lw $t0 -136($fp) + lw $t1 -160($fp) + lw $t2 -136($fp) + move $a0 $t1 + move $t9 $t2 + add $t0 $a0 $t9 + sw $t2 -136($fp) + sw $t1 -160($fp) + sw $t0 -136($fp) + lw $t0 -152($fp) + lw $t1 -136($fp) + lw $t0 0($t1) + sw $t1 -136($fp) + sw $t0 -152($fp) + lw $t0 -144($fp) + lw $t1 -152($fp) + move $t0 $t1 + sw $t1 -152($fp) + sw $t0 -144($fp) + lw $t0 -156($fp) + lw $t1 -144($fp) + move $t0 $t1 + sw $t1 -144($fp) + sw $t0 -156($fp) + lw $t0 -132($fp) + move $t0 $s7 + sw $t0 -132($fp) + lw $t0 -128($fp) + li $t0 1 + sw $t0 -128($fp) + lw $t0 -120($fp) + lw $t1 -132($fp) + lw $t2 -128($fp) + move $a0 $t1 + move $t9 $t2 + add $t0 $a0 $t9 + sw $t2 -128($fp) + sw $t1 -132($fp) + sw $t0 -120($fp) + lw $t0 -116($fp) + lw $t1 -120($fp) + move $t0 $t1 + sw $t1 -120($fp) + sw $t0 -116($fp) + lw $t0 -124($fp) + lw $t1 -116($fp) + move $t0 $t1 + sw $t1 -116($fp) + sw $t0 -124($fp) + lw $t0 -76($fp) + lw $t1 -156($fp) + move $t0 $t1 + sw $t1 -156($fp) + sw $t0 -76($fp) + lw $t0 -100($fp) + move $t0 $s7 + sw $t0 -100($fp) + lw $t0 -112($fp) + lw $t1 -76($fp) + lw $t2 -100($fp) + move $a0 $t1 + move $t9 $t2 + slt $t0 $a0 $t9 + sw $t2 -100($fp) + sw $t1 -76($fp) + sw $t0 -112($fp) + lw $t0 -96($fp) + lw $t1 -112($fp) + move $t0 $t1 + sw $t1 -112($fp) + sw $t0 -96($fp) + lw $t0 -108($fp) + lw $t1 -96($fp) + move $t0 $t1 + sw $t1 -96($fp) + sw $t0 -108($fp) + lw $t0 -108($fp) + beqz $t0 if101_else + sw $t0 -108($fp) +if101_body: + lw $t0 -84($fp) + li $t0 0 + sw $t0 -84($fp) + lw $t0 -80($fp) + lw $t1 -84($fp) + move $t0 $t1 + sw $t1 -84($fp) + sw $t0 -80($fp) + lw $t0 -104($fp) + lw $t1 -80($fp) + move $t0 $t1 + sw $t1 -80($fp) + sw $t0 -104($fp) + j if101_end +if101_else: + lw $t0 -72($fp) + lw $t1 -156($fp) + move $t0 $t1 + sw $t1 -156($fp) + sw $t0 -72($fp) + lw $t0 -124($fp) + move $s0 $t0 + sw $t0 -124($fp) + lw $t0 -88($fp) + lw $t1 -72($fp) + move $a0 $t1 + move $t9 $s0 + slt $t0 $a0 $t9 + sw $t1 -72($fp) + sw $t0 -88($fp) + lw $t0 -88($fp) + move $s1 $t0 + sw $t0 -88($fp) + move $t4 $s1 + move $t5 $t4 + lw $t0 -92($fp) + move $a0 $t5 + li $t9 0 +NULL $t0 $a0 $t9 + sw $t0 -92($fp) + lw $t0 -224($fp) + lw $t1 -92($fp) + move $t0 $t1 + sw $t1 -92($fp) + sw $t0 -224($fp) + lw $t0 -228($fp) + lw $t1 -224($fp) + move $t0 $t1 + sw $t1 -224($fp) + sw $t0 -228($fp) + lw $t0 -228($fp) + move $t7 $t0 + sw $t0 -228($fp) + beqz $t7 if108_else +if108_body: + li $s3 0 + move $t3 $s3 + lw $t0 -104($fp) + move $t0 $t3 + sw $t0 -104($fp) + j if108_end +if108_else: + li $t6 1 + lw $t0 -164($fp) + move $t0 $t6 + sw $t0 -164($fp) + lw $t0 -164($fp) + move $s4 $t0 + sw $t0 -164($fp) + lw $t0 -172($fp) + li $t0 1 + sw $t0 -172($fp) + lw $t0 -168($fp) + lw $t1 -172($fp) + move $t0 $t1 + sw $t1 -172($fp) + sw $t0 -168($fp) + lw $t0 -68($fp) + lw $t1 -168($fp) + move $t0 $t1 + sw $t1 -168($fp) + sw $t0 -68($fp) + lw $t0 -208($fp) + lw $t0 0($s6) + sw $t0 -208($fp) + lw $t0 -204($fp) + lw $t1 -208($fp) + move $t0 $t1 + sw $t1 -208($fp) + sw $t0 -204($fp) + lw $t0 -204($fp) + move $s5 $t0 + sw $t0 -204($fp) +if108_end: +if101_end: + lw $t0 -212($fp) + move $t0 $s5 + sw $t0 -212($fp) + lw $t0 -184($fp) + li $t0 1 + sw $t0 -184($fp) + lw $t0 -220($fp) + lw $t1 -212($fp) + lw $t2 -184($fp) + move $a0 $t1 + move $t9 $t2 + add $t0 $a0 $t9 + sw $t2 -184($fp) + sw $t1 -212($fp) + sw $t0 -220($fp) + lw $t0 -176($fp) + lw $t1 -220($fp) + move $t0 $t1 + sw $t1 -220($fp) + sw $t0 -176($fp) + lw $t0 -176($fp) + move $s5 $t0 + sw $t0 -176($fp) + j while83_test +while83_end: + lw $t0 -68($fp) + move $t4 $t0 + sw $t0 -68($fp) + move $t5 $t4 + move $t4 $t5 + move $v0 $t4 + lw $s0 -12($fp) + lw $s1 -16($fp) + lw $s2 -20($fp) + lw $s3 -24($fp) + lw $s4 -28($fp) + lw $s5 -32($fp) + lw $s6 -36($fp) + lw $s7 -40($fp) + lw $ra -4($fp) + lw $fp -8($fp) + addu $sp $sp 228 + jr $ra +LS_Init: + sw $fp -8($sp) + move $fp $sp + subu $sp $sp 156 + sw $ra -4($fp) + sw $s0 -12($fp) + sw $s1 -16($fp) + sw $s2 -20($fp) + sw $s3 -24($fp) + sw $s4 -28($fp) + sw $s5 -32($fp) + sw $s6 -36($fp) + sw $s7 -40($fp) + move $s5 $a0 + move $s6 $a1 + move $s7 $s6 + move $s4 $s7 + sw $s4 0($s5) + move $s4 $s6 + move $s6 $s4 + sw $t3 -44($fp) + sw $t4 -48($fp) + sw $t5 -52($fp) + sw $t6 -56($fp) + sw $t7 -60($fp) + sw $t8 -64($fp) + move $a0 $s6 + jalr $AllocArray + lw $t3 -44($fp) + lw $t4 -48($fp) + lw $t5 -52($fp) + lw $t6 -56($fp) + lw $t7 -60($fp) + lw $t8 -64($fp) + move $s4 $v0 + move $s6 $s4 + move $s4 $s6 + sw $s4 0($s5) + li $s4 1 + move $s6 $s4 + move $s4 $s6 + lw $s6 0($s5) + li $s7 1 + move $a0 $s6 + move $t9 $s7 + add $s3 $a0 $t9 + move $s7 $s3 + move $s3 $s7 +while146_test: + move $s7 $s4 + lw $t0 -148($fp) + lw $t0 0($s5) + sw $t0 -148($fp) + lw $t0 -152($fp) + lw $t1 -148($fp) + move $t0 $t1 + sw $t1 -148($fp) + sw $t0 -152($fp) + lw $t0 -136($fp) + lw $t1 -152($fp) + move $t0 $t1 + sw $t1 -152($fp) + sw $t0 -136($fp) + lw $t0 -156($fp) + lw $t1 -136($fp) + move $a0 $s7 + move $t9 $t1 + slt $t0 $a0 $t9 + sw $t1 -136($fp) + sw $t0 -156($fp) + lw $t0 -132($fp) + lw $t1 -156($fp) + move $t0 $t1 + sw $t1 -156($fp) + sw $t0 -132($fp) + lw $t0 -144($fp) + lw $t1 -132($fp) + move $t0 $t1 + sw $t1 -132($fp) + sw $t0 -144($fp) + lw $t0 -144($fp) + beqz $t0 while146_end + sw $t0 -144($fp) +while146_body: + lw $t0 -116($fp) + li $t0 2 + sw $t0 -116($fp) + lw $t0 -128($fp) + move $t0 $s4 + sw $t0 -128($fp) + lw $t0 -120($fp) + lw $t1 -116($fp) + lw $t2 -128($fp) + move $a0 $t1 + move $t9 $t2 + mul $t0 $a0 $t9 + sw $t2 -128($fp) + sw $t1 -116($fp) + sw $t0 -120($fp) + lw $t0 -124($fp) + lw $t1 -120($fp) + move $t0 $t1 + sw $t1 -120($fp) + sw $t0 -124($fp) + lw $t0 -140($fp) + lw $t1 -124($fp) + move $t0 $t1 + sw $t1 -124($fp) + sw $t0 -140($fp) + lw $t0 -72($fp) + move $t0 $s3 + sw $t0 -72($fp) + lw $t0 -96($fp) + li $t0 3 + sw $t0 -96($fp) + lw $t0 -108($fp) + lw $t1 -72($fp) + lw $t2 -96($fp) + move $a0 $t1 + move $t9 $t2 + sub $t0 $a0 $t9 + sw $t2 -96($fp) + sw $t1 -72($fp) + sw $t0 -108($fp) + lw $t0 -92($fp) + lw $t1 -108($fp) + move $t0 $t1 + sw $t1 -108($fp) + sw $t0 -92($fp) + lw $t0 -112($fp) + lw $t1 -92($fp) + move $t0 $t1 + sw $t1 -92($fp) + sw $t0 -112($fp) + lw $t0 -104($fp) + lw $t0 0($s5) + sw $t0 -104($fp) + lw $t0 -80($fp) + move $t0 $s4 + sw $t0 -80($fp) + lw $t0 -76($fp) + lw $t1 -80($fp) + move $t0 $t1 + sw $t1 -80($fp) + sw $t0 -76($fp) + lw $t0 -100($fp) + lw $t1 -76($fp) + move $a0 $t1 + li $t9 4 + mul $t0 $a0 $t9 + sw $t1 -76($fp) + sw $t0 -100($fp) + lw $t0 -100($fp) + lw $t1 -100($fp) + move $a0 $t1 + li $t9 4 + add $t0 $a0 $t9 + sw $t1 -100($fp) + sw $t0 -100($fp) + lw $t0 -100($fp) + lw $t1 -104($fp) + lw $t2 -100($fp) + move $a0 $t1 + move $t9 $t2 + add $t0 $a0 $t9 + sw $t2 -100($fp) + sw $t1 -104($fp) + sw $t0 -100($fp) + lw $t0 -84($fp) + lw $t1 -140($fp) + move $t0 $t1 + sw $t1 -140($fp) + sw $t0 -84($fp) + lw $t0 -68($fp) + lw $t1 -112($fp) + move $t0 $t1 + sw $t1 -112($fp) + sw $t0 -68($fp) + lw $t0 -88($fp) + lw $t1 -84($fp) + lw $t2 -68($fp) + move $a0 $t1 + move $t9 $t2 + add $t0 $a0 $t9 + sw $t2 -68($fp) + sw $t1 -84($fp) + sw $t0 -88($fp) + lw $t0 -88($fp) + move $s2 $t0 + sw $t0 -88($fp) + lw $t0 -100($fp) + sw $s2 0($t0) + sw $t0 -100($fp) + move $t5 $s4 + li $t6 1 + move $a0 $t5 + move $t9 $t6 + add $s6 $a0 $t9 + move $t3 $s6 + move $s4 $t3 + move $s0 $s3 + li $s1 1 + move $a0 $s0 + move $t9 $s1 + sub $t4 $a0 $t9 + move $t7 $t4 + move $s3 $t7 + j while146_test +while146_end: + li $t3 0 + move $t4 $t3 + move $t3 $t4 + move $v0 $t3 + lw $s0 -12($fp) + lw $s1 -16($fp) + lw $s2 -20($fp) + lw $s3 -24($fp) + lw $s4 -28($fp) + lw $s5 -32($fp) + lw $s6 -36($fp) + lw $s7 -40($fp) + lw $ra -4($fp) + lw $fp -8($fp) + addu $sp $sp 156 + jr $ra +AllocArray: + sw $fp -8($sp) + move $fp $sp + subu $sp $sp 64 + sw $ra -4($fp) + sw $s0 -12($fp) + sw $s1 -16($fp) + sw $s2 -20($fp) + sw $s3 -24($fp) + sw $s4 -28($fp) + sw $s5 -32($fp) + sw $s6 -36($fp) + sw $s7 -40($fp) + move $s7 $a0 + move $a0 $s7 + li $t9 4 + mul $s6 $a0 $t9 + move $a0 $s6 + li $t9 4 + add $s6 $a0 $t9 + move $a0 $s6 + jal _heapAlloc + move $s5 $v0 + sw $s7 0($s5) + move $v0 $s5 + lw $s0 -12($fp) + lw $s1 -16($fp) + lw $s2 -20($fp) + lw $s3 -24($fp) + lw $s4 -28($fp) + lw $s5 -32($fp) + lw $s6 -36($fp) + lw $s7 -40($fp) + lw $ra -4($fp) + lw $fp -8($fp) + addu $sp $sp 64 + jr $ra +_print: + li $v0 1 # syscall: print integer + syscall + la $a0 _newline + li $v0 4 # syscall: print string + syscall + jr $ra +_error: + li $v0 4 # syscall: print string + syscall + li $v0 10 # syscall: exit + syscall +_heapAlloc: + li $v0 9 # syscall: sbrk + syscall + jr $ra +.data +.align 0 +_newline: .asciiz "\n" +_str0: .asciiz "null pointer\n" |