Question: 1 . Write a C function max 3 that takes three numbers a , b , c and returns the maximum of the three numbers.
Write a C function max that takes three numbers a b c and returns the maximum of the three
numbers.
a Use the gcc compiler to generate the assembly code.
b Use the gcc compiler to generate the object code.
c Use the objdump to decompile the object code. Redirect the output into a file.
Submit the C assembly, and the decompiled object code for the above program.
Extend the program to include a main function to test the function.
a Use the gcc compiler to generate the assembly code.
b Use the gcc compiler to generate the object code.
c Use the objdump to decompile the object code. Redirect the output into a file.
Submit the C assembly, and the decompiled object code for the above program.
Assume the following values are stored at the indicated memory addresses and registers:
Address Value Register Value
xxFF rax x
xxAA rcx x
xxrdx x
xC x
Fill in the following table showing the values for the indicated operands:
Operand Value
rax
x
$x
rax
rax
rax,rdx
rcxrdx
xFCrcx
rax,rdx
You are given the following information. A function with prototype
int mysteryint a int b int c int d;
is compiled into assembly code. The body of the code is as follows:
leal rdi,rsi,eax
leal rdxrdxedx
addl edx, eax
leal rax,rcxeax
ret
Assume a at rdi, b at rsi, c at rdx d at rcx and the return value at eax.
Write the C code for mystery function that will have an effect equivalent to the assembly code
above.
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
