// File: /workspace/github_c_makefile_star2_O1/jondurbin[P]dre2/src/dre2_parse.c
// Function: dre2_initial_skip
int dre2_initial_skip( struct dre2 *graph )
{
  int i, j;
  int complete;
  int *reachable, *r_temp, *swapper;
  int count, c_temp;
  int total;

  count = 0;

  reachable = ( int * )malloc( sizeof( int ) * graph->count );
  r_temp = ( int * )malloc( sizeof( int ) * graph->count );

  for ( i = 0; i < graph->v[0].n_count; i++ )
  {
    reachable[count++] = graph->v[0].n[i];
  }

  total = 0;
  complete = false;
  while ( true )
  {
    c_temp = 0;
    if ( count == 1 )
    {
      if ( ( graph->v[reachable[0]].c == DRE2_BOL ) ||
           ( graph->v[reachable[0]].c == DRE2_EOL ) ||
           ( graph->v[reachable[0]].c == DRE2_EOF ) )
        total--;
    }
    for ( i = 0; i < count; i++ )
    {
      if ( reachable[i] == graph->starting_point )
      {
        total--;
        complete = true;
        break;
      }
      for ( j = 0; j < graph->v[reachable[i]].n_count; j++ )
      {
        if ( graph->v[reachable[i]].n[j] > reachable[i] && !dre2_contains_int( r_temp, c_temp, graph->v[reachable[i]].n[j] ) )
          r_temp[c_temp++] = graph->v[reachable[i]].n[j];
      }
    }

    total++;
    if ( complete )
      break;
    count = c_temp;
    swapper = reachable;
    reachable = r_temp;
    r_temp = swapper;
  }

  free( reachable );
  free( r_temp );
  reachable = NULL;
  r_temp = NULL;

  return total;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movslq 0x8(%rdi), %r14
shlq $0x2, %r14
movq %r14, %rdi
callq 0x22a0
movq %rax, %r13
movq %r14, %rdi
callq 0x22a0
movq %rax, %r15
movq %rbx, (%rsp)
movq (%rbx), %rbp
movslq 0x10(%rbp), %r12
xorl %r14d, %r14d
movl $0x0, %edx
testq %r12, %r12
jle 0x462e
movq 0x8(%rbp), %rsi
movq %r12, %rdx
shlq $0x2, %rdx
movq %r13, %rdi
callq 0x2230
movl %r12d, %edx
movq %r15, %r12
movq %r13, %r15
cmpl $0x1, %edx
jne 0x4659
movslq (%r15), %rax
shlq $0x6, %rax
movl (%rbp,%rax), %eax
addl $0x12, %eax
cmpl $0xe, %eax
ja 0x4659
movl $0x4003, %ecx           # imm = 0x4003
btl %eax, %ecx
jae 0x4659
decl %r14d
xorl %ecx, %ecx
testl %edx, %edx
setg %dil
jle 0x4706
movl (%r15), %esi
xorl %ecx, %ecx
movq (%rsp), %rax
cmpl 0x410(%rax), %esi
je 0x46fd
movl %edx, %edx
xorl %ecx, %ecx
xorl %edi, %edi
movslq %esi, %rax
shlq $0x6, %rax
cmpl $0x0, 0x10(%rbp,%rax)
jle 0x46de
leaq (%rax,%rbp), %r8
movq 0x8(%r8), %r9
leaq (%rax,%rbp), %r10
addq $0x8, %r10
xorl %r11d, %r11d
movl (%r9,%r11,4), %r13d
cmpl %esi, %r13d
jle 0x46d2
testl %ecx, %ecx
jle 0x46c2
movl %ecx, %eax
xorl %ebx, %ebx
cmpl %r13d, (%r12,%rbx,4)
je 0x46d2
incq %rbx
cmpq %rbx, %rax
jne 0x46b4
movq (%r10), %rax
movl (%rax,%r11,4), %eax
movslq %ecx, %rbx
incl %ecx
movl %eax, (%r12,%rbx,4)
incq %r11
movslq 0x10(%r8), %rax
cmpq %rax, %r11
jl 0x46a3
incq %rdi
cmpq %rdx, %rdi
je 0x4702
movl (%r15,%rdi,4), %esi
movq (%rsp), %rax
cmpl 0x410(%rax), %esi
jne 0x4682
cmpq %rdx, %rdi
setb %dil
decl %r14d
jmp 0x4706
setb %dil
incl %r14d
movq %r12, %r13
movl %ecx, %edx
testb %dil, %dil
je 0x462e
movq %r15, %rdi
callq 0x2070
movq %r12, %rdi
callq 0x2070
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq