A compiler-generated solution

If you use gcc on a MIPS32processor
running Linux
to generate MIPS32 assembly language
for this routine, the following
code is obtained. (In this example, registers have been renamed
from their numeric names, $5, to their symbolic
names, $a1.
Also, this code was generated at optimization level 2.)

The Task

It’s not as hard as you might think.
Look at the C code. Look at the x86-64 assembly code.
Figure out how the registers of the x86-64 code correspond to the
variables of the C code.
Figure out how the instructions of the x86-64 code implement the
statements of the C code.

Download a copy of the x86-64 code,
load it into your favorite text editor, and annotate the x86-64 code with
what you figured out in the previous paragraph.
Finally upload your annotated x86-64 code to the
Homework 11 moodle page.
You can upload a text file or a PDF file.