Assembly Functions
In this assignment, you have a given file (attached to the assignment: “main.c”). It contains different structs and some test cases that you need to verify.
You need to write assembly code for the following functions. Each function in a separate file (sumOfPowers.s, compareAges.s, findPaymentsSum.s):
- int sumOfPowers(int n);
- This function takes one input (n) and it should find the following sum:
12 + 22 + 32 + 42 + ... + n2
- int compareAges(CUSTOMER* a, CUSTOMER* b);
- This function should test if a->age == b->age. it returns 1 if they are equal; 0 otherwise.
- int findPaymentsSum(CUSTOMER* c, int num_of_pamyments);
- This function should find the sum ofall payments made by a given customer.
In “main.c”, you have given different test cases that can help you test your code. Be sure that you get the expected output when you run each test case as follows:
TestCase -1 expected output:
TestCase -2 expected output:
TestCase -3 expected output:
Extra Credits (0.25 Point)
Write assembly code for the following functions. Save its code in (findSalariesSum.s):
- int findSalariesSum(EMPLOYEE e[], int size);
- This function should find the sum of salaries of a given array of employees
Extra Credit TestCase (TestCase -4) expected output:
Important Notes:
- It is so important to submit a working program (Non-working applications will not be considered).
- You must submit one zip file only (that includes all your code files).