The following algorithm outline may be useful:
- Push on stack any information that you will change and the caller expects
will remain in tact.
- $t0 = maximum of $a0,$a1,$a2,$a3
- t0 = maximum of $a0 and $a1
$t4 = minimum of $a0 and $a1
- t0 = maximum of $t0 and $a2
$t5 = minimum of $t0 and $a2
- t0 = maximum of $t0 and $a3
$t6 = minimum of $t0 and $a3
- $t1 = maximum of $t4, $t5, $t6
- t1 = maximum of $t4 and $t5
$t4 = minimum of $t4 and $t5
- t1 = maximum of $t1 and $t6
$t5 = minimum of $t1 and $t6
- $t2 = maximum of $t4, $t5
- $t3 = minimum of $t4, $t5
- Pop off stack any information pushed on at the start of the procedure.
- Push sorted values onto stack.
- Return.