Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Exercise 3 [Conditionals] Consider the following assembly code for a function F3

ID: 3716542 • Letter: E

Question

Exercise 3 [Conditionals] Consider the following assembly code for a function F3 with two integer arguments: F3: push EBP mov EBP, ESP mov EDX, DWORD PTR [ebp+12] mov EAX, DWORD PTR [ebp+8] cmp EAX, EDX # setup stack #if # goto .L1 #EAX- mov EAX, EDX # ignore for now mov DWORD PTR [EBP-4], EAX mov ESP, EBP pop EBE ret # cleanup stack To the right of each instruction, show the contents of the register whose value changes as a result of executing that instruction, then fill in the corresponding C source code below. int F3 (int x, int y)

Explanation / Answer

Equivalent C Code:

Int F3(int x, int y){

If(x>y){

Break;

}

Else{

x=y

}

}

For the blanks:

If(x>y)

EAX = y