<b>(a) </b> void f (int ip1[], int ip2[]) { int i; for (i = 0; i < 9; ++i) { ip1[i + 1] = ip2[i] + ip2[i + 1]; } } <b>(b) </b> LOAD r1, ip2[0] LOAD r2, ip2[1] ADD r3, r1, r2 # Add ip2[0] and ip2[1]. STORE ip1[1], r3 # Store result in ip1[1]. LOAD r1, ip2[2] ADD r3, r1, r2 # Add ip2[1] and ip2[2]. STORE ip1[2], r3 # Store result in ip1[2]. LOAD r2, ip2[3] ADD r3, r1, r2 # Add ip2[2] and ip2[3]. STORE ip1[3], r3 # Store result in ip1[3]. ... <b>(c) </b> LOAD r1, ip2[0] LOAD r2, ip2[1] ADD r3, r1, r2 # Add ip2[0] and ip2[1]. STORE ip1[1], r3 # Store result in ip1[1]. LOAD r1, ip2[1] LOAD r2, ip2[2] ADD r3, r1, r2 # Add ip2[1] and ip2[2]. STORE ip1[2], r3 # Store result in ip1[2]. LOAD r1, ip2[2] LOAD r2, ip2[3] ADD r3, r1, r2 # Add ip2[2] and ip2[3]. STORE ip1[3], r3 # Store result in ip1[3]. ...
Example 2: Simple function. (a) C source code; (b) assembly code, assuming no aliasing; (c) assembly code, assuming aliasing.