// File: /workspace/github_c_makefile_star2_O1/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 $0xb8, %rsp
movq %rdx, %r15
movq %rsi, %rbx
movl %edi, %r12d
movq 0x100(%rsp), %rbp
movq 0x8(%r8), %rax
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x1ea50f
movq 0xf0(%rsp), %rax
movq %rax, 0x18(%rsp)
testq %rbp, %rbp
je 0x1ea6b7
movb 0x108(%rsp), %r14b
movq 0xf8(%rsp), %rax
subq $0x8, %rsp
leaq 0x80(%rsp), %rdi
leaq 0x40(%rsp), %rsi
movq %rcx, %rdx
movq %r8, %rcx
movl %r9d, %r8d
movq %rax, %r9
pushq %rbp
callq 0x1ea6c1
addq $0x10, %rsp
movl $0x1, %eax
movq %rax, 0x8(%rsp)
testb %r14b, %r14b
jne 0x1ea567
movq 0x28(%rbp), %rax
movq %rax, 0x8(%rsp)
movq %r15, 0x20(%rsp)
testq %rbx, %rbx
je 0x1ea6bc
movq 0x130(%rsp), %rax
movq 0x120(%rsp), %rcx
leaq 0x98(%rbp), %rdx
movq %rdx, 0x30(%rsp)
leaq (%rax,%rcx), %rdx
movq %rdx, 0x28(%rsp)
leaq (%rax,%rcx), %r15
incq %r15
xorl %r13d, %r13d
movzbl %r12b, %eax
movl %eax, 0x14(%rsp)
xorl %r14d, %r14d
movl $0x2, %r9d
cmpq %r14, 0x8(%rsp)
je 0x1ea5c3
movl 0xb0(%rbp), %r9d
movq 0x28(%rbp), %rax
cmpq %rax, %r14
jae 0x1ea6ad
movq 0x10(%rbp), %r8
addq %r13, %rax
movq 0x20(%rbp), %r10
addq %r14, %r10
movzbl 0xbd(%rbp), %r11d
movzbl 0xc2(%rbp), %r12d
movl 0x14(%rsp), %edi
movq 0x30(%rsp), %rsi
movq %rbx, %rdx
movq 0x20(%rsp), %rcx
pushq $0x0
pushq %r12
pushq 0x140(%rsp)
pushq 0x140(%rsp)
leaq 0x58(%rsp), %r12
pushq %r12
pushq 0x40(%rsp)
pushq 0x150(%rsp)
pushq 0x150(%rsp)
leaq 0xb8(%rsp), %r12
pushq %r12
pushq 0x158(%rsp)
pushq %r11
pushq %r10
pushq %rax
pushq 0x18(%rbp)
callq 0x327562
addq $0x70, %rsp
movq %rax, %r12
cmpq %r15, %rax
jb 0x1ea690
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1ea668
movq 0x28(%rsp), %rsi
callq 0x3243af
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
movq $0x0, 0x20(%rbx)
cmpq %r15, %r12
jb 0x1ea690
incq %r14
decq %r13
cmpq 0x8(%rsp), %r14
jbe 0x1ea5af
cmpq 0x10(%rbx), %r12
jb 0x1ea6b2
cmpq %r15, %r12
jae 0x1ea6b2
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x76638
callq 0x76671
callq 0x766e3
callq 0x766aa