title: Why this `cmovnel` does not work as intended?
body: <p>Please test out this code:</p>
  <pre><code>#include &lt;stdio.h&gt;
  
  unsigned f(unsigned x) {
      unsigned res;
      asm(
          &quot;movl $4, %0\n\t&quot;
          &quot;testl %1, %1\n\t&quot;
          &quot;cmovnel %1, %0\n\t&quot;
          : &quot;=r&quot;(res)
          : &quot;r&quot;(x)
          : &quot;cc&quot;
      );
      return res;
  }
  
  int main() {
      for (unsigned i = 0; i &lt; 10; ++ i)
          printf(&quot;%u, &quot;, f(i));
      return 0;
  }
  </code></pre>
  <p>As you see, the function <code>f(x)</code> is basically:</p>
  <pre><code>unsigned f(unsigned x) {
      return f ? f : 4;
  }
  </code></pre>
  <p>The problem is that sometimes it returns the correct result, sometimes it does not.</p>
  <p>If you run the above code on <a href="http://cpp.sh/" rel="nofollow noreferrer">cpp.sh</a>, you can get the intended behavior. It prints 4, 1, 2, 3 ...</p>
  <p>But if you run it on <a href="https://www.programiz.com/c-programming/online-compiler/" rel="nofollow noreferrer">programiz online compiler</a>, you will get 4, 4, 4, 4 ...</p>
  <p>When I ran it locally, I got 4, 4, 4, 4 ...</p>
  <p>What is the problem with this piece of code? Thank you.</p>