title: MIPS assembly for a simple for loop
body: <p>I need to translate this C code to MIPS assembly.
  Here is the C code:</p>
  
  <pre><code>int tmp = 0; 
  for (int  j = 0; j &lt; 15; ++j) 
       tmp = tmp * 2 + 3
  </code></pre>
  
  <p>This is my MIPS assembly code. Is it a correct translation? If you see any mistakes I would really like to know.</p>
  
  <pre><code># tmp = $v0
  # j = $t0
  
  .globl main
  
   main:
      li $v0,0
  
  loop:
      bgt $t0,15,exit
      addi $t0,$t0,1
      mul $t1,$v0,2
      add $v0,$t1, 3
      j loop  
  
  exit:
  </code></pre>