// File: /workspace/github_cpp_makefile_star2_O1/attractivechaos[P]udb2/stb/./stb.h
// Function: stb__reg_parse
static char *stb__reg_parse(stb_matcher *matcher, int start, char *regex, stb_uint16 *end)
{
   int n;
   int last_start = -1;
   stb_uint16 last_end = start;

   while (*regex) {
      switch (*regex) {
         case '(':
            last_start = last_end;
            regex = stb__reg_parse_alt(matcher, last_end, regex+1, &last_end);
            if (regex == NULL || *regex != ')')
               return NULL;
            ++regex;
            break;

         case '|':
         case ')':
            *end = last_end;
            return regex;

         case '?':
            if (last_start < 0) return NULL;
            stb__add_epsilon(matcher, last_start, last_end);
            ++regex;
            break;

         case '*':
            if (last_start < 0) return NULL;
            stb__add_epsilon(matcher, last_start, last_end);

            // fall through

         case '+':
            if (last_start < 0) return NULL;
            stb__add_epsilon(matcher, last_end, last_start);
            // prevent links back to last_end from chaining to last_start
            n = stb__add_node(matcher);
            stb__add_epsilon(matcher, last_end, n);
            last_end = n;
            ++regex;
            break;

         case '{':   // not supported!
            // @TODO: given {n,m}, clone last_start to last_end m times,
            // and include epsilons from start to first m-n blocks
            return NULL; 

         case '\\':
            ++regex;
            if (!*regex) return NULL;

            // fallthrough
         default: // match exactly this character
            n = stb__add_node(matcher);
            stb__add_edge(matcher, last_end, n, *regex);
            last_start = last_end;
            last_end = n;
            ++regex;
            break;

         case '$':
            n = stb__add_node(matcher);
            stb__add_edge(matcher, last_end, n, '\n');
            last_start = last_end;
            last_end = n;
            ++regex;
            break;

         case '.':
            n = stb__add_node(matcher);
            stb__add_edge(matcher, last_end, n, -1);
            last_start = last_end;
            last_end = n;
            ++regex;
            break;

         case '[': {
            stb_uint8 flags[256];
            int invert = 0,z;
            ++regex;
            if (matcher->num_charset == 0) {
               matcher->charset = (stb_uint *) stb_malloc(matcher, sizeof(*matcher->charset) * 256);
               memset(matcher->charset, 0, sizeof(*matcher->charset) * 256);
            }

            memset(flags,0,sizeof(flags));

            // leading ^ is special
            if (*regex == '^')
               ++regex, invert = 1;

            // leading ] is special
            if (*regex == ']') {
               flags[']'] = 1;
               ++regex;
            }
            while (*regex != ']') {
               stb_uint a;
               if (!*regex) return NULL;
               a = *regex++;
               if (regex[0] == '-' && regex[1] != ']') {
                  stb_uint i,b = regex[1];
                  regex += 2;
                  if (b == 0) return NULL;
                  if (a > b) return NULL;
                  for (i=a; i <= b; ++i)
                     flags[i] = 1;
               } else
                  flags[a] = 1;
            }
            ++regex;
            if (invert) {
               int i;
               for (i=0; i < 256; ++i)
                  flags[i] = 1-flags[i];
            }

            // now check if any existing charset matches
            for (z=0; z < matcher->num_charset; ++z) {
               int i, k[2] = { 0, 1 << z};
               for (i=0; i < 256; ++i) {
                  unsigned int f = k[flags[i]];
                  if ((matcher->charset[i] & k[1]) != f)
                     break;
               }
               if (i == 256) break;
            }

            if (z == matcher->num_charset) {
               int i;
               ++matcher->num_charset;
               if (matcher->num_charset > 32) {
                  assert(0); /* NOTREACHED */
                  return NULL; // too many charsets, oops
               }
               for (i=0; i < 256; ++i)
                  if (flags[i])
                     matcher->charset[i] |= (1 << z);
            }

            n = stb__add_node(matcher);
            stb__add_edge(matcher, last_end, n, -2 - z);
            last_start = last_end;
            last_end = n;
            break;
         }
      }
   }
   *end = last_end;
   return regex;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rcx, 0x18(%rsp)
movq %rdx, %rbx
movq %rdi, %r15
leaq 0xe(%rsp), %rax
movw %si, (%rax)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
leaq 0x1145(%rip), %r14      # 0x12304
movzwl 0xe(%rsp), %r13d
incq %rbx
movzbl -0x1(%rbx), %eax
cmpl $0x3e, %eax
jg 0x11235
leal -0x24(%rax), %ecx
cmpl $0xa, %ecx
ja 0x1128b
movslq (%r14,%rcx,4), %rax
addq %r14, %rax
jmpq *%rax
testl %ebp, %ebp
js 0x114ec
movzwl %r13w, %edx
movq %r15, %rdi
movl %ebp, %esi
callq 0x110a9
testl %ebp, %ebp
js 0x114ec
movzwl %r13w, %r12d
movq %r15, %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x110a9
movq %r15, %rdi
callq 0x11027
movl %eax, %r13d
movq %r15, %rdi
movl %r12d, %esi
movl %eax, %edx
callq 0x110a9
movw %r13w, 0xe(%rsp)
jmp 0x111c5
cmpl $0x5a, %eax
jg 0x1125a
cmpl $0x3f, %eax
jne 0x11293
testl %ebp, %ebp
js 0x114ec
movzwl %r13w, %edx
movq %r15, %rdi
movl %ebp, %esi
callq 0x110a9
jmp 0x111c5
cmpl $0x7a, %eax
jg 0x11277
cmpl $0x5b, %eax
je 0x1133b
cmpl $0x5c, %eax
jne 0x11293
cmpb $0x0, (%rbx)
jne 0x11296
jmp 0x114ec
cmpl $0x7b, %eax
je 0x114ec
cmpl $0x7c, %eax
je 0x114f0
jmp 0x11293
testl %eax, %eax
je 0x114f0
decq %rbx
movq %r15, %rdi
callq 0x11027
movl %eax, %r12d
movzwl 0xe(%rsp), %ebp
movsbl (%rbx), %ecx
movq %r15, %rdi
movl %ebp, %esi
movl %eax, %edx
callq 0x11534
movw %r12w, 0xe(%rsp)
jmp 0x112e9
movzwl 0xe(%rsp), %ebp
movq %r15, %rdi
movl %ebp, %esi
movq %rbx, %rdx
leaq 0xe(%rsp), %rcx
callq 0xd9e8
testq %rax, %rax
je 0x114ec
movq %rax, %rbx
cmpb $0x29, (%rax)
jne 0x114ec
incq %rbx
jmp 0x111bf
movq %r15, %rdi
callq 0x11027
movl %eax, %r12d
movzwl 0xe(%rsp), %ebp
movq %r15, %rdi
movl %ebp, %esi
movl %eax, %edx
movl $0xa, %ecx
jmp 0x1132b
movq %r15, %rdi
callq 0x11027
movl %eax, %r12d
movzwl 0xe(%rsp), %ebp
movq %r15, %rdi
movl %ebp, %esi
movl %eax, %edx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x11534
movw %r12w, 0xe(%rsp)
jmp 0x111bf
cmpl $0x0, 0x10(%r15)
jne 0x1136d
movl 0x8eec(%rip), %ecx      # 0x1a234
movl $0x400, %esi            # imm = 0x400
movq %r15, %rdi
movl $0x2, %edx
callq 0x5184
movq %rax, 0x8(%r15)
movl $0x400, %edx            # imm = 0x400
movq %rax, %rdi
xorl %esi, %esi
callq 0x2160
movl $0x100, %edx            # imm = 0x100
leaq 0x20(%rsp), %rdi
xorl %esi, %esi
callq 0x2160
movb (%rbx), %al
leaq 0x1(%rbx), %rcx
cmpb $0x5e, %al
cmovneq %rbx, %rcx
cmpb $0x5d, (%rcx)
jne 0x11397
movb $0x1, 0x7d(%rsp)
incq %rcx
movdqa 0xe41(%rip), %xmm1      # 0x121e0
movq %rcx, %rbx
movsbl (%rbx), %r12d
cmpl $0x5d, %r12d
je 0x113f5
testb %r12b, %r12b
je 0x113d8
cmpb $0x2d, 0x1(%rbx)
jne 0x113c0
movsbl 0x2(%rbx), %ecx
cmpl $0x5d, %ecx
jne 0x113cf
incq %rbx
movl %r12d, %ecx
movb $0x1, 0x20(%rsp,%rcx)
movb $0x1, %cl
jmp 0x113da
addq $0x3, %rbx
cmpb %cl, %r12b
jbe 0x113e3
xorl %ecx, %ecx
testb %cl, %cl
jne 0x113a2
jmp 0x114e2
movl %r12d, %edx
movl %edx, %esi
movb $0x1, 0x20(%rsp,%rsi)
incl %edx
cmpl %ecx, %edx
jbe 0x113e6
jmp 0x113cb
cmpb $0x5e, %al
jne 0x11417
xorl %eax, %eax
movdqa %xmm1, %xmm0
psubb 0x20(%rsp,%rax), %xmm0
movdqa %xmm0, 0x20(%rsp,%rax)
addq $0x10, %rax
cmpq $0x100, %rax            # imm = 0x100
jne 0x113fb
movl 0x10(%r15), %eax
testl %eax, %eax
jle 0x11477
movq 0x8(%r15), %rdx
xorl %r13d, %r13d
movl $0x1, %esi
movl %r13d, %ecx
shll %cl, %esi
movl $0x0, 0x10(%rsp)
movl %esi, 0x14(%rsp)
xorl %ecx, %ecx
movzbl 0x20(%rsp,%rcx), %edi
movl (%rdx,%rcx,4), %r8d
andl %esi, %r8d
cmpl 0x10(%rsp,%rdi,4), %r8d
jne 0x11462
incq %rcx
cmpq $0x100, %rcx            # imm = 0x100
jne 0x1143e
movl $0x100, %ecx            # imm = 0x100
cmpl $0x100, %ecx            # imm = 0x100
je 0x1147a
incl %r13d
cmpl %eax, %r13d
jne 0x11426
movl %eax, %r13d
jmp 0x1147a
xorl %r13d, %r13d
cmpl %eax, %r13d
jne 0x114b5
leal 0x1(%rax), %ecx
movl %ecx, 0x10(%r15)
cmpl $0x1f, %eax
jg 0x11515
movl $0x1, %eax
movl %r13d, %ecx
shll %cl, %eax
xorl %ecx, %ecx
cmpb $0x0, 0x20(%rsp,%rcx)
je 0x114a9
movq 0x8(%r15), %rdx
orl %eax, (%rdx,%rcx,4)
incq %rcx
cmpq $0x100, %rcx            # imm = 0x100
jne 0x1149b
incq %rbx
movq %r15, %rdi
callq 0x11027
movzwl 0xe(%rsp), %ebp
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
subl %r13d, %ecx
movq %r15, %rdi
movl %ebp, %esi
movl %eax, %r13d
movl %eax, %edx
callq 0x11534
movw %r13w, 0xe(%rsp)
cmpb $0x5d, %r12b
je 0x111bf
xorl %ebx, %ebx
jmp 0x11500
movzwl 0xe(%rsp), %eax
movq 0x18(%rsp), %rcx
movw %ax, (%rcx)
decq %rbx
movq %rbx, %rax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x130a(%rip), %rdi      # 0x12826
leaq 0xfde(%rip), %rsi       # 0x12501
leaq 0x1d66(%rip), %rcx      # 0x13290
movl $0x242d, %edx           # imm = 0x242D
callq 0x2140