Question: ( 1 5 points ) Translate the following C code into RISC - V assembly language. If you need to use temporary registers x 5
points Translate the following C code into RISCV assembly language. If you need
to use temporary registers x through x and x through x or saved registers x x
x through x use the lowernumbered registers first.
Completed the assembly language program, submit your program as a
separated asm file.
Procedure func is a leaf procedure, and procedure f is a nonleaf procedure.
Assume that the arguments a b c and d for function f are in xx respectively,
and the return value is in x
Assume that the arguments a and b for function func are in x and x
respectively, and the return value is in x
The code for functions main, f and func is as follows:
void main
int g ;
int h ;
int i ;
int j ;
f g h i j;
int f int a int b int c int d
int x funca b; x should be
int y cd; y should be
x funcx y; return value should be
x a x; x should be
return x; return x
int func int a int b
if a b
return a b;
else
return b a;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
