// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/extended/kmer_database.c
// Function: gt_kmer_database_new
GtKmerDatabase* gt_kmer_database_new(unsigned int alpabet_size,
                                     unsigned int kmer_size,
                                     GtUword sb_max_nu_kmers,
                                     GtEncseq *encseq)
{
  GtKmerDatabase *kdb = gt_malloc(sizeof (*kdb));
  gt_assert(encseq != NULL);
  gt_assert((GtUword) kmer_size < gt_encseq_total_length(encseq));
  kdb->nu_kmer_codes = gt_power_for_small_exponents(alpabet_size, kmer_size);
  kdb->offset = gt_calloc((size_t) (kdb->nu_kmer_codes + 1),
                         sizeof (*kdb->offset));
  kdb->seen_kmer_counts = gt_calloc((size_t) (kdb->nu_kmer_codes + 1),
                              sizeof (*kdb->seen_kmer_counts));
  kdb->deleted_positions = gt_bittab_new(kdb->nu_kmer_codes);
  kdb->positions = NULL;
  kdb->unique_ids = NULL;
  kdb->sb.max_nu_kmers = sb_max_nu_kmers;
  /* may need upper bound */
  kdb->initial_size = gt_encseq_total_length(encseq) / (GtUword) 100;
  if (kdb->initial_size < sb_max_nu_kmers)
    kdb->initial_size = sb_max_nu_kmers;

  kdb->seen_kmers = 0;
  kdb->current_size = 0;
  kdb->min_nu_occ = 0;
  kdb->min_code = kdb->nu_kmer_codes + 1;
  kdb->cutoff = 0;
  kdb->min_cutoff = 0;
  kdb->mean_fraction = 0;
  kdb->cutoff_is_set = false;
  kdb->mean_cutoff = false;
  kdb->prune_is_set = false;
  kdb->last_size = 0;
  kdb->sb.kmer_count = 0;
  kdb->sb.preprocessed_kmer_count = 0;
  kdb->sb.offset = 0;
  kdb->sb.kmer_size = kmer_size;
  kdb->sb.intervals_kmer_count = 0;
  kdb->sb.kmers = gt_malloc((size_t) sb_max_nu_kmers *
                            sizeof (*kdb->sb.kmers));
  kdb->sb.intervals = gt_malloc(sizeof (*kdb->sb.intervals));
  kdb->sb.ids = gt_malloc(sizeof (*kdb->sb.ids));
  GT_INITARRAY(kdb->sb.intervals, GtRange);
  GT_INITARRAY(kdb->sb.ids, GtUword);
  kdb->sb.es = gt_encseq_ref(encseq);
  kdb->sb.kmer_iter =
      gt_kmercodeiterator_encseq_new(kdb->sb.es, GT_READMODE_FORWARD,
                                     kdb->sb.kmer_size, 0);
  kdb->sb.printed = false;
  return kdb;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %r15
movl %esi, %ebp
movl %edi, %r12d
leaq 0x22e25f(%rip), %rsi    # 0x384fe0
movl $0xd8, %edi
movl $0x54, %edx
callq 0x104226
testq %r14, %r14
je 0x156f20
movq %rax, %rbx
movl %ebp, %r13d
movq %r14, %rdi
callq 0xe7b9c
cmpq %r13, %rax
jbe 0x156f25
movl %r12d, %edi
movl %ebp, %esi
callq 0x105ed6
movq %rax, 0x28(%rbx)
leaq 0x1(%rax), %rdi
leaq 0x22e217(%rip), %r12    # 0x384fe0
movl $0x8, %esi
movq %r12, %rdx
movl $0x59, %ecx
callq 0x10436a
movq %rax, (%rbx)
movq 0x28(%rbx), %rdi
incq %rdi
movl $0x8, %esi
movq %r12, %rdx
movl $0x5b, %ecx
callq 0x10436a
movq %rax, 0x8(%rbx)
movq 0x28(%rbx), %rdi
callq 0xd6a50
movq %rax, 0x20(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movq %r15, 0xa8(%rbx)
movq %r14, %rdi
callq 0xe7b9c
shrq $0x2, %rax
movabsq $0x28f5c28f5c28f5c3, %rcx # imm = 0x28F5C28F5C28F5C3
mulq %rcx
shrq $0x2, %rdx
cmpq %r15, %rdx
cmovbeq %r15, %rdx
movq %rdx, 0x30(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rbx)
movq 0x28(%rbx), %rax
incq %rax
movq %rax, 0x68(%rbx)
movups %xmm0, 0x48(%rbx)
movups %xmm0, 0x58(%rbx)
xorl %r13d, %r13d
movq %r13, 0x70(%rbx)
movl $0x0, 0x77(%rbx)
movups %xmm0, 0xb0(%rbx)
movups %xmm0, 0xc0(%rbx)
movl %ebp, 0xd0(%rbx)
shlq $0x4, %r15
movq %r15, %rdi
movq %r12, %rsi
movl $0x76, %edx
callq 0x104226
movq %rax, 0xa0(%rbx)
movl $0x18, %edi
movq %r12, %rsi
movl $0x77, %edx
callq 0x104226
movq %rax, 0x80(%rbx)
movl $0x18, %edi
movq %r12, %rsi
movl $0x78, %edx
callq 0x104226
movq %rax, 0x88(%rbx)
movq 0x80(%rbx), %rcx
movq %r13, 0x10(%rcx)
xorps %xmm0, %xmm0
movups %xmm0, (%rcx)
movq %r13, 0x10(%rax)
movups %xmm0, (%rax)
movq %r14, %rdi
callq 0xea9be
movq %rax, 0x90(%rbx)
movl 0xd0(%rbx), %edx
movq %rax, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x1ee606
movq %rax, 0x98(%rbx)
movb $0x0, 0xd4(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x49da4
callq 0x49d6d