Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write the compiled LEGV8 assembly code for the following C Code. Suppose that the base address for array arr is in register X20, a in
Write the compiled LEGV8 assembly code for the following C Code. Suppose that the base address for array arr is in register X20, a in X0, op in X9, b in X1, and res in X2. Use X2 to return the result for all procedures. long long int fact (long long int a) { long long int c = 1; while (a>1) { c = c *a; --a; return C; long long int power (long long int a, long long int b) { long long int c = 1; while (b>0){ c = c * a; --b; return c; int max (long long int a, long long int b) { if (a>b) return a; else return b; int main() { long long int arr[4]; long long int a = arr[0]; long long int op = arr[1]; long long int b = arr[2]; long long int res; switch (op) { case 0: res = a +b; break; case 1: res = a-b; break; case 2: res = a*b; break; case 3: res = fact (a); break; case 4: res = power (a,b); break; case 5: res = max (a,b); break; default: res = 0; break; arr[3] = res; return 0; Write the compiled LEGV8 assembly code for the following C Code. Suppose that the base address for array arr is in register X20, a in X0, op in X9, b in X1, and res in X2. Use X2 to return the result for all procedures. long long int fact (long long int a) { long long int c = 1; while (a>1) { c = c *a; --a; return C; long long int power (long long int a, long long int b) { long long int c = 1; while (b>0){ c = c * a; --b; return c; int max (long long int a, long long int b) { if (a>b) return a; else return b; int main() { long long int arr[4]; long long int a = arr[0]; long long int op = arr[1]; long long int b = arr[2]; long long int res; switch (op) { case 0: res = a +b; break; case 1: res = a-b; break; case 2: res = a*b; break; case 3: res = fact (a); break; case 4: res = power (a,b); break; case 5: res = max (a,b); break; default: res = 0; break; arr[3] = res; return 0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started