printf("\tBase width = %d Base length = %d\n", c-base.width,
c-base.length);
printf("\tHeight = %d\n", c-height);
printf("\tVolume = %d\n\n", c-volume);
}
int equalSize(struct cuboid *c1, struct cuboid *c2)
{
int result = FALSE;
if (c1-base.width == c2-base.width) {
if (c1-base.length == c2-base.length) {
if (c1-height == c2-height) {
result = TRUE;
}
}
}
return result;
}
int main()
{
struct cuboid first, second;
first = newCuboid();
second = newCuboid();
printf("Initial cuboid values:\n");
printCuboid("first", &first);
printCuboid("second", &second);
if (equalSize(&first, &second)) {
move(&first, +3, -6);
scale(&second, 4);
}
printf("\nChanged cuboid values:\n");
printCuboid("first", &first);
printCuboid("second", &second);
}
Implement all the subroutines above as unoptimized closed subroutines, using stack variables to store all local variables. Note that the function newCuboid() must have a local variable (called c) which is returned by value to main(), where it is assigned to the local variables first and second. In other words, create code similar to what the C compiler produces, even if it seems inefficient.
Also run the program in gdb, displaying the values of first and second after they have been set by function calls. You should show that the functions are working as expected. Capture the gdb session using the script UNIX command, and name the output file script.txt. Name your program assign4.asm.
Other Requirements
Make sure your code is readable and fully documented, including identifying information at the top of each file. You must comment each line of assembly code. Your code should also be well designed: make sure it is well organized, clear, and concise.