// File: /workspace/github_c_makefile_star2_O0/thegenemyers[P]DASCRUBBER/align.c
// Function: trace_nd
static int trace_nd(char *A, int M, char *B, int N, Trace_Waves *wave, int tspace)
{ int x, y;
  int D, s;

#ifdef DEBUG_ALIGN
  printf("%*s %ld,%ld: %d vs %d\n",depth,"",A-wave->Aabs,B-wave->Babs,M,N);
  fflush(stdout);
#endif

  if (M <= 0)
    { y = (((A-wave->Aabs)/tspace) << 1);
      wave->Trace[y] += N;
      wave->Trace[y+1] += N;
#ifdef DEBUG_TRACE
      printf("%*s Adding1 (%d,%d) to tp %d(%d,%d)\n",depth,"",N,N,y>>1,
                                                     wave->Trace[y+1],wave->Trace[y]);
      fflush(stdout);
#endif
      return (N);
    }

  if (N <= 0)
    { x = A - wave->Aabs;
      y = x/tspace;
      x = (y+1)*tspace - x;
      y <<= 1;
      for (s = M; s > 0; s -= x, x = tspace)
        { if (x > s)
            x = s;
          wave->Trace[y] += x;
#ifdef DEBUG_TRACE
          printf("%*s Adding2 (0,%d) to tp %d(%d,%d)\n",depth,"",x,y>>1,
                                                        wave->Trace[y+1],wave->Trace[y]);
          fflush(stdout);
#endif
          y += 2;
        }
      return (M);
    }

  D = split_nd(A,M,B,N,wave,&x,&y);

  if (D > 1)
    {
#ifdef DEBUG_ALIGN
      printf("%*s (%d,%d) @ %d\n",depth,"",x,y,D);
      fflush(stdout);
      depth += 2;
#endif

      s = A-wave->Aabs;
      if ((s/tspace+1)*tspace - s >= x)
        { s = ((s/tspace)<<1);
          wave->Trace[s] += (D+1)/2;
          wave->Trace[s+1] += y;
#ifdef DEBUG_TRACE
          printf("%*s Adding3 (%d,%d) to tp %d(%d,%d)\n",depth,"",y,(D+1)/2,s>>1,
                                                         wave->Trace[s+1],wave->Trace[s]);
          fflush(stdout);
#endif
        }
      else
        trace_nd(A,x,B,y,wave,tspace);

      s = (A+x)-wave->Aabs;
      if ((s/tspace+1)*tspace - s >= M-x)
        { s = ((s/tspace)<<1);
          wave->Trace[s] += D/2;
          wave->Trace[s+1] += N-y;
#ifdef DEBUG_TRACE
          printf("%*s Adding4 (%d,%d)) to tp %d(%d,%d)\n",depth,"",N-y,D/2,s>>1,
                                                          wave->Trace[s+1],wave->Trace[s]);
          fflush(stdout);
#endif
        }
      else
        trace_nd(A+x,M-x,B+y,N-y,wave,tspace);

#ifdef DEBUG_ALIGN
      depth -= 2;
#endif
    }

  else
    { int u, v;

      if (D == 0 || M < N)
        s = x;
      else
        s = x-1;
      if (s > 0)
        { u = A - wave->Aabs;
          v = u/tspace;
          u = (v+1)*tspace - u;
          for (v <<= 1; s > 0; s -= u, u = tspace)
            { if (u > s)
                u = s;
              wave->Trace[v+1] += u;
#ifdef DEBUG_TRACE
              printf("%*s Adding5 (%d,0)) to tp %d(%d,%d)\n",depth,"",u,v>>1,
                                                             wave->Trace[v+1],wave->Trace[v]);
              fflush(stdout);
#endif
              v += 2;
            }
        }

      if (D == 0)
        return (D);

      if (M < N)
        y = ((((A+x)-wave->Aabs)/tspace)<<1);
      else
        y = ((((A+(x-1))-wave->Aabs)/tspace)<<1);
      wave->Trace[y] += 1;
      if (M <= N)
        wave->Trace[y+1] += 1;
#ifdef DEBUG_TRACE
      printf("%*s Adding5 (%d,1)) to tp %d(%d,%d)\n",depth,"",N>=M,y>>1,
                                                     wave->Trace[y+1],wave->Trace[y]);
      fflush(stdout);
#endif

      s = M-x;
      if (s > 0)
        { u = (A+x) - wave->Aabs;
          v = u/tspace;
          u = (v+1)*tspace - u;
          for (v <<= 1; s > 0; s -= u, u = tspace)
            { if (u > s)
                u = s;
              wave->Trace[v+1] += u;
#ifdef DEBUG_TRACE
              printf("%*s Adding5 (%d,0)) to tp %d(%d,%d)\n",depth,"",u,v>>1,
                                                             wave->Trace[v+1],wave->Trace[v]);
              fflush(stdout);
#endif
              v += 2;
            }
        }
    }

  return (D);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq %r8, -0x30(%rbp)
movl %r9d, -0x34(%rbp)
cmpl $0x0, -0x14(%rbp)
jg 0x16334
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
movq 0x10(%rcx), %rcx
subq %rcx, %rax
movslq -0x34(%rbp), %rcx
cqto
idivq %rcx
shlq %rax
movl %eax, -0x3c(%rbp)
movl -0x24(%rbp), %esi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x3c(%rbp), %rcx
movzwl (%rax,%rcx,2), %edx
addl %esi, %edx
movw %dx, (%rax,%rcx,2)
movl -0x24(%rbp), %esi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x3c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %edx
addl %esi, %edx
movw %dx, (%rax,%rcx,2)
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x16743
cmpl $0x0, -0x24(%rbp)
jg 0x163cc
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
movq 0x10(%rcx), %rcx
subq %rcx, %rax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
cltd
idivl -0x34(%rbp)
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
imull -0x34(%rbp), %eax
subl -0x38(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x3c(%rbp), %eax
shll %eax
movl %eax, -0x3c(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jle 0x163c1
movl -0x38(%rbp), %eax
cmpl -0x44(%rbp), %eax
jle 0x1638c
movl -0x44(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %esi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x3c(%rbp), %rcx
movzwl (%rax,%rcx,2), %edx
addl %esi, %edx
movw %dx, (%rax,%rcx,2)
movl -0x3c(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x3c(%rbp)
movl -0x38(%rbp), %ecx
movl -0x44(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x44(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x38(%rbp)
jmp 0x16378
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x16743
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
movq -0x30(%rbp), %r8
leaq -0x38(%rbp), %r9
leaq -0x3c(%rbp), %rax
movq %rax, (%rsp)
callq 0x15a30
movl %eax, -0x40(%rbp)
cmpl $0x1, -0x40(%rbp)
jle 0x1654b
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
movq 0x10(%rcx), %rcx
subq %rcx, %rax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
cltd
idivl -0x34(%rbp)
addl $0x1, %eax
imull -0x34(%rbp), %eax
subl -0x44(%rbp), %eax
cmpl -0x38(%rbp), %eax
jl 0x16476
movl -0x44(%rbp), %eax
cltd
idivl -0x34(%rbp)
shll %eax
movl %eax, -0x44(%rbp)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %esi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x44(%rbp), %rcx
movzwl (%rax,%rcx,2), %edx
addl %esi, %edx
movw %dx, (%rax,%rcx,2)
movl -0x3c(%rbp), %esi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x44(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %edx
addl %esi, %edx
movw %dx, (%rax,%rcx,2)
jmp 0x16491
movq -0x10(%rbp), %rdi
movl -0x38(%rbp), %esi
movq -0x20(%rbp), %rdx
movl -0x3c(%rbp), %ecx
movq -0x30(%rbp), %r8
movl -0x34(%rbp), %r9d
callq 0x162b0
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
addq %rcx, %rax
movq -0x30(%rbp), %rcx
movq 0x10(%rcx), %rcx
subq %rcx, %rax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
cltd
idivl -0x34(%rbp)
addl $0x1, %eax
imull -0x34(%rbp), %eax
subl -0x44(%rbp), %eax
movl -0x14(%rbp), %ecx
subl -0x38(%rbp), %ecx
cmpl %ecx, %eax
jl 0x16517
movl -0x44(%rbp), %eax
cltd
idivl -0x34(%rbp)
shll %eax
movl %eax, -0x44(%rbp)
movl -0x40(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %esi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x44(%rbp), %rcx
movzwl (%rax,%rcx,2), %edx
addl %esi, %edx
movw %dx, (%rax,%rcx,2)
movl -0x24(%rbp), %esi
subl -0x3c(%rbp), %esi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x44(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %edx
addl %esi, %edx
movw %dx, (%rax,%rcx,2)
jmp 0x16546
movq -0x10(%rbp), %rdi
movslq -0x38(%rbp), %rax
addq %rax, %rdi
movl -0x14(%rbp), %esi
subl -0x38(%rbp), %esi
movq -0x20(%rbp), %rdx
movslq -0x3c(%rbp), %rax
addq %rax, %rdx
movl -0x24(%rbp), %ecx
subl -0x3c(%rbp), %ecx
movq -0x30(%rbp), %r8
movl -0x34(%rbp), %r9d
callq 0x162b0
jmp 0x1673d
cmpl $0x0, -0x40(%rbp)
je 0x16559
movl -0x14(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x16561
movl -0x38(%rbp), %eax
movl %eax, -0x44(%rbp)
jmp 0x1656a
movl -0x38(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jle 0x165f8
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
movq 0x10(%rcx), %rcx
subq %rcx, %rax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
cltd
idivl -0x34(%rbp)
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
imull -0x34(%rbp), %eax
subl -0x48(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x4c(%rbp), %eax
shll %eax
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x44(%rbp)
jle 0x165f6
movl -0x48(%rbp), %eax
cmpl -0x44(%rbp), %eax
jle 0x165bc
movl -0x44(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %esi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %edx
addl %esi, %edx
movw %dx, (%rax,%rcx,2)
movl -0x4c(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x4c(%rbp)
movl -0x48(%rbp), %ecx
movl -0x44(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x44(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x48(%rbp)
jmp 0x165a8
jmp 0x165f8
cmpl $0x0, -0x40(%rbp)
jne 0x16609
movl -0x40(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x16743
movl -0x14(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x16638
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
addq %rcx, %rax
movq -0x30(%rbp), %rcx
movq 0x10(%rcx), %rcx
subq %rcx, %rax
movslq -0x34(%rbp), %rcx
cqto
idivq %rcx
shlq %rax
movl %eax, -0x3c(%rbp)
jmp 0x16662
movq -0x10(%rbp), %rax
movl -0x38(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq -0x30(%rbp), %rcx
movq 0x10(%rcx), %rcx
subq %rcx, %rax
movslq -0x34(%rbp), %rcx
cqto
idivq %rcx
shlq %rax
movl %eax, -0x3c(%rbp)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x3c(%rbp), %rcx
movzwl (%rax,%rcx,2), %edx
addl $0x1, %edx
movw %dx, (%rax,%rcx,2)
movl -0x14(%rbp), %eax
cmpl -0x24(%rbp), %eax
jg 0x1669d
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x3c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %edx
addl $0x1, %edx
movw %dx, (%rax,%rcx,2)
movl -0x14(%rbp), %eax
subl -0x38(%rbp), %eax
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jle 0x1673b
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
addq %rcx, %rax
movq -0x30(%rbp), %rcx
movq 0x10(%rcx), %rcx
subq %rcx, %rax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
cltd
idivl -0x34(%rbp)
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
imull -0x34(%rbp), %eax
subl -0x48(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x4c(%rbp), %eax
shll %eax
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x44(%rbp)
jle 0x16739
movl -0x48(%rbp), %eax
cmpl -0x44(%rbp), %eax
jle 0x166ff
movl -0x44(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %esi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %edx
addl %esi, %edx
movw %dx, (%rax,%rcx,2)
movl -0x4c(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x4c(%rbp)
movl -0x48(%rbp), %ecx
movl -0x44(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x44(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x48(%rbp)
jmp 0x166eb
jmp 0x1673b
jmp 0x1673d
movl -0x40(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)