L7 eax edx edx eax edx eax l8 university of washington

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: onal Branch Example (Cont.) absdiff: pushl movl movl movl cmpl jle subl movl .L8: leave ret .L7: subl jmp int goto_ad(int x, int y) { int result; if (x <= y) goto Else; result = x-y; Exit: return result; Else: result = y-x; goto Exit; } int x int y %edx %eax x86 %ebp %esp, %ebp 8(%ebp), %edx 12(%ebp), %eax %eax, %edx .L7 %eax, %edx %edx, %eax %edx, %eax .L8 University of Washington CondiMonal Branch Example (Cont.) absdiff: pushl movl movl movl cmpl jle subl movl .L8: leave ret .L7: subl jmp int goto_ad(int x, int y) { int result; if (x <= y) goto Else; result = x-y; Exit: return result; Else: result = y-x; goto Exit; } int x int y %edx %eax x86 %ebp %esp, %ebp 8(%ebp), %edx 12(%ebp), %eax %eax, %edx .L7 %eax, %edx %edx, %eax %edx, %eax .L8 University of Washington CondiMonal Branch Example (Cont.) absdiff: pushl movl movl movl cmpl jle subl movl .L8: leave ret .L7: subl jmp int goto_ad(int x, int y) { int result; if (x <= y) goto Else; result = x-y; Exit: return result; Else: result = y-x; goto Exit; } int x int y %edx %eax x86 %ebp %esp, %ebp 8(%ebp), %edx 12(%ebp), %eax %eax, %edx .L7 %eax, %edx %edx, %eax %edx, %eax .L8 University of Washington CondiMonal Branch Example (Cont.) absdiff: pushl movl movl movl cmpl jle subl movl .L8: leave ret .L7: subl jmp int goto_ad(int x, int y) { int result; if (x <= y) goto Else; result = x-y; Exit: return result; Else: result = y-x; goto Exit; } int x int y %edx %eax x86 %ebp %esp, %ebp 8(%ebp), %edx 12(%ebp), %eax %eax, %edx .L7 %eax, %edx %edx, %eax %edx, %eax .L8 University of Washington CondiMonal Branch Example (Cont.) absdiff: pushl movl movl movl cmpl jle subl movl .L8: leave ret .L7: subl jmp int goto_ad(int x, int y) { int result; if (x <= y) goto Else; result = x-y; Exit: return result; Else: result = y-x; goto Exit; } int x int y %edx %eax x86 %ebp %esp, %ebp 8(%ebp), %edx 12(%ebp), %eax %eax, %edx .L7 %eax, %edx %edx, %eax %edx, %eax .L8 University of Washington General CondiMonal Expression TranslaMon C Code val = Test ? Then ­Expr : Else ­Expr; result = x>y ? x-y : y-x; if (Test) val = Then ­Expr; else val = Else ­Expr;   Test is expression returning integer Goto Version = 0 in...
View Full Document

Ask a homework question - tutors are online