// File: /workspace/github_c_makefile_star2_O0/LenShustek[P]miditones/miditones.c
// Function: queue_find_playnote
int queue_find_playnote(int search_ndx) {
   if (loggen) fprintf(logfile, "      queue_find_playnote(%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_PLAYNOTE // must match playnote
            && queue[ndx].note.channel == queue[search_ndx].note.channel //also channel, track, note, and instrument
            && queue[ndx].note.track == queue[search_ndx].note.track
            && 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, 0x7f04(%rip)      # 0xb303
je 0x3449
movq 0x7f10(%rip), %rax      # 0xb318
movq %rax, (%rsp)
movl 0x10(%rsp), %eax
movl %eax, 0x8(%rsp)
movslq 0x10(%rsp), %rax
leaq 0x9f20(%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 0x4c22(%rip), %rsi      # 0x8064
movb $0x0, %al
callq 0x10a0
movl 0x9edd(%rip), %eax      # 0xd32c
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x10(%rsp), %eax
je 0x358b
movslq 0xc(%rsp), %rcx
leaq 0x9ed3(%rip), %rax      # 0xd340
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
cmpb $0x0, 0x1(%rax)
jne 0x358b
movslq 0xc(%rsp), %rcx
leaq 0x9eb6(%rip), %rax      # 0xd340
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movzbl (%rax), %eax
cmpl $0x90, %eax
jne 0x358b
movslq 0xc(%rsp), %rcx
leaq 0x9e95(%rip), %rax      # 0xd340
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movslq 0x10(%rsp), %rdx
leaq 0x9e7f(%rip), %rcx      # 0xd340
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
cmpl 0xc(%rcx), %eax
jne 0x358b
movslq 0xc(%rsp), %rcx
leaq 0x9e63(%rip), %rax      # 0xd340
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movslq 0x10(%rsp), %rdx
leaq 0x9e4d(%rip), %rcx      # 0xd340
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x8(%rcx), %eax
jne 0x358b
movslq 0xc(%rsp), %rcx
leaq 0x9e31(%rip), %rax      # 0xd340
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movslq 0x10(%rsp), %rdx
leaq 0x9e1b(%rip), %rcx      # 0xd340
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x10(%rcx), %eax
jne 0x358b
movslq 0xc(%rsp), %rcx
leaq 0x9e03(%rip), %rax      # 0xd340
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movslq 0x10(%rsp), %rdx
leaq 0x9ded(%rip), %rcx      # 0xd340
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x14(%rcx), %eax
jne 0x358b
testb $0x1, 0x7d9d(%rip)      # 0xb303
je 0x3581
movq 0x7da9(%rip), %rdi      # 0xb318
movl 0xc(%rsp), %edx
leaq 0x4b0e(%rip), %rsi      # 0x8088
movb $0x0, %al
callq 0x10a0
movl 0xc(%rsp), %eax
movl %eax, 0x14(%rsp)
jmp 0x35dc
movl 0xc(%rsp), %eax
cmpl 0x9d93(%rip), %eax      # 0xd328
jne 0x3599
jmp 0x35b6
movl 0xc(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xc(%rsp)
cmpl $0x0, %eax
jge 0x35b1
movl $0x63, 0xc(%rsp)
jmp 0x3453
testb $0x1, 0x7d46(%rip)      # 0xb303
je 0x35d4
movq 0x7d52(%rip), %rdi      # 0xb318
leaq 0x4ac9(%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)