// File: /workspace/github_c_makefile_star2_O3/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 0x1dd188
movq %rcx, %r12
testq %rcx, %rcx
je 0x1dcfb8
movq %rdx, %r14
movabsq $-0x8000000000000000, %rbx # imm = 0x8000000000000000
addq $0x3, %rdi
leaq 0x1d529d(%rip), %rsi    # 0x3b21f4
movl $0x665, %edx            # imm = 0x665
movq %r8, 0x8(%rsp)
callq 0x104226
movq 0x8(%rsp), %rsi
movq %rax, (%rsp)
movw $0xa3e, (%rax)          # imm = 0xA3E
movq %r14, %r13
testq %rsi, %rsi
je 0x1dcf9e
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 0x1dcf82
decq %r13
movq 0x48(%r15), %rbp
testq %rbp, %rbp
je 0x1dcfc7
leaq 0x1(%r13), %rax
imulq %rbp, %rax
decq %rax
imulq %r13, %rbp
jmp 0x1dcfe0
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 0x1dcfde
movq -0x8(%rcx,%r13,8), %rbp
incq %rbp
jmp 0x1dcfe0
xorl %ebp, %ebp
leaq (%r14,%r12), %r9
decq %r9
movq 0x10(%r15), %rcx
movq %rbp, %rdx
shrq $0x5, %rdx
leaq (%rcx,%rdx,8), %r14
addq $0x8, %r14
movq -0x8(%r14), %rbx
movl %ebp, %ecx
andl $0x1f, %ecx
movl $0x20, %r12d
subl %ecx, %r12d
movq (%rsp), %rcx
addq $0x2, %rcx
movq %rcx, 0x18(%rsp)
leaq 0x181260(%rip), %r10    # 0x35e280
movq %r9, 0x10(%rsp)
movq %rbp, %rdx
notq %rdx
addq %rax, %rdx
movq 0x18(%rsp), %rsi
testw %r12w, %r12w
jne 0x1dd045
movq (%r14), %rbx
addq $0x8, %r14
movw $0x20, %r12w
cmpq %rax, %rbp
jae 0x1dd07f
cmpq 0x50(%r15), %rdx
ja 0x1dd183
leal -0x2(,%r12,2), %ecx
movl %r12d, %edi
movq %rbx, %r8
shrq %cl, %r8
decl %edi
andl $0x3, %r8d
movb (%r8,%r10), %cl
movb %cl, (%rsi)
decq %rdx
incq %rsi
incq %rbp
movl %edi, %r12d
jmp 0x1dd033
movw $0xa, (%rsi)
movq (%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0xff0f4
leaq 0x1811e7(%rip), %r10    # 0x35e280
movq 0x10(%rsp), %r9
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
movq 0x8(%rsp), %rdx
incq %r13
cmpq %r9, %r13
ja 0x1dd160
decl %r12d
incq %rbp
testq %rdx, %rdx
je 0x1dd13a
movq %rsi, %rax
movl %r13d, %ecx
shrq %cl, %rax
movq %r13, %rcx
shrq $0x6, %rcx
testq %rax, (%rdx,%rcx,8)
je 0x1dd13a
movq %rsi, %rax
movl %r13d, %ecx
shrq %cl, %rax
movq %r13, %rcx
shrq $0x6, %rcx
testq %rax, (%rdx,%rcx,8)
je 0x1dd0fa
incq %r13
cmpq %r9, %r13
jbe 0x1dd0da
jmp 0x1dd160
movq 0x48(%r15), %rbp
testq %rbp, %rbp
je 0x1dd109
imulq %r13, %rbp
jmp 0x1dd115
movq 0x38(%r15), %rax
movq -0x8(%rax,%r13,8), %rbp
incq %rbp
movq 0x10(%r15), %rax
movq %rbp, %rcx
shrq $0x5, %rcx
leaq (%rax,%rcx,8), %r14
addq $0x8, %r14
movq -0x8(%r14), %rbx
movl %ebp, %eax
andl $0x1f, %eax
movl $0x20, %r12d
subl %eax, %r12d
movq 0x48(%r15), %rax
testq %rax, %rax
je 0x1dd153
leaq 0x1(%r13), %rcx
imulq %rcx, %rax
decq %rax
jmp 0x1dd025
movq 0x38(%r15), %rax
movq (%rax,%r13,8), %rax
jmp 0x1dd025
leaq 0x1d508d(%rip), %rsi    # 0x3b21f4
movq (%rsp), %rdi
movl $0x6aa, %edx            # imm = 0x6AA
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1045eb
callq 0x7338b
callq 0x733c4