# MCS-388 Homework 5

Consider the following matrix multiplication program:
```begin
for i := 1 to n do
for j := 1 to n do
c[i,j] := 0
for i := 1 to n do
for j := 1 to n do
for k := 1 to n do
c[i,j] := c[i,j] + a[i,k] * b[k,j]
```
As you complete the numbered tasks found a little ways below, use the following bulleted guidelines.
• Assume that the arrays `a`, `b`, and `c` are indexed from 1 to `n` in each dimension. Assume that you know at compile time that `n` is 300 and that the arrays `a`, `b`, and `c` start at addresses 10000, 4000000, and 6000000, respectively.
• Because you know that `n`≥1, you know that each loop will execute at least once. Take advantage of this fact by having each loop execute its test only after it has made it through the loop body.
• 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 + j
```
not
```    t1 := i * n
t1 := t1 + j
```
1. Assuming `a`, `b`, and `c` are allocated static storage and there are four bytes per word in a byte-addressed memory, produce three-address statements for the program.