Exercise 4: A small function in assembly

Using the online GCC/GAS Assembler, write an assembly program which computes (x + y)3 + (x - y)3 where both x and y are integers and the result is an integer. Your code must work for both positive and negative integers. As an example, if x is 2 and y is 3, the result will be (2+3)3 + (2–3)3 or 125 - 1 or 124. The result for x = 8 and y = -23 is 26416.

Constraints

Submission

Once your program works, click on the white downward arrow button to download your assembly program to your machine. It is on the right side of the menu bar at the top of the screen; click here if you are having problems locating it. In addition, set x to -21 and y to 24, set a breakpoint at the ret instruction, and run the code to the breakpoint. The key inputs and outputs will be displayed in the list of registers on the right. Adjust your web browser window so there is a minimal amount of empty space on your screen, and use the snipping tool to capture the portion of the screen that includes your code, the debug console, and the registers. See this page for an example of what to capture. Upload both files (your .s file containing your code and an image file showing the debugger) to Canvas. Note both must be uploaded at once; you cannot upload one file in one submission and the other in a second submission, because we will only see the last submission when grading.