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

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

  if (M <= 0)
    { x = (wave->Aabs-A)-1;
      for (y = 1; y <= N; y++)
        { *wave->Stop++ = x;
#ifdef DEBUG_SCRIPT
          printf("%*s *I %ld(%ld)\n",depth,"",y+(B-wave->Babs),(A-wave->Aabs)+1);
#endif
        }
      return (N);
    }

  if (N <= 0)
    { y = (B-wave->Babs)+1;
      for (x = 1; x <= M; x++)
        { *wave->Stop++ = y;
#ifdef DEBUG_SCRIPT
          printf("%*s *D %ld(%ld)\n",depth,"",x+(A-wave->Aabs),(B-wave->Babs)+1);
#endif
        }
      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

      dandc_nd(A,x,B,y,wave);
      dandc_nd(A+x,M-x,B+y,N-y,wave);

#ifdef DEBUG_ALIGN
      depth -= 2;
#endif
    }

  else if (D == 1)

    { if (M > N)
        { *wave->Stop++ = (B-wave->Babs)+y+1;
#ifdef DEBUG_SCRIPT
          printf("%*s  D %ld(%ld)\n",depth,"",(A-wave->Aabs)+x,(B-wave->Babs)+y+1);
#endif
        }

      else if (M < N)
        { *wave->Stop++ = (wave->Aabs-A)-x-1;
#ifdef DEBUG_SCRIPT
          printf("%*s  I %ld(%ld)\n",depth,"",(B-wave->Babs)+y,(A-wave->Aabs)+x+1);
#endif
        }

#ifdef DEBUG_SCRIPT
      else
        printf("%*s  %ld S %ld\n",depth,"",(wave->Aabs-A)+x,(B-wave->Babs)+y);
#endif
    }

  return (D);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %rbx
movl %ecx, %r14d
movq %rdi, %r15
testl %esi, %esi
jle 0xfed8
movq %rdx, %r12
movl %esi, %r13d
testl %r14d, %r14d
jle 0xff03
leaq 0x14(%rsp), %rax
movq %rax, (%rsp)
leaq 0x18(%rsp), %r9
movq %r15, %rdi
movl %r13d, %esi
movq %r12, %rdx
movl %r14d, %ecx
movq %rbx, %r8
callq 0xfa40
cmpl $0x2, %eax
jl 0xff30
movslq 0x18(%rsp), %rbp
movslq 0x14(%rsp), %rcx
movq %rcx, 0x20(%rsp)
movq %r15, %rdi
movl %eax, 0x1c(%rsp)
movl %ebp, %esi
movq %r12, %rdx
movq %rbx, %r8
callq 0xfe2e
addq %rbp, %r15
subl %ebp, %r13d
movq 0x20(%rsp), %rax
addq %rax, %r12
subl %eax, %r14d
movq %r15, %rdi
movl %r13d, %esi
movq %r12, %rdx
movl %r14d, %ecx
movq %rbx, %r8
callq 0xfe2e
movl 0x1c(%rsp), %eax
jmp 0xff7c
notl %r15d
addl 0x10(%rbx), %r15d
movl %r15d, 0x18(%rsp)
testl %r14d, %r14d
jle 0xff56
movq (%rbx), %rcx
leal 0x1(%r14), %eax
movl %r14d, %edx
movl %r15d, (%rcx)
addq $0x4, %rcx
decl %edx
jne 0xfef3
movq %rcx, (%rbx)
jmp 0xff5b
subl 0x18(%rbx), %r12d
incl %r12d
movl %r12d, 0x14(%rsp)
movq (%rbx), %rax
leal 0x1(%r13), %ecx
movl %r13d, %edx
movl %r12d, (%rax)
addq $0x4, %rax
decl %edx
jne 0xff19
movq %rax, (%rbx)
movl %ecx, 0x18(%rsp)
movl %r13d, %r14d
jmp 0xff7f
cmpl $0x1, %eax
jne 0xff7c
cmpl %r14d, %r13d
jle 0xff61
subl 0x18(%rbx), %r12d
movl 0x14(%rsp), %ecx
leal (%rcx,%r12), %esi
incl %esi
movq (%rbx), %rcx
leaq 0x4(%rcx), %rdx
movq %rdx, (%rbx)
movl %esi, (%rcx)
jmp 0xff7c
movl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0xff7f
jge 0xff7c
addl 0x18(%rsp), %r15d
notl %r15d
addl 0x10(%rbx), %r15d
movq (%rbx), %rdx
leaq 0x4(%rdx), %rcx
movq %rcx, (%rbx)
movl %r15d, (%rdx)
movl %eax, %r14d
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq