
addi	r2, r0, 10		//size of arrays
addi	r3, r0, 50		//base address of A[]
addi	r4, r0, 100		//base address of B[] 
addi	r5, r0, 150		//base address of C[]
addi	r6, r0, 200		//base address of D[]
addi	r7, r0, 250		//base address of E[]
addi	r8, r0, 0		//i


init:
bge	r8, r2, doneinit	//if (r8 >= r2) goto doneinit

add	r9, r3, r8		// memlocation = base address + offset into A
st_d	0(r9), r8		// A[i] = i

add	r9, r4, r8		// memlocation = base address + offset into B
st_d	0(r9), r8		// B[i] = i

add	r9, r5, r8		// memlocation = base address + offset into C
st_d	0(r9), r8		// C[i] = i

add	r9, r6, r8		// memlocation = base address + offset into D
st_d	0(r9), r8		// D[i] = i

add	r9, r7, r8		// memlocation = base address + offset into E
st_d	0(r9), r8		// E[i] = i

addi	r8, r8, 1		// i++
j	init

doneinit:




addi	r8, r0, 0		// i=0
loop1:
bge	r8, r2, endloop1	// if (r8 >= r2) goto endloop1
	
add	r10, r5, r8		// memlocation C[i] = base addr of C + offset

add	r11, r3, r8		// memlocation A[i] = base addr of A + offset
ld_d	r14, 0(r11)		// r14 = A[i]

add	r12, r4, r8		// memlocation B[i] = base addr of B + offset
ld_d	r15, 0(r12)		// r14 = B[i]

add	r13, r14, r15		// r13 = A[] + B[]
st_d	0(r10), r13		// C[i] = r13

addi	r8, r8, 1		// i++
j	loop1			// goto loop1
	
endloop1:




addi	r8, r0, 0		// i=0
loop2:
bge	r8, r2, endloop2	// if (r8 >= r2) goto endloop2

add	r10, r6, r8		// memlocation D[i] = base addr of D + offset

add	r11, r5, r8		// memlocation C[i] = base addr of C + offset
ld_d	r14, 0(r11)		// r14 = C[i]

add	r12, r7, r8		// memlocation E[i] = base addr of E + offset
ld_d	r15, 0(r12)		// r14 = E[i]

add	r13, r14, 15		// r13 = C[] + E[]
st_d	0(r10), r13		// D[i] = r13

addi	r8, r8, 1		// i++
j	loop2			// goto loop2
endloop2:




addi	r8, r0, 0		// i=0
loop3:
bge	r8, r2, endloop3	// if (r8 >= r2) goto endloop3
	
add	r11, r3, r8		// memlocation A[i] = base addr of A + offset
ld_d	r14, 0(r11)		// r14 = A[i]

add	r12, r4, r8		// memlocation B[i] = base addr of B + offset
ld_d	r15, 0(r12)		// r14 = B[i]

add	r13, r14, 15		// r13 = A[] + B[]
st_d	0(r11), r13		// A[i] = r13

addi	r8, r8, 1		// i++
j	loop3			// goto loop3
endloop3:

exit





