; Assembler Practice#3 ; // find the largest of the three and set w to it ; // assume no two are equal ; if (x > y) { ; if (x > z) { ; w = x; ; } else { ; w = z; ; } ; } else { ; if (y > z) { ; w = y; ; } else { ; w = z; ; } ; } ; print w; extern printf segment .data wOut db "w=%d",10,0 x dd 55 y dd 11 z dd 63 w dd 0 segment .text global main main: push ebp mov ebp, esp mov eax, [x] cmp eax, [y] jle _outerElse cmp eax, [z] jle _topInnerElse mov [w], eax ; x wins jmp printAnswer _topInnerElse: mov eax, [z] mov [w], eax ; z wins jmp printAnswer _outerElse: mov eax, [y] cmp eax, [z] jle _bottomInnerElse mov [w], eax ; y wins jmp printAnswer _bottomInnerElse: mov eax, [z] mov [w], eax ; z wins printAnswer: push dword [w] push wOut call printf add esp, 8 mov eax, 0 mov esp, ebp pop ebp ret