// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/diagonalbandalign_affinegapcost.c
// Function: gt_diagonalbandalign_affinegapcost_check
void gt_diagonalbandalign_affinegapcost_check(GT_UNUSED bool forward,
                                              const GtUchar *useq, GtUword ulen,
                                              const GtUchar *vseq, GtUword vlen)
{
  GtUword affine_cost1, affine_cost2, affine_cost3,
          matchcost = 0, mismatchcost = 1,
          gap_opening = 2, gap_extension = 1;
  GtWord left_dist, right_dist;
  GtAlignment *align;
  GtScoreHandler *scorehandler;
  GtLinspaceManagement *spacemanager;

  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);
  }

  left_dist = -ulen;
  right_dist = vlen;

  scorehandler = gt_scorehandler_new(matchcost, mismatchcost,
                                     gap_opening, gap_extension);
  gt_scorehandler_plain(scorehandler);
  gt_scorehandler_downcase(scorehandler);
  affine_cost1 = gt_diagonalbandalign_affinegapcost_square_space_distance_only(
                                           useq, 0, ulen, vseq, 0, vlen,
                                           left_dist, right_dist, scorehandler);

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

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

  gt_linspace_management_delete(spacemanager);
  affine_cost2 = gt_alignment_eval_with_affine_score(align, true, matchcost,
                                                     mismatchcost,
                                                     gap_opening,
                                                     gap_extension);
  if (affine_cost1 != affine_cost2)
  {
    fprintf(stderr,"gt_diagonalband_affinegapcost_square_space_distance_only = "
            GT_WU" != "GT_WU" = gt_alignment_eval_generic_with_affine_score\n",
            affine_cost1, affine_cost2);

    exit(GT_EXIT_PROGRAMMING_ERROR);
  }

  affine_cost3 = diagonalband_linear_affine(useq, 0, ulen, vseq, 0, vlen,
                                           left_dist, right_dist, scorehandler);
  if (affine_cost3 != affine_cost2)
  {
    fprintf(stderr,"diagonalband_linear_affine = "GT_WU
            " != "GT_WU" = gt_alignment_eval_generic_with_affine_score\n",
            affine_cost3, affine_cost2);

    exit(GT_EXIT_PROGRAMMING_ERROR);
  }
  gt_scorehandler_delete(scorehandler);
  gt_alignment_delete(align);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %r8, %r12
movq %rcx, %r14
movq %rdx, %r13
movq %rsi, %rbx
movq %rsi, %rdi
movl $0xff, %esi
callq 0x178a0
testq %rax, %rax
jne 0x13ba72
movq %r14, %rdi
movl $0xff, %esi
movq %r12, %rdx
callq 0x178a0
testq %rax, %rax
jne 0x13ba77
movq %r13, %rax
negq %rax
movq %rax, %r15
movq %rax, 0x18(%rsp)
movl $0x1, %esi
movl $0x2, %edx
movl $0x1, %ecx
xorl %edi, %edi
callq 0x179740
movq %rax, %rbp
movq %rax, %rdi
callq 0x1797a3
movq %rbp, %rdi
callq 0x1797b3
subq $0x8, %rsp
movq %rbx, %rdi
xorl %esi, %esi
movq %r13, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
movq %r12, %r9
pushq %rbp
pushq %r12
pushq %r15
callq 0x13b09a
addq $0x20, %rsp
movq %rax, 0x20(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0x126b6e
movq %rax, %r15
xorl %eax, %eax
callq 0x1638ec
movq %r14, %r10
movq %rax, %r14
subq $0x8, %rsp
movq %rax, %rdi
movq %rbp, 0x18(%rsp)
movq %rbp, %rsi
movq 0x20(%rsp), %rbp
movq %r15, %rdx
movq %rbx, 0x68(%rsp)
movq %rbx, %rcx
xorl %r8d, %r8d
movq %r13, %r9
pushq %r12
pushq %rbp
pushq %r12
pushq $0x0
movq %r10, %rbx
pushq %r10
callq 0x13b306
addq $0x30, %rsp
movq %r14, %rdi
callq 0x163927
movl $0x1, %ecx
movl $0x2, %r8d
movl $0x1, %r9d
movq %r15, 0x30(%rsp)
movq %r15, %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x1271c2
movq %rax, %rsi
movq 0x20(%rsp), %rdi
cmpq %rax, %rdi
jne 0x13ba7c
movq %r12, %rcx
subq %r13, %rcx
movq %rcx, %rdx
sarq $0x3f, %rdx
andq %rcx, %rdx
xorl %eax, %eax
testq %rcx, %rcx
cmovgq %rcx, %rax
cmpq %rbp, %rdx
jl 0x13ba81
cmpq %r12, %rax
jg 0x13ba81
movq %rbx, 0x50(%rsp)
movq 0x10(%rsp), %rbx
testq %rbx, %rbx
je 0x13ba86
movq %rsi, 0x28(%rsp)
movabsq $0x7fffffffffffffff, %rbp # imm = 0x7FFFFFFFFFFFFFFF
movq %rbx, %rdi
callq 0x1797eb
movq %rax, %r14
movq %rbx, %rdi
callq 0x1797fb
movq %rax, %rbx
leaq (%r12,%r13), %rax
leaq (%rax,%rax,2), %rdi
shlq $0x4, %rdi
addq $0x30, %rdi
leaq 0x248ac7(%rip), %rsi    # 0x384273
movl $0x1d6, %edx            # imm = 0x1D6
callq 0x1092b2
movq %rbx, %r8
movq $0x0, (%rax)
movq %r14, 0x8(%rax)
movq %rax, 0x8(%rsp)
movq %r14, 0x10(%rax)
testq %r13, %r13
je 0x13b812
leaq 0x1(%r13), %rcx
cmpq $0x3, %rcx
movl $0x2, %eax
cmovaeq %rcx, %rax
decq %rax
movq 0x8(%rsp), %rcx
addq $0x40, %rcx
movq %rbp, -0x10(%rcx)
movq -0x38(%rcx), %rdx
leaq (%rdx,%r8), %rsi
cmpq %rbp, %rdx
cmoveq %rbp, %rsi
movq %rsi, -0x8(%rcx)
movq %rbp, (%rcx)
addq $0x30, %rcx
decq %rax
jne 0x13b7ef
testq %r12, %r12
je 0x13ba06
addq %r8, %r14
movq 0x8(%rsp), %rax
addq $0x40, %rax
movq %rax, 0x38(%rsp)
movl $0x1, %r10d
movq %r13, %r9
movq %r12, 0x48(%rsp)
movq %r13, 0x40(%rsp)
movq %r14, 0x58(%rsp)
movq 0x8(%rsp), %rsi
movq 0x10(%rsi), %rbx
movq (%rsi), %rcx
movq 0x8(%rsi), %r12
leaq (%rcx,%r14), %rax
movq %rcx, 0x18(%rsp)
cmpq %rbp, %rcx
cmoveq %rbp, %rax
leaq (%r12,%r14), %rcx
cmpq %rbp, %r12
cmoveq %rbp, %rcx
leaq (%rbx,%r8), %rdx
cmpq %rbp, %rbx
cmoveq %rbp, %rdx
cmpq %rcx, %rax
cmovlq %rax, %rcx
cmpq %rdx, %rcx
cmovgeq %rdx, %rcx
cmpq %r13, %r9
adcq $0x0, %r9
movq %rcx, 0x10(%rsi)
movq %rbp, (%rsi)
movq %rbp, 0x8(%rsi)
movq 0x50(%rsp), %r13
movq 0x10(%rsp), %rdi
je 0x13b9ee
movl $0x1, %edx
movq 0x38(%rsp), %r15
movq %r10, 0x68(%rsp)
movq %rdx, 0x20(%rsp)
movq -0x10(%r15), %rcx
movq %rcx, 0x80(%rsp)
movq -0x8(%r15), %rdx
movq %rdx, 0x78(%rsp)
movq (%r15), %rsi
movq %rsi, 0x70(%rsp)
leaq (%rcx,%r14), %rax
cmpq %rbp, %rcx
cmoveq %rbp, %rax
leaq (%rdx,%r14), %rcx
cmpq %rbp, %rdx
cmoveq %rbp, %rcx
leaq (%rsi,%r8), %rdx
cmpq %rbp, %rsi
cmoveq %rbp, %rdx
cmpq %rcx, %rax
cmovlq %rax, %rcx
cmpq %rdx, %rcx
cmovgeq %rdx, %rcx
movq %rcx, (%r15)
movq 0x60(%rsp), %rax
movq 0x20(%rsp), %rcx
movzbl -0x1(%rax,%rcx), %esi
movzbl -0x1(%r13,%r10), %edx
movq %r8, %rbp
movq %r9, %r14
callq 0x17982a
movq 0x68(%rsp), %r10
movq %r14, %r9
movq %rbp, %r8
movq 0x10(%rsp), %rdi
movq 0x58(%rsp), %r14
movabsq $0x7fffffffffffffff, %rbp # imm = 0x7FFFFFFFFFFFFFFF
movq 0x18(%rsp), %rdx
leaq (%rax,%rdx), %rcx
cmpq %rbp, %rdx
cmoveq %rbp, %rcx
leaq (%rax,%r12), %rdx
cmpq %rbp, %r12
cmoveq %rbp, %rdx
addq %rbx, %rax
cmpq %rbp, %rbx
cmoveq %rbp, %rax
cmpq %rdx, %rcx
cmovlq %rcx, %rdx
cmpq %rax, %rdx
cmovgeq %rax, %rdx
movq %rdx, -0x10(%r15)
movq -0x40(%r15), %rax
movq -0x38(%r15), %rcx
leaq (%rax,%r14), %rdx
cmpq %rbp, %rax
cmoveq %rbp, %rdx
leaq (%rcx,%r8), %rax
cmpq %rbp, %rcx
cmoveq %rbp, %rax
movq -0x30(%r15), %rcx
leaq (%rcx,%r14), %rsi
cmpq %rbp, %rcx
cmoveq %rbp, %rsi
cmpq %rax, %rdx
cmovlq %rdx, %rax
cmpq %rsi, %rax
cmovgeq %rsi, %rax
movq 0x20(%rsp), %rdx
movq %rax, -0x8(%r15)
incq %rdx
addq $0x30, %r15
movq 0x80(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x78(%rsp), %r12
movq 0x70(%rsp), %rbx
cmpq %r9, %rdx
jbe 0x13b8b9
incq %r10
movq 0x48(%rsp), %r12
cmpq %r12, %r10
movq 0x40(%rsp), %r13
jbe 0x13b844
jmp 0x13ba09
movq %r13, %r9
leaq (%r9,%r9,2), %rax
shlq $0x4, %rax
movq 0x8(%rsp), %rdi
movq (%rdi,%rax), %rcx
movq 0x8(%rdi,%rax), %rbx
cmpq %rbx, %rcx
cmovlq %rcx, %rbx
movq 0x10(%rdi,%rax), %rax
cmpq %rax, %rbx
cmovgeq %rax, %rbx
leaq 0x24883a(%rip), %rsi    # 0x384273
movl $0x245, %edx            # imm = 0x245
callq 0x109670
movq 0x28(%rsp), %rsi
cmpq %rsi, %rbx
jne 0x13ba8b
movq 0x10(%rsp), %rdi
callq 0x1797c3
movq 0x30(%rsp), %rdi
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x127c25
callq 0x3ffef
callq 0x40017
callq 0x4003f
callq 0x400c6
callq 0x4008d
movq %rbx, %rdi
callq 0x40066