Concept:
Compilers perform "Code Optimization" to improve performance without changing the program's output.
• Common Subexpression Elimination (CSE): Identifying identical expressions that compute the same value.
• Redundancy: Avoiding the re-calculation of a value that has already been computed.
Step 1: Identifying the redundancy.
In the given code, both $X$ and $Y$ are assigned the result of $(a * 2)$.
Assuming 'a' does not change between these lines, the calculation is performed twice.
Step 2: Applying Common Subexpression Elimination.
The compiler can store the result of the first calculation in a temporary register or variable.
For the second line, it simply assigns the stored value to $Y$.
Step 3: Efficiency Comparison.
Multiplication is a relatively expensive operation for a CPU.
A simple "copy" or "assignment" is much faster.
Thus, computing once and reusing is the most efficient transformation.