title: Assembly + C - Sorting Structures
body: <p>I'm working on a project that uses x86 Assembly (NASM) and C together. There's a subroutine written in Assembly that uses indexed addressing modes to figure out if a certain year (int) is lesser or greater than another, then returns -1, 1, or 0 depending on the outcome. It appears that if I input more than about 4 or 5 records, it doesn't sort properly. I've spent a few hours running it through gdb and figured out that on the last iteration of incrementing j for the first time (before i is incremented), it runs the swap even though it shouldn't, but I'm not sure how to fix it just yet. Thanks in advance for any thoughts.</p>
  
  <p>---C code---</p>