Question
**Need help with disassembling binary executable files and *.o files to C code (in C (not C++) language)** ---------------------------------------------------------------------------- Basically, I need to write C
**Need help with disassembling binary executable files and *.o files to C code (in C (not C++) language)**
----------------------------------------------------------------------------
Basically, I need to write C code with given executable file and o files.
-----------------------------------------------------------------------------
## Problem 1
You are given two object files `given/problem1.o` and `given/foo_given.o` as well as an executable binary
file called `given/problem1_given`. The first one
contains the `main` function, the second contains a function called `foo` and the third
one is the program build from the two object files. Your task is to write C code for
the function `foo` in `foo_given.o`. Your code may not end up being identical to
the one in the given file, but it should be equivalent (i.e., given the same
inputs, it should produce the same output).
The `main()` function executes a few tests of the function `foo` in `foo_given.o`. These are not exhaustive tests and passing them does not
guarantee correctness, but it should be a pretty good indicator that your code is on the right track
(unless, of course, you will try to circumvent the process and design your `foo` function so that it ONLY works
with the tests present in `main`).
__Your own function should be implemented in the file `foo.c`.__ In order to build the object file, run :
```
make foo.o
```
In order to build and run your code:
```
make problem1
make run_problem1
```
The output from the program will give you an idea if your function `foo` performs
the task equivalent to the given version.
__Deliverables:__
Implementation of the function `foo` in file `foo.c`.
------------------------------------------------------------------------------------------------------
## Problem 2
You are given two object files `given/problem2.o` and `given/bar_given.o` as well as an executable binary
file called `given/problem2_given`. The first one
contains the `main` function, the second contains a function called `bar` and the third
one is the program build from the two object files. Your task is to write C code for
the function `bar` in `bar_given.o`. Your code may not end up being identical to
the one in the given file, but it should be equivalent (i.e., given the same
inputs, it should produce the same output).
The `main()` function executes a few tests of the function `bar` in `bar_given.o`. These are not exhaustive tests and passing them does not
guarantee correctness, but it should be a pretty good indicator that your code is on the right track
(unless, of course, you will try to circumvent the process and design your `bar` function so that it ONLY works
with the tests present in `main`).
__Your own function should be implemented in the file `bar.c`.__ In order to build the object file, run :
```
make bar.o
```
In order to build and run your code:
```
make problem2
make run_problem2
```
The output from the program will give you an idea if your function `bar` performs
the task equivalent to the given version.
__Deliverables:__
Implementation of the function `bar` in file `bar.c`.
--------------------------------------------------------------------------------------------
(Because I cannot upload files(such as o files and binary files) other than image files, I attached files as google drive link. If there is another way to upload files or link does not work, let me know please.)
https://drive.google.com/file/d/1uLsU7-mG4WUHkXm02gr1b_iVCsQRUDkO/view
I attached questions in the google drive link via problem.txt file
Thank you.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started