RegisterToAssocHelper[stateReg_,instructions_,acc_,num_]:=Module[{instr,list},instr=instructions[[1]];(*Print[acc];*)list=Lookup[acc,instr[[1]]];If[instructions=={},acc,If[instr[[2]]=="+",If[instr[[3]]==0,RegisterToAssocHelper[stateReg,Drop[instructions,1],Append[acc,instr[[1]]->Join[list,{{num,{0,0}}}]],num+1],RegisterToAssocHelper[stateReg,Drop[instructions,1],Append[acc,instr[[1]]->Join[list,{{num,{instr[[3]],Lookup[stateReg,instr[[3]]]}}}]],num+1]],If[instr[[3]]==0&&instr[[4]]==0,RegisterToAssocHelper[stateReg,Drop[instructions,1],Append[acc,instr[[1]]->Join[list,{{num,{0,0},{0,0}}}]],num+1],If[instr[[3]]==0,RegisterToAssocHelper[stateReg,Drop[instructions,1],Append[acc,instr[[1]]->Join[list,{{num,{instr[[4]],Lookup[stateReg,instr[[4]]]},{0,0}}}]],num+1],If[instr[[4]]==0,RegisterToAssocHelper[stateReg,Drop[instructions,1],Append[acc,instr[[1]]->Join[list,{{num,{0,0},{instr[[3]],Lookup[stateReg,instr[[3]]]}}}]],num+1],RegisterToAssocHelper[stateReg,Drop[instructions,1],Append[acc,instr[[1]]->Join[list,{{num,{instr[[4]],Lookup[stateReg,instr[[4]]]},{instr[[3]],Lookup[stateReg,instr[[3]]]}}}]],num+1]]]]]]]