// File: /workspace/github_cpp_makefile_star2_O2/attractivechaos[P]udb2/stb/./stb.h
// Function: stb__matcher_dfa
static int stb__matcher_dfa(stb_matcher *m, char *str_c, int *len)
{
   stb_uint8 *str = (stb_uint8 *) str_c;
   stb_int16 node,prevnode;
   stb_dfa *trans;
   int match_length = 0;
   stb_int16 match_result=0;

   if (m->dfa_start == STB__DFA_UNDEF) {
      stb_uint16 *list;

      m->num_words_per_dfa = (stb_arr_len(m->nodes)+31) >> 5;
      stb__optimize(m);

      list = stb__add_if_inactive(m, NULL, m->start_node);
      list = stb__eps_closure(m,list);
      if (m->does_lex) {
         m->dfa_start = stb__get_dfa_node(m,list);
         stb__clear(m, list);
         // DON'T allow start state to be a goal state!
         // this allows people to specify regexes that can match 0
         // characters without them actually matching (also we don't
         // check _before_ advancing anyway
         if (m->dfa_start <= STB__DFA_MGOAL)
            m->dfa_start = -(m->dfa_start - STB__DFA_MGOAL);
      } else {
         if (stb__clear_goalcheck(m, list))
            m->dfa_start = STB__DFA_GOAL;
         else
            m->dfa_start = stb__get_dfa_node(m,list);
      }
      stb_arr_free(list);
   }

   prevnode = STB__DFA_UNDEF;
   node = m->dfa_start;
   trans = m->dfa;

   if (m->dfa_start == STB__DFA_GOAL)
      return 1;

   for(;;) {
      assert(node >= STB__DFA_VALID);

      // fast inner DFA loop; especially if STB__DFA_VALID is 0

      do {
         prevnode = node;
         node = trans[node].transition[*str++];
      } while (node >= STB__DFA_VALID);

      assert(node >= STB__DFA_MGOAL - stb_arr_len(m->dfa));
      assert(node < stb_arr_len(m->dfa));

      // special case for lex: need _longest_ match, so notice goal
      // state without stopping
      if (node <= STB__DFA_MGOAL) {
         match_length = str - (stb_uint8 *) str_c;
         node = -(node - STB__DFA_MGOAL);
         match_result = node;
         continue;
      }

      // slow NFA->DFA conversion

      // or we hit the goal or the end of the string, but those
      // can only happen once per search...

      if (node == STB__DFA_UNDEF) {
         // build a list  -- @TODO special case <= 32 states
         // heck, use a more compact data structure for <= 16 and <= 8 ?!

         // @TODO keep states/newstates around instead of reallocating them
         stb_uint16 *states = NULL;
         stb_uint16 *newstates = NULL;
         int i,j,y,z;
         stb_uint32 *flags = &m->dfa_mapping[prevnode * m->num_words_per_dfa];
         assert(prevnode != STB__DFA_UNDEF);
         stb_arr_setsize(states, 4);
         stb_arr_setsize(newstates,4);
         for (j=0; j < m->num_words_per_dfa; ++j) {
            for (i=0; i < 32; ++i) {
               if (*flags & (1 << i))
                  stb_arr_push(states, j*32+i);
            }
            ++flags;
         }
         // states is now the states we were in in the previous node;
         // so now we can compute what node it transitions to on str[-1]

         y = stb_arr_len(states);
         for (i=0; i < y; ++i) {
            stb_nfa_node *n = &m->nodes[(int) states[i]];
            z = stb_arr_len(n->out);
            for (j=0; j < z; ++j) {
               if (n->out[j].match >= 0) {
                  if (n->out[j].match == str[-1] || (str[-1] == 0 && n->out[j].match == '\n'))
                     newstates = stb__add_if_inactive(m, newstates, n->out[j].node);
               } else if (n->out[j].match == -1) {
                  if (str[-1] != '\n' && str[-1])
                     newstates = stb__add_if_inactive(m, newstates, n->out[j].node);
               } else if (n->out[j].match < -1) {
                  int z = -n->out[j].match - 2;
                  if (m->charset[str[-1]] & (1 << z))
                     newstates = stb__add_if_inactive(m, newstates, n->out[j].node);
               }
            }
         }
         // AND add in the start state!
         if (!m->match_start || (str[-1] == '\n' && !m->does_lex))
            newstates = stb__add_if_inactive(m, newstates, m->start_node);
         // AND epsilon close it
         newstates = stb__eps_closure(m, newstates);
         // if it's a goal state, then that's all there is to it
         if (stb__clear_goalcheck(m, newstates)) {
            if (m->does_lex) {
               match_length = str - (stb_uint8 *) str_c;
               node = stb__get_dfa_node(m,newstates);
               match_result = node;
               node = -node + STB__DFA_MGOAL;
               trans = m->dfa; // could have gotten realloc()ed
            } else
               node = STB__DFA_GOAL;
         } else if (str[-1] == 0 || stb_arr_len(newstates) == 0) {
            node = STB__DFA_END;
         } else {
            node = stb__get_dfa_node(m,newstates);
            trans = m->dfa; // could have gotten realloc()ed
         }
         trans[prevnode].transition[str[-1]] = node;
         if (node <= STB__DFA_MGOAL)
            node = -(node - STB__DFA_MGOAL);
         stb_arr_free(newstates);
         stb_arr_free(states);
      }

      if (node == STB__DFA_GOAL) {
         return 1;
      }
      if (node == STB__DFA_END) {
         if (m->does_lex) {
            if (match_result) {
               if (len) *len = match_length;
               return m->dfa_result[(int) match_result];
            }
         }
         return 0;
      }

      assert(node != STB__DFA_UNDEF);
   }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, 0x38(%rsp)
movq %rsi, %r15
movq %rdi, 0x8(%rsp)
movzwl 0x2(%rdi), %ebp
pushq $-0x4
popq %rbx
cmpw $-0x1, %bp
jne 0xcba8
movq 0x8(%rsp), %rbp
movq 0x18(%rbp), %r14
testq %r14, %r14
je 0xca7c
movl -0x10(%r14), %eax
addl $0x1f, %eax
sarl $0x5, %eax
jmp 0xca7e
xorl %eax, %eax
movl %eax, 0x40(%rbp)
xorl %ebx, %ebx
testq %r14, %r14
je 0xca8e
movslq -0x10(%r14), %rax
jmp 0xca90
xorl %eax, %eax
cmpq %rax, %rbx
jge 0xcb10
imulq $0x18, %rbx, %rax
leaq (%r14,%rax), %r12
movq 0x8(%r14,%rax), %r13
xorl %ebp, %ebp
testq %r13, %r13
je 0xcaaf
movslq -0x10(%r13), %rax
jmp 0xcab1
xorl %eax, %eax
cmpq %rax, %rbp
jge 0xcad1
movzwl 0x2(%r13,%rbp,4), %esi
movq 0x8(%rsp), %rdi
callq 0xf6fe
movw %ax, 0x2(%r13,%rbp,4)
incq %rbp
jmp 0xcaa4
movq 0x10(%r12), %r12
xorl %r13d, %r13d
movq 0x8(%rsp), %rbp
testq %r12, %r12
je 0xcaea
movslq -0x10(%r12), %rax
jmp 0xcaec
xorl %eax, %eax
cmpq %rax, %r13
jge 0xcb08
movzwl (%r12,%r13,2), %esi
movq %rbp, %rdi
callq 0xf6fe
movw %ax, (%r12,%r13,2)
incq %r13
jmp 0xcade
incq %rbx
jmp 0xca83
movzwl (%rbp), %esi
movq %rbp, %rdi
callq 0xf6fe
movw %ax, (%rbp)
movzwl %ax, %edx
movq %rbp, %rdi
xorl %esi, %esi
callq 0xc689
movq %rbp, %rdi
movq %rax, %rsi
callq 0xc6f6
movq %rax, %r14
movq %rax, 0x18(%rsp)
cmpl $0x0, 0x20(%rbp)
je 0xcb73
movq %rbp, %rdi
movq %r14, %rsi
callq 0xc7ae
movw %ax, 0x2(%rbp)
movq %rbp, %rdi
movq %r14, %rsi
callq 0xc783
movzwl 0x2(%rbp), %ecx
cmpw $-0x4, %cx
pushq $-0x4
popq %rbx
jg 0xcb9a
movl %ebx, %eax
subl %ecx, %eax
jmp 0xcb96
movq %rbp, %rdi
movq %r14, %rsi
callq 0xf6c7
movl %eax, %ecx
movw $0xfffe, %ax            # imm = 0xFFFE
testl %ecx, %ecx
pushq $-0x4
popq %rbx
jne 0xcb96
movq %rbp, %rdi
movq %r14, %rsi
callq 0xc7ae
movw %ax, 0x2(%rbp)
leaq 0x18(%rsp), %rdi
callq 0x510d
movzwl 0x2(%rbp), %ebp
cmpw $-0x2, %bp
jne 0xcbc0
pushq $0x1
popq %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rsp), %rax
movq 0x28(%rax), %r8
movl %r15d, %edx
negl %edx
xorl %edi, %edi
xorl %esi, %esi
movq %rdx, 0x40(%rsp)
testw %bp, %bp
js 0xcf8e
leal (%rdx,%r15), %r12d
movzwl %bp, %r14d
movl %r14d, %eax
shll $0x9, %eax
addq %r8, %rax
movzbl (%r15), %ecx
incq %r15
movswl (%rax,%rcx,2), %ebp
incl %r12d
testl %ebp, %ebp
jns 0xcbe4
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rax
testq %rax, %rax
je 0xcc21
movl -0x10(%rax), %eax
movl %ebx, %ecx
subl %eax, %ecx
cmpl %ebp, %ecx
jle 0xcc2d
jmp 0xcfad
xorl %eax, %eax
cmpw $-0x4, %bp
jb 0xcfad
cmpl %ebp, %eax
jle 0xcfcc
cmpw $-0x4, %bp
ja 0xcc46
movl %ebx, %esi
subl %ebp, %esi
movl %r12d, %edi
movl %esi, %ebp
jmp 0xcbd7
movq %r8, 0x30(%rsp)
cmpw $-0x1, %bp
jne 0xcf14
movl %edi, 0x28(%rsp)
movl %esi, 0x2c(%rsp)
andq $0x0, 0x18(%rsp)
andq $0x0, 0x10(%rsp)
movq 0x8(%rsp), %rbp
movslq 0x40(%rbp), %rbx
imulq %r14, %rbx
shlq $0x2, %rbx
addq 0x30(%rbp), %rbx
leaq 0x18(%rsp), %rdi
pushq $0x2
popq %r13
movl %r13d, %esi
pushq $0x4
popq %rdx
callq 0x5135
leaq 0x10(%rsp), %rdi
movl %r13d, %esi
pushq $0x4
popq %rdx
callq 0x5135
movq $0x0, 0x20(%rsp)
xorl %r13d, %r13d
cmpl 0x40(%rbp), %r13d
jge 0xcd1f
xorl %ebp, %ebp
cmpl $0x20, %ebp
je 0xcd04
movl (%rbx), %eax
btl %ebp, %eax
jae 0xcd00
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0xccdb
movl -0x10(%rax), %ecx
cmpl -0xc(%rax), %ecx
jge 0xccdb
incl %ecx
movl %ecx, -0x10(%rax)
jmp 0xccf0
leaq 0x18(%rsp), %rdi
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
callq 0x521e
movq 0x18(%rsp), %rax
movq 0x20(%rsp), %rcx
addl %ebp, %ecx
movslq -0x10(%rax), %rdx
movw %cx, -0x2(%rax,%rdx,2)
incl %ebp
jmp 0xccb6
addq $0x4, %rbx
incl %r13d
movq 0x20(%rsp), %rax
addl $0x20, %eax
movq %rax, 0x20(%rsp)
movq 0x8(%rsp), %rbp
jmp 0xccae
movq 0x18(%rsp), %rcx
testq %rcx, %rcx
je 0xcd2e
movl -0x10(%rcx), %edx
jmp 0xcd30
xorl %edx, %edx
pushq $-0x4
popq %rbx
testl %edx, %edx
movl $0x0, %eax
cmovlel %eax, %edx
xorl %esi, %esi
movq %rdx, 0x48(%rsp)
movq %rcx, 0x50(%rsp)
cmpq %rdx, %rsi
je 0xce23
movq 0x18(%rbp), %rax
movzwl (%rcx,%rsi,2), %ecx
imulq $0x18, %rcx, %rcx
movq 0x8(%rax,%rcx), %rdx
testq %rdx, %rdx
movq %rsi, 0x20(%rsp)
je 0xcd72
movl -0x10(%rdx), %ebp
jmp 0xcd74
xorl %ebp, %ebp
leaq (%rax,%rcx), %rbx
addq $0x8, %rbx
testl %ebp, %ebp
movl $0x0, %eax
cmovlel %eax, %ebp
xorl %r13d, %r13d
cmpq %r13, %rbp
je 0xce04
movq (%rbx), %rax
movswl (%rax,%r13,4), %ecx
testl %ecx, %ecx
js 0xcdaf
movzbl -0x1(%r15), %edx
cmpl %edx, %ecx
je 0xcde5
cmpw $0xa, %cx
jne 0xcdff
testb %dl, %dl
je 0xcde5
jmp 0xcdff
cmpw $-0x1, %cx
je 0xcdd7
movq 0x8(%rsp), %rdx
movq 0x8(%rdx), %rdx
movzbl -0x1(%r15), %esi
movl (%rdx,%rsi,4), %edx
movb $-0x2, %sil
subb %cl, %sil
movzbl %sil, %ecx
btl %ecx, %edx
jb 0xcde5
jmp 0xcdff
movzbl -0x1(%r15), %ecx
testl %ecx, %ecx
je 0xcdff
cmpl $0xa, %ecx
je 0xcdff
movq 0x10(%rsp), %rsi
movzwl 0x2(%rax,%r13,4), %edx
movq 0x8(%rsp), %rdi
callq 0xc689
movq %rax, 0x10(%rsp)
incq %r13
jmp 0xcd89
movq 0x20(%rsp), %rsi
incq %rsi
movq 0x8(%rsp), %rbp
pushq $-0x4
popq %rbx
movq 0x50(%rsp), %rcx
movq 0x48(%rsp), %rdx
jmp 0xcd49
cmpl $0x0, 0x14(%rbp)
je 0xce36
cmpb $0xa, -0x1(%r15)
jne 0xce4c
cmpl $0x0, 0x20(%rbp)
jne 0xce4c
movq 0x10(%rsp), %rsi
movzwl (%rbp), %edx
movq %rbp, %rdi
callq 0xc689
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rsi
movq %rbp, %rdi
callq 0xc6f6
movq %rax, %r13
movq %rax, 0x10(%rsp)
movq %rbp, %rdi
movq %rax, %rsi
callq 0xf6c7
testl %eax, %eax
je 0xce97
cmpl $0x0, 0x20(%rbp)
movq 0x30(%rsp), %rax
je 0xceca
movq %rbp, %rdi
movq %r13, %rsi
callq 0xc7ae
movl %ebx, %r13d
movl %eax, 0x2c(%rsp)
subl %eax, %r13d
movl %r12d, 0x28(%rsp)
jmp 0xcec4
movq %r13, %rax
movw $0xfffd, %r13w          # imm = 0xFFFD
movq %rax, %rsi
testq %rax, %rax
movq 0x30(%rsp), %rax
je 0xcecf
cmpb $0x0, -0x1(%r15)
je 0xcecf
cmpl $0x0, -0x10(%rsi)
je 0xcecf
movq %rbp, %rdi
callq 0xc7ae
movl %eax, %r13d
movq 0x28(%rbp), %rax
jmp 0xcecf
movw $0xfffe, %r13w          # imm = 0xFFFE
shll $0x9, %r14d
movq %rax, 0x30(%rsp)
addq %rax, %r14
movzbl -0x1(%r15), %eax
movw %r13w, (%r14,%rax,2)
movl %ebx, %ebp
subl %r13d, %ebp
leaq 0x10(%rsp), %rdi
callq 0x510d
leaq 0x18(%rsp), %rdi
callq 0x510d
cmpw $-0x3, %r13w
cmovgel %r13d, %ebp
movq 0x40(%rsp), %rdx
movl 0x2c(%rsp), %esi
movl 0x28(%rsp), %edi
cmpw $-0x3, %bp
je 0xcf57
movzwl %bp, %eax
cmpl $0xfffe, %eax           # imm = 0xFFFE
je 0xcbae
cmpl $0xffff, %eax           # imm = 0xFFFF
movq 0x30(%rsp), %r8
jne 0xcbd7
leaq 0x4338(%rip), %rdi      # 0x11277
leaq 0x34db(%rip), %rsi      # 0x10421
leaq 0x42af(%rip), %rcx      # 0x111fc
movl $0x2653, %edx           # imm = 0x2653
callq 0x2140
xorl %eax, %eax
movq 0x8(%rsp), %rdx
cmpl $0x0, 0x20(%rdx)
je 0xcbb1
testw %si, %si
je 0xcbb1
movq 0x38(%rsp), %rcx
testq %rcx, %rcx
je 0xcf7d
movl %edi, (%rcx)
movq 0x38(%rdx), %rax
movswq %si, %rcx
movswl (%rax,%rcx,2), %eax
jmp 0xcbb1
leaq 0x4250(%rip), %rdi      # 0x111e5
leaq 0x3485(%rip), %rsi      # 0x10421
leaq 0x4259(%rip), %rcx      # 0x111fc
movl $0x25e8, %edx           # imm = 0x25E8
callq 0x2140
leaq 0x427b(%rip), %rdi      # 0x1122f
leaq 0x3466(%rip), %rsi      # 0x10421
leaq 0x423a(%rip), %rcx      # 0x111fc
movl $0x25f1, %edx           # imm = 0x25F1
callq 0x2140
leaq 0x4289(%rip), %rdi      # 0x1125c
leaq 0x3447(%rip), %rsi      # 0x10421
leaq 0x421b(%rip), %rcx      # 0x111fc
movl $0x25f2, %edx           # imm = 0x25F2
callq 0x2140