title: Optimizing Three Address Code
body: <p>I have the following three address code, where n is some external constant:</p>
  
  <pre><code>   x = 0
     i = 0
  L: t1 = i * 4
     t2 = a[t1]
     t3 = i * 4
     t4 = b[t3]
     t5 = t2 * t4
     x = x + t5
     i = i + 1
     if i &lt; n goto L
  </code></pre>
  
  <p>I would like to optimize it as much as I can. Here is what I've come up with so far:</p>
  
  <pre><code>    x = 0
      i = 0
      t1 = -4
  L:  t1 = t1+4
      t5 = a[t1] * b[t1]
      x = x + t5
      i = i + 1
      if i &lt; n goto L
  </code></pre>
  
  <p>Can anyone offer corrections/additional optimizations?</p>