// File: /workspace/github_c_makefile_star2_O3/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, (%rsp)
movabsq $0x7fffffffffffffff, %rbx # imm = 0x7FFFFFFFFFFFFFFF
movq %rsi, 0x8(%rsp)
movq %rsi, %rdi
callq 0x1e2a08
cmpq %rbx, %rax
jae 0x1b1eee
movq %r14, %rdi
callq 0x1e2a08
cmpq %rbx, %rax
jae 0x1b1ef3
movq 0x8(%rsp), %rdi
callq 0x1e2a08
movq (%rsp), %rbx
movq %rax, 0x8(%rbx)
movq %r14, %rdi
callq 0x1e2a08
movq %rbx, %r10
movq %rax, %rcx
movq %rax, 0x10(%rbx)
movq 0x8(%rbx), %rdx
cmpq %rax, %rdx
cmovgq %rdx, %rax
negq %rax
movq %rax, 0x18(%rbx)
xorl %eax, %eax
movq %rax, 0x30(%rsp)
movq %rax, 0x40(%rsp)
movq $0x1, 0x38(%rsp)
testq %rdx, %rdx
sete %dl
testq %rcx, %rcx
sete %cl
orb %dl, %cl
jne 0x1b1bcb
movl $0x1, %edi
movq 0x8(%rsp), %rsi
movq %r14, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x1e2a2e
movq (%rsp), %r10
movq 0x20(%r10), %rcx
movq %rax, (%rcx)
movq 0x8(%r10), %r12
movq 0x10(%r10), %rcx
movq %r12, %rdx
xorq %rcx, %rdx
xorq %rcx, %rax
orq %rdx, %rax
jne 0x1b1bef
xorl %eax, %eax
jmp 0x1b1edc
movq %r14, 0x68(%rsp)
leaq 0x18(%r10), %rbx
cmpq %rcx, %r12
movq %rcx, %rax
cmovlq %r12, %rax
movl $0x1, %esi
movl $0x1, %r9d
subq %rax, %r9
leaq 0x30(%rsp), %rax
leaq 0x1f5a14(%rip), %rbp    # 0x3a7630
movq %rax, %r11
cmpq %rax, %r11
movq %rax, %r15
leaq 0x48(%rsp), %rdx
cmoveq %rdx, %r15
movq 0x8(%r11), %r14
addq (%r11), %r14
movq %r14, (%r15)
testq %r9, %r9
movq %rsi, 0x10(%rsp)
jle 0x1b1c59
cmpq %rsi, %r12
cmovgeq %rsi, %r12
cmpq %rsi, %rcx
cmovgeq %rsi, %rcx
leaq (%r12,%rcx), %rdx
incq %rdx
jmp 0x1b1c64
leaq 0x1(,%rsi,2), %rdx
movq %rsi, %r12
negq %r12
cmpq %rax, %r11
movl $0x10, %edi
movl $0x28, %eax
cmoveq %rax, %rdi
movq %r12, 0x30(%rsp,%rdi)
movl $0x8, %r13d
movl $0x20, %eax
cmoveq %rax, %r13
movq %rdx, 0x30(%rsp,%r13)
leaq (%r14,%rdx), %rax
movq (%r10), %rsi
cmpq %rsi, %rax
movq %r9, 0x28(%rsp)
movq %r11, 0x20(%rsp)
movq %rdi, 0x18(%rsp)
jb 0x1b1d03
movq 0x10(%rsp), %rax
leaq 0x1(%rax), %r12
movq 0x20(%r10), %rax
addq %r12, %rsi
movq %rsi, (%r10)
shlq $0x3, %rsi
movq %rax, %rdi
movq %rbp, %rdx
movl $0x144, %ecx            # imm = 0x144
callq 0x104461
movq (%rsp), %r10
movq %rax, 0x20(%r10)
movq 0x30(%rsp,%r13), %rdx
movq (%r15), %r14
leaq (%r14,%rdx), %rcx
movq (%r10), %rsi
cmpq %rsi, %rcx
jae 0x1b1cb9
movq 0x18(%rsp), %rdi
movq 0x30(%rsp,%rdi), %r12
movq 0x28(%rsp), %r9
movq 0x20(%rsp), %r11
testq %rdx, %rdx
jle 0x1b1e7d
movq %r13, 0x80(%rsp)
shlq $0x3, %r14
addq 0x20(%r10), %r14
movq %r9, %rax
negq %rax
movq %rax, 0x78(%rsp)
movq %r15, 0x70(%rsp)
cmpq %r9, %r12
jge 0x1b1d4e
testq %r9, %r9
jle 0x1b1d4e
cmpq 0x78(%rsp), %r12
jle 0x1b1d4e
movq (%rbx), %rax
movq %rax, (%r14)
incq %r12
movq %r12, %r13
jmp 0x1b1e58
movq (%r11), %rax
movq 0x10(%r11), %rcx
shlq $0x3, %rax
addq 0x20(%r10), %rax
leaq (,%rcx,8), %rdx
subq %rdx, %rax
movq %rbx, %rdx
cmpq %r12, %rcx
jg 0x1b1d82
movq 0x8(%r11), %rdx
addq %rcx, %rdx
cmpq %r12, %rdx
leaq (%rax,%r12,8), %rdx
cmovleq %rbx, %rdx
movq %rbx, %rsi
cmpq %r12, %rcx
jge 0x1b1da6
movq 0x8(%r11), %rdi
addq %rcx, %rdi
movq %rbx, %rsi
cmpq %r12, %rdi
movq 0x18(%rsp), %rdi
jl 0x1b1da6
leaq (%rax,%r12,8), %rsi
addq $-0x8, %rsi
movq %rbp, %r15
movq (%rdx), %rdx
incq %rdx
movq (%rsi), %rsi
cmpq %rsi, %rdx
cmovleq %rsi, %rdx
leaq 0x1(%r12), %r13
movq %rbx, %rsi
cmpq %r13, %rcx
jg 0x1b1dd5
addq 0x8(%r11), %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 0x1b1e47
movq %rbp, %r8
addq %r12, %r8
js 0x1b1e47
movq 0x8(%r10), %rax
testq %rax, %rax
je 0x1b1e37
cmpq %rax, %rbp
jge 0x1b1e39
cmpq 0x10(%r10), %r8
jge 0x1b1e39
movl $0x1, %edi
movq 0x8(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq %rbp, %rcx
callq 0x1e2a2e
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %r11
movq (%rsp), %r10
movq 0x28(%rsp), %r9
addq %rax, %rbp
movq 0x8(%r10), %rax
jmp 0x1b1e39
xorl %eax, %eax
cmpq %rax, %rbp
jg 0x1b1e47
addq %rbp, %r12
cmpq 0x10(%r10), %r12
jle 0x1b1e4a
movq (%rbx), %rbp
movq %rbp, (%r14)
movq %r13, %r12
movq %r15, %rbp
movq 0x70(%rsp), %r15
addq $0x8, %r14
movq 0x30(%rsp,%rdi), %rax
movq 0x80(%rsp), %rcx
movq 0x30(%rsp,%rcx), %rdx
leaq (%rdx,%rax), %rcx
cmpq %rcx, %r13
jl 0x1b1d2c
jmp 0x1b1e80
movq %r12, %rax
movq 0x8(%r10), %r12
movq 0x10(%r10), %rcx
movq %rcx, %rsi
subq %r12, %rsi
movq %rbx, %rdi
cmpq %rsi, %rax
jg 0x1b1eba
movq (%r15), %rdi
shlq $0x3, %rdi
addq 0x20(%r10), %rdi
leaq (,%rax,8), %r8
subq %r8, %rdi
addq %rax, %rdx
cmpq %rsi, %rdx
leaq (%rdi,%rsi,8), %rdi
cmovleq %rbx, %rdi
cmpq %r12, (%rdi)
je 0x1b1ed7
movq 0x10(%rsp), %rsi
incq %rsi
incq %r9
movq %r15, %r11
leaq 0x30(%rsp), %rax
jmp 0x1b1c1f
movq 0x10(%rsp), %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x651c3
callq 0x651fc