// File: /workspace/github_c_makefile_star2_O1/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 0x1ec2a0
cmpq %rbx, %rax
jae 0x1baacc
movq %r14, %rdi
callq 0x1ec2a0
cmpq %rbx, %rax
jae 0x1baad1
movq 0x8(%rsp), %rdi
callq 0x1ec2a0
movq %rax, 0x8(%r15)
movq %r14, %rdi
callq 0x1ec2a0
movq %rax, %rcx
movq %rax, 0x10(%r15)
movq 0x8(%r15), %rdx
cmpq %rax, %rdx
cmovgq %rdx, %rax
negq %rax
movq %rax, 0x18(%r15)
xorl %eax, %eax
movq %rax, 0x10(%rsp)
movq %rax, 0x20(%rsp)
movq $0x1, 0x18(%rsp)
testq %rdx, %rdx
sete %dl
testq %rcx, %rcx
sete %cl
orb %dl, %cl
jne 0x1ba77f
movl $0x1, %edi
movq 0x8(%rsp), %rsi
movq %r14, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x1ec2c6
movq 0x20(%r15), %rcx
movq %rax, (%rcx)
movq 0x8(%r15), %rcx
movq 0x10(%r15), %rax
cmpq %rax, %rcx
jne 0x1ba7b4
movq 0x20(%r15), %rdx
cmpq %rax, (%rdx)
jne 0x1ba7b4
xorl %r11d, %r11d
movq %r11, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, 0x70(%rsp)
cmpq %rax, %rcx
cmovlq %rcx, %rax
leaq 0x18(%r15), %rbx
movl $0x1, %r11d
movl $0x1, %r9d
subq %rax, %r9
leaq 0x10(%rsp), %rbp
leaq 0x1f640d(%rip), %rdi    # 0x3b0bec
movq %rbp, %r10
movq %r9, 0x58(%rsp)
cmpq %rbp, %r10
movq %rbp, %r13
leaq 0x28(%rsp), %rax
cmoveq %rax, %r13
movq 0x8(%r10), %rax
addq (%r10), %rax
movq %rax, (%r13)
testq %r9, %r9
movq %r11, 0x48(%rsp)
jle 0x1ba843
movq 0x8(%r15), %rax
cmpq %r11, %rax
cmovgeq %r11, %rax
movq %rax, %rcx
negq %rcx
cmpq %rbp, %r10
leaq 0x20(%rsp), %rdx
leaq 0x38(%rsp), %rsi
cmoveq %rsi, %rdx
movq %rcx, (%rdx)
movq 0x10(%r15), %rcx
cmpq %r11, %rcx
cmovgeq %r11, %rcx
addq %rcx, %rax
incq %rax
jmp 0x1ba865
movq %r11, %rax
negq %rax
cmpq %rbp, %r10
leaq 0x20(%rsp), %rcx
leaq 0x38(%rsp), %rdx
cmoveq %rdx, %rcx
movq %rax, (%rcx)
leaq 0x1(,%r11,2), %rax
movq %r10, 0x50(%rsp)
cmpq %rbp, %r10
movl $0x8, %r11d
movl $0x20, %ecx
cmoveq %rcx, %r11
movq %rax, 0x10(%rsp,%r11)
movq (%r13), %r14
movq %rax, %rcx
addq %r14, %rcx
movq (%r15), %rsi
cmpq %rsi, %rcx
movq %r11, 0x68(%rsp)
jb 0x1ba8dd
movq %rdi, %rbp
movq 0x48(%rsp), %rax
leaq 0x1(%rax), %r12
addq %r12, %rsi
movq %rsi, (%r15)
movq 0x20(%r15), %rdi
shlq $0x3, %rsi
movq %rbp, %rdx
movl $0x144, %ecx            # imm = 0x144
callq 0x1094e6
movq 0x68(%rsp), %r11
movq %rax, 0x20(%r15)
movq (%r13), %r14
movq 0x10(%rsp,%r11), %rax
leaq (%rax,%r14), %rcx
movq (%r15), %rsi
cmpq %rsi, %rcx
jae 0x1ba8a4
movq %r13, 0x78(%rsp)
movq 0x50(%rsp), %r10
leaq 0x10(%rsp), %rcx
cmpq %rcx, %r10
movl $0x10, %edx
movl $0x28, %ecx
cmoveq %rcx, %rdx
testq %rax, %rax
movq 0x58(%rsp), %r9
jle 0x1baa61
shlq $0x3, %r14
addq 0x20(%r15), %r14
movq 0x10(%rsp,%rdx), %r12
movq %r9, %rax
negq %rax
movq %rax, 0x80(%rsp)
leaq (,%r12,8), %r13
movq %rdx, 0x60(%rsp)
cmpq %r9, %r12
jge 0x1ba94b
testq %r9, %r9
jle 0x1ba94b
cmpq 0x80(%rsp), %r12
jg 0x1baa3d
movq (%r10), %rax
movq 0x10(%r10), %rcx
shlq $0x3, %rax
addq 0x20(%r15), %rax
leaq (,%rcx,8), %rdx
subq %rdx, %rax
movq %rbx, %rdx
cmpq %r12, %rcx
jg 0x1ba97f
movq 0x8(%r10), %rsi
addq %rcx, %rsi
leaq (%rax,%r13), %rdx
cmpq %r12, %rsi
cmovleq %rbx, %rdx
movq %rbx, %rsi
cmpq %r12, %rcx
jge 0x1ba99e
movq 0x8(%r10), %rdi
addq %rcx, %rdi
movq %rbx, %rsi
cmpq %r12, %rdi
jl 0x1ba99e
leaq (%rax,%r13), %rsi
addq $-0x8, %rsi
movq (%rdx), %rdx
incq %rdx
movq (%rsi), %rsi
cmpq %rsi, %rdx
cmovleq %rsi, %rdx
leaq 0x1(%r12), %rdi
movq %rbx, %rsi
cmpq %rdi, %rcx
jg 0x1ba9cb
addq 0x8(%r10), %rcx
cmpq %rdi, %rcx
leaq 0x8(%rax,%r13), %rsi
cmovleq %rbx, %rsi
movq (%rsi), %rax
leaq 0x1(%rax), %rbp
cmpq %rax, %rdx
cmovgq %rdx, %rbp
testq %rbp, %rbp
movq 0x60(%rsp), %rdx
js 0x1baa3d
movq %rbp, %r8
addq %r12, %r8
js 0x1baa3d
movq 0x8(%r15), %rax
testq %rax, %rax
je 0x1baa2d
cmpq %rax, %rbp
jge 0x1baa2d
cmpq 0x10(%r15), %r8
jge 0x1baa2d
movl $0x1, %edi
movq 0x8(%rsp), %rsi
movq 0x70(%rsp), %rdx
movq %rbp, %rcx
callq 0x1ec2c6
movq 0x60(%rsp), %rdx
movq 0x68(%rsp), %r11
movq 0x50(%rsp), %r10
movq 0x58(%rsp), %r9
addq %rax, %rbp
cmpq 0x8(%r15), %rbp
jg 0x1baa3d
leaq (%r12,%rbp), %rax
cmpq 0x10(%r15), %rax
jle 0x1baa40
movq (%rbx), %rbp
movq %rbp, (%r14)
incq %r12
addq $0x8, %r14
movq 0x10(%rsp,%r11), %rax
addq 0x10(%rsp,%rdx), %rax
addq $0x8, %r13
cmpq %rax, %r12
jl 0x1ba933
movq 0x10(%rsp,%rdx), %rcx
movq 0x8(%r15), %rax
movq 0x10(%r15), %rdx
subq %rax, %rdx
movq %rbx, %rsi
cmpq %rdx, %rcx
movq 0x78(%rsp), %r8
jg 0x1baaa4
movq (%r8), %rsi
shlq $0x3, %rsi
addq 0x20(%r15), %rsi
leaq (,%rcx,8), %rdi
subq %rdi, %rsi
addq 0x10(%rsp,%r11), %rcx
cmpq %rdx, %rcx
leaq (%rsi,%rdx,8), %rsi
cmovleq %rbx, %rsi
cmpq %rax, (%rsi)
movq 0x48(%rsp), %r11
leaq 0x1f6139(%rip), %rdi    # 0x3b0bec
je 0x1ba79f
incq %r11
incq %r9
movq %r8, %r10
leaq 0x10(%rsp), %rbp
jmp 0x1ba7e2
callq 0x66982
callq 0x669bb
nop