// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/condenseq_creator.c
// Function: ces_c_extend_seed_kmer
static CesCState ces_c_extend_seed_kmer(GtCondenseqCreator *ces_c,
                                        GtError *err)
{
  CesCState state = GT_CONDENSEQ_CREATOR_CONT;
  GtCondenseqLink link = {NULL, 0, 0, 0, 0};
  GtMultieoplist *extrameops = NULL, *linkops = NULL;

  if (ces_c->extend(ces_c, &link, err) != 0) {
    return GT_CONDENSEQ_CREATOR_ERROR;
  }

  if (link.len >= ces_c->min_align_len) {
    GtUword remaining;

    linkops = ces_c_xdrop_backtrack(ces_c->xdrop);
    if (ces_c->current_orig_start < link.orig_startpos) {
      GtUword leading_unique_len =
        link.orig_startpos - ces_c->current_orig_start;
      if (leading_unique_len <= (GtUword) ces_c->kmersize) {
        GtUword count;
        for (count = 0; count < leading_unique_len; count++)
          gt_multieoplist_add_insertion(linkops);
        link.orig_startpos -= leading_unique_len;
        link.len += leading_unique_len;
      }
      else {
        GT_CES_LENCHECK_STATE(leading_unique_len);
        if (state != GT_CONDENSEQ_CREATOR_ERROR) {
          gt_condenseq_add_unique_to_db(ces_c->ces,
                                        ces_c->current_orig_start,
                                        leading_unique_len);
          ces_c_add_kmers(ces_c, ces_c->current_orig_start, link.orig_startpos);
        }
      }
    }

    /* if only left extended the alignment might be ending before main_pos */
    if (state != GT_CONDENSEQ_CREATOR_ERROR) {
      if (ces_c->main_pos < link.orig_startpos + link.len)
        state = ces_c_reset_pos_and_iter(ces_c, link.orig_startpos + link.len);
      else {
        ces_c->current_orig_start = link.orig_startpos + link.len;
        ces_c->window.count = 0;
        ces_c->window.next = 0;
      }

      remaining = ces_c->current_seq_len - ces_c->current_seq_pos +
        ces_c->current_orig_start - ces_c->main_pos;
      if (remaining != 0 && remaining <= (GtUword) ces_c->kmersize) {
        GtUword count;
        extrameops = gt_multieoplist_new();
        for (count = 0; count < remaining; count++)
          gt_multieoplist_add_insertion(extrameops);
        gt_multieoplist_combine(extrameops, linkops, true);
        gt_multieoplist_delete(linkops);
        linkops = extrameops;
        link.len += remaining;
        remaining = 0;
        state = ces_c_reset_pos_and_iter(ces_c, link.orig_startpos + link.len);
      }

      link.editscript = gt_editscript_new_with_sequences(ces_c->input_es,
                                                         linkops,
                                                         link.orig_startpos,
                                                         GT_READMODE_FORWARD);
      gt_multieoplist_delete(linkops);
      gt_condenseq_add_link_to_db(ces_c->ces, link);

      if (state != GT_CONDENSEQ_CREATOR_EOD &&
          remaining < ces_c->min_align_len) {
        state = ces_c_handle_seqend(ces_c, err);
      }
    }
  }
  return state;
}

// Assembly:
subq $0xc8, %rsp
movq %rdi, 0xb8(%rsp)
movq %rsi, 0xb0(%rsp)
movl $0x0, 0xac(%rsp)
leaq 0x88(%rsp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x19360
movq $0x0, 0x80(%rsp)
movq $0x0, 0x78(%rsp)
movq 0xb8(%rsp), %rax
movq 0x50(%rax), %rax
movq 0xb8(%rsp), %rdi
movq 0xb0(%rsp), %rdx
leaq 0x88(%rsp), %rsi
callq *%rax
cmpl $0x0, %eax
je 0x1483e6
movl $0x3, 0xc4(%rsp)
jmp 0x148806
movl 0x98(%rsp), %eax
movq 0xb8(%rsp), %rcx
cmpq 0x100(%rcx), %rax
jb 0x1487f8
movq 0xb8(%rsp), %rcx
addq $0x58, %rcx
movq 0x50(%rcx), %rdx
movq %rsp, %rax
movq %rdx, 0x50(%rax)
movups 0x40(%rcx), %xmm0
movups %xmm0, 0x40(%rax)
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups 0x20(%rcx), %xmm2
movups 0x30(%rcx), %xmm3
movups %xmm3, 0x30(%rax)
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x148970
movq %rax, 0x78(%rsp)
movq 0xb8(%rsp), %rax
movq 0xc8(%rax), %rax
cmpq 0x90(%rsp), %rax
jae 0x148590
movq 0x90(%rsp), %rax
movq 0xb8(%rsp), %rcx
subq 0xc8(%rcx), %rax
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rax
movq 0xb8(%rsp), %rcx
movl 0x138(%rcx), %ecx
cmpq %rcx, %rax
ja 0x1484fc
movq $0x0, 0x60(%rsp)
movq 0x60(%rsp), %rax
cmpq 0x68(%rsp), %rax
jae 0x1484c9
movq 0x78(%rsp), %rdi
callq 0x1affd0
movq 0x60(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x60(%rsp)
jmp 0x1484a3
movq 0x68(%rsp), %rcx
movq 0x90(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x90(%rsp)
movq 0x68(%rsp), %rcx
movl 0x98(%rsp), %eax
addq %rcx, %rax
movl %eax, 0x98(%rsp)
jmp 0x14858e
jmp 0x1484fe
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, 0x68(%rsp)
jbe 0x148535
movq 0xb0(%rsp), %rdi
movq 0x68(%rsp), %rdx
leaq 0x403bb6(%rip), %rsi    # 0x54c0d4
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movb $0x0, %al
callq 0xd88c0
movl $0x3, 0xac(%rsp)
jmp 0x148537
cmpl $0x3, 0xac(%rsp)
je 0x14858c
movq 0xb8(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0xb8(%rsp), %rax
movq 0xc8(%rax), %rsi
movq 0x68(%rsp), %rax
movl %eax, %edx
callq 0x13f0b0
movq 0xb8(%rsp), %rdi
movq 0xb8(%rsp), %rax
movq 0xc8(%rax), %rsi
movq 0x90(%rsp), %rdx
callq 0x1480a0
jmp 0x14858e
jmp 0x148590
cmpl $0x3, 0xac(%rsp)
je 0x1487f6
movq 0xb8(%rsp), %rax
movq 0xf0(%rax), %rax
movq 0x90(%rsp), %rcx
movl 0x98(%rsp), %edx
addq %rdx, %rcx
cmpq %rcx, %rax
jae 0x1485ec
movq 0xb8(%rsp), %rdi
movq 0x90(%rsp), %rsi
movl 0x98(%rsp), %eax
addq %rax, %rsi
callq 0x148150
movl %eax, 0xac(%rsp)
jmp 0x148631
movq 0x90(%rsp), %rcx
movl 0x98(%rsp), %eax
addq %rax, %rcx
movq 0xb8(%rsp), %rax
movq %rcx, 0xc8(%rax)
movq 0xb8(%rsp), %rax
movl $0x0, 0xc4(%rax)
movq 0xb8(%rsp), %rax
movl $0x0, 0xc0(%rax)
movq 0xb8(%rsp), %rax
movq 0xd0(%rax), %rax
movq 0xb8(%rsp), %rcx
subq 0xd8(%rcx), %rax
movq 0xb8(%rsp), %rcx
addq 0xc8(%rcx), %rax
movq 0xb8(%rsp), %rcx
subq 0xf0(%rcx), %rax
movq %rax, 0x70(%rsp)
cmpq $0x0, 0x70(%rsp)
je 0x14874c
movq 0x70(%rsp), %rax
movq 0xb8(%rsp), %rcx
movl 0x138(%rcx), %ecx
cmpq %rcx, %rax
ja 0x14874c
callq 0x1af960
movq %rax, 0x80(%rsp)
movq $0x0, 0x58(%rsp)
movq 0x58(%rsp), %rax
cmpq 0x70(%rsp), %rax
jae 0x1486d9
movq 0x80(%rsp), %rdi
callq 0x1affd0
movq 0x58(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x58(%rsp)
jmp 0x1486b0
movq 0x80(%rsp), %rdi
movq 0x78(%rsp), %rsi
movl $0x1, %edx
callq 0x1b0850
movq 0x78(%rsp), %rdi
callq 0x1afba0
movq 0x80(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x70(%rsp), %rcx
movl 0x98(%rsp), %eax
addq %rcx, %rax
movl %eax, 0x98(%rsp)
movq $0x0, 0x70(%rsp)
movq 0xb8(%rsp), %rdi
movq 0x90(%rsp), %rsi
movl 0x98(%rsp), %eax
addq %rax, %rsi
callq 0x148150
movl %eax, 0xac(%rsp)
movq 0xb8(%rsp), %rax
movq (%rax), %rdi
movq 0x78(%rsp), %rsi
movq 0x90(%rsp), %rdx
xorl %ecx, %ecx
callq 0x15a3c0
movq %rax, 0x88(%rsp)
movq 0x78(%rsp), %rdi
callq 0x1afba0
movq 0xb8(%rsp), %rax
movq 0x28(%rax), %rdi
leaq 0x88(%rsp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rcx
movq %rcx, 0x10(%rsp)
movq 0x18(%rax), %rax
movq %rax, 0x18(%rsp)
callq 0x13f3d0
cmpl $0x1, 0xac(%rsp)
je 0x1487f4
movq 0x70(%rsp), %rax
movq 0xb8(%rsp), %rcx
cmpq 0x100(%rcx), %rax
jae 0x1487f4
movq 0xb8(%rsp), %rdi
movq 0xb0(%rsp), %rsi
callq 0x148820
movl %eax, 0xac(%rsp)
jmp 0x1487f6
jmp 0x1487f8
movl 0xac(%rsp), %eax
movl %eax, 0xc4(%rsp)
movl 0xc4(%rsp), %eax
addq $0xc8, %rsp
retq
nopw %cs:(%rax,%rax)