CS250 Lab 6: Practice with Functions

Due Monday, March 16

For this lab, write a function called "square", that takes as a parameter a number, and returns the square of that number. Calling and return convention is up to you for this one.
As part of this lab, please look at the documentation from Intel on mul (page 1427 of this .pdf document) and imul (page 1152): https://software.intel.com/en-us/download/intel-64-and-ia-32-architectures-sdm-combined-volumes-1-2a-2b-2c-2d-3a-3b-3c-3d-and-4

Remember, Intel syntax uses a different register order than the AT&T syntax used in our book. In particular, pay attention to the note that the destination operand is in eax, and the result is stored there as well. This is different than add, which can be done on any two registers.
Verify that your code works using GDB. Appendix F in the book explains how to use GDB with assembly. You can set a break point after your function, and make sure the correct value has been returned. Then use the print_number function from our class example to make a demonstration that shows your function works.