// File: /workspace/github_c_makefile_star2_O3/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, %r12
movq %rcx, %r15
movq %rdx, %r14
movq %rsi, %rbx
movq %rsi, %rdi
movl $0xff, %esi
callq 0x178a0
testq %rax, %rax
jne 0x13378c
movq %rbx, 0x10(%rsp)
movq %r15, 0x18(%rsp)
movq %r15, %rdi
movl $0xff, %esi
movq %r12, %rdx
callq 0x178a0
testq %rax, %rax
jne 0x133791
movq %r12, %rbx
movq %r14, 0x8(%rsp)
subq %r14, %rbx
leaq -0x1(%rbx), %r15
leaq 0x2(%rbx), %r13
xorl %r14d, %r14d
movl $0x1, %esi
movl $0x1, %ecx
xorl %edi, %edi
xorl %edx, %edx
callq 0x17137c
movq %rax, %rbp
movq %rax, %rdi
callq 0x1713df
movq %rbp, 0x60(%rsp)
movq %rbp, %rdi
callq 0x1713ef
testq %rbx, %rbx
cmovgq %r14, %r15
cmovleq %r14, %r13
cmovnsq %r14, %rbx
cmpq %r15, %rbx
jl 0x133796
testq %r13, %r13
js 0x133796
movq %r13, 0x20(%rsp)
subq %r15, %r13
leaq 0x8(,%r13,8), %rdi
leaq 0x24794a(%rip), %rsi    # 0x37ac1b
movl $0x15c, %edx            # imm = 0x15C
callq 0x104226
movq %rax, %rdi
movq %r15, %rsi
negq %rsi
movq $0x0, (%rax)
jae 0x133306
movq (%rdi), %rax
incq %rax
xorl %ecx, %ecx
leaq (%rax,%rcx), %rdx
movq %rdx, 0x8(%rdi,%rcx,8)
incq %rcx
cmpq %rcx, %rsi
jne 0x1332f5
testq %r12, %r12
movq 0x8(%rsp), %rax
movq %r12, 0x68(%rsp)
movq %r15, 0x40(%rsp)
je 0x1335bf
cmpq %rax, %rsi
sete %cl
leaq 0x1(%r12), %rax
cmpq $0x3, %rax
movl $0x2, %edx
cmovaeq %rax, %rdx
movq %rdx, 0x80(%rsp)
leaq 0x8(%rdi), %rax
movq %rax, 0x78(%rsp)
movq %rdi, %rax
addq $0x10, %rax
movq %rax, 0x70(%rsp)
movq $-0x1, %r8
movl $0x1, %eax
xorl %edx, %edx
movq %rsi, %r13
movq $-0x1, %r9
movq %rdi, 0x48(%rsp)
movq (%rdi), %rbx
cmpq 0x20(%rsp), %rax
jbe 0x133388
cmpq %r13, %rdx
je 0x133383
movq 0x8(%rdi), %r9
incq %rdx
jmp 0x13338b
movq %rbx, %r9
movq %rax, 0x28(%rsp)
xorl %r12d, %r12d
cmpq 0x8(%rsp), %r13
setb %r12b
leaq (%r12,%r13), %rsi
movq %rsi, %rax
subq %rdx, %rax
movq %rax, 0x90(%rsp)
movq $-0x1, %r14
cmovneq %r9, %r14
testb $0x1, %cl
cmovneq %r9, %r14
movq %r14, %r15
incq %r15
cmoveq %r8, %r15
movq %r15, (%rdi)
testq %rdx, %rdx
movq %rsi, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
je 0x133435
cmpq $-0x1, %rbx
je 0x133435
movq 0x10(%rsp), %rax
movzbl -0x1(%rax,%rdx), %edi
movl %ecx, (%rsp)
callq 0x17ae0
movl %eax, %ebp
movq 0x18(%rsp), %rax
movq 0x28(%rsp), %rcx
movzbl -0x1(%rax,%rcx), %edi
callq 0x17ae0
movq $-0x1, %r8
movq 0x50(%rsp), %rdx
movq 0x58(%rsp), %rsi
movq 0x48(%rsp), %rdi
xorl %ecx, %ecx
cmpl %eax, %ebp
setne %cl
addq %rcx, %rbx
movl (%rsp), %ecx
cmpq %r15, %rbx
jae 0x133435
movq %rbx, (%rdi)
leaq 0x1(%rdx), %rax
cmpq %rsi, %rax
jbe 0x133446
movq %r14, %r9
jmp 0x1335a4
movq 0x10(%rsp), %rax
addq %rdx, %rax
movq %rax, 0x98(%rsp)
movq 0x8(%rsp), %rax
subq %rdx, %rax
movq %rax, 0x88(%rsp)
movq 0x78(%rsp), %rax
leaq (%rax,%rdx,8), %rbx
addq %r12, %r13
negq %r13
leaq (%rdx,%r13), %rax
incq %rax
movq %rax, 0xa0(%rsp)
movl $0x1, %ebp
movq 0x70(%rsp), %r13
testb $0x1, %cl
movzbl %cl, %ecx
jne 0x1334cc
movq 0xa0(%rsp), %rax
addq %rbp, %rax
cmpq $0x1, %rax
jne 0x1334cc
cmpq 0x8(%rsp), %rsi
movl $0x1, %eax
cmovel %eax, %ecx
movq $-0x1, %r9
movq 0x90(%rsp), %r12
movq $-0x1, %r15
jmp 0x1334f6
testq %rdx, %rdx
movq %r13, %rax
cmoveq %rbx, %rax
movq (%rax), %r9
cmpq %rbp, 0x88(%rsp)
movl $0x1, %eax
cmovel %eax, %ecx
movq %r9, %r15
incq %r15
cmoveq %r8, %r15
movq %rbp, %r12
movl %ecx, (%rsp)
movq %r15, (%rdi,%r12,8)
cmpq $-0x1, %r14
je 0x13355b
movq 0x98(%rsp), %rax
movzbl -0x1(%rax,%rbp), %edi
movq %r9, 0x30(%rsp)
callq 0x17ae0
movl %eax, 0x3c(%rsp)
movq 0x18(%rsp), %rax
movq 0x28(%rsp), %rcx
movzbl -0x1(%rax,%rcx), %edi
callq 0x17ae0
movq 0x30(%rsp), %r9
movq $-0x1, %r8
movq 0x50(%rsp), %rdx
movq 0x58(%rsp), %rsi
movq 0x48(%rsp), %rdi
xorl %ecx, %ecx
cmpl %eax, 0x3c(%rsp)
setne %cl
addq %rcx, %r14
jmp 0x133562
movq $-0x1, %r14
cmpq %r15, %r14
ja 0x13356e
movq %r14, (%rdi,%r12,8)
movq %r14, %r15
movq -0x8(%rdi,%r12,8), %rax
incq %rax
cmoveq %r8, %rax
cmpq %r15, %rax
movl (%rsp), %ecx
ja 0x133586
movq %rax, (%rdi,%r12,8)
addq $0x8, %rbx
addq $0x8, %r13
leaq (%rdx,%rbp), %rax
incq %rax
incq %rbp
movq %r9, %r14
cmpq %rsi, %rax
jbe 0x13348e
movq 0x28(%rsp), %rax
incq %rax
movq %rsi, %r13
cmpq 0x80(%rsp), %rax
jne 0x133370
jmp 0x1335c1
xorl %edx, %edx
subq %rdx, %rsi
movq (%rdi,%rsi,8), %rax
movq %rax, (%rsp)
leaq 0x247648(%rip), %r14    # 0x37ac1b
movq %r14, %rsi
movl $0x1a0, %edx            # imm = 0x1A0
callq 0x1045eb
movq 0x8(%rsp), %r13
leaq 0x1(%r13), %rbx
leaq 0x8(,%r13,8), %r12
movq %r12, %rdi
movq %r14, %rsi
movl $0x82, %edx
callq 0x104226
movq %rax, %rbp
movq 0x68(%rsp), %r15
leaq 0x1(%r15), %rdi
imulq %r12, %rdi
movq %r14, %rsi
movl $0x82, %edx
callq 0x104226
movq %rax, (%rbp)
cmpq $0x2, %rbx
jb 0x133649
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 0x133639
movl $0x1, %esi
movl $0x1, %ecx
xorl %edi, %edi
xorl %edx, %edx
callq 0x17137c
movq %rax, %r12
movq %rax, %rdi
callq 0x1713df
movq %r12, %rdi
callq 0x1713ef
movq %rbp, %rdi
movq 0x10(%rsp), %rsi
xorl %edx, %edx
movq %r13, %rcx
movq %r15, %r14
movq 0x18(%rsp), %r8
xorl %r9d, %r9d
pushq %r12
pushq 0x28(%rsp)
pushq 0x50(%rsp)
pushq %r15
callq 0x132b94
addq $0x20, %rsp
movq (%rbp,%r13,8), %rax
movq (%rax,%r15,8), %rbx
movq (%rbp), %rdi
leaq 0x24756b(%rip), %r15    # 0x37ac1b
movq %r15, %rsi
movl $0x8b, %edx
callq 0x1045eb
movq %rbp, %rdi
movq %r15, %rsi
movl $0x8b, %edx
callq 0x1045eb
movq %r12, %rdi
callq 0x1713ff
cmpq %rbx, (%rsp)
jne 0x13379b
xorl %eax, %eax
callq 0x15bb80
movq %rax, %rbx
movq 0x10(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
movq 0x18(%rsp), %r15
movq %r15, %rdx
movq %r14, %rcx
callq 0x120d76
movq %rax, %r12
subq $0x8, %rsp
movq %rbx, 0x38(%rsp)
movq %rbx, %rdi
movq 0x68(%rsp), %rbx
movq %rbx, %rsi
movq %rax, %rdx
movq %rbp, %rcx
xorl %r8d, %r8d
movq %r13, %r9
pushq 0x28(%rsp)
pushq 0x50(%rsp)
pushq %r14
pushq $0x0
pushq %r15
callq 0x132f46
addq $0x30, %rsp
movl $0x1, %ecx
movl $0x1, %r8d
movq %r12, %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x1211ad
movq (%rsp), %rdi
cmpq %rax, %rdi
jne 0x1337a7
movq %r12, %rdi
callq 0x121e3c
movq 0x30(%rsp), %rdi
callq 0x15bbbb
movq %rbx, %rdi
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1713ff
callq 0x3f06a
callq 0x3f092
callq 0x3f108
movq (%rsp), %rdi
movq %rbx, %rsi
callq 0x3f0ba
movq %rax, %rsi
callq 0x3f0e1