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

  int  *VF = wave->VF;
  int  *VB = wave->VB;
  int   flow;  //  fhgh == D !
  int   blow, bhgh;
  char *a;

  y = 0;
  if (N < M)
    while (y < N && B[y] == A[y])
      y += 1;
  else
    { while (y < M && B[y] == A[y])
        y += 1;
      if (y >= M && N == M)
        { *px = *py = M;
          return (0);
        }
    }

  flow   = 0;
  VF[0]  = y;
  VF[-1] = -2;

  x = N-M;
  a = A-x;
  y = N-1;
  if (N > M)
    while (y >= x && B[y] == a[y])
      y -= 1;
  else
    while (y >= 0 && B[y] == a[y])
      y -= 1;

  blow = bhgh = -x;
  VB += x;
  VB[blow]   = y;
  VB[blow-1] = N+1;

  for (D = 1; 1; D += 1)
    { int   k, r;
      int   am, ac, ap;

      //  Forward wave

      flow -= 1;
      am = ac = VF[flow-1] = -2;

      a = A + D;
      x = M - D;
      for (k = D; k >= flow; k--)
        { ap = ac;
          ac = am+1;
          am = VF[k-1];

          if (ac < am)
            if (ap < am)
              y  = am;
            else
              y = ap;
          else
            if (ap < ac)
              y = ac;
            else
              y = ap;

          if (blow <= k && k <= bhgh)
            { r = VB[k];
              if (y > r)
                { D = (D<<1)-1;
                  if (ap > r)
                    y = ap;
                  else if (ac > r)
                    y = ac;
                  else
                    y = r+1;
                  x = k+y;
                  *px = x;
                  *py = y;
                  return (D);
                }
            }

          if (N < x)
            while (y < N && B[y] == a[y])
              y += 1;
          else
            while (y < x && B[y] == a[y])
              y += 1;
          
          VF[k] = y;
          a -= 1;
          x += 1;
        }

#ifdef DEBUG_AWAVE
      print_awave(VF,flow,D);
#endif

      //  Reverse Wave

      bhgh += 1;
      blow -= 1;
	am = ac = VB[blow-1] = N+1;

      a = A + bhgh;
      x = -bhgh;
      for (k = bhgh; k >= blow; k--)
        { ap = ac+1;
          ac = am;
          am = VB[k-1];

          if (ac > am)
            if (ap > am)
              y  = am;
            else
              y = ap;
          else
            if (ap > ac)
              y = ac;
            else
              y = ap;

          if (flow <= k && k <= D)
            { r = VF[k];
	        if (y <= r)
                { D = (D << 1);
                  if (ap <= r)
                    y = ap;
                  else if (ac <= r)
                    y = ac;
                  else
                    y = r;
                  x = k+y;
                  *px = x;
                  *py = y;
                  return (D);
                }
            }

          y -= 1;
          if (x > 0)
            while (y >= x && B[y] == a[y])
              y -= 1;
          else
            while (y >= 0 && B[y] == a[y])
              y -= 1;

          VB[k] = y;
          a -= 1;
          x += 1;
        }

#ifdef DEBUG_AWAVE
      print_awave(VB,blow,bhgh);
#endif
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x58(%rbp)
movl $0x0, -0x40(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x15ac7
jmp 0x15a7b
movl -0x40(%rbp), %ecx
xorl %eax, %eax
cmpl -0x24(%rbp), %ecx
movb %al, -0x85(%rbp)
jge 0x15aae
movq -0x20(%rbp), %rax
movslq -0x40(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movq -0x10(%rbp), %rcx
movslq -0x40(%rbp), %rdx
movsbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x85(%rbp)
movb -0x85(%rbp), %al
testb $0x1, %al
jne 0x15aba
jmp 0x15ac5
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x15a7b
jmp 0x15b40
jmp 0x15ac9
movl -0x40(%rbp), %ecx
xorl %eax, %eax
cmpl -0x14(%rbp), %ecx
movb %al, -0x86(%rbp)
jge 0x15afc
movq -0x20(%rbp), %rax
movslq -0x40(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movq -0x10(%rbp), %rcx
movslq -0x40(%rbp), %rdx
movsbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x86(%rbp)
movb -0x86(%rbp), %al
testb $0x1, %al
jne 0x15b08
jmp 0x15b13
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x15ac9
movl -0x40(%rbp), %eax
cmpl -0x14(%rbp), %eax
jl 0x15b3e
movl -0x24(%rbp), %eax
cmpl -0x14(%rbp), %eax
jne 0x15b3e
movl -0x14(%rbp), %ecx
movq 0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x160c8
jmp 0x15b40
movl $0x0, -0x5c(%rbp)
movl -0x40(%rbp), %ecx
movq -0x50(%rbp), %rax
movl %ecx, (%rax)
movq -0x50(%rbp), %rax
movl $0xfffffffe, -0x4(%rax) # imm = 0xFFFFFFFE
movl -0x24(%rbp), %eax
subl -0x14(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movslq -0x3c(%rbp), %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
movl -0x24(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x40(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x14(%rbp), %eax
jle 0x15bd7
jmp 0x15b8b
movl -0x40(%rbp), %ecx
xorl %eax, %eax
cmpl -0x3c(%rbp), %ecx
movb %al, -0x87(%rbp)
jl 0x15bbe
movq -0x20(%rbp), %rax
movslq -0x40(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movq -0x70(%rbp), %rcx
movslq -0x40(%rbp), %rdx
movsbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x87(%rbp)
movb -0x87(%rbp), %al
testb $0x1, %al
jne 0x15bca
jmp 0x15bd5
movl -0x40(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x15b8b
jmp 0x15c23
jmp 0x15bd9
xorl %eax, %eax
cmpl $0x0, -0x40(%rbp)
movb %al, -0x88(%rbp)
jl 0x15c0a
movq -0x20(%rbp), %rax
movslq -0x40(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movq -0x70(%rbp), %rcx
movslq -0x40(%rbp), %rdx
movsbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x88(%rbp)
movb -0x88(%rbp), %al
testb $0x1, %al
jne 0x15c16
jmp 0x15c21
movl -0x40(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x15bd9
jmp 0x15c23
xorl %eax, %eax
subl -0x3c(%rbp), %eax
movl %eax, -0x64(%rbp)
movl %eax, -0x60(%rbp)
movl -0x3c(%rbp), %ecx
movq -0x58(%rbp), %rax
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movl -0x40(%rbp), %edx
movq -0x58(%rbp), %rax
movslq -0x60(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x24(%rbp), %edx
addl $0x1, %edx
movq -0x58(%rbp), %rax
movl -0x60(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl $0x1, -0x44(%rbp)
movb $0x1, %al
testb $0x1, %al
jne 0x15c79
jmp 0x160c8
movl -0x5c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x5c(%rbp)
movq -0x50(%rbp), %rax
movl -0x5c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl $0xfffffffe, (%rax,%rcx,4) # imm = 0xFFFFFFFE
movl $0xfffffffe, -0x80(%rbp) # imm = 0xFFFFFFFE
movl $0xfffffffe, -0x7c(%rbp) # imm = 0xFFFFFFFE
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
movl -0x14(%rbp), %eax
subl -0x44(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x5c(%rbp), %eax
jl 0x15e9a
movl -0x80(%rbp), %eax
movl %eax, -0x84(%rbp)
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
movq -0x50(%rbp), %rax
movl -0x74(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x7c(%rbp)
movl -0x80(%rbp), %eax
cmpl -0x7c(%rbp), %eax
jge 0x15d19
movl -0x84(%rbp), %eax
cmpl -0x7c(%rbp), %eax
jge 0x15d0e
movl -0x7c(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x15d17
movl -0x84(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x15d37
movl -0x84(%rbp), %eax
cmpl -0x80(%rbp), %eax
jge 0x15d2c
movl -0x80(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x15d35
movl -0x84(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x15d37
movl -0x60(%rbp), %eax
cmpl -0x74(%rbp), %eax
jg 0x15dc5
movl -0x74(%rbp), %eax
cmpl -0x64(%rbp), %eax
jg 0x15dc5
movq -0x58(%rbp), %rax
movslq -0x74(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x78(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x78(%rbp), %eax
jle 0x15dc3
movl -0x44(%rbp), %eax
shll %eax
subl $0x1, %eax
movl %eax, -0x44(%rbp)
movl -0x84(%rbp), %eax
cmpl -0x78(%rbp), %eax
jle 0x15d82
movl -0x84(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x15d9d
movl -0x80(%rbp), %eax
cmpl -0x78(%rbp), %eax
jle 0x15d92
movl -0x80(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x15d9b
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x15d9d
movl -0x74(%rbp), %eax
addl -0x40(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
movl -0x40(%rbp), %ecx
movq 0x10(%rbp), %rax
movl %ecx, (%rax)
movl -0x44(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x160c8
jmp 0x15dc5
movl -0x24(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0x15e1b
jmp 0x15dcf
movl -0x40(%rbp), %ecx
xorl %eax, %eax
cmpl -0x24(%rbp), %ecx
movb %al, -0x89(%rbp)
jge 0x15e02
movq -0x20(%rbp), %rax
movslq -0x40(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movq -0x70(%rbp), %rcx
movslq -0x40(%rbp), %rdx
movsbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x89(%rbp)
movb -0x89(%rbp), %al
testb $0x1, %al
jne 0x15e0e
jmp 0x15e19
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x15dcf
jmp 0x15e69
jmp 0x15e1d
movl -0x40(%rbp), %ecx
xorl %eax, %eax
cmpl -0x3c(%rbp), %ecx
movb %al, -0x8a(%rbp)
jge 0x15e50
movq -0x20(%rbp), %rax
movslq -0x40(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movq -0x70(%rbp), %rcx
movslq -0x40(%rbp), %rdx
movsbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x8a(%rbp)
movb -0x8a(%rbp), %al
testb $0x1, %al
jne 0x15e5c
jmp 0x15e67
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x15e1d
jmp 0x15e69
movl -0x40(%rbp), %edx
movq -0x50(%rbp), %rax
movslq -0x74(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x70(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x70(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x74(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x15cc2
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
movl -0x60(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x60(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movq -0x58(%rbp), %rcx
movl -0x60(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
movl %eax, (%rcx,%rdx,4)
movl %eax, -0x80(%rbp)
movl %eax, -0x7c(%rbp)
movq -0x10(%rbp), %rax
movslq -0x64(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
xorl %eax, %eax
subl -0x64(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x64(%rbp), %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x60(%rbp), %eax
jl 0x160b8
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
movl -0x7c(%rbp), %eax
movl %eax, -0x80(%rbp)
movq -0x58(%rbp), %rax
movl -0x74(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x7c(%rbp)
movl -0x80(%rbp), %eax
cmpl -0x7c(%rbp), %eax
jle 0x15f3c
movl -0x84(%rbp), %eax
cmpl -0x7c(%rbp), %eax
jle 0x15f31
movl -0x7c(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x15f3a
movl -0x84(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x15f5a
movl -0x84(%rbp), %eax
cmpl -0x80(%rbp), %eax
jle 0x15f4f
movl -0x80(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x15f58
movl -0x84(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x15f5a
movl -0x5c(%rbp), %eax
cmpl -0x74(%rbp), %eax
jg 0x15fde
movl -0x74(%rbp), %eax
cmpl -0x44(%rbp), %eax
jg 0x15fde
movq -0x50(%rbp), %rax
movslq -0x74(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x78(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x78(%rbp), %eax
jg 0x15fdc
movl -0x44(%rbp), %eax
shll %eax
movl %eax, -0x44(%rbp)
movl -0x84(%rbp), %eax
cmpl -0x78(%rbp), %eax
jg 0x15f9e
movl -0x84(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x15fb6
movl -0x80(%rbp), %eax
cmpl -0x78(%rbp), %eax
jg 0x15fae
movl -0x80(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x15fb4
movl -0x78(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x15fb6
movl -0x74(%rbp), %eax
addl -0x40(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
movl -0x40(%rbp), %ecx
movq 0x10(%rbp), %rax
movl %ecx, (%rax)
movl -0x44(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x160c8
jmp 0x15fde
movl -0x40(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x3c(%rbp)
jle 0x1603b
jmp 0x15fef
movl -0x40(%rbp), %ecx
xorl %eax, %eax
cmpl -0x3c(%rbp), %ecx
movb %al, -0x8b(%rbp)
jl 0x16022
movq -0x20(%rbp), %rax
movslq -0x40(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movq -0x70(%rbp), %rcx
movslq -0x40(%rbp), %rdx
movsbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x8b(%rbp)
movb -0x8b(%rbp), %al
testb $0x1, %al
jne 0x1602e
jmp 0x16039
movl -0x40(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x15fef
jmp 0x16087
jmp 0x1603d
xorl %eax, %eax
cmpl $0x0, -0x40(%rbp)
movb %al, -0x8c(%rbp)
jl 0x1606e
movq -0x20(%rbp), %rax
movslq -0x40(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movq -0x70(%rbp), %rcx
movslq -0x40(%rbp), %rdx
movsbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x8c(%rbp)
movb -0x8c(%rbp), %al
testb $0x1, %al
jne 0x1607a
jmp 0x16085
movl -0x40(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x1603d
jmp 0x16087
movl -0x40(%rbp), %edx
movq -0x58(%rbp), %rax
movslq -0x74(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x70(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x70(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x74(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x15ee5
jmp 0x160ba
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x15c6e
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)