// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/kmer_database.c
// Function: gt_kmer_database_prune
static void gt_kmer_database_prune(GtKmerDatabase *kdb)
{
  GtUword code,
          deleted = 0,
          right = 0,
          current_left,
          left = 0;
  bool delete = false;

  gt_assert(kdb != NULL);

  for (code = 0; code < kdb->nu_kmer_codes; code++) {
    current_left = kdb->offset[code];
    right = kdb->offset[code + 1];
    kdb->offset[code] -= deleted;
    if (kdb->seen_kmer_counts[code] > kdb->cutoff &&
        !gt_bittab_bit_is_set(kdb->deleted_positions, code)) {
      if (!delete && deleted > 0) {
        memmove(kdb->positions + left - deleted, kdb->positions + left,
                (size_t) (current_left - left) * sizeof (*kdb->positions));
        memmove(kdb->unique_ids + left - deleted, kdb->unique_ids + left,
                (size_t) (current_left - left) * sizeof (*kdb->unique_ids));
      }
      delete = true;
      deleted += right - current_left;
      gt_bittab_set_bit(kdb->deleted_positions, code);
    }
    else if (delete) {
      left = current_left;
      delete = false;
    }
  }
  if (!delete && deleted > 0) {
    memmove(kdb->positions + left - deleted, kdb->positions + left,
            (size_t) (right - left) * sizeof (*kdb->positions));
    memmove(kdb->unique_ids + left - deleted, kdb->unique_ids + left,
            (size_t) (right - left) * sizeof (*kdb->unique_ids));
  }
  kdb->offset[code] -= deleted;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq $0x0, 0x20(%rsp)
movq $0x0, 0x18(%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x7(%rsp)
cmpq $0x0, 0x30(%rsp)
jne 0x19bb69
movq 0x4a0468(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x37a4d1(%rip), %rsi    # 0x516013
leaq 0x3bbc59(%rip), %rdx    # 0x5577a2
leaq 0x3bc658(%rip), %rcx    # 0x5581a8
leaq 0x3bbbe4(%rip), %r8     # 0x55773b
movl $0xe9, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x19bb6b
movq $0x0, 0x28(%rsp)
movq 0x28(%rsp), %rax
movq 0x30(%rsp), %rcx
cmpq 0x28(%rcx), %rax
jae 0x19bd16
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x10(%rsp)
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq 0x28(%rsp), %rcx
movq 0x8(%rax,%rcx,8), %rax
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rsi
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %rdx
subq %rsi, %rdx
movq %rdx, (%rax,%rcx,8)
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x30(%rsp), %rcx
cmpq 0x48(%rcx), %rax
jbe 0x19bce9
movq 0x30(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x28(%rsp), %rsi
callq 0x8a780
testb $0x1, %al
jne 0x19bce9
testb $0x1, 0x7(%rsp)
jne 0x19bcbb
cmpq $0x0, 0x20(%rsp)
jbe 0x19bcbb
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x8(%rsp), %rax
shlq $0x3, %rax
addq %rax, %rdi
xorl %eax, %eax
subq 0x20(%rsp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rsi
movq 0x8(%rsp), %rax
shlq $0x3, %rax
addq %rax, %rsi
movq 0x10(%rsp), %rdx
subq 0x8(%rsp), %rdx
shlq $0x3, %rdx
callq 0x19bf0
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x8(%rsp), %rax
shlq $0x3, %rax
addq %rax, %rdi
xorl %eax, %eax
subq 0x20(%rsp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x8(%rsp), %rax
shlq $0x3, %rax
addq %rax, %rsi
movq 0x10(%rsp), %rdx
subq 0x8(%rsp), %rdx
shlq $0x3, %rdx
callq 0x19bf0
movb $0x1, 0x7(%rsp)
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
addq 0x20(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x30(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x28(%rsp), %rsi
callq 0x89b00
jmp 0x19bd01
testb $0x1, 0x7(%rsp)
je 0x19bcff
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rsp)
movb $0x0, 0x7(%rsp)
jmp 0x19bd01
jmp 0x19bd03
movq 0x28(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x28(%rsp)
jmp 0x19bb74
testb $0x1, 0x7(%rsp)
jne 0x19bdc3
cmpq $0x0, 0x20(%rsp)
jbe 0x19bdc3
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x8(%rsp), %rax
shlq $0x3, %rax
addq %rax, %rdi
xorl %eax, %eax
subq 0x20(%rsp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rsi
movq 0x8(%rsp), %rax
shlq $0x3, %rax
addq %rax, %rsi
movq 0x18(%rsp), %rdx
subq 0x8(%rsp), %rdx
shlq $0x3, %rdx
callq 0x19bf0
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x8(%rsp), %rax
shlq $0x3, %rax
addq %rax, %rdi
xorl %eax, %eax
subq 0x20(%rsp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x8(%rsp), %rax
shlq $0x3, %rax
addq %rax, %rsi
movq 0x18(%rsp), %rdx
subq 0x8(%rsp), %rdx
shlq $0x3, %rdx
callq 0x19bf0
movq 0x20(%rsp), %rsi
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %rdx
subq %rsi, %rdx
movq %rdx, (%rax,%rcx,8)
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
nop