Question
Write an x86-64 procedure/function named sumThirdMembers , that computes the sum of the third data members (member3) of the structures contained in an array of
Write an x86-64 procedure/function named sumThirdMembers, that computes the sum of the third data members (member3) of the structures contained in an array of structures; each of the structures in the array has 6 short members. (Recall that a short is 2 bytes and that x86-64 code uses 8 byte memory addresses.)
struct sixShortMembers { #this declaration is for a more clear understanding only
short member1;
short member2;
short member3;
short member4;
short member5;
short member6;
} array[size];
After computing the sum, the function should call printf to print the sum.The function is passed two parameters by its caller.A C-language prototype for the function is shown below:
void sumThirdMembers(int size, struct sixShortMembers *array);
The parameter array is a pointer to the first element of an array of structures; each structure has six short members.The function should print the sum it computes by calling printf, using the format string below:
.section .rodata
LCO: .string The sum of the third members of the array elements is: %hi
If you do not understand the format %hi, you should figure it out before the final. It is referenced in the format slides for printf from the beginning of the semester.
Assume no overflow of the sum occurs.
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