$24
Exercise 1: Convert into ARMV8 Assembly the following C code:
int getMax(int a, int b, int c) {
int result = a;
if (b result) {
if (c b) result = c;
else result = b;
} else if (c result) result = c; return result;
}
void printMax(int m) {
printf("The maximum number is: %d\n", m);
}
int main(void) {
int max;
max = getMax(4, 3, 7);
printMax(max);
}
Exercise 2: Without removing any of the statements that are already in each subroutine, update the following assembly code so the add operation in write subroutine is performed using the values of register x1 and x2 as defined in main subroutine
.text
.globl main
main:
mov x1, 1
mov x2, 2
bl write
bl exit
write:
mov x1, #10
mov x2, #20
add x3, x1, x2
ldr x0, =msg
bl printf
exit:
mov x8, #93
svc 0
.data
msg: .asciz "%d + %d = %d\n"
Each exercise should be implemented in separate files. Attach in the corresponding assignment link the assembly code source files (.s file) implementing the solution to each exercise.