title: What exactly is the "as-if" rule?
body: <p>As the title says:</p>
  <blockquote>
  <p><strong><a href="https://en.cppreference.com/w/cpp/language/as_if" rel="noreferrer">What exactly is the &quot;as-if&quot; rule?</a></strong></p>
  </blockquote>
  <p>A typical answer one would get is:</p>
  <blockquote>
  <p>The rule that allows any and all code transformations that do not change the observable behavior of the program</p>
  </blockquote>
  <p>From time to time, we keep getting behaviors from certain implementations, which are attributed to this rule. Many times wrongly.</p>
  <p>So, what exactly is this rule? The standard does not clearly mention this rule as a section or paragraph, so what exactly falls under the purview of this rule?</p>
  <p>To me, it seems like a grey area which is not defined in detail by the standard. Can someone elaborate on the details, citing the references from the standard?</p>
  <p><sup>Note: Tagging this as C and C++ both, because it is relevant to both languages.</sup></p>