Assume that the arrays
c are indexed from 1 to
n in each dimension.
Assume that you know at compile time that
n is 500 and
that the arrays
start at addresses 20000, 3000000, and 5000000, respectively.
In your three address code, do not use the bracket notation, but rather do the address addition explicitly.
Create a new temporary for each value, rather than trying to be frugal and re-use temporaries. That is, do something like
t1 := i * n t2 := t1 + jnot
t1 := i * n t1 := t1 + j