Question: In this assignment, you will reverse engineer several x86-64 assembly language functions. The goal is to increase your knowledge of assembly language and help you

In this assignment, you will "reverse engineer" several x86-64 assembly language functions. The goal is to increase your knowledge of assembly language and help you develop the ability to read assembly language code and understand what it does.

Your task: You will find a file called hw5.s , which contains x64 (assembly language) implementations of 9 functions. They are called f1, f2, f3, etc. I generated hw5.s by running gcc on my own C source code, using the S and O2 flags. Your task is to write C implementations of these 9 functions, so that your C code emulates the assembly language versions. Each C function that you write will be counted as correct if your function returns the same value as its assembly language version, provided they are both passed the same parameter(s). The exact way in which your C functions are implemented does not have to match the assembly language code. In other words, if you run gcc on your own C code with -S and -O2, the assembly language produced from your code does not have to be an exact match with mine.

PROTOTYPE FOR FUNCTIONS:

#include #include #include "hw5.h"

TEMPLATES:

int f1(int a, int b, int c) { return 0; // replace this }

void f2(int *a, int b) {

}

int f3(long a) { return 0; // replace this }

int f4(int a, int b) { return 0; // replace this }

int f5(char *a) { return 0; // replace this

}

char *f6(char *a, char *b) { return a; // replace this }

char *f7(char *a, char *b) { return a; // replace this }

void f8(int *a, int b) {

}

int f9(int *a, int b) { return 0; // replace this }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!