// File: /workspace/github_c_makefile_star2_O2/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 $0x68, %rsp
movq %rsi, %r13
movq %rdi, %rbx
leaq 0x18(%rsp), %rax
andq $0x0, (%rax)
movq 0x8(%rdi), %rdi
callq 0x586a4
movq %rax, 0x20(%rsp)
xorl %r14d, %r14d
pushq $0x20
popq %r15
xorl %r12d, %r12d
xorl %ebp, %ebp
cmpq 0x20(%rsp), %rbp
je 0x18afdc
movq 0x8(%rbx), %rdi
movq %rbp, %rsi
callq 0x581aa
movq 0x40(%rax), %rcx
testq %rcx, %rcx
je 0x18afd4
movq %rbp, 0x28(%rsp)
movq %r14, 0x30(%rsp)
movq %rax, 0x38(%rsp)
movq 0x38(%rax), %rbp
leaq (%rcx,%rbp), %rax
decq %rax
movq %rax, 0x40(%rsp)
movq $0x0, 0x10(%rsp)
xorl %edx, %edx
movq %r12, %r14
cmpq 0x40(%rsp), %rbp
ja 0x18af8b
movq %rbp, %rax
shrq $0x6, %rax
movq (%r13,%rax,8), %rax
movl %ebp, %ecx
shlq %cl, %rax
shrq $0x3f, %rax
je 0x18aec5
movq %rdx, %r12
movq %rbx, %rdi
movq %rbp, %rsi
leaq 0x58(%rsp), %rdx
leaq 0x60(%rsp), %rcx
leaq 0x50(%rsp), %r8
leaq 0x48(%rsp), %r9
callq 0x18a6d9
movq 0x58(%rsp), %rax
leaq -0x1(%rax), %rdx
movq 0x50(%rsp), %r8
movq 0x48(%rsp), %rsi
movq 0x60(%rsp), %rdi
subq $0x1, %rdx
jb 0x18aeaf
testq %r8, %r8
jne 0x18ae97
movq (%rsi), %rdi
addq $0x8, %rsi
movq %r15, %r8
decq %r8
leal (%r8,%r8), %ecx
movq %rdi, %r9
shrq %cl, %r9
andl $0x3, %r9d
decq 0x18(%rbx,%r9,8)
jmp 0x18ae82
movq %r12, %rdx
addq %rax, %rdx
incq %r14
incq 0x10(%rsp)
incq %rbp
jmp 0x18ae26
testq %r14, %r14
je 0x18aef1
movq %r13, %r12
movq %rbp, %r13
subq %r14, %r13
jb 0x18b040
movq %r14, (%rsp)
movq 0x48(%rbx), %r14
testq %r14, %r14
movq %rdx, 0x8(%rsp)
je 0x18aef6
imulq %r13, %r14
jmp 0x18af0d
xorl %r14d, %r14d
jmp 0x18aebd
cmpq (%rsp), %rbp
jne 0x18af01
xorl %r14d, %r14d
jmp 0x18af0d
movq 0x38(%rbx), %rax
movq -0x8(%rax,%r13,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, 0x18(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
leaq 0x18(%rsp), %r8
callq 0x18aa77
cmpq $0x0, 0x48(%rbx)
je 0x18af4f
movq %r12, %r13
movq (%rsp), %r14
movq 0x8(%rsp), %rdx
jmp 0x18aebd
movq 0x38(%rbx), %rax
movq (%rax,%rbp,8), %rcx
subq -0x8(%rax,%rbp,8), %rcx
cmpq 0x50(%rbx), %rcx
movq 0x8(%rsp), %rdx
ja 0x18b0a2
addq %r14, %rcx
cmpq 0x60(%rbx), %rcx
ja 0x18b071
decq %rcx
movq %rcx, (%rax,%r13,8)
movq %r12, %r13
movq (%rsp), %r14
jmp 0x18aebd
movq 0x38(%rsp), %rcx
movq 0x40(%rcx), %rax
movq 0x10(%rsp), %rsi
subq %rsi, %rax
jb 0x18b12f
movq %r14, %r12
andb (%rcx), %sil
cmpb $0x1, %sil
movq 0x30(%rsp), %r14
movq 0x28(%rsp), %rbp
je 0x18b0d3
movq %rax, 0x40(%rcx)
movq 0x30(%rcx), %rax
subq %rdx, %rax
jb 0x18b101
addq %rdx, %r14
movq %rax, 0x30(%rcx)
incq %rbp
jmp 0x18add5
movq 0x40(%rbx), %rax
cmpq %r12, %rax
jb 0x18b167
subq %r12, %rax
movq %rax, 0x40(%rbx)
jne 0x18aff6
xorl %eax, %eax
jmp 0x18b003
movq 0x60(%rbx), %rax
subq %r14, %rax
jb 0x18b195
movq %rax, 0x60(%rbx)
testq %r12, %r12
je 0x18b031
movq 0x10(%rbx), %rdi
shrq $0x5, %rax
leaq 0x10(,%rax,8), %rsi
leaq 0x1c7633(%rip), %rdx    # 0x352656
movl $0x79b, %ecx            # imm = 0x79B
callq 0x93472
movq %rax, 0x10(%rbx)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2acf21(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x159fc2(%rip), %rsi    # 0x2e5013
leaq 0x1c7894(%rip), %rdx    # 0x3528ec
leaq 0x1c78a9(%rip), %rcx    # 0x352908
leaq 0x1c75f0(%rip), %r8     # 0x352656
movl $0x764, %r9d            # imm = 0x764
jmp 0x18b15b
movq 0x2acef0(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x159f91(%rip), %rsi    # 0x2e5013
leaq 0x1c78ba(%rip), %rdx    # 0x352943
leaq 0x1c7878(%rip), %rcx    # 0x352908
leaq 0x1c75bf(%rip), %r8     # 0x352656
movl $0x776, %r9d            # imm = 0x776
jmp 0x18b15b
movq 0x2acebf(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x159f60(%rip), %rsi    # 0x2e5013
leaq 0x1c786f(%rip), %rdx    # 0x352929
leaq 0x1c7847(%rip), %rcx    # 0x352908
leaq 0x1c758e(%rip), %r8     # 0x352656
movl $0x775, %r9d            # imm = 0x775
jmp 0x18b15b
movq 0x2ace8e(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x159f2f(%rip), %rsi    # 0x2e5013
leaq 0x1c78b2(%rip), %rdx    # 0x35299d
leaq 0x1c7816(%rip), %rcx    # 0x352908
leaq 0x1c755d(%rip), %r8     # 0x352656
movl $0x786, %r9d            # imm = 0x786
jmp 0x18b15b
movq 0x2ace60(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x159f01(%rip), %rsi    # 0x2e5013
leaq 0x1c78a6(%rip), %rdx    # 0x3529bf
leaq 0x1c77e8(%rip), %rcx    # 0x352908
leaq 0x1c752f(%rip), %r8     # 0x352656
movl $0x788, %r9d            # imm = 0x788
jmp 0x18b15b
movq 0x2ace32(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x159ed3(%rip), %rsi    # 0x2e5013
leaq 0x1c782d(%rip), %rdx    # 0x352974
leaq 0x1c77ba(%rip), %rcx    # 0x352908
leaq 0x1c7501(%rip), %r8     # 0x352656
movl $0x784, %r9d            # imm = 0x784
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x2acdfa(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x159e9b(%rip), %rsi    # 0x2e5013
leaq 0x1c786d(%rip), %rdx    # 0x3529ec
leaq 0x1c7782(%rip), %rcx    # 0x352908
leaq 0x1c74c9(%rip), %r8     # 0x352656
movl $0x78c, %r9d            # imm = 0x78C
jmp 0x18b15b
movq 0x2acdcc(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x159e6d(%rip), %rsi    # 0x2e5013
leaq 0x1c7861(%rip), %rdx    # 0x352a0e
leaq 0x1c7754(%rip), %rcx    # 0x352908
leaq 0x1c749b(%rip), %r8     # 0x352656
movl $0x794, %r9d            # imm = 0x794
jmp 0x18b15b