// File: /workspace/github_cpp_makefile_star2_O1/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, 0x4(%rsp)
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r15
movb (%rdi), %cl
testl %edx, %edx
je 0xd5da
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
xorl %ebx, %ebx
movl $0x0, %eax
testb %cl, %cl
je 0xd652
testl %ebp, %ebp
jne 0xd3dd
cmpb $0x2a, (%r15)
jne 0xd6aa
cmpl $0x1, %ebp
adcq $0x0, %r15
movl %ebp, 0x10(%rsp)
movq %rbx, 0x8(%rsp)
cmpb $0x0, (%r15)
je 0xd638
movzbl (%r15), %ecx
cmpl $0x2a, %ecx
jne 0xd405
incq %r15
jmp 0xd3f7
testl %ecx, %ecx
jne 0xd41c
xorl %ecx, %ecx
testl %r12d, %r12d
movl $0x0, %eax
cmovgl %r12d, %eax
jmp 0xd5d0
movl %eax, 0x18(%rsp)
xorl %r13d, %r13d
movzbl (%r15,%r13), %eax
testl %eax, %eax
je 0xd436
cmpl $0x2a, %eax
je 0xd436
incq %r13
jmp 0xd423
testl %ebp, %ebp
jne 0xd487
testb %al, %al
jne 0xd487
testq %r13, %r13
je 0xd458
xorl %eax, %eax
cmpb $0x0, (%r14,%rax)
je 0xd562
incq %rax
cmpq %rax, %r13
jne 0xd445
leaq -0x1(%r14), %rdi
cmpb $0x0, 0x1(%rdi,%r13)
leaq 0x1(%rdi), %rdi
jne 0xd45c
movq %r15, %rsi
movl %r13d, %edx
movl 0x4(%rsp), %ecx
callq 0xd6c9
xorl %ecx, %ecx
testl %eax, %eax
jne 0xd40b
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0xd5d0
movl %r12d, 0x14(%rsp)
leaq (%r15,%r13), %rax
movq %rax, 0x28(%rsp)
leaq -0x1(%r13), %rax
movq %r14, 0x20(%rsp)
leaq 0x1(%r14), %rcx
movq %rcx, %r14
xorl %ebp, %ebp
movsbq (%r15,%rbp), %r12
cmpq $0x3f, %r12
jne 0xd4cc
cmpl %ebp, %eax
je 0xd55e
incq %r14
cmpb $0x0, (%rcx,%rbp)
leaq 0x1(%rbp), %rbp
jne 0xd4a7
jmp 0xd557
cmpl $0x0, 0x4(%rsp)
je 0xd4df
callq 0x23b0
movq (%rax), %rax
movb (%rax,%r12,4), %r12b
movq 0x20(%rsp), %rax
movb (%rax,%rbp), %bl
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testb %bl, %bl
je 0xd56c
leaq (%r15,%rbp), %rax
incq %rax
movq %rax, 0x30(%rsp)
notq %rbp
addq %r13, %rbp
movsbl %r12b, %eax
movl %eax, 0x1c(%rsp)
xorl %r12d, %r12d
cmpl $0x0, 0x4(%rsp)
je 0xd525
callq 0x23b0
movq (%rax), %rax
movsbq %bl, %rcx
movl (%rax,%rcx,4), %eax
jmp 0xd528
movsbl %bl, %eax
cmpl 0x1c(%rsp), %eax
jne 0xd545
movq %r14, %rdi
movq 0x30(%rsp), %rsi
movl %ebp, %edx
movl 0x4(%rsp), %ecx
callq 0xd6c9
testl %eax, %eax
jne 0xd569
movb (%r14), %bl
incq %r14
incl %r12d
testb %bl, %bl
jne 0xd50d
movq 0x8(%rsp), %rbx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
jmp 0xd571
xorl %ecx, %ecx
jmp 0xd571
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0xd5c7
movl %r12d, %ecx
movq 0x8(%rsp), %rbx
testl %ecx, %ecx
movq 0x20(%rsp), %r14
movl 0x10(%rsp), %ebp
movl 0x14(%rsp), %r12d
js 0xd59e
leal (%rcx,%rbx), %eax
testl %r12d, %r12d
cmovsl %eax, %r12d
addl %ecx, %r13d
addq %r13, %r14
movq 0x28(%rsp), %r15
movl 0x18(%rsp), %eax
jmp 0xd5a3
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
js 0xd5c7
movzbl (%r15), %ecx
cmpl $0x2a, %ecx
je 0xd5cb
testl %ecx, %ecx
jne 0xd66c
testl %ebp, %ebp
je 0xd68b
xorl %ecx, %ecx
movl %r12d, %eax
jmp 0xd5d0
xorl %ecx, %ecx
jmp 0xd5d0
incq %r15
movb $0x1, %cl
testb %cl, %cl
jne 0xd3ed
jmp 0xd652
xorl %r12d, %r12d
cmpb $0x2a, %cl
sete %r12b
negl %r12d
xorl %ebx, %ebx
movzbl (%r15,%rbx), %eax
cmpl $0x3f, %eax
je 0xd624
cmpl $0x2a, %eax
je 0xd661
testl %eax, %eax
je 0xd64a
cmpl $0x0, 0x4(%rsp)
je 0xd62d
movq %rbx, %r13
movsbq %al, %rbx
callq 0x23b0
movq (%rax), %rax
movsbq (%r14,%r13), %rcx
movl (%rax,%rcx,4), %ecx
cmpl (%rax,%rbx,4), %ecx
movq %r13, %rbx
je 0xd633
jmp 0xd643
cmpb $0x0, (%r14,%rbx)
jne 0xd633
jmp 0xd643
cmpb %al, (%r14,%rbx)
jne 0xd643
incq %rbx
jmp 0xd5e9
xorl %eax, %eax
testl %r12d, %r12d
cmovgl %r12d, %eax
jmp 0xd652
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0xd652
xorl %eax, %eax
cmpb (%r14,%rbx), %al
sbbl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq %rbx, %r14
addq %rbx, %r15
jmp 0xd3cf
leaq 0x56c0(%rip), %rdi      # 0x12d33
leaq 0x4e87(%rip), %rsi      # 0x12501
leaq 0x56bf(%rip), %rcx      # 0x12d40
movl $0x2329, %edx           # imm = 0x2329
callq 0x2140
leaq 0x56e0(%rip), %rdi      # 0x12d72
leaq 0x4e68(%rip), %rsi      # 0x12501
leaq 0x56a0(%rip), %rcx      # 0x12d40
movl $0x2325, %edx           # imm = 0x2325
callq 0x2140
leaq 0x5678(%rip), %rdi      # 0x12d29
leaq 0x4e49(%rip), %rsi      # 0x12501
leaq 0x5681(%rip), %rcx      # 0x12d40
movl $0x22f6, %edx           # imm = 0x22F6
callq 0x2140