// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/match/reads2twobit.c
// Function: gt_reads2twobit_decode_range
void gt_reads2twobit_decode_range(const GtReads2Twobit *r2t,
    GtFile *outfp, GtUword seqnum_from, GtUword nofseqs,
    const GtBitsequence *skip)
{
  GtTwobitencoding code;
  unsigned short charsincode;
  const char code2char[] = "acgt";
  GtUword seqnum, pos, nextsep, nextdecoded, seqnum_to;
  const GtTwobitencoding *nextencoded;
  char *decoded;

  gt_assert(r2t->seqlen_max > 0);
  if (nofseqs == 0)
    return;
  seqnum_to = seqnum_from + nofseqs - 1UL;
  decoded = gt_malloc(sizeof (*decoded) * (r2t->seqlen_max + 3UL));
  decoded[0] = '>';
  decoded[1] = '\n';
  nextdecoded = 2UL;

  seqnum = seqnum_from;
  if (skip != NULL)
    while (GT_ISIBITSET(skip, seqnum))
      seqnum++;

  if (r2t->seqlen_eqlen > 0)
  {
    nextsep = r2t->seqlen_eqlen * (seqnum + 1UL) - 1UL;
    pos = seqnum * r2t->seqlen_eqlen;
  }
  else
  {
    nextsep = r2t->seppos[seqnum];
    pos = (seqnum == 0) ? 0 : r2t->seppos[seqnum - 1UL] + 1UL;
  }

  nextencoded = r2t->twobitencoding + GT_DIVBYUNITSIN2BITENC(pos);
  code = *(nextencoded++);
  charsincode = (unsigned short)GT_UNITSIN2BITENC -
    (unsigned short)GT_MODBYUNITSIN2BITENC(pos);

  while (true)
  {
    if (charsincode == 0)
    {
      code = *(nextencoded++);
      charsincode = (unsigned short)GT_UNITSIN2BITENC;
    }
    if (pos++ < nextsep)
    {
      gt_assert(nextsep - pos <= r2t->seqlen_max);
      decoded[nextdecoded++] = code2char[code >> ((--charsincode) << 1) & 3];
    }
    else
    {
      /* output sequence */
      charsincode--;
      decoded[nextdecoded++] = '\n';
      decoded[nextdecoded] = '\0';
      gt_file_xfputs(decoded, outfp);
      nextdecoded = 2UL;

      seqnum++;
      if (seqnum > seqnum_to)
        break;
      if (skip != NULL && GT_ISIBITSET(skip, seqnum))
      {
        /* jump to next non-contained sequence */
        while (seqnum <= seqnum_to && GT_ISIBITSET(skip, seqnum))
          seqnum++;
        if (seqnum > seqnum_to)
          break;
        pos = r2t->seqlen_eqlen > 0 ? seqnum * r2t->seqlen_eqlen :
          r2t->seppos[seqnum - 1UL] + 1UL;
        nextencoded = r2t->twobitencoding + GT_DIVBYUNITSIN2BITENC(pos);
        code = *(nextencoded++);
        charsincode = (unsigned short)GT_UNITSIN2BITENC -
          (unsigned short)GT_MODBYUNITSIN2BITENC(pos);
      }
      nextsep = (r2t->seqlen_eqlen > 0)
        ? r2t->seqlen_eqlen * (seqnum + 1UL) - 1UL
        : r2t->seppos[seqnum];
    }
  }
  gt_free(decoded);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, 0x20(%rsp)
movq %rdi, %r15
movq 0x50(%rdi), %rdi
testq %rdi, %rdi
je 0x1e69d4
movq %rcx, %rbp
testq %rcx, %rcx
je 0x1e67e7
movq %rdx, %r14
movabsq $-0x8000000000000000, %rbx # imm = 0x8000000000000000
addq $0x3, %rdi
leaq 0x1d506e(%rip), %rsi    # 0x3bb7f4
movl $0x665, %edx            # imm = 0x665
movq %r8, 0x8(%rsp)
callq 0x1092b2
movq 0x8(%rsp), %rsi
movq %rax, (%rsp)
movw $0xa3e, (%rax)          # imm = 0xA3E
movq %r14, %r13
testq %rsi, %rsi
je 0x1e67cd
movq %rbx, %rdi
movq %r14, %r13
movq %r13, %rax
movq %rdi, %rdx
movl %r13d, %ecx
shrq %cl, %rdx
shrq $0x6, %rax
incq %r13
testq %rdx, (%rsi,%rax,8)
jne 0x1e67b1
decq %r13
movq 0x48(%r15), %r12
testq %r12, %r12
je 0x1e67f6
leaq 0x1(%r13), %rax
imulq %r12, %rax
decq %rax
imulq %r13, %r12
jmp 0x1e6810
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x38(%r15), %rcx
movq (%rcx,%r13,8), %rax
testq %r13, %r13
je 0x1e680d
movq -0x8(%rcx,%r13,8), %r12
incq %r12
jmp 0x1e6810
xorl %r12d, %r12d
leaq (%r14,%rbp), %r9
decq %r9
movq 0x10(%r15), %rcx
movq %r12, %rdx
shrq $0x5, %rdx
leaq (%rcx,%rdx,8), %r14
addq $0x8, %r14
movq -0x8(%r14), %rbx
movl %r12d, %ecx
andl $0x1f, %ecx
movl $0x20, %ebp
subl %ecx, %ebp
movq (%rsp), %rcx
addq $0x2, %rcx
movq %rcx, 0x18(%rsp)
leaq 0x180b2d(%rip), %r10    # 0x36737c
movq %r9, 0x10(%rsp)
movq %r12, %rdx
notq %rdx
addq %rax, %rdx
movq 0x18(%rsp), %rsi
testw %bp, %bp
jne 0x1e6872
movq (%r14), %rbx
addq $0x8, %r14
movw $0x20, %bp
cmpq %rax, %r12
jae 0x1e68a9
cmpq 0x50(%r15), %rdx
ja 0x1e69cf
leal -0x2(,%rbp,2), %ecx
movl %ebp, %edi
movq %rbx, %r8
shrq %cl, %r8
decl %edi
andl $0x3, %r8d
movb (%r8,%r10), %cl
movb %cl, (%rsi)
decq %rdx
incq %rsi
incq %r12
movl %edi, %ebp
jmp 0x1e6862
movw $0xa, (%rsi)
movq (%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0x103fc4
leaq 0x180ab9(%rip), %r10    # 0x36737c
movq 0x10(%rsp), %r9
movabsq $-0x8000000000000000, %r8 # imm = 0x8000000000000000
movq 0x8(%rsp), %rdi
incq %r13
cmpq %r9, %r13
ja 0x1e69ac
decl %ebp
incq %r12
testq %rdi, %rdi
je 0x1e6986
movq %r8, %rax
movl %r13d, %ecx
shrq %cl, %rax
movq %r13, %rdx
shrq $0x6, %rdx
testq %rax, (%rdi,%rdx,8)
je 0x1e6986
cmpq %r9, %r13
seta %al
ja 0x1e69ac
movq %r8, %rsi
movl %r13d, %ecx
shrq %cl, %rsi
testq %rsi, (%rdi,%rdx,8)
je 0x1e6943
incq %r13
cmpq %r9, %r13
seta %al
ja 0x1e69ac
movq %r8, %rdx
movl %r13d, %ecx
shrq %cl, %rdx
movq %r13, %rcx
shrq $0x6, %rcx
testq %rdx, (%rdi,%rcx,8)
jne 0x1e6922
testb %al, %al
jne 0x1e69ac
movq 0x48(%r15), %r12
testq %r12, %r12
je 0x1e6956
imulq %r13, %r12
jmp 0x1e6962
movq 0x38(%r15), %rax
movq -0x8(%rax,%r13,8), %r12
incq %r12
movq 0x10(%r15), %rax
movq %r12, %rcx
shrq $0x5, %rcx
leaq (%rax,%rcx,8), %r14
addq $0x8, %r14
movq -0x8(%r14), %rbx
movl %r12d, %eax
andl $0x1f, %eax
movl $0x20, %ebp
subl %eax, %ebp
movq 0x48(%r15), %rax
testq %rax, %rax
je 0x1e699f
leaq 0x1(%r13), %rcx
imulq %rcx, %rax
decq %rax
jmp 0x1e6854
movq 0x38(%r15), %rax
movq (%rax,%r13,8), %rax
jmp 0x1e6854
leaq 0x1d4e41(%rip), %rsi    # 0x3bb7f4
movq (%rsp), %rdi
movl $0x6aa, %edx            # imm = 0x6AA
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x109670
callq 0x74fa6
callq 0x74fdf