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

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

  scorehandler = gt_scorehandler_new(matchcost,  mismatchcost, 0, gapcost);
  gt_scorehandler_plain(scorehandler);
  gt_scorehandler_downcase(scorehandler);
  spacemanager = gt_linspace_management_new();
  align = gt_alignment_new_with_seqs(useq, ulen, vseq, vlen);
  edist1 = gt_calc_linearalign(spacemanager, scorehandler, align,
                               useq, 0, ulen,
                               vseq, 0, vlen);
  edist2 = gt_squarealign_global_distance_only(useq, 0, ulen, vseq, 0, vlen,
                                               scorehandler);

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

  edist3 = gt_alignment_eval_with_score(align, true, matchcost,
                                        mismatchcost, gapcost);

  if (edist2 != edist3)
  {
    fprintf(stderr,"gt_squarealign_global_distance_only = "GT_WU" != "GT_WU
            " = gt_alignment_eval_with_score\n", edist2,edist3);
    exit(GT_EXIT_PROGRAMMING_ERROR);
  }

  edist4 = gt_calc_linearedist(downcase,useq, ulen, vseq, vlen);
  if (edist3 != edist4)
  {
    fprintf(stderr,"gt_alignment_eval_with_score = "GT_WU" != "GT_WU
            " = gt_calc_linearedist\n", edist3, edist4);
    exit(GT_EXIT_PROGRAMMING_ERROR);
  }
  gt_linspace_management_delete(spacemanager);
  gt_scorehandler_delete(scorehandler);
  gt_alignment_delete(align);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %r12
movq %rcx, %r14
movq %rdx, %rbp
movq %rsi, %rdi
movq %rsi, (%rsp)
movl $0xff, %esi
callq 0x178a0
testq %rax, %rax
jne 0x16187e
movq %r14, %rdi
movl $0xff, %esi
movq %r12, %rdx
callq 0x178a0
testq %rax, %rax
jne 0x161883
movl $0x1, %esi
movl $0x1, %ecx
xorl %edi, %edi
xorl %edx, %edx
callq 0x179740
movq %rax, %r13
movq %rax, %rdi
callq 0x1797a3
movq %r13, %rdi
callq 0x1797b3
xorl %eax, %eax
callq 0x1638ec
movq %rax, %r15
movq (%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0x126b6e
subq $0x8, %rsp
movq %r15, 0x38(%rsp)
movq %r15, %rdi
movq %rax, %r15
movq %r13, %rsi
movq %rax, %rdx
movq %rbx, %rcx
xorl %r8d, %r8d
movq %rbp, %r9
pushq %r12
pushq $0x0
pushq %r14
callq 0x160748
addq $0x20, %rsp
movq %rax, 0x8(%rsp)
subq $0x8, %rsp
movq %rbx, %rdi
xorl %esi, %esi
movq %rbp, 0x20(%rsp)
movq %rbp, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
movq %r12, 0x18(%rsp)
movq %r12, %r9
movq %r13, 0x40(%rsp)
pushq %r13
callq 0x181f26
addq $0x10, %rsp
movq %rax, %r12
movq 0x8(%rsp), %rdi
cmpq %rax, %rdi
jne 0x161888
movq %r14, %rbx
movl $0x1, %ecx
movl $0x1, %r8d
movq %r15, %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x126fa5
movq %rax, 0x20(%rsp)
cmpq %rax, %r12
movq %r15, 0x28(%rsp)
jne 0x161890
leaq 0x22dbf3(%rip), %rdi    # 0x38f249
leaq 0x22dbfd(%rip), %rsi    # 0x38f25a
xorl %r14d, %r14d
movq 0x18(%rsp), %rbp
movl %ebp, %edx
movl %ebp, %ecx
movq (%rsp), %r8
movq 0x10(%rsp), %r12
movl %r12d, %r9d
xorl %eax, %eax
movq %rbx, %r15
pushq %rbx
pushq %r12
callq 0x17070
addq $0x10, %rsp
cmpq %r12, %rbp
movq %r12, %rbx
cmovbq %rbp, %rbx
leaq 0x8(,%rbx,8), %rdi
leaq 0x22d885(%rip), %rsi    # 0x38ef24
movl $0x209, %edx            # imm = 0x209
callq 0x1092b2
movq %rax, %r12
leaq 0x1(%rbx), %r13
cmpq $0x1, %r13
movq %rbx, 0x8(%rsp)
adcq $0x1, %rbx
leaq 0x1(%rbx), %rax
andq $-0x2, %rax
decq %rbx
movq %rbx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqa 0x200396(%rip), %xmm1   # 0x361a70
movdqa 0x20039e(%rip), %xmm2   # 0x361a80
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movdqa 0x20039e(%rip), %xmm4   # 0x361a90
movdqa %xmm1, %xmm5
pxor %xmm2, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
movd %xmm5, %ecx
notl %ecx
testb $0x1, %cl
je 0x161727
movq %r14, (%r12,%r14,8)
pxor %xmm3, %xmm5
pextrw $0x4, %xmm5, %ecx
testb $0x1, %cl
je 0x16173e
leaq 0x1(%r14), %rcx
movq %rcx, 0x8(%r12,%r14,8)
addq $0x2, %r14
paddq %xmm4, %xmm1
cmpq %r14, %rax
jne 0x1616f2
movq 0x10(%rsp), %rax
cmpq %rax, %rbp
movq %r15, %rcx
cmovaq (%rsp), %rcx
movq %rcx, 0x40(%rsp)
movq %rax, %rcx
cmovaq %rbp, %rcx
testq %rcx, %rcx
je 0x16182b
movq %rcx, %rdx
cmpq %rax, %rbp
movq (%rsp), %rax
cmovaq %r15, %rax
movq %rax, (%rsp)
cmpq $0x3, %r13
movl $0x2, %eax
cmovbq %rax, %r13
incq %rdx
cmpq $0x3, %rdx
cmovbq %rax, %rdx
movq %rdx, 0x18(%rsp)
movq (%r12), %r14
decq %r13
movl $0x1, %ebx
movq 0x40(%rsp), %rax
movzbl -0x1(%rax,%rbx), %edi
callq 0x17ae0
movq %rbx, 0x10(%rsp)
movq %rbx, (%r12)
cmpq $0x0, 0x8(%rsp)
je 0x161816
movl %eax, %ebp
xorl %ebx, %ebx
movq %r14, %r15
movq (%rsp), %rax
movzbl (%rax,%rbx), %edi
callq 0x17ae0
movq (%r12,%rbx,8), %rcx
movq 0x8(%r12,%rbx,8), %r14
xorl %edx, %edx
xorb %bpl, %al
setne %dl
addq %r15, %rdx
incq %rcx
cmpq %rdx, %rcx
cmovaeq %rdx, %rcx
leaq 0x1(%r14), %rax
cmpq %rcx, %rax
jb 0x161809
movq %rcx, %rax
movq %rax, 0x8(%r12,%rbx,8)
incq %rbx
cmpq %rbx, %r13
jne 0x1617cf
movq 0x10(%rsp), %rax
movq %rax, %r14
incq %rax
movq %rax, %rbx
cmpq 0x18(%rsp), %rax
jne 0x1617ab
movq 0x8(%rsp), %rax
movq (%r12,%rax,8), %rbx
leaq 0x22d6e9(%rip), %rsi    # 0x38ef24
movq %r12, %rdi
movl $0x20e, %edx            # imm = 0x20E
callq 0x109670
movq 0x20(%rsp), %rdi
cmpq %rbx, %rdi
jne 0x16189d
movq 0x30(%rsp), %rdi
callq 0x163927
movq 0x38(%rsp), %rdi
callq 0x1797c3
movq 0x28(%rsp), %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x127c25
callq 0x4b782
callq 0x4b7aa
movq %r12, %rsi
callq 0x4b7d2
movq %r12, %rdi
movq 0x20(%rsp), %rsi
callq 0x4b7f9
movq %rbx, %rsi
callq 0x4b820