Another usage of the stack

Recall we had trouble performing the following computation:

   result = square(3) + square(4); 

This code will not work all the time:

   /* -------------------------------------------------
      Call square(3)
      ------------------------------------------------- */
   mov     r0, #3
   bl      square

   mov	r10, r0           // Save 3^2 in r10 *** FAIL !!!

   /* -------------------------------------------------
      Call square(4)
      ------------------------------------------------- */
   mov     r0, #4
   bl      square     <--- r10 overwritten by this call 

   add	r0, r0, r10       // FAIL to compute 32 + 42 

DEMO:   /home/cs255001/demo/asm/8-sub/reg-problem.s