// File: /workspace/github_c_makefile_star2_O1/jondurbin[P]dre2/src/dre2_parse.c
// Function: dre2_use_paths
int dre2_use_paths( struct dre2 *graph, int best, struct dre2_fl_cost *cost )
{
  int i, j;
  struct dre2_node *node;
  int b_n_count, b_c_count, b_frequency;
  int p_n_count, p_c_count, p_frequency;
  int *original, *tp;
  double bf, pf, diff;
  unsigned char *temp;
  struct dre2_cost node_cost;

  if ( best == 0 )
  {
    b_n_count = cost->f_n_count;
    b_c_count = cost->f_c_count;
    b_frequency = cost->f_frequency;
  } else if ( best == graph->count - 1 )
  {
    b_n_count = cost->l_n_count;
    b_c_count = cost->l_c_count;
    b_frequency = cost->l_frequency;
  } else
  {
    node_cost = dre2_single_cost( graph, best );
    b_n_count = 1;
    b_c_count = node_cost.c_count;
    b_frequency = node_cost.frequency;
  }

  temp = ( unsigned char * )calloc( RANGE, sizeof( unsigned char ) );
  tp = ( int * )calloc( RANGE, sizeof( int ) );
  original = graph->starting_chars;
  graph->starting_chars = tp;

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

  p_c_count = 0;
  p_frequency = 0;
  for ( i = 0; i < graph->starting_count; i++ )
  {
    dre2_set_chars( graph, graph->starting_points[i] );
    for ( j = 1; j < RANGE; j++ )
    {
      if ( graph->starting_chars[j] && !dre2_contains_char( temp, j ) )
      {
        p_c_count++;
        temp[p_c_count - 1] = j;
        p_frequency += dre2_frequency[j];
      }
    }
  }

  graph->starting_chars = original;
  free( temp );
  temp = NULL;
  free( tp );
  tp = NULL;

  if ( b_n_count * b_c_count < p_n_count * p_c_count ||
     ( b_n_count * b_c_count == p_n_count * p_c_count && b_frequency <= p_frequency ) )
    return false;
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
testl %esi, %esi
je 0x3c2e
movl 0x8(%rbx), %eax
decl %eax
cmpl %esi, %eax
jne 0x3c46
movl 0xc(%rdx), %eax
movl %eax, 0x4(%rsp)
movl 0x10(%rdx), %eax
movq %rax, 0x8(%rsp)
movl 0x14(%rdx), %eax
jmp 0x3c3f
movl (%rdx), %eax
movl %eax, 0x4(%rsp)
movl 0x4(%rdx), %eax
movq %rax, 0x8(%rsp)
movl 0x8(%rdx), %eax
movq %rax, 0x10(%rsp)
jmp 0x3c64
movq %rbx, %rdi
callq 0x2280
movq %rax, 0x8(%rsp)
shrq $0x20, %rax
movq %rax, 0x10(%rsp)
movl $0x1, 0x4(%rsp)
movl $0x100, %edi            # imm = 0x100
movl $0x1, %esi
callq 0x2200
movq %rax, %r15
movl $0x100, %edi            # imm = 0x100
movl $0x4, %esi
callq 0x2200
movq %rax, %r14
movq 0x418(%rbx), %rax
movq %rax, 0x20(%rsp)
movq %r14, 0x418(%rbx)
movl 0x438(%rbx), %ebp
xorl %r13d, %r13d
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x2180
movq %r14, 0x28(%rsp)
movq %r14, 0x418(%rbx)
movl $0x0, %r14d
movl %ebp, 0x1c(%rsp)
testl %ebp, %ebp
jle 0x3d45
xorl %ebp, %ebp
xorl %r14d, %r14d
xorl %r13d, %r13d
movq %rbx, 0x30(%rsp)
movq 0x430(%rbx), %rax
movl (%rax,%rbp,4), %esi
movq %rbx, %rdi
callq 0x2260
movq 0x418(%rbx), %rbx
movl $0x1, %r12d
cmpl $0x0, (%rbx,%r12,4)
je 0x3d25
movzbl %r12b, %esi
movq %r15, %rdi
callq 0x2160
testl %eax, %eax
jne 0x3d25
movslq %r14d, %rax
incl %r14d
movb %r12b, (%r15,%rax)
movq 0xa2c7(%rip), %rax      # 0xdfe8
addl (%rax,%r12,4), %r13d
incq %r12
cmpq $0x100, %r12            # imm = 0x100
jne 0x3cf9
incq %rbp
movq 0x30(%rsp), %rbx
movslq 0x438(%rbx), %rax
cmpq %rax, %rbp
jl 0x3cda
movq 0x20(%rsp), %rax
movq %rax, 0x418(%rbx)
movq %r15, %rdi
callq 0x2070
movq 0x28(%rsp), %rdi
callq 0x2070
movl 0x4(%rsp), %eax
imull 0x8(%rsp), %eax
imull 0x1c(%rsp), %r14d
cmpl %r14d, %eax
setge %al
setne %cl
cmpl %r13d, 0x10(%rsp)
setg %dl
orb %cl, %dl
andb %al, %dl
movzbl %dl, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq