// File: /workspace/github_cpp_makefile_star2_O2/attractivechaos[P]udb2/stb/./stb.h
// Function: stb__wildmatch_raw2
int stb__wildmatch_raw2(char *expr, char *candidate, int search, int insensitive)
{
   int where=0;
   int start = -1;
   
   if (!search) {
      // parse to first '*'
      if (*expr != '*')
         start = 0;
      while (*expr != '*') {
         if (!*expr)
            return *candidate == 0 ? 0 : -1;
         if (*expr == '?') {
            if (!*candidate) return -1;
         } else {
            if (insensitive) {
               if (tolower(*candidate) != tolower(*expr))
                  return -1;
            } else 
               if (*candidate != *expr)
                  return -1;
         }
         ++candidate, ++expr, ++where;
      }
   } else {
      // 0-length search string
      if (!*expr)
         return 0;
   }

   assert(search || *expr == '*');
   if (!search)
      ++expr;

   // implicit '*' at this point
      
   while (*expr) {
      int o=0;
      // combine redundant * characters
      while (expr[0] == '*') ++expr;

      // ok, at this point, expr[-1] == '*',
      // and expr[0] != '*'

      if (!expr[0]) return start >= 0 ? start : 0;

      // now find next '*'
      o = 0;
      while (expr[o] != '*') {
         if (expr[o] == 0)
            break;
         ++o;
      }
      // if no '*', scan to end, then match at end
      if (expr[o] == 0 && !search) {
         int z;
         for (z=0; z < o; ++z)
            if (candidate[z] == 0)
               return -1;
         while (candidate[z])
            ++z;
         // ok, now check if they match
         if (stb__match_qstring(candidate+z-o, expr, o, insensitive))
            return start >= 0 ? start : 0;
         return -1; 
      } else {
         // if yes '*', then do stb__find_qmatch on the intervening chars
         int n = stb__find_qstring(candidate, expr, o, insensitive);
         if (n < 0)
            return -1;
         if (start < 0)
            start = where + n;
         expr += o;
         candidate += n+o;
      }

      if (*expr == 0) {
         assert(search);
         return start;
      }

      assert(*expr == '*');
      ++expr;
   }

   return start >= 0 ? start : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %ecx, %r13d
movq %rsi, %r14
movq %rdi, %r15
movb (%rdi), %bl
movl %edx, 0x4(%rsp)
testl %edx, %edx
je 0xbd71
xorl %esi, %esi
testb %bl, %bl
je 0xbdd0
pushq $-0x1
popq %r12
movq %r14, 0x8(%rsp)
cmpl $0x1, 0x4(%rsp)
adcq $0x0, %r15
movq %rsi, 0x30(%rsp)
movb (%r15), %r14b
testb %r14b, %r14b
je 0xbe27
incq %r15
cmpb $0x2a, %r14b
jne 0xbc29
movb (%r15), %r14b
jmp 0xbc1b
movzbl %r14b, %eax
testl %eax, %eax
je 0xbe27
movl %r13d, (%rsp)
leaq -0x1(%r15), %rax
xorl %edx, %edx
movzbl %r14b, %r13d
testb %r13b, %r13b
je 0xbc57
cmpl $0x2a, %r13d
je 0xbc57
movb (%r15,%rdx), %r14b
incq %rdx
jmp 0xbc3f
cmpl $0x0, 0x4(%rsp)
jne 0xbc67
testb %r14b, %r14b
je 0xbde9
movl %r12d, 0x18(%rsp)
movq %rdx, 0x20(%rsp)
leaq -0x1(%rdx), %rcx
movq 0x8(%rsp), %rdx
leaq 0x1(%rdx), %rbx
xorl %r12d, %r12d
movsbq (%rax), %rbp
cmpq $0x3f, %rbp
jne 0xbcb1
cmpl %r12d, %ecx
je 0xbd37
incq %rax
incq %rbx
movq 0x8(%rsp), %rdx
cmpb $0x0, 0x1(%rdx,%r12)
leaq 0x1(%r12), %r12
jne 0xbc81
jmp 0xbe05
cmpl $0x0, (%rsp)
je 0xbcc3
callq 0x23a0
movq (%rax), %rax
movb (%rax,%rbp,4), %bpl
leaq (%r15,%r12), %rax
movq %rax, 0x28(%rsp)
notq %r12
addq 0x20(%rsp), %r12
movsbl %bpl, %eax
movl %eax, 0x1c(%rsp)
movq $0x0, 0x10(%rsp)
movsbq -0x1(%rbx), %rbp
testq %rbp, %rbp
je 0xbe05
cmpl $0x0, (%rsp)
je 0xbd04
callq 0x23a0
movq (%rax), %rax
movl (%rax,%rbp,4), %ebp
cmpl 0x1c(%rsp), %ebp
jne 0xbd26
movq %rbx, %rdi
movq 0x28(%rsp), %rsi
movl %r12d, %edx
movl (%rsp), %ecx
callq 0xbe8c
movq 0x30(%rsp), %rsi
testl %eax, %eax
jne 0xbd3b
incq %rbx
movq 0x10(%rsp), %rax
incl %eax
movq %rax, 0x10(%rsp)
jmp 0xbce5
xorl %ecx, %ecx
jmp 0xbd40
movq 0x10(%rsp), %rcx
leal (%rcx,%rsi), %eax
movl 0x18(%rsp), %r12d
testl %r12d, %r12d
cmovsl %eax, %r12d
cmpb $0x2a, %r14b
movq 0x20(%rsp), %rax
jne 0xbe3f
addl %eax, %ecx
addq %rcx, 0x8(%rsp)
addq %rax, %r15
movl (%rsp), %r13d
jmp 0xbc0f
xorl %r12d, %r12d
cmpb $0x2a, %bl
sete %r12b
negl %r12d
xorl %esi, %esi
cmpb $0x3f, %bl
je 0xbdb7
movzbl %bl, %eax
cmpl $0x2a, %eax
je 0xbdde
testl %eax, %eax
je 0xbdd4
testl %r13d, %r13d
je 0xbdc0
movq %rsi, %rbp
callq 0x23a0
movq %rbp, %rsi
movq (%rax), %rax
movsbq (%r14,%rbp), %rcx
movl (%rax,%rcx,4), %ecx
movsbq %bl, %rdx
cmpl (%rax,%rdx,4), %ecx
je 0xbdc6
jmp 0xbe05
cmpb $0x0, (%r14,%rsi)
jne 0xbdc6
jmp 0xbe05
cmpb %bl, (%r14,%rsi)
jne 0xbe05
movb 0x1(%r15,%rsi), %bl
incq %rsi
jmp 0xbd80
xorl %eax, %eax
jmp 0xbe30
xorl %eax, %eax
cmpb (%r14,%rsi), %al
sbbl %eax, %eax
jmp 0xbe30
addq %rsi, %r14
addq %rsi, %r15
jmp 0xbbfc
decq %r15
xorl %eax, %eax
movl (%rsp), %ecx
movq 0x8(%rsp), %rdi
cmpq %rax, %rdx
je 0xbe0a
cmpb $0x0, (%rdi,%rax)
leaq 0x1(%rax), %rax
jne 0xbdf6
pushq $-0x1
popq %rax
jmp 0xbe30
decq %rdi
cmpb $0x0, 0x1(%rdi,%rdx)
leaq 0x1(%rdi), %rdi
jne 0xbe0d
movq %r15, %rsi
callq 0xbe8c
testl %eax, %eax
pushq $-0x1
popq %rax
je 0xbe30
xorl %eax, %eax
testl %r12d, %r12d
cmovgl %r12d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %r13d, %r13d
jne 0xbe6d
movl %r12d, %eax
cmpl $0x0, 0x4(%rsp)
jne 0xbe30
leaq 0x4e26(%rip), %rdi      # 0x10c7b
leaq 0x45c5(%rip), %rsi      # 0x10421
leaq 0x4de6(%rip), %rcx      # 0x10c49
movl $0x2325, %edx           # imm = 0x2325
callq 0x2140
leaq 0x4e0e(%rip), %rdi      # 0x10c82
leaq 0x45a6(%rip), %rsi      # 0x10421
leaq 0x4dc7(%rip), %rcx      # 0x10c49
movl $0x2329, %edx           # imm = 0x2329
callq 0x2140