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

Consider the following assembly code for a function F1 with two integer argument

ID: 3917519 • Letter: C

Question

Consider the following assembly code for a function F1 with two integer arguments F1: push EBP mov EBP, ESP mov EDX, DWORD PTR [ebp+12] mov EAX, DWORD PTR [ebp+8] add EAX, EAX add EAX, EDX mov DWORD PTR [ebp-4], EAX mOv ESP, EBP Pop EBP ret # setup stack #EAX = x # ignore for now # cleanup stack To the right of each instruction, show the contents of the register whose value changes as a result of executing that instuction, then fill in the blanks in the corresponding C source code below Note: you may only use the symbolic variables x, y in your expressions below -- do not use register names int Fl (int x, int y) int result; result- return result

Explanation / Answer

Answer: Result = 2x+y;

Explanation:

EAX contains x; EDX contains y

For the instruction

ADD EAX,EAX; x= x+x = 2x

ADD EAX,EDX; X = 2x+y

Therefore result will be 2x+y

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote