Question: 2. [20] Consider the following C function: long f( long x, long y, long z ) When compiled on https://godbolt.org/ with 8664 gcc 8.3 and
![2. [20] Consider the following C function: long f( long x,](https://s3.amazonaws.com/si.experts.images/answers/2024/09/66e1c32d97ff1_59766e1c32d03844.jpg)
2. [20] Consider the following C function: long f( long x, long y, long z ) When compiled on https://godbolt.org/ with 8664 gcc 8.3 and the Wall Ogmasm=att arguments, the resulting x8664 code for the function body is: Assume that x is in \%rdi, y is in \%rsi, z is in \%rdx, and that \%rax is used to hold the return value. Your task is to reverse engineer the C code; specifically, to write a C implementation for the function that is functionally equivalent to the compiled x86-64 code above. Start by copy/pasting the above assembly code into your C file as a comment above your new f implementation. Comment each line of assembly in terms of x,y, and z (and any temporary variables that will appear in your C code) - for example: 2. [20] Consider the following C function: long f( long x, long y, long z ) When compiled on https://godbolt.org/ with 8664 gcc 8.3 and the Wall Ogmasm=att arguments, the resulting x8664 code for the function body is: Assume that x is in \%rdi, y is in \%rsi, z is in \%rdx, and that \%rax is used to hold the return value. Your task is to reverse engineer the C code; specifically, to write a C implementation for the function that is functionally equivalent to the compiled x86-64 code above. Start by copy/pasting the above assembly code into your C file as a comment above your new f implementation. Comment each line of assembly in terms of x,y, and z (and any temporary variables that will appear in your C code) - for example
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
