and(3+x)-1 = 2+x
4*(2*x - 1) = 8*x - 4
To find examples like this, one has to be willing to perform transformations using rules of arithmetic like commutativity and associativity while looking for constant sub-expressions.
really-big-constant + variable + pretty-big-constantIf the sum of the two constants is too big for the arithmetic type being used, combining the constants might result in an arithmetic overflow while, at run-time, the value of "variable" might have been a negative number big enough to avoid the overflow.
A "real compiler" has to be careful about these issues. We will ignore them (from here on).
display-pointer + disp(X) + 4*(i+1)(assuming the element of the array x occupy 4 units of memory).
( disp(X) + 4) + (4*i + display-pointer)makes it possible to use the "disp(x)+4" as such a displacement.