title: Assembly infinite loop
body: <p>My saga with x86 assembly continues, I'm getting into an infinite loop with this piece of code and I'm a bit puzzled.</p>
  
  <pre><code>movl $1, %ecx
  movl $4, %edi
  
  do_loop:
     cmpl %edi, %ecx
     je do_exit
     .........
     do_stuff
     .........
     incl %ecx
     jmp do_loop
  do_exit:
  </code></pre>
  
  <p>I'm expecting a jump to <strong>do_exit:</strong> when %ecx reaches 4 since it's incremented in every iteration</p>