// File: /workspace/github_c_makefile_star2_O0/LenShustek[P]miditones/miditones.c
// Function: queue_find_stopnote
int queue_find_stopnote(int search_ndx) {
   if (loggen) fprintf(logfile, "      queue_find_stopnote(%d), %s: ", search_ndx, describe(&queue[search_ndx].note));
   for (int ndx = queue_newest_ndx;;) {
      if (ndx != search_ndx // don't look at the entry we're trying to match
            && !queue[ndx].delete // don't re-find queue entries already deleted
            && queue[ndx].cmd == CMD_STOPNOTE // must match stopnote
            && queue[ndx].note.time_usec == queue[search_ndx].note.time_usec // also time, note, and instrument
            && queue[ndx].note.note == queue[search_ndx].note.note
            && queue[ndx].note.instrument == queue[search_ndx].note.instrument) {
         if (loggen) fprintf(logfile, "found ndx %d\n", ndx);
         return ndx; }
      if (ndx == queue_oldest_ndx) break;
      if (--ndx < 0) ndx = QUEUE_SIZE - 1; }
   if (loggen) fprintf(logfile, "not found\n");
   return -1; }

// Assembly:
subq $0x18, %rsp
movl %edi, 0x10(%rsp)
testb $0x1, 0x7d04(%rip)      # 0xb303
je 0x3649
movq 0x7d10(%rip), %rax      # 0xb318
movq %rax, (%rsp)
movl 0x10(%rsp), %eax
movl %eax, 0x8(%rsp)
movslq 0x10(%rsp), %rax
leaq 0x9d20(%rip), %rdi      # 0xd340
imulq $0x1c, %rax, %rax
addq %rax, %rdi
addq $0x4, %rdi
callq 0x2260
movq (%rsp), %rdi
movl 0x8(%rsp), %edx
movq %rax, %rcx
leaq 0x4a5f(%rip), %rsi      # 0x80a1
movb $0x0, %al
callq 0x10a0
movl 0x9cdd(%rip), %eax      # 0xd32c
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x10(%rsp), %eax
je 0x3759
movslq 0xc(%rsp), %rcx
leaq 0x9cd3(%rip), %rax      # 0xd340
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
cmpb $0x0, 0x1(%rax)
jne 0x3759
movslq 0xc(%rsp), %rcx
leaq 0x9cb6(%rip), %rax      # 0xd340
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movzbl (%rax), %eax
cmpl $0x80, %eax
jne 0x3759
movslq 0xc(%rsp), %rcx
leaq 0x9c95(%rip), %rax      # 0xd340
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movslq 0x10(%rsp), %rdx
leaq 0x9c7f(%rip), %rcx      # 0xd340
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
jne 0x3759
movslq 0xc(%rsp), %rcx
leaq 0x9c63(%rip), %rax      # 0xd340
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movslq 0x10(%rsp), %rdx
leaq 0x9c4d(%rip), %rcx      # 0xd340
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x10(%rcx), %eax
jne 0x3759
movslq 0xc(%rsp), %rcx
leaq 0x9c35(%rip), %rax      # 0xd340
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movslq 0x10(%rsp), %rdx
leaq 0x9c1f(%rip), %rcx      # 0xd340
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x14(%rcx), %eax
jne 0x3759
testb $0x1, 0x7bcf(%rip)      # 0xb303
je 0x374f
movq 0x7bdb(%rip), %rdi      # 0xb318
movl 0xc(%rsp), %edx
leaq 0x4940(%rip), %rsi      # 0x8088
movb $0x0, %al
callq 0x10a0
movl 0xc(%rsp), %eax
movl %eax, 0x14(%rsp)
jmp 0x37aa
movl 0xc(%rsp), %eax
cmpl 0x9bc5(%rip), %eax      # 0xd328
jne 0x3767
jmp 0x3784
movl 0xc(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xc(%rsp)
cmpl $0x0, %eax
jge 0x377f
movl $0x63, 0xc(%rsp)
jmp 0x3653
testb $0x1, 0x7b78(%rip)      # 0xb303
je 0x37a2
movq 0x7b84(%rip), %rdi      # 0xb318
leaq 0x48fb(%rip), %rsi      # 0x8096
movb $0x0, %al
callq 0x10a0
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
movl 0x14(%rsp), %eax
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)