// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/wtree_encseq.c
// Function: gt_wtree_encseq_access_rec
static GtWtreeSymbol gt_wtree_encseq_access_rec(GtWtreeEncseq *we,
                                                GtUword pos,
                                                GtUword node_start,
                                                GtUword node_size,
                                                unsigned int alpha_start,
                                                unsigned int alpha_end)
{
  unsigned int middle = GT_DIV2(alpha_start + alpha_end);
  int bit;
  GtUword zero_rank_prefix = 0,
          one_rank_prefix = 0,
          left_child_size;
  gt_assert(pos < node_size);

  if (alpha_start < alpha_end) {
    bit = gt_compressed_bitsequence_access(we->c_bits, node_start + pos);
    if (node_start != 0)
      zero_rank_prefix =
        gt_compressed_bitsequence_rank_0(we->c_bits, node_start - 1);
    left_child_size =
      gt_compressed_bitsequence_rank_0(we->c_bits, node_start + node_size - 1) -
      zero_rank_prefix;

    if (bit == 0) {
      pos = gt_compressed_bitsequence_rank_0(we->c_bits, node_start + pos) -
        zero_rank_prefix - 1; /*convert count (rank) to position */
      alpha_end = middle;
      node_start += we->parent_instance.members->length;
      node_size = left_child_size;
      return gt_wtree_encseq_access_rec(we, pos, node_start,
                                        node_size, alpha_start, alpha_end);
    }
    else {
      if (node_start != 0)
        one_rank_prefix =
          gt_compressed_bitsequence_rank_1(we->c_bits, node_start - 1);
      pos = gt_compressed_bitsequence_rank_1(we->c_bits, node_start + pos) -
        one_rank_prefix - 1; /*convert count (rank) to position */
      alpha_start = middle + 1;
      node_size =
        gt_compressed_bitsequence_rank_1(we->c_bits,
                                         node_start + node_size - 1) -
        one_rank_prefix;
      node_start +=
        we->parent_instance.members->length + left_child_size;
      return gt_wtree_encseq_access_rec(we, pos, node_start,
                                        node_size, alpha_start, alpha_end);
    }
  }
  return (GtWtreeSymbol) alpha_start;
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdx, 0x38(%rsp)
movq %rcx, 0x30(%rsp)
movl %r8d, 0x2c(%rsp)
movl %r9d, 0x28(%rsp)
movl 0x2c(%rsp), %eax
addl 0x28(%rsp), %eax
shrl %eax
movl %eax, 0x24(%rsp)
movq $0x0, 0x18(%rsp)
movq $0x0, 0x10(%rsp)
movq 0x40(%rsp), %rax
cmpq 0x30(%rsp), %rax
jb 0x1f7d96
movq 0x44423b(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x31e2a4(%rip), %rsi    # 0x516013
leaq 0x377663(%rip), %rdx    # 0x56f3d9
leaq 0x37766c(%rip), %rcx    # 0x56f3e9
leaq 0x377605(%rip), %r8     # 0x56f389
movl $0x4a, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1f7d98
movl 0x2c(%rsp), %eax
cmpl 0x28(%rsp), %eax
jae 0x1f7f4e
movq 0x48(%rsp), %rax
movq 0x38(%rax), %rdi
movq 0x38(%rsp), %rsi
addq 0x40(%rsp), %rsi
callq 0x13ad10
movl %eax, 0x20(%rsp)
cmpq $0x0, 0x38(%rsp)
je 0x1f7de6
movq 0x48(%rsp), %rax
movq 0x38(%rax), %rdi
movq 0x38(%rsp), %rsi
subq $0x1, %rsi
callq 0x13b2c0
movq %rax, 0x18(%rsp)
movq 0x48(%rsp), %rax
movq 0x38(%rax), %rdi
movq 0x38(%rsp), %rsi
addq 0x30(%rsp), %rsi
subq $0x1, %rsi
callq 0x13b2c0
subq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpl $0x0, 0x20(%rsp)
jne 0x1f7e8e
movq 0x48(%rsp), %rax
movq 0x38(%rax), %rdi
movq 0x38(%rsp), %rsi
addq 0x40(%rsp), %rsi
callq 0x13b2c0
subq 0x18(%rsp), %rax
subq $0x1, %rax
movq %rax, 0x40(%rsp)
movl 0x24(%rsp), %eax
movl %eax, 0x28(%rsp)
movq 0x48(%rsp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
addq 0x38(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq 0x30(%rsp), %rcx
movl 0x2c(%rsp), %r8d
movl 0x28(%rsp), %r9d
callq 0x1f7d10
movq %rax, 0x50(%rsp)
jmp 0x1f7f57
cmpq $0x0, 0x38(%rsp)
je 0x1f7eb2
movq 0x48(%rsp), %rax
movq 0x38(%rax), %rdi
movq 0x38(%rsp), %rsi
subq $0x1, %rsi
callq 0x13b130
movq %rax, 0x10(%rsp)
movq 0x48(%rsp), %rax
movq 0x38(%rax), %rdi
movq 0x38(%rsp), %rsi
addq 0x40(%rsp), %rsi
callq 0x13b130
subq 0x10(%rsp), %rax
subq $0x1, %rax
movq %rax, 0x40(%rsp)
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
movq 0x48(%rsp), %rax
movq 0x38(%rax), %rdi
movq 0x38(%rsp), %rsi
addq 0x30(%rsp), %rsi
subq $0x1, %rsi
callq 0x13b130
subq 0x10(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x48(%rsp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
addq 0x8(%rsp), %rax
addq 0x38(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq 0x30(%rsp), %rcx
movl 0x2c(%rsp), %r8d
movl 0x28(%rsp), %r9d
callq 0x1f7d10
movq %rax, 0x50(%rsp)
jmp 0x1f7f57
movl 0x2c(%rsp), %eax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)