// File: /workspace/github_c_makefile_star2_O0/thegenemyers[P]DASCRUBBER/DASrealign.c
// Function: recon
static int recon(Path *image, Path *path, Finger *afinger, Finger *bfinger)
{ static int     tmax = -1;
  static uint16 *itrace = NULL;

  int ae, be;
  int al, bl;
  int an, bn;
  int t, tl, df;
  uint16 *strace = ((uint16 *) (path->trace));

  if (path->tlen > tmax)
    { tmax = 1.2*path->tlen + 100;
      itrace = (uint16 *) Realloc(itrace,sizeof(uint16)*tmax,"Reallocating image trace");
    }
  image->trace = itrace;

#ifdef TRACE
  printf("      Backbone:\n");
  fflush(stdout);
#endif
  df = 0;
  tl = -1;
  al = bl = 0;
  ae = lowTP(path->abpos);
  be = path->bbpos;
  if ((an = good(afinger,path->abpos)) >= 0 && (bn = good(bfinger,be)) >= 0)
    { image->abpos = al = an;
      image->bbpos = bl = bn;
      tl = 0;
#ifdef TRACE
      printf("        %5d,%5d -> %5d,%5d\n",path->abpos,be,an,bn);
      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 (tl >= 0)
        df += strace[t-1];
      if ((an = good(afinger,ae)) >= 0 && (bn = good(bfinger,be)) >= 0)
        { if (tl < 0)
            { image->abpos = an;
              image->bbpos = bn;
              tl = 0;
            }
          else
            { itrace[tl]   = an-al;
              itrace[tl+1] = bn-bl;
              tl += 2;
            }
          image->aepos = al = an;
          image->bepos = bl = bn;
          image->diffs = df;
#ifdef TRACE
          printf("        %5d,%5d -> %5d,%5d\n",ae,be,an,bn);
          fflush(stdout);
#endif
        }
    }

  image->tlen = tl;
  if (tl <= 0)
    return (0);
  else
    return (1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
cmpl 0x27cb0(%rip), %eax     # 0x2c1b0
jle 0x4551
movq -0x18(%rbp), %rax
cvtsi2sdl 0x8(%rax), %xmm0
movsd 0x22af5(%rip), %xmm1    # 0x27008
mulsd %xmm1, %xmm0
movsd 0x22af9(%rip), %xmm1    # 0x27018
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x27c83(%rip)     # 0x2c1b0
movq 0x28114(%rip), %rdi     # 0x2c648
movslq 0x27c75(%rip), %rsi     # 0x2c1b0
shlq %rsi
leaq 0x22d9b(%rip), %rdx     # 0x272e0
callq 0x1b840
movq %rax, 0x280f7(%rip)     # 0x2c648
movq 0x280f0(%rip), %rcx     # 0x2c648
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4c(%rbp)
movl $0xffffffff, -0x48(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x38(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x18(%rbp), %rax
movl 0x10(%rax), %edi
callq 0x2400
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x30(%rbp)
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x10(%rax), %esi
callq 0x4bd0
movl %eax, -0x3c(%rbp)
cmpl $0x0, %eax
jl 0x45e1
movq -0x28(%rbp), %rdi
movl -0x30(%rbp), %esi
callq 0x4bd0
movl %eax, -0x40(%rbp)
cmpl $0x0, %eax
jl 0x45e1
movl -0x3c(%rbp), %ecx
movl %ecx, -0x34(%rbp)
movq -0x10(%rbp), %rax
movl %ecx, 0x10(%rax)
movl -0x40(%rbp), %ecx
movl %ecx, -0x38(%rbp)
movq -0x10(%rbp), %rax
movl %ecx, 0x14(%rax)
movl $0x0, -0x48(%rbp)
movl $0x1, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x470e
movl 0x27e1a(%rip), %eax     # 0x2c418
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x58(%rbp), %rax
movslq -0x44(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x2c(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jle 0x462c
movq -0x18(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x48(%rbp)
jl 0x4649
movq -0x58(%rbp), %rax
movl -0x44(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x20(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0x4bd0
movl %eax, -0x3c(%rbp)
cmpl $0x0, %eax
jl 0x46fe
movq -0x28(%rbp), %rdi
movl -0x30(%rbp), %esi
callq 0x4bd0
movl %eax, -0x40(%rbp)
cmpl $0x0, %eax
jl 0x46fe
cmpl $0x0, -0x48(%rbp)
jge 0x469c
movl -0x3c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x10(%rax)
movl -0x40(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x14(%rax)
movl $0x0, -0x48(%rbp)
jmp 0x46da
movl -0x3c(%rbp), %eax
subl -0x34(%rbp), %eax
movw %ax, %dx
movq 0x27f9c(%rip), %rax     # 0x2c648
movslq -0x48(%rbp), %rcx
movw %dx, (%rax,%rcx,2)
movl -0x40(%rbp), %eax
subl -0x38(%rbp), %eax
movw %ax, %dx
movq 0x27f84(%rip), %rax     # 0x2c648
movl -0x48(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movw %dx, (%rax,%rcx,2)
movl -0x48(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x48(%rbp)
movl -0x3c(%rbp), %ecx
movl %ecx, -0x34(%rbp)
movq -0x10(%rbp), %rax
movl %ecx, 0x18(%rax)
movl -0x40(%rbp), %ecx
movl %ecx, -0x38(%rbp)
movq -0x10(%rbp), %rax
movl %ecx, 0x1c(%rax)
movl -0x4c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xc(%rax)
jmp 0x4700
movl -0x44(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x44(%rbp)
jmp 0x45e8
movl -0x48(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
cmpl $0x0, -0x48(%rbp)
jg 0x4727
movl $0x0, -0x4(%rbp)
jmp 0x472e
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)