hmwk2_sol_Assembly_ch

hmwk2_sol_Assembly_ch - * * * * Description: Sorting...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
* Description: Sorting Methods * Created on: Dec 5, 2010 * Author: * Class: COMPE271 .global _insertion_sort _insertion_sort: pushl %ebp movl %esp , %ebp subl $16, %esp movl $0, -12( %ebp ) movl $1, -4( %ebp ) L2: movl -4( %ebp ), %eax cmpl 12( %ebp ), %eax jge L1 movl -4( %ebp ), %eax leal 0(, %eax ,4), %edx movl 8( %ebp ), %eax movl ( %edx , %eax ), %eax movl %eax , -16( %ebp ) movl -4( %ebp ), %eax decl %eax movl %eax , -8( %ebp ) L5: cmpl $0, -8( %ebp ) js L6 movl -8( %ebp ), %eax leal 0(, %eax ,4), %edx movl 8( %ebp ), %eax movl ( %edx , %eax ), %eax cmpl -16( %ebp ), %eax jle L6 movl -8( %ebp ), %eax sall $2, %eax addl 8( %ebp ), %eax leal 4( %eax ), %ecx movl -8( %ebp ), %eax leal 0(, %eax ,4), %edx movl 8( %ebp ), %eax movl ( %edx , %eax ), %eax movl %eax , ( %ecx ) leal -8( %ebp ), %eax decl ( %eax ) jmp L5 L6: movl -8( %ebp ), %eax sall $2, %eax addl 8( %ebp ), %eax leal 4( %eax ), %edx movl -16( %ebp ), %eax movl %eax , ( %edx ) leal -4( %ebp ), %eax incl ( %eax ) jmp L2 L1:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
leave ret .global _exchange_sort _exchange_sort: pushl %ebp movl %esp , %ebp pushl %esi pushl %ebx subl $16, %esp movl $0, -20( %ebp ) movl $0, -12( %ebp ) L8: movl 12( %ebp ), %eax
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/07/2011 for the course COMPE 271 taught by Professor Staff during the Fall '08 term at San Diego State.

Page1 / 5

hmwk2_sol_Assembly_ch - * * * * Description: Sorting...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online