This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.
int sorter ( int *list, int count, int opcode )
int wasswap; //flag to indicate if there was a swap in loop execution
int i; // loop counter
mov wasswap, 1 ; set wasswap to true to enter loop
whileLoop: ; main loop
cmp wasswap, 0 ; check if there was a swap
je endWhileLoop ; exit loop if there were no swap
mov eax, count ; move count to reg
sub eax, 1 ; decrement reg with 1
mov count, eax ; count = count - 1
mov wasswap, 0 ; set wasswap to false before the checks start
mov i, 0 ; set i to 0, start checking loop
mov eax, count ; move count to reg to compare with i...
This is only a preview of the solution. Please use the purchase button to see the entire solution