// File: /workspace/github_c_makefile_star2_O0/jondurbin[P]dre2/src/dre2_parse.c
// Function: dre2_make_range
void dre2_make_range( struct dre2_node **v, int *node_count, int *last_node, struct dre2_parse_return *res, int min, int max, int **minimal )
{
  int i, j;
  int group;
  struct dre2_node *node;
  int original;
  int node_opener;

  if ( ( *v )[*last_node].c == DRE2_GROUP_CLOSE )
  {
    group = true;
  } else
  {
    node_opener = *last_node;
    original = *last_node;
    group = false;
  }

  if ( min == 0 )
  {
    if ( ( *v )[*last_node].c != DRE2_GROUP_OPEN && ( *v )[*last_node].c != DRE2_GROUP_CLOSE )
    {
      // Duplicate the node.
      dre2_duplicate_node( v, node_count, original, minimal );
      // Set node that was duplicated to be group open.
      ( *v )[*node_count - 2].c = DRE2_GROUP_OPEN;
      node_opener = *node_count - 2;
      // Add the group close node.
      dre2_add_node( v, node_count, DRE2_GROUP_CLOSE, minimal, false );
      // Add link from group open node to actual node.
      dre2_add_neighbor( v, *node_count - 3, *node_count - 2 );
      // Add link from group open node to group close node.
      dre2_add_neighbor( v, *node_count - 3, *node_count - 1 );
      // Add link from actual node to group close node.
      dre2_add_neighbor( v, *node_count - 2, *node_count - 1 );

      for ( i = *last_node; i < *node_count; i++ )
        dre2_remove_minimal( minimal, i );
      *last_node = *node_count - 1;
      original = *node_count - 2;
    } else
    {
      dre2_add_neighbor( v, res->open, res->close );
      for ( i = res->open; i <= res->close; i++ )
        dre2_remove_minimal( minimal, i );
    }
  }

  // Make the required minimum range first.
  for ( i = 0; i < min - 1; i++ )
  {
    dre2_add_neighbor( v, *last_node, *last_node + 1 );
    if ( group )
    {
      dre2_duplicate_group( v, node_count, last_node, res, minimal );
    } else
    {
      dre2_duplicate_node( v, node_count, original, minimal );
      *last_node = *node_count - 1;
      node_opener = *last_node;
    }
  }

  // If max is min, we're done.
  if ( max == min )
    return;

  if ( max == DRE2_INFINITE )
  {
    if ( group )
    {
      dre2_add_neighbor( v, res->close, res->open );
    } else
    {
      if ( min == 0 )
        dre2_add_neighbor( v, *last_node, *last_node - 1 );
      else
        dre2_add_neighbor( v, *last_node, *last_node );
    }
  } else
  {
    if ( min == 0 )
      max--;
    for ( i = min; i < max; i++ )
    {
      dre2_add_neighbor( v, *last_node, *last_node + 1 );
      if ( group )
      {
        dre2_duplicate_group( v, node_count, last_node, res, minimal );
        dre2_add_neighbor( v, res->open, res->close );
        for ( j = res->open; j <= res->close; j++ )
          dre2_remove_minimal( minimal, j );
      } else
      {
        // Duplicate the node.
        dre2_duplicate_node( v, node_count, original, minimal );
        // Add a link from the last required to here.
        dre2_add_neighbor( v, node_opener, *node_count - 1 );
        // Mark it as not minimal.
        dre2_remove_minimal( minimal, *node_count - 1 );
        // Update last node.
        *last_node = *node_count - 1;
      }
    }
    if ( !group )
    {
      dre2_add_neighbor( v, *last_node, *node_count );
      dre2_add_node( v, node_count, DRE2_GROUP_CLOSE, minimal, false );
      dre2_add_neighbor( v, node_opener, *node_count - 1 );
      *last_node = *node_count - 1;
    }
  }
}

// Assembly:
subq $0x48, %rsp
movq 0x50(%rsp), %rax
movq %rdi, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movq %rdx, 0x30(%rsp)
movq %rcx, 0x28(%rsp)
movl %r8d, 0x24(%rsp)
movl %r9d, 0x20(%rsp)
movq 0x40(%rsp), %rax
movq (%rax), %rax
movq 0x30(%rsp), %rcx
movslq (%rcx), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
cmpl $-0x2, (%rax)
jne 0x717d
movl $0x1, 0x14(%rsp)
jmp 0x719a
movq 0x30(%rsp), %rax
movl (%rax), %eax
movl %eax, (%rsp)
movq 0x30(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x4(%rsp)
movl $0x0, 0x14(%rsp)
cmpl $0x0, 0x24(%rsp)
jne 0x7347
movq 0x40(%rsp), %rax
movq (%rax), %rax
movq 0x30(%rsp), %rcx
movslq (%rcx), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
cmpl $-0x1, (%rax)
je 0x72f6
movq 0x40(%rsp), %rax
movq (%rax), %rax
movq 0x30(%rsp), %rcx
movslq (%rcx), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
cmpl $-0x2, (%rax)
je 0x72f6
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rsi
movl 0x4(%rsp), %edx
movq 0x50(%rsp), %rcx
callq 0x2120
movq 0x40(%rsp), %rax
movq (%rax), %rax
movq 0x38(%rsp), %rcx
movl (%rcx), %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movq 0x38(%rsp), %rax
movl (%rax), %eax
subl $0x2, %eax
movl %eax, (%rsp)
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x50(%rsp), %rcx
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
xorl %r8d, %r8d
callq 0x20a0
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rax
movl (%rax), %esi
subl $0x3, %esi
movq 0x38(%rsp), %rax
movl (%rax), %edx
subl $0x2, %edx
callq 0x21a0
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rax
movl (%rax), %esi
subl $0x3, %esi
movq 0x38(%rsp), %rax
movl (%rax), %edx
subl $0x1, %edx
callq 0x21a0
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rax
movl (%rax), %esi
subl $0x2, %esi
movq 0x38(%rsp), %rax
movl (%rax), %edx
subl $0x1, %edx
callq 0x21a0
movq 0x30(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movq 0x38(%rsp), %rcx
cmpl (%rcx), %eax
jge 0x72d5
movq 0x50(%rsp), %rdi
movl 0x1c(%rsp), %esi
callq 0x2210
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x72ad
movq 0x38(%rsp), %rax
movl (%rax), %ecx
subl $0x1, %ecx
movq 0x30(%rsp), %rax
movl %ecx, (%rax)
movq 0x38(%rsp), %rax
movl (%rax), %eax
subl $0x2, %eax
movl %eax, 0x4(%rsp)
jmp 0x7345
movq 0x40(%rsp), %rdi
movq 0x28(%rsp), %rax
movl (%rax), %esi
movq 0x28(%rsp), %rax
movl 0x4(%rax), %edx
callq 0x21a0
movq 0x28(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movq 0x28(%rsp), %rcx
cmpl 0x4(%rcx), %eax
jg 0x7343
movq 0x50(%rsp), %rdi
movl 0x1c(%rsp), %esi
callq 0x2210
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x731a
jmp 0x7345
jmp 0x7347
movl $0x0, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movl 0x24(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x73e9
movq 0x40(%rsp), %rdi
movq 0x30(%rsp), %rax
movl (%rax), %esi
movq 0x30(%rsp), %rax
movl (%rax), %edx
addl $0x1, %edx
callq 0x21a0
cmpl $0x0, 0x14(%rsp)
je 0x73a4
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x28(%rsp), %rcx
movq 0x50(%rsp), %r8
callq 0x2300
jmp 0x73d7
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rsi
movl 0x4(%rsp), %edx
movq 0x50(%rsp), %rcx
callq 0x2120
movq 0x38(%rsp), %rax
movl (%rax), %ecx
subl $0x1, %ecx
movq 0x30(%rsp), %rax
movl %ecx, (%rax)
movq 0x30(%rsp), %rax
movl (%rax), %eax
movl %eax, (%rsp)
jmp 0x73d9
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x734f
movl 0x20(%rsp), %eax
cmpl 0x24(%rsp), %eax
jne 0x73f8
jmp 0x75e6
cmpl $-0x1, 0x20(%rsp)
jne 0x7464
cmpl $0x0, 0x14(%rsp)
je 0x7421
movq 0x40(%rsp), %rdi
movq 0x28(%rsp), %rax
movl 0x4(%rax), %esi
movq 0x28(%rsp), %rax
movl (%rax), %edx
callq 0x21a0
jmp 0x745f
cmpl $0x0, 0x24(%rsp)
jne 0x7445
movq 0x40(%rsp), %rdi
movq 0x30(%rsp), %rax
movl (%rax), %esi
movq 0x30(%rsp), %rax
movl (%rax), %edx
subl $0x1, %edx
callq 0x21a0
jmp 0x745d
movq 0x40(%rsp), %rdi
movq 0x30(%rsp), %rax
movl (%rax), %esi
movq 0x30(%rsp), %rax
movl (%rax), %edx
callq 0x21a0
jmp 0x745f
jmp 0x75e6
cmpl $0x0, 0x24(%rsp)
jne 0x7476
movl 0x20(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x20(%rsp)
movl 0x24(%rsp), %eax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
cmpl 0x20(%rsp), %eax
jge 0x7581
movq 0x40(%rsp), %rdi
movq 0x30(%rsp), %rax
movl (%rax), %esi
movq 0x30(%rsp), %rax
movl (%rax), %edx
addl $0x1, %edx
callq 0x21a0
cmpl $0x0, 0x14(%rsp)
je 0x751b
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x28(%rsp), %rcx
movq 0x50(%rsp), %r8
callq 0x2300
movq 0x40(%rsp), %rdi
movq 0x28(%rsp), %rax
movl (%rax), %esi
movq 0x28(%rsp), %rax
movl 0x4(%rax), %edx
callq 0x21a0
movq 0x28(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x18(%rsp)
movl 0x18(%rsp), %eax
movq 0x28(%rsp), %rcx
cmpl 0x4(%rcx), %eax
jg 0x7519
movq 0x50(%rsp), %rdi
movl 0x18(%rsp), %esi
callq 0x2210
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x74f0
jmp 0x756f
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rsi
movl 0x4(%rsp), %edx
movq 0x50(%rsp), %rcx
callq 0x2120
movq 0x40(%rsp), %rdi
movl (%rsp), %esi
movq 0x38(%rsp), %rax
movl (%rax), %edx
subl $0x1, %edx
callq 0x21a0
movq 0x50(%rsp), %rdi
movq 0x38(%rsp), %rax
movl (%rax), %esi
subl $0x1, %esi
callq 0x2210
movq 0x38(%rsp), %rax
movl (%rax), %ecx
subl $0x1, %ecx
movq 0x30(%rsp), %rax
movl %ecx, (%rax)
jmp 0x7571
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x747e
cmpl $0x0, 0x14(%rsp)
jne 0x75e4
movq 0x40(%rsp), %rdi
movq 0x30(%rsp), %rax
movl (%rax), %esi
movq 0x38(%rsp), %rax
movl (%rax), %edx
callq 0x21a0
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x50(%rsp), %rcx
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
xorl %r8d, %r8d
callq 0x20a0
movq 0x40(%rsp), %rdi
movl (%rsp), %esi
movq 0x38(%rsp), %rax
movl (%rax), %edx
subl $0x1, %edx
callq 0x21a0
movq 0x38(%rsp), %rax
movl (%rax), %ecx
subl $0x1, %ecx
movq 0x30(%rsp), %rax
movl %ecx, (%rax)
jmp 0x75e6
addq $0x48, %rsp
retq
nopl (%rax,%rax)