Search for question
Question

Hello, assembly

The goal of this assignment is to create two C-compatible functions using 32-bit x86 assembly language.

To simplify this assignment, global variables are used instead of function parameters. Create the C program below.

#include

#include

int x,y,z

int f();

int g();

int main(int arge, char *argv[])

{

}

if (arge 1-4)

return 0;

xatoi (argv[1]);

y atoi (argv[2]);

zatoi (argv[3]);

gi

printf("f(d, sd, id) = ad\n",x,y,z,f());

printf("g(d, sd, id) = \d\n",x,y,z,g());

return 0;

Create an assembly source file to define the required functions.

• £ () should compute (x-7)(y+3) + z

• g() should compute (xo.2+yo.3+2)(x9.31+ three-if-y-is-odd), where a means the bits of a from i to j (inclusive)

Use the following to get started.

.text

.global f

#put code here

ret

.global g

#put code here

ret

No branch or stack operations are required; only move/tranfer and arithmetic/logic operations are needed. You should use the fewest number of

instructions possible.

You may use secx and sedx registers. The result (return value) should be left in the seax register. Do not modify any other registers.

Submit your assembly source file.

Submit

Assembly: Choose File No file chosen

Submit

Fig: 1