// File: /workspace/github_c_makefile_star2_O3/jondurbin[P]dre2/src/dre2_parse.c
// Function: dre2_starting_chars
void dre2_starting_chars( struct dre2 *graph, int *minimal )
{
  int i, count;
  struct dre2_node *node;

  for ( i = 0; i < RANGE; i++ )
    graph->starting_chars[i] = false;

  if ( graph->starting_point == graph->count - 1 && graph->v[graph->count - 1].n_count > 0 && ( graph->options & DRE2_GREEDY ) )
    graph->starting_point = 0;

  if ( graph->starting_point == -1 )
  {
    // Using multiple nodes.
    for ( i = 0; i < graph->starting_count; i++ )
      dre2_set_chars( graph, graph->starting_points[i] );
  } else if ( graph->starting_point != 0 && graph->starting_point != graph->count - 1 )
  {
    // Only a single node, set the chars for that node.
    dre2_set_chars( graph, graph->starting_point );
  } else if ( graph->starting_point == 0 )
  {
    // Set all of the chars possible from the reachable nodes of the first node.
    for ( i = 0; i < graph->v[0].n_count; i++ )
    {
      if ( minimal[graph->v[0].n[i]] || ( graph->options & DRE2_GREEDY ) )
        dre2_set_chars( graph, graph->v[0].n[i] );
    }
  } else
  {
    // Set all of the chars possible from the parents of the last node.
    for ( i = 0; i < graph->v[graph->count - 1].p_count; i++ )
    {
      if ( minimal[graph->v[graph->count - 1].p[i]] || ( graph->options & DRE2_GREEDY ) )
        dre2_set_chars( graph, graph->v[graph->count - 1].p[i] );
    }
  }

  // Check if the there is a single starting char or multiple (determines matching method)
  count = 0;
  for ( i = 0; i < RANGE; i++ )
  {
    if ( graph->starting_chars[i] )
      count++;
    if ( count > 1 )
      break;
  }
  if ( count > 1 )
    graph->single = false;
  else
    graph->single = true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq 0x418(%rdi), %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x2180
movslq 0x410(%rbx), %rsi
movl 0x8(%rbx), %eax
leal -0x1(%rax), %ecx
cmpl %ecx, %esi
jne 0x3353
movq (%rbx), %rdx
movq %rsi, %rdi
shlq $0x6, %rdi
cmpl $0x0, 0x10(%rdx,%rdi)
jle 0x3353
testb $0x1, 0x43c(%rbx)
jne 0x33fa
testl %esi, %esi
je 0x3404
cmpl $-0x1, %esi
jne 0x3397
cmpl $0x0, 0x438(%rbx)
jle 0x3449
xorl %r14d, %r14d
movq 0x430(%rbx), %rax
movl (%rax,%r14,4), %esi
movq %rbx, %rdi
callq 0x2260
incq %r14
movslq 0x438(%rbx), %rax
cmpq %rax, %r14
jl 0x3370
jmp 0x3449
cmpl %ecx, %esi
jne 0x3441
movslq %eax, %rdx
movq (%rbx), %rcx
shlq $0x6, %rdx
cmpl $0x0, -0x20(%rcx,%rdx)
jle 0x3449
addq %rcx, %rdx
xorl %r15d, %r15d
movq -0x28(%rdx), %rdx
movslq (%rdx,%r15,4), %rsi
cmpl $0x0, (%r14,%rsi,4)
jne 0x33d2
testb $0x1, 0x43c(%rbx)
je 0x33e0
movq %rbx, %rdi
callq 0x2260
movq (%rbx), %rcx
movl 0x8(%rbx), %eax
incq %r15
movslq %eax, %rsi
shlq $0x6, %rsi
leaq (%rcx,%rsi), %rdx
movslq -0x20(%rcx,%rsi), %rsi
cmpq %rsi, %r15
jl 0x33ba
jmp 0x3449
movl $0x0, 0x410(%rbx)
movq (%rbx), %rax
cmpl $0x0, 0x10(%rax)
jle 0x3449
xorl %r15d, %r15d
movq 0x8(%rax), %rcx
movslq (%rcx,%r15,4), %rsi
cmpl $0x0, (%r14,%rsi,4)
jne 0x3428
testb $0x1, 0x43c(%rbx)
je 0x3433
movq %rbx, %rdi
callq 0x2260
movq (%rbx), %rax
incq %r15
movslq 0x10(%rax), %rcx
cmpq %rcx, %r15
jl 0x3410
jmp 0x3449
movq %rbx, %rdi
callq 0x2260
movq 0x418(%rbx), %rcx
xorl %eax, %eax
xorl %edx, %edx
xorl %esi, %esi
cmpl $0x1, (%rcx,%rdx,4)
sbbl $-0x1, %esi
cmpl $0x2, %esi
jae 0x3473
incq %rdx
cmpq $0x100, %rdx            # imm = 0x100
jne 0x3456
movl $0x1, %eax
movl %eax, 0x420(%rbx)
popq %rbx
popq %r14
popq %r15
retq