// File: /workspace/github_c_makefile_star2_O1/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, %rbp
movq %rdi, %rbx
movq $0x0, 0x28(%rsp)
movq 0x8(%rdi), %rdi
callq 0xd4a9a
movq %rax, 0x30(%rsp)
testq %rax, %rax
je 0x1e6fd1
xorl %r15d, %r15d
xorl %r13d, %r13d
xorl %r14d, %r14d
movq 0x8(%rbx), %rdi
movq %r15, %rsi
callq 0xd47ba
movq 0x40(%rax), %r12
testq %r12, %r12
je 0x1e6fc1
movq %r15, 0x38(%rsp)
movq %r14, 0x40(%rsp)
movq 0x38(%rax), %r15
decq %r12
addq %r15, %r12
jae 0x1e6dc7
movq $0x0, 0x8(%rsp)
xorl %r11d, %r11d
movq %r13, %r14
jmp 0x1e6f7c
xorl %r11d, %r11d
movq $0x0, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movq %r13, %r14
movq %r15, %rcx
shrq $0x6, %rcx
movq (%rbp,%rcx,8), %rdx
movl %r15d, %ecx
shlq %cl, %rdx
shrq $0x3f, %rdx
je 0x1e6e05
movq 0x48(%rbx), %r10
testq %r10, %r10
je 0x1e6e3f
movq %r10, %rcx
imulq %r15, %rcx
jmp 0x1e6e6d
testq %r14, %r14
je 0x1e6e59
movq %r12, %r13
movq %rbp, %r12
movq %r15, %rbp
subq %r14, %rbp
jb 0x1e7037
movq %r14, %rax
movq 0x48(%rbx), %r14
testq %r14, %r14
movq %rax, 0x18(%rsp)
movq %r11, 0x20(%rsp)
je 0x1e6ed5
imulq %rbp, %r14
jmp 0x1e6eeb
testq %r15, %r15
je 0x1e6e61
movq 0x38(%rbx), %rdx
movq -0x8(%rdx,%r15,8), %rcx
movq (%rdx,%r15,8), %r10
subq %rcx, %r10
incq %rcx
jmp 0x1e6e6d
xorl %r14d, %r14d
jmp 0x1e6f70
movq 0x38(%rbx), %rcx
movq (%rcx), %r10
incq %r10
xorl %ecx, %ecx
movq %r10, %rdx
decq %rdx
je 0x1e6ec5
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 0x1e6eaa
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 0x1e6e98
addq %r10, %r11
incq %r14
incq 0x8(%rsp)
jmp 0x1e6f70
cmpq %rax, %r15
jne 0x1e6edf
xorl %r14d, %r14d
jmp 0x1e6eeb
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, 0x28(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
leaq 0x28(%rsp), %r8
callq 0x1e6a3a
cmpq $0x0, 0x48(%rbx)
je 0x1e6f30
movq %r12, %rbp
movq 0x10(%rsp), %rax
movq 0x20(%rsp), %r11
movq 0x18(%rsp), %r14
jmp 0x1e6f6d
movq 0x38(%rbx), %rdx
movq (%rdx,%r15,8), %rcx
subq -0x8(%rdx,%r15,8), %rcx
cmpq 0x50(%rbx), %rcx
movq 0x10(%rsp), %rax
movq 0x20(%rsp), %r11
ja 0x1e7041
addq %r14, %rcx
cmpq 0x60(%rbx), %rcx
movq 0x18(%rsp), %r14
ja 0x1e703c
decq %rcx
movq %rcx, (%rdx,%rbp,8)
movq %r12, %rbp
movq %r13, %r12
incq %r15
cmpq %r12, %r15
jbe 0x1e6ddb
movq 0x40(%rax), %rcx
movq 0x8(%rsp), %rdx
subq %rdx, %rcx
jb 0x1e7050
movq %r14, %r13
testb $0x1, %dl
movq 0x40(%rsp), %r14
movq 0x38(%rsp), %r15
je 0x1e6fa9
cmpb $0x0, (%rax)
jne 0x1e7046
movq %rcx, 0x40(%rax)
movq 0x30(%rax), %rcx
subq %r11, %rcx
jb 0x1e704b
addq %r11, %r14
movq %rcx, 0x30(%rax)
incq %r15
cmpq 0x30(%rsp), %r15
jne 0x1e6d84
jmp 0x1e6fd7
xorl %r14d, %r14d
xorl %r13d, %r13d
movq 0x40(%rbx), %rax
cmpq %r13, %rax
jb 0x1e7055
subq %r13, %rax
movq %rax, 0x40(%rbx)
jne 0x1e6fed
xorl %eax, %eax
jmp 0x1e6ff6
movq 0x60(%rbx), %rax
subq %r14, %rax
jb 0x1e705a
movq %rax, 0x60(%rbx)
testq %r13, %r13
je 0x1e7028
movq 0x10(%rbx), %rdi
movq 0x60(%rbx), %rax
shrq $0x5, %rax
leaq 0x10(,%rax,8), %rsi
leaq 0x1d47da(%rip), %rdx    # 0x3bb7f4
movl $0x79b, %ecx            # imm = 0x79B
callq 0x1094e6
movq %rax, 0x10(%rbx)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x750c3
callq 0x75051
callq 0x7508a
callq 0x75135
callq 0x750fc
callq 0x7516e
callq 0x751e0
callq 0x751a7