# $t5 contains array
sub $sp, $sp, 16
sw $s0, 0($sp)
sw $s1, 4($sp)
sw $s2, 8($sp)
sw $ra, 12($sp)
la $t0, array
begin:
move $s0, $a1
move $s1, $a2
mul $t1, $a1, 4
add $t1, $t0, $t1
lw $s2, 0($t1)
while_condition:
bge $s0, $s1, end_while
mul $t2, $s1, 4
add $t2, $t0, $t2
lw $t3, 0($t2)
while_condition_2:
ble $t3, $s2, end_while_2
sub $s1, $s1, 1
j while_condition_2
end_while_2:
while_condition_3:
bge $s0, $s1, end_while_3
mul $t4, $s0, 4
add $t4, $t0, $t4
lw $t5, 0($t4)
bgt $t5, $s2, end_while_3
addi $s0, $s0, 1
j while_condition_3
end_while_3:
if_2:
bge $s0, $s1, end_if_2
mul $t4, $s0, 4
add $t4, $t0, $t4
lw $a0, 0($t4)
mul $t2, $s1, 4
add $t2, $t0, $t2
lw $a1, 0($t2)
jal Swap
end_if_2:
end_while:
mul $t1, $a1, 4
add $t1, $t0, $t1
mul $t2, $s1, 4
add $t2, $t0, $t2
lw $t3, 0($t2)
sw $t3, 0($t1)
sw $s2, 0($t2)
move $v0, $s2
lw $s0, 0($sp)
lw $s1, 4($sp)
lw $s2, 8($sp)
lw $ra, 12($sp)
addi $sp, $sp, 16
end_Partition: