// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/diagonalbandalign.c
// Function: gt_diagonalbandalign_check
void gt_diagonalbandalign_check(GT_UNUSED bool forward,
                                const GtUchar *useq,
                                GtUword ulen,
                                const GtUchar *vseq,
                                GtUword vlen)
{
  GtUword edist1, edist2, edist3, matchcost = 0, mismatchcost = 1, gapcost = 1;
  GtWord left_dist, right_dist;
  GtAlignment *align;
  GtLinspaceManagement *spacemanager;
  GtScoreHandler *scorehandler;

  if (memchr(useq, LINEAR_EDIST_GAP,ulen) != NULL)
  {
    fprintf(stderr,"%s: sequence u contains gap symbol\n",__func__);
    exit(GT_EXIT_PROGRAMMING_ERROR);
  }
  if (memchr(vseq, LINEAR_EDIST_GAP,vlen) != NULL)
  {
    fprintf(stderr,"%s: sequence v contains gap symbol\n",__func__);
    exit(GT_EXIT_PROGRAMMING_ERROR);
  }

  /* set valid left_dist and right_dist for this test*/
  if ((GtWord)vlen-(GtWord)ulen > 0)
    left_dist = 0;
  else
    left_dist = (GtWord)vlen-(GtWord)ulen-1;
  if ((GtWord)vlen-(GtWord)ulen > 0)
    right_dist = (GtWord)vlen-(GtWord)ulen+2;
  else
    right_dist = 0;

  scorehandler = gt_scorehandler_new(matchcost, mismatchcost, 0, gapcost);
  gt_scorehandler_plain(scorehandler);
  gt_scorehandler_downcase(scorehandler);
  edist1 = diagonalband_linear_distance_only(useq, 0, ulen, vseq, 0, vlen,
                                             left_dist, right_dist, matchcost,
                                             mismatchcost, gapcost);

  edist2 = diagonalband_squarespace_distance_only(useq, 0, ulen, vseq, 0, vlen,
                                                  left_dist, right_dist,
                                                  matchcost, mismatchcost,
                                                  gapcost);

  if (edist1 != edist2)
  {
    fprintf(stderr,"diagonalband_linear_distance_only = "GT_WU" != "GT_WU
              " = diagonalband_squarespace_distance_only\n", edist1, edist2);
    exit(GT_EXIT_PROGRAMMING_ERROR);
  }

  spacemanager = gt_linspace_management_new();
  align = gt_alignment_new_with_seqs(useq, ulen, vseq, vlen);

  gt_calc_diagonalbandalign(spacemanager, scorehandler, align,
                            useq, 0, ulen, vseq, 0, vlen,
                            left_dist, right_dist);

  edist3 = gt_alignment_eval_with_score(align, true, matchcost,
                                        mismatchcost, gapcost);
  if (edist2 != edist3)
  {
    fprintf(stderr,"diagonalband_squarespace_distance_only = "GT_WU" != "GT_WU
              " = gt_alignment_eval_with_score\n", edist2, edist3);
    exit(GT_EXIT_PROGRAMMING_ERROR);
  }
  gt_alignment_delete(align);
  gt_linspace_management_delete(spacemanager);
  gt_scorehandler_delete(scorehandler);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %r8, %r15
movq %rcx, %rbx
movq %rdx, %r13
movq %rsi, %r14
movq %rsi, %rdi
movl $0xff, %esi
callq 0x178a0
testq %rax, %rax
jne 0x139b5a
movq %r14, 0x28(%rsp)
movq %rbx, 0x10(%rsp)
movq %rbx, %rdi
movl $0xff, %esi
movq %r15, %rdx
callq 0x178a0
testq %rax, %rax
jne 0x139b5f
movq %r15, 0x20(%rsp)
movq %r15, %rbx
subq %r13, %rbx
leaq -0x1(%rbx), %r15
leaq 0x2(%rbx), %rbp
xorl %r14d, %r14d
movl $0x1, %esi
movl $0x1, %ecx
xorl %edi, %edi
xorl %edx, %edx
callq 0x179740
movq %rax, %r12
movq %rax, %rdi
callq 0x1797a3
movq %r12, 0x68(%rsp)
movq %r12, %rdi
callq 0x1797b3
testq %rbx, %rbx
cmovgq %r14, %r15
cmovleq %r14, %rbp
cmovnsq %r14, %rbx
cmpq %r15, %rbx
setl %al
testq %rbp, %rbp
sets %cl
orb %al, %cl
movq $-0x1, 0x8(%rsp)
movq %rbp, 0x30(%rsp)
movq %r15, 0x40(%rsp)
jne 0x139997
movb %cl, 0x7(%rsp)
movq %rbp, %rax
subq %r15, %rax
leaq 0x8(,%rax,8), %rdi
leaq 0x24a8d8(%rip), %rsi    # 0x383f73
movl $0x15c, %edx            # imm = 0x15C
callq 0x1092b2
movq %rax, %rdi
movq %r15, %rsi
negq %rsi
movq $0x0, (%rax)
jae 0x1396d0
movq (%rdi), %rax
incq %rax
xorl %ecx, %ecx
leaq (%rax,%rcx), %rdx
movq %rdx, 0x8(%rdi,%rcx,8)
incq %rcx
cmpq %rcx, %rsi
jne 0x1396bf
movq 0x20(%rsp), %rax
testq %rax, %rax
movq %r13, 0x48(%rsp)
je 0x13996f
cmpq %r13, %rsi
sete %cl
incq %rax
cmpq $0x3, %rax
movl $0x2, %edx
cmovaeq %rax, %rdx
movq %rdx, 0x88(%rsp)
leaq 0x8(%rdi), %rax
movq %rax, 0x80(%rsp)
movq %rdi, %rax
addq $0x10, %rax
movq %rax, 0x78(%rsp)
movl $0x1, %eax
movl $0x1, %edx
subq %r13, %rdx
movq %rdx, 0x70(%rsp)
xorl %edx, %edx
movq %rsi, %r14
movq $-0x1, %r9
movq %rdi, 0x50(%rsp)
movq (%rdi), %r13
cmpq %rbp, %rax
movq %rax, 0x38(%rsp)
jbe 0x139757
cmpq %r14, %rdx
je 0x139752
movq 0x8(%rdi), %r9
incq %rdx
jmp 0x13975a
movq %r13, %r9
xorl %ebp, %ebp
cmpq 0x48(%rsp), %r14
setb %bpl
leaq (%r14,%rbp), %rsi
cmpq %rsi, %rdx
movq $-0x1, %rbx
cmovneq %r9, %rbx
testb $0x1, %cl
cmovneq %r9, %rbx
movq %rbx, %r12
incq %r12
movq $-0x1, %rax
cmoveq %rax, %r12
movq %r12, (%rdi)
testq %rdx, %rdx
movq %rsi, 0x60(%rsp)
movq %rdx, 0x58(%rsp)
je 0x139800
cmpq $-0x1, %r13
je 0x1397f1
movq 0x28(%rsp), %rax
movzbl -0x1(%rax,%rdx), %edi
movl %ecx, 0x8(%rsp)
callq 0x17ae0
movl %eax, %r15d
movq 0x10(%rsp), %rax
movq 0x38(%rsp), %rcx
movzbl -0x1(%rax,%rcx), %edi
callq 0x17ae0
movq 0x58(%rsp), %rdx
movq 0x60(%rsp), %rsi
movq 0x50(%rsp), %rdi
xorl %ecx, %ecx
cmpl %eax, %r15d
setne %cl
addq %rcx, %r13
movl 0x8(%rsp), %ecx
jmp 0x1397f8
movq $-0x1, %r13
cmpq %r12, %r13
jae 0x139800
movq %r13, (%rdi)
leaq 0x1(%rdx), %rax
cmpq %rsi, %rax
jbe 0x139811
movq %rbx, %r9
jmp 0x13994f
movq 0x28(%rsp), %rax
addq %rdx, %rax
movq %rax, 0x90(%rsp)
movq 0x80(%rsp), %rax
leaq (%rax,%rdx,8), %r15
movq 0x70(%rsp), %rax
addq %rdx, %rax
movq %rax, 0xa0(%rsp)
addq %rbp, %r14
negq %r14
leaq (%rdx,%r14), %rax
incq %rax
movq %rax, 0x98(%rsp)
movq 0x78(%rsp), %rbp
xorl %r13d, %r13d
testb $0x1, %cl
jne 0x139873
movq 0x98(%rsp), %rax
movq $-0x1, %r9
addq %r13, %rax
je 0x139880
testq %rdx, %rdx
movq %rbp, %rax
cmoveq %r15, %rax
movq (%rax), %r9
movq 0xa0(%rsp), %rax
addq %r13, %rax
movzbl %cl, %ecx
movl $0x1, %eax
cmovel %eax, %ecx
movq %r9, %r12
incq %r12
movq $-0x1, %rax
cmoveq %rax, %r12
movq %r12, 0x8(%rdi,%r13,8)
cmpq $-0x1, %rbx
je 0x139908
movq 0x90(%rsp), %rax
movzbl (%rax,%r13), %edi
movl %ecx, 0x8(%rsp)
movq %r9, %r14
callq 0x17ae0
movl %eax, 0x18(%rsp)
movq 0x10(%rsp), %rax
movq 0x38(%rsp), %rcx
movzbl -0x1(%rax,%rcx), %edi
callq 0x17ae0
movq %r14, %r9
movq 0x58(%rsp), %rdx
movq 0x60(%rsp), %rsi
movq 0x50(%rsp), %rdi
xorl %ecx, %ecx
cmpl %eax, 0x18(%rsp)
setne %cl
addq %rcx, %rbx
movl 0x8(%rsp), %ecx
movq %rbx, %rax
cmpq %r12, %rax
ja 0x139912
movq %rax, 0x8(%rdi,%r13,8)
movq (%rdi,%r13,8), %rax
incq %rax
movq $-0x1, %r8
cmoveq %r8, %rax
cmpq 0x8(%rdi,%r13,8), %rax
ja 0x139930
movq %rax, 0x8(%rdi,%r13,8)
addq $0x8, %r15
addq $0x8, %rbp
leaq (%rdx,%r13), %rax
addq $0x2, %rax
incq %r13
movq %r9, %rbx
cmpq %rsi, %rax
jbe 0x13985a
movq 0x38(%rsp), %rax
incq %rax
movq %rsi, %r14
cmpq 0x88(%rsp), %rax
movq 0x30(%rsp), %rbp
jne 0x13973c
jmp 0x139971
xorl %edx, %edx
subq %rdx, %rsi
movq (%rdi,%rsi,8), %rax
movq %rax, 0x8(%rsp)
leaq 0x24a5ef(%rip), %rsi    # 0x383f73
movl $0x1a0, %edx            # imm = 0x1A0
callq 0x109670
movq 0x48(%rsp), %r13
movb 0x7(%rsp), %cl
testb %cl, %cl
jne 0x139b64
leaq 0x1(%r13), %rbx
leaq 0x8(,%r13,8), %r14
leaq 0x24a5c1(%rip), %r12    # 0x383f73
movq %r14, %rdi
movq %r12, %rsi
movl $0x82, %edx
callq 0x1092b2
movq %rax, %rbp
movq 0x20(%rsp), %r15
leaq 0x1(%r15), %rdi
imulq %r14, %rdi
movq %r12, %rsi
movl $0x82, %edx
callq 0x1092b2
movq %rax, (%rbp)
cmpq $0x2, %rbx
jb 0x139a0a
leaq 0x8(,%r15,8), %rax
movq (%rbp), %rcx
addq %rax, %rcx
xorl %edx, %edx
movq %rcx, 0x8(%rbp,%rdx,8)
addq %rax, %rcx
incq %rdx
cmpq %rdx, %r13
jne 0x1399fa
movl $0x1, %esi
movl $0x1, %ecx
xorl %edi, %edi
xorl %edx, %edx
callq 0x179740
movq %rax, %r14
movq %rax, %rdi
callq 0x1797a3
movq %r14, %rdi
callq 0x1797b3
movq %rbp, %rdi
movq %r15, %rbx
movq 0x28(%rsp), %r15
movq %r15, %rsi
xorl %edx, %edx
movq %r13, %rcx
movq 0x10(%rsp), %r8
xorl %r9d, %r9d
pushq %r14
pushq 0x38(%rsp)
pushq 0x50(%rsp)
pushq %rbx
callq 0x138f48
addq $0x20, %rsp
movq (%rbp,%r13,8), %rax
movq (%rax,%rbx,8), %rbx
movq (%rbp), %rdi
movq %r13, %r12
leaq 0x24a4fd(%rip), %r13    # 0x383f73
movq %r13, %rsi
movl $0x8b, %edx
callq 0x109670
movq %rbp, %rdi
movq %r13, %rsi
movl $0x8b, %edx
callq 0x109670
movq %r14, %rdi
callq 0x1797c3
movq 0x8(%rsp), %rdi
movq %rbx, 0x18(%rsp)
cmpq %rbx, %rdi
jne 0x139b69
xorl %eax, %eax
callq 0x1638ec
movq %rax, %r13
movq %r15, %rdi
movq %r12, %rsi
movq 0x10(%rsp), %rbx
movq %rbx, %rdx
movq 0x20(%rsp), %rbp
movq %rbp, %rcx
callq 0x126b6e
movq %rax, %r14
subq $0x8, %rsp
movq %r13, 0x10(%rsp)
movq %r13, %rdi
movq 0x70(%rsp), %r13
movq %r13, %rsi
movq %rax, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
movq %r12, %r9
pushq 0x38(%rsp)
pushq 0x50(%rsp)
pushq %rbp
pushq $0x0
pushq %rbx
callq 0x1392f9
addq $0x30, %rsp
movl $0x1, %ecx
movl $0x1, %r8d
movq %r14, %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x126fa5
movq 0x18(%rsp), %rdi
cmpq %rax, %rdi
jne 0x139b73
movq %r14, %rdi
callq 0x127c25
movq 0x8(%rsp), %rdi
callq 0x163927
movq %r13, %rdi
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1797c3
callq 0x3fb53
callq 0x3fb7b
callq 0x3fbf1
movq 0x18(%rsp), %rsi
callq 0x3fba3
movq %rax, %rsi
callq 0x3fbca