A computer which issues instructions in order, has only $2$ registers and $3$ opcodes $\text{ADD, SUB}$ and $\text{MOV}$. Consider $2$ different implementations of the following basic block :
$$\begin{array}{l|l}\text{Case 1} & \text{Case 2} \\ \hline t1=a+b;&t2=c+d;\\t2=c+d;&t3=e-t2;\\t3=e-t2;&t1=a+b;\\t4=t1-t2;&t4=t1-t2;\end{array}$$
Assume that all operands are initially in memory. Final value of computation also has to reside in memory. Which one is better in terms of memory accesses and by how many $\text{MOV}$ instructions?
- $\text{Case 2,2}$
- $\text{Case 2,3}$
- $\text{Case 1,2}$
- $\text{Case 1,3}$