// File: /workspace/github_c_makefile_star2_O3/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, %r14
movq %rsi, %rbx
movl %edi, %r15d
movq 0x100(%rsp), %r12
movq 0x8(%r8), %rax
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x1e0ca6
movq 0xf0(%rsp), %rax
movq %rax, 0x10(%rsp)
testq %r12, %r12
je 0x1e0e50
movb 0x108(%rsp), %bpl
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 %r12
callq 0x1e0e5a
addq $0x10, %rsp
movl $0x1, %eax
movq %rax, (%rsp)
testb %bpl, %bpl
jne 0x1e0cfe
movq 0x28(%r12), %rax
movq %rax, (%rsp)
testq %rbx, %rbx
je 0x1e0e55
movq 0x130(%rsp), %rax
movq 0x120(%rsp), %rcx
leaq 0x98(%r12), %rdx
movq %rdx, 0x30(%rsp)
leaq (%rax,%rcx), %rdx
movq %rdx, 0x18(%rsp)
leaq 0x1(%rax,%rcx), %rax
movq %rax, 0x28(%rsp)
movq (%rsp), %rax
incq %rax
movq %rax, 0x20(%rsp)
xorl %r13d, %r13d
movzbl %r15b, %eax
movl %eax, 0xc(%rsp)
xorl %ebp, %ebp
movl $0x2, %r9d
cmpq %rbp, (%rsp)
je 0x1e0d64
movl 0xb0(%r12), %r9d
movq 0x28(%r12), %rax
cmpq %rax, %rbp
jae 0x1e0e4b
movq 0x10(%r12), %r8
addq %r13, %rax
movq 0x20(%r12), %r10
addq %rbp, %r10
movzbl 0xbd(%r12), %r11d
movzbl 0xc2(%r12), %r15d
movl 0xc(%rsp), %edi
movq 0x30(%rsp), %rsi
movq %rbx, %rdx
movq %r14, %rcx
pushq $0x0
pushq %r15
pushq 0x140(%rsp)
pushq 0x140(%rsp)
leaq 0x58(%rsp), %r15
pushq %r15
pushq 0x38(%rsp)
pushq 0x150(%rsp)
pushq 0x150(%rsp)
leaq 0xb8(%rsp), %r15
pushq %r15
pushq 0x158(%rsp)
pushq %r11
pushq %r10
pushq %rax
pushq 0x18(%r12)
callq 0x31d1d5
addq $0x70, %rsp
cmpq 0x28(%rsp), %rax
jb 0x1e0e33
testq %r14, %r14
je 0x1e0e0b
movq %r14, %rdi
movq 0x18(%rsp), %rsi
callq 0x31a0c7
incq %rbp
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
movq $0x0, 0x20(%rbx)
decq %r13
cmpq %rbp, 0x20(%rsp)
jne 0x1e0d50
callq 0x749e4
cmpq 0x10(%rbx), %rax
jb 0x1e0e2e
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x749ab
callq 0x74a56
callq 0x74a1d