// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/greedyedist.c
// Function: greedyunitedist
GtUword greedyunitedist(GtFrontResource *ftres,
                        const GtSeqabstract *useq,
                        const GtSeqabstract *vseq)
{
  GtUword realdistance, kval;
  GtWord r;
  GtFrontspec frontspecspace[2], *fspec, *prevfspec;
  GtFrontvalue *fptr;

#ifdef SKDEBUG
  printf("unitedistcheckSEPgeneric(ulen=" GT_WU ",vlen=" GT_WU ")\n",
         ulenvalue,vlenvalue);
#endif
  gt_assert(gt_seqabstract_length(useq) < (GtUword) LONG_MAX);
  gt_assert(gt_seqabstract_length(vseq) < (GtUword) LONG_MAX);
  ftres->ulen = (GtWord) gt_seqabstract_length(useq);
  ftres->vlen = (GtWord) gt_seqabstract_length(vseq);
  ftres->integermin = -GT_MAX(ftres->ulen,ftres->vlen);
  prevfspec = &frontspecspace[0];
  firstfrontforward(useq,vseq,ftres,prevfspec);
  if (ftres->ulen == ftres->vlen &&
      GT_FRONT_ROWVALUE(ftres->frontspace) == ftres->vlen)
  {
    realdistance = 0;
  } else
  {
    for (kval=1UL, r=1-GT_MIN(ftres->ulen,ftres->vlen);
         /* Nothing */ ; kval++, r++)
    {
      if (prevfspec == &frontspecspace[0])
      {
        fspec = &frontspecspace[1];
      } else
      {
        fspec = &frontspecspace[0];
      }
      fspec->offset = prevfspec->offset + prevfspec->width;
      frontspecparms(ftres,fspec,(GtWord) kval,r);
      while ((GtUword) (fspec->offset + fspec->width)
             >= ftres->currentallocated)
      {
        ftres->currentallocated += kval+1;
        ftres->frontspace
          = gt_realloc(ftres->frontspace,
                       sizeof *ftres->frontspace * ftres->currentallocated);
      }
      (void) evalfrontforward(useq,vseq,ftres,prevfspec,fspec,r);
      fptr = ftres->frontspace + fspec->offset - fspec->left;
      if (accessfront(ftres,fptr,fspec,ftres->vlen - ftres->ulen)
          == ftres->ulen)
      {
        realdistance = kval;
        break;
      }
      if (prevfspec == &frontspecspace[0])
      {
        prevfspec = &frontspecspace[1];
      } else
      {
        prevfspec = &frontspecspace[0];
      }
    }
  }
#ifdef SKDEBUG
  printf("unitedistfrontSEP returns "GT_WD"\n",realdistance);
#endif
  return realdistance;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, %r14
movq %rdi, %r15
movabsq $0x7fffffffffffffff, %rbx # imm = 0x7FFFFFFFFFFFFFFF
movq %rsi, 0x8(%rsp)
movq %rsi, %rdi
callq 0x1919bf
cmpq %rbx, %rax
jae 0x15f8a1
movq %r14, %rdi
callq 0x1919bf
cmpq %rbx, %rax
jae 0x15f8cf
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x1919bf
movq %rax, 0x8(%r15)
movq %r14, %rdi
callq 0x1919bf
movq %rax, 0x10(%r15)
movq 0x8(%r15), %rcx
cmpq %rax, %rcx
movq %rax, %rdx
cmovgq %rcx, %rdx
negq %rdx
movq %rdx, 0x18(%r15)
andq $0x0, 0x30(%rsp)
andq $0x0, 0x40(%rsp)
movq $0x1, 0x38(%rsp)
testq %rcx, %rcx
sete %cl
testq %rax, %rax
sete %al
orb %cl, %al
je 0x15f581
xorl %ecx, %ecx
jmp 0x15f597
pushq $0x1
popq %rdi
movq %rbx, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x191a18
movq %rax, %rcx
movq 0x20(%r15), %rax
movq %rcx, (%rax)
movq 0x8(%r15), %rdx
movq 0x10(%r15), %rsi
movq %rdx, %rdi
xorq %rsi, %rdi
xorq %rsi, %rcx
orq %rdi, %rcx
jne 0x15f5d2
movq $0x0, (%rsp)
movq (%rsp), %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, 0x68(%rsp)
cmpq %rsi, %rdx
movq %rsi, %rcx
cmovlq %rdx, %rcx
leaq 0x18(%r15), %rbx
pushq $0x1
popq %r14
movq %r14, %r13
subq %rcx, %r13
leaq 0x30(%rsp), %r8
leaq 0x1e83b5(%rip), %r12    # 0x3479b0
movq %r8, %rbp
movq %r14, %rcx
movq %r15, 0x60(%rsp)
cmpq %r8, %rbp
movq %r8, %r9
leaq 0x48(%rsp), %rdi
cmoveq %rdi, %r9
movq %r9, 0x20(%rsp)
movq %rcx, (%r9)
testq %r13, %r13
jle 0x15f639
cmpq %r14, %rdx
cmovgeq %r14, %rdx
cmpq %r14, %rsi
cmovgeq %r14, %rsi
leaq (%rdx,%rsi), %rdi
incq %rdi
jmp 0x15f644
leaq 0x1(,%r14,2), %rdi
movq %r14, %rdx
negq %rdx
cmpq %r8, %rbp
pushq $0x10
popq %r8
pushq $0x28
popq %rsi
cmoveq %rsi, %r8
movq %r8, 0x18(%rsp)
movq %rdx, 0x30(%rsp,%r8)
pushq $0x8
popq %rsi
pushq $0x20
popq %rdx
cmoveq %rdx, %rsi
movq %rsi, 0x28(%rsp)
movq %rdi, 0x30(%rsp,%rsi)
leaq 0x1(%r14), %rdx
movq %rdx, 0x10(%rsp)
leaq (%rdi,%rcx), %rdx
movq (%r15), %rsi
cmpq %rsi, %rdx
jb 0x15f6bc
addq 0x10(%rsp), %rsi
movq %rsi, (%r15)
shlq $0x3, %rsi
movq %rax, %rdi
movq %r12, %rdx
movl $0x144, %ecx            # imm = 0x144
callq 0x93472
movq %rax, 0x20(%r15)
movq 0x20(%rsp), %rcx
movq (%rcx), %rcx
movq 0x28(%rsp), %rdx
movq 0x30(%rsp,%rdx), %rdi
jmp 0x15f67c
movq %r14, (%rsp)
leaq (%rax,%rcx,8), %r12
movq 0x18(%rsp), %rax
movq 0x30(%rsp,%rax), %r8
movq %r13, %r9
negq %r9
movq %r8, %r14
movq %r13, 0x80(%rsp)
movq %rbp, 0x78(%rsp)
movq %r9, 0x70(%rsp)
addq %r8, %rdi
cmpq %rdi, %r14
jge 0x15f82d
cmpq %r13, %r14
jge 0x15f713
testq %r13, %r13
jle 0x15f713
cmpq %r9, %r14
jle 0x15f713
movq (%rbx), %rax
movq %rax, (%r12)
incq %r14
jmp 0x15f810
movq (%rbp), %rax
movq 0x10(%rbp), %rcx
shlq $0x3, %rax
addq 0x20(%r15), %rax
leaq (,%rcx,8), %rdx
subq %rdx, %rax
movq %rbx, %rdx
cmpq %r14, %rcx
jg 0x15f748
movq 0x8(%rbp), %rdx
addq %rcx, %rdx
cmpq %r14, %rdx
leaq (%rax,%r14,8), %rdx
cmovleq %rbx, %rdx
movq %rbx, %rsi
cmpq %r14, %rcx
jge 0x15f767
movq 0x8(%rbp), %rdi
addq %rcx, %rdi
movq %rbx, %rsi
cmpq %r14, %rdi
jl 0x15f767
leaq (%rax,%r14,8), %rsi
addq $-0x8, %rsi
movq (%rdx), %rdx
incq %rdx
movq (%rsi), %rsi
cmpq %rsi, %rdx
cmovleq %rsi, %rdx
leaq 0x1(%r14), %r13
movq %rbx, %rsi
cmpq %r13, %rcx
jg 0x15f792
addq 0x8(%rbp), %rcx
cmpq %r13, %rcx
leaq (%rax,%r13,8), %rsi
cmovleq %rbx, %rsi
movq (%rsi), %rax
leaq 0x1(%rax), %rbp
cmpq %rax, %rdx
cmovgq %rdx, %rbp
testq %rbp, %rbp
js 0x15f7f9
movq %rbp, %r8
addq %r14, %r8
js 0x15f7f9
movq 0x8(%r15), %rax
testq %rax, %rax
je 0x15f7e9
cmpq %rax, %rbp
jge 0x15f7eb
cmpq 0x10(%r15), %r8
jge 0x15f7eb
pushq $0x1
popq %rdi
movq 0x8(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq %rbp, %rcx
callq 0x191a18
movq 0x70(%rsp), %r9
addq %rax, %rbp
movq 0x60(%rsp), %rax
movq 0x8(%rax), %rax
jmp 0x15f7eb
xorl %eax, %eax
cmpq %rax, %rbp
jg 0x15f7f9
addq %rbp, %r14
cmpq 0x10(%r15), %r14
jle 0x15f7fc
movq (%rbx), %rbp
movq %rbp, (%r12)
movq %r13, %r14
movq 0x80(%rsp), %r13
movq 0x78(%rsp), %rbp
addq $0x8, %r12
movq 0x18(%rsp), %rax
movq 0x30(%rsp,%rax), %r8
movq 0x28(%rsp), %rax
movq 0x30(%rsp,%rax), %rdi
jmp 0x15f6e9
movq 0x20(%r15), %rax
movq 0x20(%rsp), %r11
movq (%r11), %rcx
leaq (%rax,%rcx,8), %r9
leaq (,%r8,8), %rdx
subq %rdx, %r9
movq 0x8(%r15), %rdx
movq 0x10(%r15), %rsi
movq %rsi, %r10
subq %rdx, %r10
cmpq %r10, %rdi
leaq (%r9,%r10,8), %rdi
cmovleq %rbx, %rdi
cmpq %r10, %r8
cmovgq %rbx, %rdi
cmpq %rdx, (%rdi)
je 0x15f5bc
incq %r13
leaq 0x30(%rsp), %r8
cmpq %r8, %rbp
leaq 0x38(%rsp), %rdi
leaq 0x50(%rsp), %r9
cmoveq %r9, %rdi
addq (%rdi), %rcx
movq 0x10(%rsp), %r14
movq %r11, %rbp
leaq 0x1e8114(%rip), %r12    # 0x3479b0
jmp 0x15f606
movq 0x2d86c0(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x185761(%rip), %rsi    # 0x2e5013
leaq 0x1e810f(%rip), %rdx    # 0x3479c8
leaq 0x19260b(%rip), %rcx    # 0x2f1ecb
leaq 0x1e80e9(%rip), %r8     # 0x3479b0
movl $0x125, %r9d            # imm = 0x125
jmp 0x15f8fb
movq 0x2d8692(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x185733(%rip), %rsi    # 0x2e5013
leaq 0x1e8112(%rip), %rdx    # 0x3479f9
leaq 0x1925dd(%rip), %rcx    # 0x2f1ecb
leaq 0x1e80bb(%rip), %r8     # 0x3479b0
movl $0x126, %r9d            # imm = 0x126
xorl %eax, %eax
callq 0x17a50
callq 0x17390
nop