// File: /workspace/github_c_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %r13
movq %rcx, %r12
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0xa1f8d
decq %rax
cmpq %r15, %rax
jbe 0xa8675
leaq 0x1(%r15), %rsi
movq %rbx, %rdi
callq 0xa6788
movq %rax, %rbp
decq %rbp
jmp 0xa8680
movq %rbx, %rdi
callq 0xa1f4a
movq %rax, %rbp
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa6788
movq %rax, %r15
addq %r12, %r15
leaq (%r15,%r13), %r12
cmpq %r12, %rbp
cmovbq %rbp, %r12
testq %r13, %r13
cmoveq %rbp, %r12
xorl %r13d, %r13d
pushq $0x1
popq %rbp
cmpq %r15, %r12
je 0xa8723
movq %rsp, %rdi
movq %rbx, %rsi
movl %ebp, %edx
movq %r15, %rcx
movq %r12, %r8
callq 0xa8312
movq 0x8(%r14), %rax
cmpq %rax, 0x10(%r14)
jae 0xa86d0
movq (%r14), %rax
jmp 0xa86f7
leaq 0x20(%rax), %rcx
movq %rcx, 0x8(%r14)
movq (%r14), %rdi
leaq 0x100(,%rax,8), %rsi
leaq 0x434b0(%rip), %rdx     # 0xebb9a
movl $0x18e6, %ecx           # imm = 0x18E6
callq 0xcfc2
movq %rax, (%r14)
testq %rax, %rax
je 0xa8741
movq (%rsp), %rcx
movq 0x10(%r14), %rdx
leaq 0x1(%rdx), %rsi
movq %rsi, 0x10(%r14)
movq %rcx, (%rax,%rdx,8)
movl 0x8(%rsp), %eax
cmpl $0x1f, %eax
jbe 0xa872b
addq $0x20, %r15
addl $-0x20, %r13d
jmp 0xa86a9
negl %r13d
movl %r13d, %eax
jmp 0xa8732
testl %eax, %eax
je 0xa8779
subl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x85870(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x21914(%rip), %rsi     # 0xca066
leaq 0x444ee(%rip), %rdx     # 0xecc47
leaq 0x44515(%rip), %rcx     # 0xecc75
leaq 0x43433(%rip), %r8      # 0xebb9a
movl $0x18e6, %r9d           # imm = 0x18E6
xorl %eax, %eax
callq 0xb8c0
callq 0xb300
movq 0x85838(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x218dc(%rip), %rsi     # 0xca066
leaq 0x4450a(%rip), %rdx     # 0xecc9b
leaq 0x444dd(%rip), %rcx     # 0xecc75
leaq 0x433fb(%rip), %r8      # 0xebb9a
movl $0x18e8, %r9d           # imm = 0x18E8
jmp 0xa876d