// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/condenseq_creator.c
// Function: ces_c_init_kmer_db
static int ces_c_init_kmer_db(GtCondenseqCreator *ces_c, GtError *err)
{
  int had_err = 0;
  GtUword kmersize = (GtUword) ces_c->kmersize - 1;
  CesCState state;

  /* disable pruning for initialization */
  if (ces_c->use_cutoff && ces_c->prune_kmer_db)
    gt_kmer_database_disable_prune(ces_c->kmer_db);

  state = ces_c_skip_short_seqs(ces_c);
  if (state == GT_CONDENSEQ_CREATOR_CONT) {
    state = ces_c_reset_pos_and_iter_to_current_seq(ces_c);
  }
  while (!had_err &&
         state != GT_CONDENSEQ_CREATOR_EOD &&
         ces_c->initsize > gt_kmer_database_get_kmer_count(ces_c->kmer_db)) {
    GtUword initsize = ces_c->initsize -
                       gt_kmer_database_get_kmer_count(ces_c->kmer_db),
            usable_seqlen = ces_c->current_seq_len - kmersize -
                            ces_c->current_seq_pos;
    gt_log_log("at pos: " GT_WU ", seq: " GT_WU " remaining: " GT_WU " kmers, "
               "have: " GT_WU " kmers",
               ces_c->main_pos, ces_c->main_seqnum, initsize,
               gt_kmer_database_get_kmer_count(ces_c->kmer_db));
    /* assure initzise is long enough to allow addition of kmers to kmer-db */
    initsize = initsize < ces_c->min_align_len ?
                 ces_c->min_align_len :
                 initsize;
    /* large sequences */
    if (usable_seqlen >= initsize) {
      /* if rest would be to small on its own, put it into initial set */
      if (usable_seqlen - initsize < ces_c->min_align_len) {
        GT_CES_LENCHECK(ces_c->current_seq_len);
        gt_log_log("large enough with end (" GT_WU ") add all",
                   usable_seqlen);
        if (!had_err) {
          gt_condenseq_add_unique_to_db(ces_c->ces,
                                        ces_c->main_pos,
                                        usable_seqlen + kmersize);
          ces_c_add_kmers(ces_c, ces_c->main_pos,
                          ces_c->main_pos + usable_seqlen);
          ces_c->main_seqnum++;
          state = ces_c_skip_short_seqs(ces_c);
          if (state == GT_CONDENSEQ_CREATOR_CONT) {
            state = ces_c_reset_pos_and_iter_to_current_seq(ces_c);
          }
        }
      }
      else {
        initsize += kmersize;
        gt_log_log("large enough (" GT_WU ") add " GT_WU,
                   usable_seqlen, initsize);
        GT_CES_LENCHECK(initsize);
        if (!had_err) {
          gt_condenseq_add_unique_to_db(ces_c->ces,
                                        ces_c->main_pos,
                                        initsize);
          ces_c_add_kmers(ces_c, ces_c->main_pos,
                          ces_c->main_pos + initsize);
          ces_c->main_pos += initsize;
          ces_c->current_seq_pos += initsize;
          state = ces_c_reset_pos_and_iter(ces_c, ces_c->main_pos);
        }
      }
    }
    /* small sequences */
    else {
      gt_log_log("small seq: " GT_WU "add all", usable_seqlen);
      GT_CES_LENCHECK(usable_seqlen);
      if (!had_err) {
        gt_condenseq_add_unique_to_db(ces_c->ces,
                                      ces_c->main_pos,
                                      usable_seqlen + kmersize);
        ces_c_add_kmers(ces_c, ces_c->main_pos,
                        ces_c->main_pos + usable_seqlen + kmersize);
        ces_c->main_seqnum++;
        state = ces_c_skip_short_seqs(ces_c);
        if (state == GT_CONDENSEQ_CREATOR_CONT) {
          state = ces_c_reset_pos_and_iter_to_current_seq(ces_c);
        }
      }
    }
    if (!had_err) {
      gt_kmer_database_flush(ces_c->kmer_db);
    }
  }
  INIT_EOD_CHECK;
  if (!had_err &&
      ces_c->initsize > gt_kmer_database_get_kmer_count(ces_c->kmer_db)) {
    gt_error_set(err, "not enough kmers found for init, check input data or "
                 "review initsize! (found " GT_WU " kmers)",
                 gt_kmer_database_get_kmer_count(ces_c->kmer_db));
    had_err = -1;
  }

  if (!had_err)
    gt_log_log("filled kmer-db at pos " GT_WU, ces_c->main_pos);
  /* reanable */
  if (ces_c->use_cutoff && ces_c->prune_kmer_db)
    gt_kmer_database_set_prune(ces_c->kmer_db);
  return had_err;
}

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
movl $0x0, 0x74(%rsp)
movq 0x80(%rsp), %rax
movl 0x138(%rax), %eax
subq $0x1, %rax
movq %rax, 0x68(%rsp)
movq 0x80(%rsp), %rax
testb $0x1, 0x147(%rax)
je 0x1477c6
movq 0x80(%rsp), %rax
testb $0x1, 0x149(%rax)
je 0x1477c6
movq 0x80(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x199a20
movq 0x80(%rsp), %rdi
callq 0x147f20
movl %eax, 0x64(%rsp)
cmpl $0x0, 0x64(%rsp)
jne 0x1477ef
movq 0x80(%rsp), %rdi
callq 0x148020
movl %eax, 0x64(%rsp)
jmp 0x1477f1
xorl %eax, %eax
cmpl $0x0, 0x74(%rsp)
movb %al, 0x4f(%rsp)
jne 0x147842
xorl %eax, %eax
cmpl $0x1, 0x64(%rsp)
movb %al, 0x4f(%rsp)
je 0x147842
movq 0x80(%rsp), %rax
movq 0xe8(%rax), %rax
movq %rax, 0x40(%rsp)
movq 0x80(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x199a70
movq %rax, %rcx
movq 0x40(%rsp), %rax
cmpq %rcx, %rax
seta %al
movb %al, 0x4f(%rsp)
movb 0x4f(%rsp), %al
testb $0x1, %al
jne 0x14784f
jmp 0x147cba
movq 0x80(%rsp), %rax
movq 0xe8(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x80(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x199a70
movq %rax, %rcx
movq 0x20(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x58(%rsp)
movq 0x80(%rsp), %rax
movq 0xd0(%rax), %rax
subq 0x68(%rsp), %rax
movq 0x80(%rsp), %rcx
subq 0xd8(%rcx), %rax
movq %rax, 0x50(%rsp)
movq 0x80(%rsp), %rax
movq 0xf0(%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x80(%rsp), %rax
movq 0xf8(%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x80(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x199a70
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x38(%rsp), %rcx
movq %rax, %r8
leaq 0x404bd9(%rip), %rdi    # 0x54c4e1
movb $0x0, %al
callq 0xe7740
movq 0x58(%rsp), %rax
movq 0x80(%rsp), %rcx
cmpq 0x100(%rcx), %rax
jae 0x14793b
movq 0x80(%rsp), %rax
movq 0x100(%rax), %rax
movq %rax, 0x18(%rsp)
jmp 0x147945
movq 0x58(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x50(%rsp), %rax
cmpq 0x58(%rsp), %rax
jb 0x147ba4
movq 0x50(%rsp), %rax
subq 0x58(%rsp), %rax
movq 0x80(%rsp), %rcx
cmpq 0x100(%rcx), %rax
jae 0x147a8b
jmp 0x147980
movq 0x80(%rsp), %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rcx, 0xd0(%rax)
jbe 0x1479c5
movq 0x78(%rsp), %rdi
movq 0x80(%rsp), %rax
movq 0xd0(%rax), %rdx
leaq 0x404723(%rip), %rsi    # 0x54c0d4
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x74(%rsp) # imm = 0xFFFFFFFF
jmp 0x1479c7
movq 0x50(%rsp), %rsi
leaq 0x404b4a(%rip), %rdi    # 0x54c51d
movb $0x0, %al
callq 0xe7740
cmpl $0x0, 0x74(%rsp)
jne 0x147a86
movq 0x80(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0x80(%rsp), %rax
movq 0xf0(%rax), %rsi
movq 0x50(%rsp), %rax
addq 0x68(%rsp), %rax
movl %eax, %edx
callq 0x13f0b0
movq 0x80(%rsp), %rdi
movq 0x80(%rsp), %rax
movq 0xf0(%rax), %rsi
movq 0x80(%rsp), %rax
movq 0xf0(%rax), %rdx
addq 0x50(%rsp), %rdx
callq 0x1480a0
movq 0x80(%rsp), %rax
movq 0xf8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0xf8(%rax)
movq 0x80(%rsp), %rdi
callq 0x147f20
movl %eax, 0x64(%rsp)
cmpl $0x0, 0x64(%rsp)
jne 0x147a84
movq 0x80(%rsp), %rdi
callq 0x148020
movl %eax, 0x64(%rsp)
jmp 0x147a86
jmp 0x147b9f
movq 0x68(%rsp), %rax
addq 0x58(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
leaq 0x404a96(%rip), %rdi    # 0x54c541
movb $0x0, %al
callq 0xe7740
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, 0x58(%rsp)
jbe 0x147ae3
movq 0x78(%rsp), %rdi
movq 0x58(%rsp), %rdx
leaq 0x404605(%rip), %rsi    # 0x54c0d4
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x74(%rsp) # imm = 0xFFFFFFFF
jmp 0x147ae5
cmpl $0x0, 0x74(%rsp)
jne 0x147b9d
movq 0x80(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0x80(%rsp), %rax
movq 0xf0(%rax), %rsi
movq 0x58(%rsp), %rax
movl %eax, %edx
callq 0x13f0b0
movq 0x80(%rsp), %rdi
movq 0x80(%rsp), %rax
movq 0xf0(%rax), %rsi
movq 0x80(%rsp), %rax
movq 0xf0(%rax), %rdx
addq 0x58(%rsp), %rdx
callq 0x1480a0
movq 0x58(%rsp), %rcx
movq 0x80(%rsp), %rax
addq 0xf0(%rax), %rcx
movq %rcx, 0xf0(%rax)
movq 0x58(%rsp), %rcx
movq 0x80(%rsp), %rax
addq 0xd8(%rax), %rcx
movq %rcx, 0xd8(%rax)
movq 0x80(%rsp), %rdi
movq 0x80(%rsp), %rax
movq 0xf0(%rax), %rsi
callq 0x148150
movl %eax, 0x64(%rsp)
jmp 0x147b9f
jmp 0x147c9d
movq 0x50(%rsp), %rsi
leaq 0x4049ac(%rip), %rdi    # 0x54c55c
movb $0x0, %al
callq 0xe7740
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, 0x50(%rsp)
jbe 0x147be8
movq 0x78(%rsp), %rdi
movq 0x50(%rsp), %rdx
leaq 0x404500(%rip), %rsi    # 0x54c0d4
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x74(%rsp) # imm = 0xFFFFFFFF
jmp 0x147bea
cmpl $0x0, 0x74(%rsp)
jne 0x147c9b
movq 0x80(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0x80(%rsp), %rax
movq 0xf0(%rax), %rsi
movq 0x50(%rsp), %rax
addq 0x68(%rsp), %rax
movl %eax, %edx
callq 0x13f0b0
movq 0x80(%rsp), %rdi
movq 0x80(%rsp), %rax
movq 0xf0(%rax), %rsi
movq 0x80(%rsp), %rax
movq 0xf0(%rax), %rdx
addq 0x50(%rsp), %rdx
addq 0x68(%rsp), %rdx
callq 0x1480a0
movq 0x80(%rsp), %rax
movq 0xf8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0xf8(%rax)
movq 0x80(%rsp), %rdi
callq 0x147f20
movl %eax, 0x64(%rsp)
cmpl $0x0, 0x64(%rsp)
jne 0x147c99
movq 0x80(%rsp), %rdi
callq 0x148020
movl %eax, 0x64(%rsp)
jmp 0x147c9b
jmp 0x147c9d
cmpl $0x0, 0x74(%rsp)
jne 0x147cb5
movq 0x80(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x197f70
jmp 0x1477f1
jmp 0x147cbc
cmpl $0x0, 0x74(%rsp)
jne 0x147d12
cmpl $0x1, 0x64(%rsp)
jne 0x147d12
movq 0x78(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x80(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x199a70
movq 0x10(%rsp), %rdi
movq %rax, %rdx
movq 0x80(%rsp), %rax
movq 0xf0(%rax), %rcx
leaq 0x40486f(%rip), %rsi    # 0x54c572
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x74(%rsp) # imm = 0xFFFFFFFF
jmp 0x147d14
cmpl $0x0, 0x74(%rsp)
jne 0x147d84
movq 0x80(%rsp), %rax
movq 0xe8(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x80(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x199a70
movq %rax, %rcx
movq 0x8(%rsp), %rax
cmpq %rcx, %rax
jbe 0x147d84
movq 0x78(%rsp), %rax
movq %rax, (%rsp)
movq 0x80(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x199a70
movq (%rsp), %rdi
movq %rax, %rdx
leaq 0x40485a(%rip), %rsi    # 0x54c5cf
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x74(%rsp) # imm = 0xFFFFFFFF
cmpl $0x0, 0x74(%rsp)
jne 0x147da8
movq 0x80(%rsp), %rax
movq 0xf0(%rax), %rsi
leaq 0x404886(%rip), %rdi    # 0x54c627
movb $0x0, %al
callq 0xe7740
movq 0x80(%rsp), %rax
testb $0x1, 0x147(%rax)
je 0x147ddb
movq 0x80(%rsp), %rax
testb $0x1, 0x149(%rax)
je 0x147ddb
movq 0x80(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x199980
movl 0x74(%rsp), %eax
addq $0x88, %rsp
retq
nopw (%rax,%rax)