Question: Consider the following high-level recursive procedure: long long int f(long long int n, long long int k) { long long int b; b=k+2; if (n==0)
Consider the following high-level recursive procedure:
long long int f(long long int n, long long int k) {
long long int b;
b=k+2;
if (n==0) b = 8;
else b = b + 4 * n + f(n-1,k+1);
return b + k;
}
Translate the high-level procedure f into ARMv8 assembly language.
-Pay particular attention to properly saving and restoring registers across procedure calls;
-Use the ARMv8 preserved register convention;
-Clearly comment your code;
-Assume that the procedure starts at address 0x00400100;
-Keep local variable b in X19;
-Assume n and k are passed in X0 and X1 respectively and that the result is returned in X2.
IN ARM NOT MIPS
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
