I will re-write code based on versions of variable. The initial version of a variable $v$ shall be $v_0$
$a_0=1\\ b_0=10\\ c_0=20\\ d_0=a_0+b_0\\ e_0=c_0+d_0=c_0+a_0+b_0\\ f_0=c_0+e_0=c_0+c_0+a_0+b_0\\ b_1=c_0+e_0=f_0\\ e_1=b_1+f_0=f_0+f_0=b_1+b_1\\ d_1=5+e_1=5+f_0+f_0\\$
$return\,\,d_1+f_0=5+f_0+f_0+f_0\\$
(1)$Load\,R_1,a_0$
(2)$Load\,R_2,b_0$
(3)$Add\,R_1,R_2$(R1 now contains $d_0=a_0+b_0$)
(4)$Load\,R_2,c_0$
(5)$Add\,R_1,R_2$(R1 contains $e_0=c_0+a_0+b_0$)
(6)$Add \,R_1,R_2$(R1 now contains $f_0=c_0+e_0=c_0+c_0+a_0+b_0$)
(7) Now I know that the return value is $5+e_1=5+f_0+f_0+f_0$ and R1 contains $f_0$, I need to add $f_0$ two times more to the register R1, Load Register R2 with 5, Add it to the the register R1 and return contents of the Register $R_1$. And since, variables a,b,c,d,e,f are temporaries, means after execution of the code the values of a,b,c,d,e,f won't be required further and hence I don't need to store them in memory.
So, minimum registers required should be 2.