@foone A properly groomed compiler will do the right thing here, not just common subexpression elimination, but also down to replacing the multiplication for array index aslculation by an addition for monotonically increasing indices.
I'd write that in whatever way brings the most clarity to the human reader.