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
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) { } 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; --a; } c = c * a; --b; return C; } int max (long long int a, long long int b) { if (a>b) else return a; 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
The compiled LEGV8 assembly code corresponding to the provided C code section data arr quad 0 0 0 0 ...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