title: Use the return value of a function inside a if statement in mips
body: <p>How do I use the return value of a function in another function in mips? I know I have to use stacks but I am not sure how.</p>
  
  <p>For example, if I have the code below: </p>
  
  <pre><code>int is_more_than_a_dozen(int a, int b) {
    if (sum(a, b) &gt; 12)
      return 1;
    else
      return 0;
  }
  int sum(int a, int b) {
    return a + b;
  }
  </code></pre>
  
  <p>I know how to do everything except for calling the function sum() in the if statement. </p>
  
  <p>Thank you</p>
  
  <hr>
  
  <p>Edit: </p>
  
  <p>This is my sum function:</p>
  
  <pre><code>sum:
    add $v0, $a0, $a1
    jr $ra
  </code></pre>