title: MIPS Assembler trouble - Arrays
body: <p>I have an assembly code containing an array, and I simply cannot understand what actually the result in the $s2 register shows. If someone could help and explain or simplify it for me that would be great.
  Here's the code:</p>
  
  <pre><code>.data     arr:     .word     3 2 -6 1 4 10 530 115 2231 1422
            arrSize: .word 10
  .text
  .global   main
  
  main:
  la        $s0, arr
  la        $t0, arrSize
  lw        $s1, 0($t0)
  add       $s2, $zero, $zero
  
  loop:
  lw        $t1, 0($s0)
  andi      $t2, $t1, 1
  bne       $t2, $zero, skip
  addi      $s2, $s2, 1
  
  skip:
  addi      $s0, $s0, 4
  addi      $s1, $s1, -1
  bne       $s1, $zero, loop  
  
  end:
  add       $v0, $zero, $s2
  </code></pre>