// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/match/reads2twobit.c
// Function: gt_reads2twobit_delete_sequences
void gt_reads2twobit_delete_sequences(GtReads2Twobit *r2t, GtBitsequence *list)
{
  GtTwobitencoding outputoffset = 0, *outputbuffer;
  GtUword libnum, seqnum, output_seqnum,
                noflibs = gt_array_size(r2t->collection),
                deleted_sequences = 0, deleted_chars = 0, output_startpos = 0;
  for (libnum = 0; libnum < noflibs; libnum++)
  {
    GtReadsLibraryInfo *rli = gt_array_get(r2t->collection, libnum);
    if (rli->nofseqs > 0)
    {
      GtUword deleted_sequences_in_lib = 0, deleted_chars_in_lib = 0,
                    last_seqnum = rli->first_seqnum + rli->nofseqs - 1UL;
      for (seqnum = rli->first_seqnum; seqnum <= last_seqnum; seqnum++)
      {
        if (!GT_ISIBITSET(list, seqnum))
        {
          if (deleted_sequences > 0)
          {
            gt_assert(seqnum >= deleted_sequences);
            output_seqnum = seqnum - deleted_sequences;
            output_startpos = (r2t->seqlen_eqlen > 0)
              ? r2t->seqlen_eqlen * output_seqnum
              : ((output_seqnum == 0) ? 0 :
              r2t->seppos[output_seqnum - 1UL] + 1UL);
            outputbuffer = r2t->twobitencoding +
              GT_DIVBYUNITSIN2BITENC(output_startpos);
            outputoffset = (GtTwobitencoding)
              GT_MODBYUNITSIN2BITENC(output_startpos);
            (void)gt_reads2twobit_write_encoded(r2t, seqnum, outputbuffer,
                outputoffset, &outputoffset);
            if (r2t->seqlen_eqlen == 0)
            {
              GtUword seqlen;
              gt_assert(seqnum > 0);
              seqlen = r2t->seppos[seqnum] - r2t->seppos[seqnum - 1UL];
              gt_assert(seqlen <= r2t->seqlen_max);
              gt_assert(output_startpos + seqlen <= r2t->total_seqlength);
              r2t->seppos[output_seqnum] = output_startpos + seqlen - 1UL;
            }
          }
        }
        else
        {
          deleted_chars_in_lib +=
            gt_reads2twobit_subtract_from_chardistri(r2t, seqnum);
          deleted_sequences++;
          deleted_sequences_in_lib++;
        }
      }
      deleted_chars += deleted_chars_in_lib;
      gt_assert(deleted_sequences_in_lib <= rli->nofseqs);
      if (rli->paired == true)
        gt_assert(deleted_sequences_in_lib % 2 == 0);
      rli->nofseqs -= deleted_sequences_in_lib;
      gt_assert(deleted_chars_in_lib <= rli->total_seqlength);
      rli->total_seqlength -= deleted_chars_in_lib;
    }
  }
  gt_assert(deleted_sequences <= r2t->nofseqs);
  r2t->nofseqs -= deleted_sequences;
  if (r2t->nofseqs == 0)
  {
    r2t->total_seqlength = 0;
  }
  else
  {
    gt_assert(deleted_chars <= r2t->total_seqlength);
    r2t->total_seqlength -= deleted_chars;
  }
  if (deleted_sequences > 0)
  {
    r2t->twobitencoding = gt_realloc(r2t->twobitencoding,
        sizeof (*r2t->twobitencoding) *
        (GT_DIVBYUNITSIN2BITENC(r2t->total_seqlength) + 2UL));
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq $0x0, 0x38(%rsp)
movq 0x8(%rdi), %rdi
callq 0xd24e0
movq %rax, 0x40(%rsp)
testq %rax, %rax
je 0x1dd7a8
xorl %r15d, %r15d
xorl %ebp, %ebp
movq $0x0, 0x8(%rsp)
movq 0x8(%rbx), %rdi
movq %r15, %rsi
callq 0xd2207
movq 0x40(%rax), %r12
testq %r12, %r12
je 0x1dd787
movq %r15, 0x10(%rsp)
movq 0x38(%rax), %r15
decq %r12
addq %r15, %r12
jae 0x1dd584
movq %rax, %rcx
addq $0x30, %rcx
movq 0x30(%rax), %rdx
xorl %r11d, %r11d
movq 0x10(%rsp), %r15
jmp 0x1dd781
xorl %r11d, %r11d
xorl %r13d, %r13d
movq %rax, 0x18(%rsp)
movq %r15, %rcx
shrq $0x6, %rcx
movq (%r14,%rcx,8), %rdx
movl %r15d, %ecx
shlq %cl, %rdx
shrq $0x3f, %rdx
je 0x1dd5b8
movq 0x48(%rbx), %r10
testq %r10, %r10
je 0x1dd5fa
movq %r10, %rcx
imulq %r15, %rcx
jmp 0x1dd623
testq %rbp, %rbp
je 0x1dd614
movq %r13, 0x30(%rsp)
movq %rbp, %rcx
movq %r15, %rbp
subq %rcx, %rbp
jb 0x1dd80e
movq %r12, %r13
movq %r14, %r12
movq %rcx, %rax
movq 0x48(%rbx), %r14
testq %r14, %r14
movq %rcx, 0x20(%rsp)
movq %r11, 0x28(%rsp)
je 0x1dd689
imulq %rbp, %r14
jmp 0x1dd69f
movq 0x38(%rbx), %rdx
testq %r15, %r15
je 0x1dd61b
movq -0x8(%rdx,%r15,8), %rcx
movq (%rdx,%r15,8), %r10
subq %rcx, %r10
incq %rcx
jmp 0x1dd623
xorl %ebp, %ebp
jmp 0x1dd72f
movq (%rdx), %r10
incq %r10
xorl %ecx, %ecx
movq %r10, %rdx
decq %rdx
je 0x1dd67b
movq 0x10(%rbx), %rsi
movq %rcx, %rdi
shrq $0x5, %rdi
leaq (%rsi,%rdi,8), %rsi
addq $0x8, %rsi
movq -0x8(%rsi), %rdi
andl $0x1f, %ecx
movl $0x20, %r8d
subq %rcx, %r8
testq %r8, %r8
jne 0x1dd660
movq (%rsi), %rdi
addq $0x8, %rsi
movl $0x20, %r8d
decq %r8
leal (%r8,%r8), %ecx
movq %rdi, %r9
shrq %cl, %r9
andl $0x3, %r9d
decq 0x18(%rbx,%r9,8)
decq %rdx
jne 0x1dd64e
addq %r10, %r11
incq %rbp
incq %r13
jmp 0x1dd72f
cmpq %rax, %r15
jne 0x1dd693
xorl %r14d, %r14d
jmp 0x1dd69f
movq 0x38(%rbx), %rax
movq -0x8(%rax,%rbp,8), %r14
incq %r14
movq %r14, %rdx
shrq $0x2, %rdx
andq $-0x8, %rdx
addq 0x10(%rbx), %rdx
movl %r14d, %ecx
andl $0x1f, %ecx
movq %rcx, 0x38(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
leaq 0x38(%rsp), %r8
callq 0x1dd1ee
cmpq $0x0, 0x48(%rbx)
je 0x1dd6e7
movq %r12, %r14
movq 0x18(%rsp), %rax
movq 0x28(%rsp), %r11
movq 0x20(%rsp), %rbp
movq %r13, %r12
jmp 0x1dd72a
movq 0x38(%rbx), %rdx
movq (%rdx,%r15,8), %rcx
subq -0x8(%rdx,%r15,8), %rcx
cmpq 0x50(%rbx), %rcx
movq 0x18(%rsp), %rax
movq 0x28(%rsp), %r11
ja 0x1dd813
addq %r14, %rcx
cmpq 0x60(%rbx), %rcx
movq 0x20(%rsp), %rsi
ja 0x1dd818
decq %rcx
movq %rcx, (%rdx,%rbp,8)
movq %r12, %r14
movq %r13, %r12
movq %rsi, %rbp
movq 0x30(%rsp), %r13
incq %r15
cmpq %r12, %r15
jbe 0x1dd58f
movq 0x40(%rax), %rdx
subq %r13, %rdx
jb 0x1dd827
testb $0x1, %r13b
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %r15
je 0x1dd761
cmpb $0x0, (%rax)
jne 0x1dd822
movq %rdx, 0x40(%rax)
movq 0x30(%rax), %rdx
cmpq %rdx, %r11
ja 0x1dd81d
addq %r11, %rcx
movq %rcx, 0x8(%rsp)
addq $0x30, %rax
movq %rax, %rcx
subq %r11, %rdx
movq %rdx, (%rcx)
incq %r15
cmpq 0x40(%rsp), %r15
jne 0x1dd542
movq 0x40(%rbx), %rax
cmpq %rax, %rbp
movq 0x8(%rsp), %rcx
jbe 0x1dd7b0
callq 0x7358c
movq 0x40(%rbx), %rax
xorl %ebp, %ebp
xorl %ecx, %ecx
subq %rbp, %rax
movq %rax, 0x40(%rbx)
jne 0x1dd7c8
movq $0x0, 0x60(%rbx)
movl $0x10, %esi
jmp 0x1dd7e1
movq 0x60(%rbx), %rax
subq %rcx, %rax
jb 0x1dd82c
movq %rax, 0x60(%rbx)
shrq $0x5, %rax
leaq 0x10(,%rax,8), %rsi
testq %rbp, %rbp
je 0x1dd7ff
movq 0x10(%rbx), %rdi
leaq 0x1d4a03(%rip), %rdx    # 0x3b21f4
movl $0x79b, %ecx            # imm = 0x79B
callq 0x104461
movq %rax, 0x10(%rbx)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x734a8
callq 0x7346f
callq 0x73436
callq 0x734e1
callq 0x7351a
callq 0x73553
callq 0x735c5