Exercise 1 [Arithmetic Operations Consider the following assembly code for a fun
ID: 3716539 • Letter: E
Question
Exercise 1 [Arithmetic Operations Consider the following assembly code for a function F1 with two integer arguments F1: push EBP mov EBP, ESP # setup stack mov EDX, DWORD PTR [ebp+12] mov EAX, DWORD PTR [ebp+8] add EAX, EAX #EAX #EAX # ignore for now # cleanup stack add EAX, EDX mov DWORD PTR [ebp-4], EAX mov ESP, EBP pop EBP ret 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 blanks in the corresponding C source code below. do not use Note: you may only use the symbolic variables x, y in your expressions below 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
Please rate it if you find the answer is helpful...:)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.