// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/core/encseq.c
// Function: gt_encseq_relpos_extract2bitencvector
unsigned int gt_encseq_relpos_extract2bitencvector(
                                          GtArrayGtTwobitencoding *tbereservoir,
                                          const GtEncseq *encseq,
                                          GtUword seqnum,
                                          GtUword relpos,
                                          GtUword maxnofelem)
{
  GtEndofTwobitencoding etbecurrent;
  GtUword pos, twobitencodingstoppos;
  unsigned int offset;

  if (seqnum < gt_encseq_num_of_sequences(encseq) - 1) {
    twobitencodingstoppos = gt_encseq_seqstartpos(encseq, seqnum + 1) - 1;
  }
  else {
    twobitencodingstoppos = gt_encseq_total_length(encseq);
  }
  pos = gt_encseq_seqstartpos(encseq, seqnum) + relpos;
  if (maxnofelem > 0) {
    GtUword maxpos = pos + maxnofelem;
    if (twobitencodingstoppos > maxpos)
      twobitencodingstoppos = maxpos;
  }
  for (offset = 0; /* Nothing */;
       offset += (unsigned int) GT_UNITSIN2BITENC) {
    if (pos == twobitencodingstoppos) {
      return offset;
    }
    (void) gt_encseq_extract2bitenc(&etbecurrent, encseq, true, pos,
                                    twobitencodingstoppos);
    GT_STOREINARRAY(tbereservoir, GtTwobitencoding, 32UL, etbecurrent.tbe);
    if (etbecurrent.unitsnotspecial < (unsigned int) GT_UNITSIN2BITENC) {
      gt_assert(etbecurrent.unitsnotspecial > 0);
      return offset + etbecurrent.unitsnotspecial;
    }
    pos += GT_UNITSIN2BITENC;
  }
}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x68(%rsp)
movq %rsi, 0x60(%rsp)
movq %rdx, 0x58(%rsp)
movq %rcx, 0x50(%rsp)
movq %r8, 0x48(%rsp)
movq 0x58(%rsp), %rax
movq %rax, (%rsp)
movq 0x60(%rsp), %rdi
callq 0x113f30
movq %rax, %rcx
movq (%rsp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x11deee
movq 0x60(%rsp), %rdi
movq 0x58(%rsp), %rsi
addq $0x1, %rsi
callq 0x11a710
subq $0x1, %rax
movq %rax, 0x20(%rsp)
jmp 0x11defd
movq 0x60(%rsp), %rdi
callq 0x113ee0
movq %rax, 0x20(%rsp)
movq 0x60(%rsp), %rdi
movq 0x58(%rsp), %rsi
callq 0x11a710
addq 0x50(%rsp), %rax
movq %rax, 0x28(%rsp)
cmpq $0x0, 0x48(%rsp)
jbe 0x11df45
movq 0x28(%rsp), %rax
addq 0x48(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %rax
cmpq 0x10(%rsp), %rax
jbe 0x11df43
movq 0x10(%rsp), %rax
movq %rax, 0x20(%rsp)
jmp 0x11df45
movl $0x0, 0x1c(%rsp)
movq 0x28(%rsp), %rax
cmpq 0x20(%rsp), %rax
jne 0x11df66
movl 0x1c(%rsp), %eax
movl %eax, 0x74(%rsp)
jmp 0x11e115
movq 0x60(%rsp), %rsi
movq 0x28(%rsp), %rcx
movq 0x20(%rsp), %r8
leaq 0x30(%rsp), %rdi
movl $0x1, %edx
callq 0x11d840
jmp 0x11df86
movq 0x68(%rsp), %rax
movq 0x10(%rax), %rax
addq $0x0, %rax
movq 0x68(%rsp), %rcx
cmpq 0x8(%rcx), %rax
jb 0x11e031
movq $0x20, 0x8(%rsp)
xorl %eax, %eax
cmpq 0x8(%rsp), %rax
jbe 0x11dfec
movq 0x9601d(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x400a1(%rip), %rsi     # 0x15e066
leaq 0x532d0(%rip), %rdx     # 0x17129c
leaq 0x68773(%rip), %rcx     # 0x186746
leaq 0x67684(%rip), %r8      # 0x18565e
movl $0x18e6, %r9d           # imm = 0x18E6
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x11dfee
movq 0x8(%rsp), %rcx
movq 0x68(%rsp), %rax
addq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x68(%rsp), %rax
movq (%rax), %rdi
movq 0x68(%rsp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
leaq 0x67642(%rip), %rdx     # 0x18565e
movl $0x18e6, %ecx           # imm = 0x18E6
callq 0xd730
movq %rax, %rcx
movq 0x68(%rsp), %rax
movq %rcx, (%rax)
jmp 0x11e033
movq 0x68(%rsp), %rax
cmpq $0x0, (%rax)
jne 0x11e076
movq 0x95f93(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x40017(%rip), %rsi     # 0x15e066
leaq 0x686c2(%rip), %rdx     # 0x186718
leaq 0x686e9(%rip), %rcx     # 0x186746
leaq 0x675fa(%rip), %r8      # 0x18565e
movl $0x18e6, %r9d           # imm = 0x18E6
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x11e078
jmp 0x11e07a
movq 0x30(%rsp), %rdx
movq 0x68(%rsp), %rax
movq (%rax), %rax
movq 0x68(%rsp), %rsi
movq 0x10(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x10(%rsi)
movq %rdx, (%rax,%rcx,8)
cmpl $0x20, 0x38(%rsp)
jae 0x11e0f7
jmp 0x11e0a8
cmpl $0x0, 0x38(%rsp)
ja 0x11e0e7
movq 0x95f22(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x3ffa6(%rip), %rsi     # 0x15e066
leaq 0x686a5(%rip), %rdx     # 0x18676c
leaq 0x68678(%rip), %rcx     # 0x186746
leaq 0x67589(%rip), %r8      # 0x18565e
movl $0x18e8, %r9d           # imm = 0x18E8
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x11e0e9
movl 0x1c(%rsp), %eax
addl 0x38(%rsp), %eax
movl %eax, 0x74(%rsp)
jmp 0x11e115
movq 0x28(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x28(%rsp)
movl 0x1c(%rsp), %eax
addl $0x20, %eax
movl %eax, 0x1c(%rsp)
jmp 0x11df4d
movl 0x74(%rsp), %eax
addq $0x78, %rsp
retq
nop