// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/seed-extend.c
// Function: gt_align_front_prune_edist
void gt_align_front_prune_edist(bool rightextension,
                                GtFtPolished_point *best_polished_point,
                                GtFrontTrace *front_trace,
                                const GtSeqorEncseq *dbes,
                                const GtSeqorEncseq *queryes,
                                GtReadmode query_readmode,
                                GtUword query_seqstart,
                                GtUword query_seqlen,
                                GtGreedyextendmatchinfo *ggemi,
                                bool greedyextension,
                                GtUword seedlength,
                                GtUword ustart,
                                GtUword ulen,
                                GtUword vstart,
                                GtUword vlen)
{
  GtUword distance = 0, iteration, maxiterations;
  GtFTsequenceResources ufsr, vfsr;
  const GtUword vseqstartpos = queryes->encseq != NULL ? query_seqstart : 0;

  gt_assert(ggemi != NULL);
  gt_greedy_extend_init(&ufsr,&vfsr,
                        dbes,queryes,query_readmode,
                        query_seqlen,ggemi);
  maxiterations = greedyextension ? 1 : ggemi->perc_mat_history;
  gt_assert(best_polished_point != NULL);
  for (iteration = 0; iteration <= maxiterations; iteration++)
  {
    GtTrimmingStrategy trimstrategy;
#ifdef SKDEBUG
    printf("%s: iteration " GT_WU "\n",__func__,iteration);
#endif
    if (iteration == maxiterations)
    {
      trimstrategy = GT_OUTSENSE_TRIM_NEVER;
    } else
    {
      trimstrategy = ggemi->trimstrategy;
    }
    gt_assert(iteration < ggemi->perc_mat_history);
    distance = front_prune_edist_inplace(rightextension,
                                         &ggemi->frontspace_reservoir,
                                         best_polished_point,
                                         front_trace,
                                         ggemi->pol_info,
                                         trimstrategy,
                                         ggemi->history,
                                         ggemi->perc_mat_history - iteration,
                                         ggemi->maxalignedlendifference
                                           + iteration,
                                         ggemi->showfrontinfo,
                                         seedlength,
                                         &ufsr,
                                         ustart,
                                         ulen,
                                         vseqstartpos,
                                         &vfsr,
                                         vstart,
                                         vlen,
                                         ggemi->cam_generic,
                                         NULL); /* trimstat */
    if (distance < ulen + vlen + 1)
    {
#ifdef SKDEBUG
      GtUword u_ext = best_polished_point->row, v_ext;
      gt_assert(best_polished_point->alignedlen >= u_ext);
      v_ext = best_polished_point->alignedlen - u_ext;
      printf("greedy(%s): align=" GT_WU ",row=" GT_WU ",distance=" GT_WU "\n",
          rightextension ? "right" : "left",
          u_ext + v_ext,
          u_ext,
          best_polished_point->distance);
#endif
      break;
    }
    if (front_trace != NULL)
    {
      front_trace_reset(front_trace,ulen + vlen);
    }
    best_polished_point->alignedlen = 0;
    best_polished_point->row = 0;
    best_polished_point->distance = 0;
    best_polished_point->trimleft = 0;
    best_polished_point->max_mismatches = 0;
  }
  gt_assert(distance >= best_polished_point->distance &&
            distance < ulen + vlen + 1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movl %edi, %r15d
movq 0xf0(%rsp), %rbp
movq 0x8(%r8), %rax
movq %rax, (%rsp)
testq %rax, %rax
je 0x18f580
movq 0xe0(%rsp), %rax
movq %rax, (%rsp)
testq %rbp, %rbp
je 0x18f73e
movb 0xf8(%rsp), %r12b
movq 0xe8(%rsp), %rax
subq $0x8, %rsp
leaq 0x70(%rsp), %rdi
leaq 0x30(%rsp), %rsi
movq %rcx, %rdx
movq %r8, %rcx
movl %r9d, %r8d
movq %rax, %r9
pushq %rbp
callq 0x18f7cb
popq %rax
popq %rcx
testb %r12b, %r12b
je 0x18f5c5
pushq $0x1
popq %rax
jmp 0x18f5c9
movq 0x28(%rbp), %rax
movq %rax, 0x8(%rsp)
testq %rbx, %rbx
je 0x18f76c
movq 0x120(%rsp), %rax
movq 0x110(%rsp), %rcx
leaq 0x98(%rbp), %rdx
movq %rdx, 0x20(%rsp)
leaq (%rax,%rcx), %rdx
movq %rdx, 0x18(%rsp)
addq %rcx, %rax
incq %rax
movq %rax, 0x10(%rsp)
xorl %r13d, %r13d
movzbl %r15b, %r15d
xorl %r12d, %r12d
cmpq 0x8(%rsp), %r13
ja 0x18f6df
pushq $0x2
popq %r9
je 0x18f629
movl 0xb0(%rbp), %r9d
movq 0x28(%rbp), %rax
subq %r13, %rax
jbe 0x18f706
movq 0x10(%rbp), %r8
movq 0x20(%rbp), %r10
addq %r13, %r10
movzbl 0xbd(%rbp), %r11d
movzbl 0xc2(%rbp), %r12d
movl %r15d, %edi
movq 0x20(%rsp), %rsi
movq %rbx, %rdx
movq %r14, %rcx
pushq $0x0
pushq %r12
pushq 0x130(%rsp)
pushq 0x130(%rsp)
leaq 0x48(%rsp), %r12
pushq %r12
pushq 0x28(%rsp)
pushq 0x140(%rsp)
pushq 0x140(%rsp)
leaq 0xa8(%rsp), %r12
pushq %r12
pushq 0x148(%rsp)
pushq %r11
pushq %r10
pushq %rax
pushq 0x18(%rbp)
callq 0x2bdf27
addq $0x70, %rsp
movq %rax, %r12
cmpq 0x10(%rsp), %rax
jb 0x18f6df
testq %r14, %r14
je 0x18f6c8
movq %r14, %rdi
movq 0x18(%rsp), %rsi
callq 0x2ba420
incq %r13
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
andq $0x0, 0x20(%rbx)
jmp 0x18f611
cmpq 0x10(%rbx), %r12
jb 0x18f79a
cmpq 0x10(%rsp), %r12
jae 0x18f79a
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2a885b(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1558fc(%rip), %rsi    # 0x2e5013
leaq 0x1c58ee(%rip), %rdx    # 0x35500c
leaq 0x1c58b0(%rip), %rcx    # 0x354fd5
leaq 0x1c55b8(%rip), %r8     # 0x354ce4
movl $0x322, %r9d            # imm = 0x322
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x2a8823(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1558c4(%rip), %rsi    # 0x2e5013
leaq 0x1c5814(%rip), %rdx    # 0x354f6a
leaq 0x1c5878(%rip), %rcx    # 0x354fd5
leaq 0x1c5580(%rip), %r8     # 0x354ce4
movl $0x30f, %r9d            # imm = 0x30F
jmp 0x18f732
movq 0x2a87f5(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x155896(%rip), %rsi    # 0x2e5013
leaq 0x1c586c(%rip), %rdx    # 0x354ff0
leaq 0x1c584a(%rip), %rcx    # 0x354fd5
leaq 0x1c5552(%rip), %r8     # 0x354ce4
movl $0x314, %r9d            # imm = 0x314
jmp 0x18f732
movq 0x2a87c7(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x155868(%rip), %rsi    # 0x2e5013
leaq 0x1c587e(%rip), %rdx    # 0x355030
leaq 0x1c581c(%rip), %rcx    # 0x354fd5
leaq 0x1c5524(%rip), %r8     # 0x354ce4
movl $0x351, %r9d            # imm = 0x351
jmp 0x18f732