&gt;  Can assert() actually function this way? Can you use assert to tell the optimizer it can assume something is true?<p>Trivially.<p><pre><code>  #ifdef NDEBUG
  # define assert_and_assume(cond) if(!(cond))     
    __builtin_unreachable((cond))
  #else
  # define assert_and_assume assert
  #endif</code></pre>