// File: /workspace/github_c_makefile_star2_O0/jondurbin[P]dre2/src/dre2_parse.c
// Function: dre2_character_class
int dre2_character_class( struct dre2_node *node, unsigned char *re, int s )
{
  int length = strlen(re);
  int i = s;
  int action;
  int k;

  if ( re[i] == ']' )
  {
    printf( "No content in charcter class.\n" );
    return false;
  } else if ( re[i] == '^' )
  {
    i++;
    action = false;
  } else
  {
    action = true;
  }

  for ( k = 0; k < RANGE; k++ )
    node->possible[k] = action == true ? false : true;
  node->possible[0] = false;

  unsigned char c;
  unsigned char last = '\0';
  while ( i < length )
  {
    c = re[i];
    if ( c == '\\' )
    {
      i++;
      if ( i == length )
      {
        printf( "Invalid character class.\n" );
        return false;
      }
      c = re[i];
      dre2_predefined_class( node, &c, action, true );
      last = '\0';
      i++;
      continue;
    } else if ( c == '-' )
    {
      i++;
      if ( i == length )
      {
        printf( "Invalid character class.\n" );
        return false;
      }
      c = re[i];
      if ( c == ']' )
      {
        node->possible['-'] = action;
        return i;
      } else
      {
        if ( !last || last > c )
        {
          printf( "Invalid range in character class.\n" );
          return false;
        }
        for ( k = last; k <= c; k++ )
          node->possible[k] = action;
      }
      i++;
      continue;
    } else if ( c == ']' )
    {
      return i;
    } else
    {
      node->possible[c] = action;
    }
    i++;
    last = c;
  }
  return false;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movl %edx, 0x1c(%rsp)
movq 0x20(%rsp), %rdi
callq 0x2100
movl %eax, 0x18(%rsp)
movl 0x1c(%rsp), %eax
movl %eax, 0x14(%rsp)
movq 0x20(%rsp), %rax
movslq 0x14(%rsp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x5d, %eax
jne 0x2ac6
leaq 0xd916(%rip), %rdi      # 0x103c8
movb $0x0, %al
callq 0x2130
movl $0x0, 0x34(%rsp)
jmp 0x2d24
movq 0x20(%rsp), %rax
movslq 0x14(%rsp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x5e, %eax
jne 0x2aee
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
movl $0x0, 0x10(%rsp)
jmp 0x2af6
movl $0x1, 0x10(%rsp)
jmp 0x2af8
movl $0x0, 0xc(%rsp)
cmpl $0x100, 0xc(%rsp)       # imm = 0x100
jge 0x2b39
movl 0x10(%rsp), %ecx
movl $0x1, %edx
xorl %eax, %eax
cmpl $0x1, %ecx
cmovel %eax, %edx
movq 0x28(%rsp), %rax
movq 0x28(%rax), %rax
movslq 0xc(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x2b00
movq 0x28(%rsp), %rax
movq 0x28(%rax), %rax
movl $0x0, (%rax)
movb $0x0, 0xa(%rsp)
movl 0x14(%rsp), %eax
cmpl 0x18(%rsp), %eax
jge 0x2d1c
movq 0x20(%rsp), %rax
movslq 0x14(%rsp), %rcx
movb (%rax,%rcx), %al
movb %al, 0xb(%rsp)
movzbl 0xb(%rsp), %eax
cmpl $0x5c, %eax
jne 0x2be4
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
movl 0x14(%rsp), %eax
cmpl 0x18(%rsp), %eax
jne 0x2ba6
leaq 0xd855(%rip), %rdi      # 0x103e7
movb $0x0, %al
callq 0x2130
movl $0x0, 0x34(%rsp)
jmp 0x2d24
movq 0x20(%rsp), %rax
movslq 0x14(%rsp), %rcx
movb (%rax,%rcx), %al
movb %al, 0xb(%rsp)
movq 0x28(%rsp), %rdi
movl 0x10(%rsp), %edx
leaq 0xb(%rsp), %rsi
movl $0x1, %ecx
callq 0x2250
movb $0x0, 0xa(%rsp)
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x2b4d
movzbl 0xb(%rsp), %eax
cmpl $0x2d, %eax
jne 0x2cd7
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
movl 0x14(%rsp), %eax
cmpl 0x18(%rsp), %eax
jne 0x2c22
leaq 0xd7d9(%rip), %rdi      # 0x103e7
movb $0x0, %al
callq 0x2130
movl $0x0, 0x34(%rsp)
jmp 0x2d24
movq 0x20(%rsp), %rax
movslq 0x14(%rsp), %rcx
movb (%rax,%rcx), %al
movb %al, 0xb(%rsp)
movzbl 0xb(%rsp), %eax
cmpl $0x5d, %eax
jne 0x2c5d
movl 0x10(%rsp), %ecx
movq 0x28(%rsp), %rax
movq 0x28(%rax), %rax
movl %ecx, 0xb4(%rax)
movl 0x14(%rsp), %eax
movl %eax, 0x34(%rsp)
jmp 0x2d24
cmpb $0x0, 0xa(%rsp)
je 0x2c72
movzbl 0xa(%rsp), %eax
movzbl 0xb(%rsp), %ecx
cmpl %ecx, %eax
jle 0x2c8d
leaq 0xd788(%rip), %rdi      # 0x10401
movb $0x0, %al
callq 0x2130
movl $0x0, 0x34(%rsp)
jmp 0x2d24
movzbl 0xa(%rsp), %eax
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %eax
movzbl 0xb(%rsp), %ecx
cmpl %ecx, %eax
jg 0x2cc5
movl 0x10(%rsp), %edx
movq 0x28(%rsp), %rax
movq 0x28(%rax), %rax
movslq 0xc(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x2c96
jmp 0x2cc7
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x2b4d
movzbl 0xb(%rsp), %eax
cmpl $0x5d, %eax
jne 0x2ceb
movl 0x14(%rsp), %eax
movl %eax, 0x34(%rsp)
jmp 0x2d24
movl 0x10(%rsp), %edx
movq 0x28(%rsp), %rax
movq 0x28(%rax), %rax
movzbl 0xb(%rsp), %ecx
movl %edx, (%rax,%rcx,4)
jmp 0x2d02
jmp 0x2d04
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
movb 0xb(%rsp), %al
movb %al, 0xa(%rsp)
jmp 0x2b4d
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopl (%rax)