Give the corresponding Assembly code to do the following C++ function calls.
Example: int f(int &a, int y);
q = f(y, s); push s invoke f, s, addr y1. (3 pt) int f4(int &a);
x = f4( z );
2. (3 pt) int f5(int a, int &b, int c);
x = f5( 5, z, y);
| Example: int f( int &a, int
y) { return a+y; } |
f proc push ebp mov ebp, esp mov ebx, [ebp+8] mov eax, [ebp+12] add eax, [ebx] pop ebp ret f endp |
f
proc C, a:ptr dword, y:dword mov eBx, a mov eAx, [eBx] add eAx, y ret f endp |
3. (3 pt) int f3(int a) {
return a+1;
}
4. (3 pt) int f3(int &a) {
return a+1;
}
5. (4 pt) int f5(int a, int &b, int c);
return a+b+c;
}