// File: /workspace/github_c_makefile_star2_O0/thegenemyers[P]DASCRUBBER/DASrealign.c
// Function: estimate
static int estimate(Path *path, Finger *afinger, Finger *bfinger, int *bsta, int *bstb, int *acc)
{ int ae, be;
  int an, bn;
  int best, adst, bdst;
  int t;
  uint16 *strace = ((uint16 *) (path->trace));

  *bsta = *bstb = -1;
  best  = INT32_MAX;

#ifdef TRACE
  printf("      Point Estimate:\n");
  fflush(stdout);
#endif
  ae = lowTP(path->abpos);
  be = path->bbpos;
  if ((an = where(afinger,path->abpos,&adst)) >= 0 && (bn = where(bfinger,be,&bdst)) >= 0)
    { best = adst + bdst;
      *bsta = an;
      *bstb = bn;
#ifdef TRACE
      printf("        %5d,%5d -> %5d(%d),%5d(%d)\n",path->abpos,be,an,adst,bn,bdst);
      fflush(stdout);
#endif
    }
  for (t = 1; t < path->tlen; t += 2)
    { ae += TRACE_SPACING;
      be += strace[t];
      if (ae > path->aepos)
        ae = path->aepos;
      if ((an = where(afinger,ae,&adst)) >= 0 && (bn = where(bfinger,be,&bdst)) >= 0)
        { if (adst + bdst < best)
            { best = adst + bdst;
              *bsta = an;
              *bstb = bn;
            }
#ifdef TRACE
          printf("        %5d,%5d -> %5d(%d),%5d(%d)\n",ae,be,an,adst,bn,bdst);
          fflush(stdout);
#endif
        }
    }
  *acc = best;

  return (*bsta >= 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movq -0x20(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0x7fffffff, -0x44(%rbp) # imm = 0x7FFFFFFF
movq -0x8(%rbp), %rax
movl 0x10(%rax), %edi
callq 0x2400
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x10(%rax), %esi
leaq -0x48(%rbp), %rdx
callq 0x4de0
movl %eax, -0x3c(%rbp)
cmpl $0x0, %eax
jl 0x47ee
movq -0x18(%rbp), %rdi
movl -0x38(%rbp), %esi
leaq -0x4c(%rbp), %rdx
callq 0x4de0
movl %eax, -0x40(%rbp)
cmpl $0x0, %eax
jl 0x47ee
movl -0x48(%rbp), %eax
addl -0x4c(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x3c(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl -0x40(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl $0x1, -0x50(%rbp)
movl -0x50(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x48a1
movl 0x27c0d(%rip), %eax     # 0x2c418
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x58(%rbp), %rax
movslq -0x50(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
addl -0x38(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x34(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jle 0x4839
movq -0x8(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rdi
movl -0x34(%rbp), %esi
leaq -0x48(%rbp), %rdx
callq 0x4de0
movl %eax, -0x3c(%rbp)
cmpl $0x0, %eax
jl 0x4891
movq -0x18(%rbp), %rdi
movl -0x38(%rbp), %esi
leaq -0x4c(%rbp), %rdx
callq 0x4de0
movl %eax, -0x40(%rbp)
cmpl $0x0, %eax
jl 0x4891
movl -0x48(%rbp), %eax
addl -0x4c(%rbp), %eax
cmpl -0x44(%rbp), %eax
jge 0x488f
movl -0x48(%rbp), %eax
addl -0x4c(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x3c(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl -0x40(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
jmp 0x4891
jmp 0x4893
movl -0x50(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x50(%rbp)
jmp 0x47f5
movl -0x44(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
setge %al
andb $0x1, %al
movzbl %al, %eax
addq $0x60, %rsp
popq %rbp
retq
nop