At optimization level 2, the compiler is conservative in the optimization techniques it applies and should not affect program correctness. At optimization level 2, the following techniques are used:
a = c + d; f = c + d + e;the common expression c + d is saved from its first evaluation and is used in the subsequent statement to determine the value of f.