Question: I have a programming assignment where I need to answer a bunch of questions, but to do so I need to generate both the unoptimized
I have a programming assignment where I need to answer a bunch of questions, but to do so I need to generate both the unoptimized and optimized assembly code from the C source code file Project c which Ive provided to you in both image and text form to avoid any indenting errors from the text version. I need the assembly code for both the unoptimized and optimized versions to be able to answer my assignment questions.
If you're somehow unsure how to generate these files, I believe you can use the following commands:
For unoptimized assembly:
gcc Waadhln g masmintel m "Project c "Project gasm"
For optimized assembly:
gcc Waadhln O masmintel m "Project c "Project oasm"
Once you generate these, please send both the codes and let me know which is which. This will allow me to proceed with solving the assignment questions. Thank you!
GCC
gcc Waadhln g masmintel m "Project c "Project gasm"
gcc Waadhln O masmintel m "Project c "Project oasm"
#include
#define NOINLINE attributenoinline
static NOINLINE int functionint x int y
int i;
int sum;
int values;
sum ;
for i ; i ; i
valuesi i x y;
sum valuesi;
return sum;
static int NOINLINE functionint values int valuesLen
int i;
int sum;
int sum;
int v;
sum;
sum;
for i ; i valuesLen; i
v valuesi;
if v
sum v;
else
sum v;
return sum sum;
static NOINLINE int functionint x
int y;
y x ;
return y;
static NOINLINE int functionint a int b int c int d
int r;
if a b
r b;
else if a c
r a;
else if a d
r a;
else
r ;
return r;
static NOINLINE unsigned int functionunsigned int x
unsigned int x;
unsigned int x;
unsigned int x;
x x ;
x x ;
x x ;
return x x x;
int mainint argc, char argv
int i;
int j;
int k;
int values;
i ;
j ;
k functioni j;
printffunction: i d j d k d
i j k;
for i ; i ; i
valuesi i j;
k functionvalues;
printffunction: k d
k;
k function;
printffunction: k d
k;
k function;
printffunction: k d
k;
k function;
printffunction: k d
k;
return ;
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
