// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq %r8, -0x30(%rbp)
cmpl $0x0, -0x14(%rbp)
jg 0x16151
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
subq $0x1, %rax
movl %eax, -0x34(%rbp)
movl $0x1, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x24(%rbp), %eax
jg 0x16146
movl -0x34(%rbp), %ecx
movq -0x30(%rbp), %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x4, %rsi
movq %rsi, (%rdx)
movl %ecx, (%rax)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x1611d
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1629a
cmpl $0x0, -0x24(%rbp)
jg 0x161a8
movq -0x20(%rbp), %rax
movq -0x30(%rbp), %rcx
movq 0x18(%rcx), %rcx
subq %rcx, %rax
addq $0x1, %rax
movl %eax, -0x38(%rbp)
movl $0x1, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x14(%rbp), %eax
jg 0x1619d
movl -0x38(%rbp), %ecx
movq -0x30(%rbp), %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x4, %rsi
movq %rsi, (%rdx)
movl %ecx, (%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x16174
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1629a
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
movq -0x30(%rbp), %r8
leaq -0x34(%rbp), %r9
leaq -0x38(%rbp), %rax
movq %rax, (%rsp)
callq 0x15a30
movl %eax, -0x3c(%rbp)
cmpl $0x1, -0x3c(%rbp)
jle 0x16218
movq -0x10(%rbp), %rdi
movl -0x34(%rbp), %esi
movq -0x20(%rbp), %rdx
movl -0x38(%rbp), %ecx
movq -0x30(%rbp), %r8
callq 0x160e0
movq -0x10(%rbp), %rdi
movslq -0x34(%rbp), %rax
addq %rax, %rdi
movl -0x14(%rbp), %esi
subl -0x34(%rbp), %esi
movq -0x20(%rbp), %rdx
movslq -0x38(%rbp), %rax
addq %rax, %rdx
movl -0x24(%rbp), %ecx
subl -0x38(%rbp), %ecx
movq -0x30(%rbp), %r8
callq 0x160e0
jmp 0x16294
cmpl $0x1, -0x3c(%rbp)
jne 0x16292
movl -0x14(%rbp), %eax
cmpl -0x24(%rbp), %eax
jle 0x16257
movq -0x20(%rbp), %rax
movq -0x30(%rbp), %rcx
movq 0x18(%rcx), %rcx
subq %rcx, %rax
movslq -0x38(%rbp), %rcx
addq %rcx, %rax
addq $0x1, %rax
movl %eax, %ecx
movq -0x30(%rbp), %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x4, %rsi
movq %rsi, (%rdx)
movl %ecx, (%rax)
jmp 0x16290
movl -0x14(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x1628e
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
movslq -0x34(%rbp), %rcx
subq %rcx, %rax
subq $0x1, %rax
movl %eax, %ecx
movq -0x30(%rbp), %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x4, %rsi
movq %rsi, (%rdx)
movl %ecx, (%rax)
jmp 0x16290
jmp 0x16292
jmp 0x16294
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)