Use the peephole methods of load/store, jump over jump, and simple algebraic optimiza-tion to improve the following Mini program segment:
CMP R1,a,2 // JMP if R1 < a
JMP L1
CMP 0,0,0
JMP L2
L1:
LOD R1,b
ADD R1,c
STO R1,T1
LOD R1,T1
SUB R1,a
STO R1,T2
LOD R1,T2
STO R1,a
SUB R1,0
STO R1,b
L2:
CMP R1,a,2 // Jump Over Jump
JMP L1
CMP 0,0,0
JMP L2
L1:
LOD R1,b
ADD R1,c
STO R1,T1 // Load/Store
LOD R1,T1
SUB R1,a
STO R1,T2 // Load/Store
LOD R1,T2
STO R1,a
SUB R1,0 // Algebraic
STO R1,b
L2:
// optimized code
CMP R1,a,5 // JMP if R1 >= a
JMP L2
LOD R1,b
ADD R1,c
SUB R1,a
STO R1,a
STO R1,b
L2: