title: Skipping instruction in ARM assembly
body: <p>Im not experienced in writing Assembly at all, so I have this rather easy to answer question I guess.</p>
  
  <p>Having this simple loop:</p>
  
  <pre><code>mov r0,#3
  loop:
     do some instructions
     ...
     last-instruction
  
  subs r0,r0,#1
  bne loop
  afterloop:
  </code></pre>
  
  <p>If I understand well, this loop should decrease from 3 to 0 and stop (correct me if Im wrong).</p>
  
  <p>However,in the last iteration when r0 == 0 I want to skip the <code>last-instruction</code> and step out of the loop. I presume there has to be some <code>cmp</code> if r0 equals 0 then jump to <code>afterloop</code>. But I guess there might be some easier way to achieve this.</p>
  
  <p><strong>EDIT:</strong>
  One more question - what if there's more instructions to be skipped?</p>
  
  <p>In C it would look like this:</p>
  
  <pre><code>int i = 3;
  while (1) {
    foo();
  
    if (i == 0) break;
    skipped_func();
    --i;
  }
  </code></pre>