// File: /workspace/github_c_makefile_star2_O3/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, %r15
movq %rcx, %rbx
movq %rdx, %r13
movq %rsi, %r14
movq %rsi, %rdi
movl $0xff, %esi
callq 0x178a0
testq %rax, %rax
jne 0x135687
movq %rbx, %rdi
movl $0xff, %esi
movq %r15, %rdx
callq 0x178a0
testq %rax, %rax
jne 0x13568c
movq %r13, %rax
negq %rax
movq %rax, %rbp
movq %rax, 0x18(%rsp)
movl $0x1, %esi
movl $0x2, %edx
movl $0x1, %ecx
xorl %edi, %edi
callq 0x17137c
movq %rax, %r12
movq %rax, %rdi
callq 0x1713df
movq %r12, %rdi
callq 0x1713ef
subq $0x8, %rsp
movq %r14, %rdi
xorl %esi, %esi
movq %r13, %rdx
movq %rbx, %rcx
xorl %r8d, %r8d
movq %r15, %r9
pushq %r12
pushq %r15
pushq %rbp
callq 0x134cc5
addq $0x20, %rsp
movq %rax, 0x20(%rsp)
movq %r14, %rdi
movq %r13, %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x120d76
movq %rbx, 0x28(%rsp)
movq %rax, %rbp
xorl %eax, %eax
callq 0x15bb80
movq %rax, %rbx
subq $0x8, %rsp
movq %rax, %rdi
movq %r12, 0x18(%rsp)
movq %r12, %rsi
movq %rbp, %rdx
movq %r14, %r12
movq %r14, %rcx
movq 0x20(%rsp), %r14
xorl %r8d, %r8d
movq %r13, %r9
pushq %r15
pushq %r14
pushq %r15
pushq $0x0
pushq 0x50(%rsp)
callq 0x134f31
addq $0x30, %rsp
movq %rbx, %rdi
callq 0x15bbbb
movl $0x1, %ecx
movl $0x2, %r8d
movl $0x1, %r9d
movq %rbp, 0x38(%rsp)
movq %rbp, %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x1213ca
cmpq %rax, 0x20(%rsp)
jne 0x135691
movq %r15, %rcx
subq %r13, %rcx
movq %rcx, %rdx
sarq $0x3f, %rdx
andq %rcx, %rdx
xorl %eax, %eax
testq %rcx, %rcx
cmovgq %rcx, %rax
cmpq %r14, %rdx
jl 0x13569e
cmpq %r15, %rax
jg 0x13569e
movq %r12, 0x60(%rsp)
movq 0x10(%rsp), %rbx
testq %rbx, %rbx
je 0x1356a3
movabsq $0x7fffffffffffffff, %r12 # imm = 0x7FFFFFFFFFFFFFFF
movq %rbx, %rdi
callq 0x171427
movq %rax, %r14
movq %rbx, %rdi
callq 0x171437
movq %rax, %rbx
leaq (%r15,%r13), %rax
leaq (%rax,%rax,2), %rdi
shlq $0x4, %rdi
addq $0x30, %rdi
leaq 0x245b3e(%rip), %rsi    # 0x37af0a
movl $0x1d6, %edx            # imm = 0x1D6
callq 0x104226
movq %rbx, %r8
movq $0x0, (%rax)
movq %r14, 0x8(%rax)
movq %rax, 0x8(%rsp)
movq %r14, 0x10(%rax)
testq %r13, %r13
je 0x135421
movq 0x8(%rsp), %rax
addq $0x40, %rax
movq %r13, %rcx
movq %r12, -0x10(%rax)
movq -0x38(%rax), %rdx
leaq (%rdx,%r8), %rsi
cmpq %r12, %rdx
cmoveq %r12, %rsi
movq %rsi, -0x8(%rax)
movq %r12, (%rax)
addq $0x30, %rax
decq %rcx
jne 0x1353fe
testq %r15, %r15
je 0x13561b
addq %r8, %r14
movq 0x8(%rsp), %rax
addq $0x40, %rax
movq %rax, 0x40(%rsp)
movl $0x1, %r10d
movq %r13, %r9
movq %r15, 0x50(%rsp)
movq %r13, 0x48(%rsp)
movq %r14, 0x58(%rsp)
movq 0x8(%rsp), %rsi
movq 0x10(%rsi), %rbx
movq (%rsi), %rcx
movq 0x8(%rsi), %rbp
leaq (%rcx,%r14), %rax
movq %rcx, 0x30(%rsp)
cmpq %r12, %rcx
cmoveq %r12, %rax
leaq (%r14,%rbp), %rcx
cmpq %r12, %rbp
cmoveq %r12, %rcx
leaq (%rbx,%r8), %rdx
cmpq %r12, %rbx
cmoveq %r12, %rdx
cmpq %rcx, %rax
cmovlq %rax, %rcx
cmpq %rdx, %rcx
cmovgeq %rdx, %rcx
cmpq %r13, %r9
adcq $0x0, %r9
movq %rcx, 0x10(%rsi)
movq %r12, (%rsi)
movq %r12, 0x8(%rsi)
movq 0x28(%rsp), %r11
movq 0x10(%rsp), %rdi
je 0x135603
movl $0x1, %edx
movq 0x40(%rsp), %r15
movq %r10, 0x68(%rsp)
movq %rdx, 0x18(%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 %r12, %rcx
cmoveq %r12, %rax
leaq (%rdx,%r14), %rcx
cmpq %r12, %rdx
cmoveq %r12, %rcx
leaq (%rsi,%r8), %rdx
cmpq %r12, %rsi
cmoveq %r12, %rdx
cmpq %rcx, %rax
cmovlq %rax, %rcx
cmpq %rdx, %rcx
cmovgeq %rdx, %rcx
movq %rcx, (%r15)
movq 0x60(%rsp), %rax
movq 0x18(%rsp), %rcx
movzbl -0x1(%rax,%rcx), %esi
movzbl -0x1(%r11,%r10), %edx
movq %r8, %r13
movq %r9, %r14
movq %r11, %r12
callq 0x171466
movq %r12, %r11
movq 0x68(%rsp), %r10
movq %r14, %r9
movq %r13, %r8
movq 0x10(%rsp), %rdi
movq 0x58(%rsp), %r14
movabsq $0x7fffffffffffffff, %r12 # imm = 0x7FFFFFFFFFFFFFFF
movq 0x30(%rsp), %rdx
leaq (%rax,%rdx), %rcx
cmpq %r12, %rdx
cmoveq %r12, %rcx
leaq (%rax,%rbp), %rdx
cmpq %r12, %rbp
cmoveq %r12, %rdx
addq %rbx, %rax
cmpq %r12, %rbx
cmoveq %r12, %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 %r12, %rax
cmoveq %r12, %rdx
leaq (%rcx,%r13), %rax
cmpq %r12, %rcx
cmoveq %r12, %rax
movq -0x30(%r15), %rcx
leaq (%rcx,%r14), %rsi
cmpq %r12, %rcx
cmoveq %r12, %rsi
cmpq %rax, %rdx
cmovlq %rdx, %rax
cmpq %rsi, %rax
cmovgeq %rsi, %rax
movq 0x18(%rsp), %rdx
movq %rax, -0x8(%r15)
incq %rdx
addq $0x30, %r15
movq 0x80(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x78(%rsp), %rbp
movq 0x70(%rsp), %rbx
cmpq %r9, %rdx
jbe 0x1354c8
incq %r10
movq 0x50(%rsp), %r15
cmpq %r15, %r10
movq 0x48(%rsp), %r13
jbe 0x135453
jmp 0x13561e
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 0x2458bc(%rip), %rsi    # 0x37af0a
movl $0x245, %edx            # imm = 0x245
callq 0x1045eb
movq 0x20(%rsp), %rsi
cmpq %rsi, %rbx
jne 0x1356a8
movq 0x10(%rsp), %rdi
callq 0x1713ff
movq 0x38(%rsp), %rdi
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x121e3c
callq 0x3f4cd
callq 0x3f4f5
movq 0x20(%rsp), %rdi
movq %rax, %rsi
callq 0x3f51d
callq 0x3f5a4
callq 0x3f56b
movq %rbx, %rdi
callq 0x3f544