Load R2, N // Load the size of the list.
Clear R3 //Initialize sum to 0
Move R4, #NUM1 // Get address of the first number
. LOOP: Load R5, (R4)// Get the next number.
Add R3, R3, R5 // Add this numberto sum.
Add R4, R4, #4 //Increment the pointer to the list.
Branch_if [R2]>0 LOOP //Branch back if notfinished.
Subtract R2, R2, #1 // Decrement the counter.
Store R3, SUM //Store thefinal sum.
can we shift the sub instruction down to branch so that store will not be fetched since ID stage of Branch and If of sub will overlap
and in ID satge Branch change the pc value and will transfer the control to loop if true .