// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/extended/linearalign.c
// Function: gt_calc_linearalign
GtUword gt_calc_linearalign(GtLinspaceManagement *spacemanager,
                            const GtScoreHandler *scorehandler,
                            GtAlignment *align,
                            const GtUchar *useq,
                            GtUword ustart,
                            GtUword ulen,
                            const GtUchar *vseq,
                            GtUword vstart,
                            GtUword vlen)
{
  GtUword distance, gapcost, *Ctab, *EDtabcolumn, *Rtabcolumn, threadcount = 1;

  gt_assert(scorehandler);
  gt_linspace_management_set_ulen(spacemanager,ulen);
  gapcost = gt_scorehandler_get_gapscore(scorehandler);

  if (ulen == 0UL)
  {
    return gt_reconstructalignment_trivial_insertion(align, vlen, gapcost);
  }
  else if (vlen == 0UL)
  {
    return gt_reconstructalignment_trivial_deletion(align, ulen, gapcost);
  }
  else if (vlen == 1UL)
  {
    gt_linspace_management_check(spacemanager, (ulen+1)*(vlen+1)-1, ulen,
                                sizeof (*EDtabcolumn), sizeof (EDtabcolumn), 0);
    return gt_squarealign_calculate_generic(spacemanager, align,
                                            useq, ustart, ulen,
                                            vseq, vstart, vlen, scorehandler);
  }
  else if (gt_linspace_management_checksquare(spacemanager, ulen, vlen,
                                              sizeof (*EDtabcolumn),
                                              sizeof (*Rtabcolumn)))
  { /* call 2dim */
    return gt_squarealign_calculate_generic(spacemanager, align,
                                            useq, ustart, ulen,
                                            vseq, vstart, vlen, scorehandler);
  }

#ifdef GT_THREADS_ENABLED
  gt_linspace_management_check(spacemanager, ulen + GT_DIV2(vlen), vlen,
                               sizeof (*EDtabcolumn), sizeof (*Rtabcolumn),
                               sizeof (*Ctab));
#else
  gt_linspace_management_check(spacemanager, ulen, vlen, sizeof (*EDtabcolumn),
                               sizeof (*Rtabcolumn), sizeof (*Ctab));
#endif
  Ctab = gt_linspace_management_get_crosspointTabspace(spacemanager);

  Ctab[vlen] = ulen;
  distance = evaluatelinearcrosspoints(spacemanager, scorehandler,
                                       useq, ustart, ulen,
                                       vseq, vstart, vlen,
                                       Ctab, 0, 0, &threadcount);

  determineCtab0(Ctab, scorehandler, vseq[vstart], useq, ustart);
  gt_reconstructalignment_from_Ctab(align, Ctab, useq, ustart, vseq, vstart,
                                    vlen, scorehandler);

  return distance;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, 0x10(%rsp)
movq %rdx, 0x18(%rsp)
movq 0x90(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x88(%rsp), %rbx
movq 0x80(%rsp), %r13
movq $0x1, 0x40(%rsp)
testq %rsi, %rsi
je 0x158c49
movq %r9, %r15
movq %r8, %rbp
movq %rsi, %r14
movq %rdi, %r12
movq %r9, %rsi
callq 0x15be18
movq %r14, %rdi
callq 0x171437
testq %r15, %r15
je 0x158a43
movq %rbx, 0x8(%rsp)
movq 0x20(%rsp), %rbx
cmpq $0x1, %rbx
je 0x158a63
testq %rbx, %rbx
jne 0x158aa4
movq 0x18(%rsp), %rdi
movq %r15, %rsi
movq %rax, %rdx
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x16cce8
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq %rax, %rdx
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x16cd21
leaq 0x1(,%r15,2), %rsi
movl $0x8, %ecx
movl $0x8, %r8d
movq %r12, %rdi
movq %r15, %rdx
xorl %r9d, %r9d
callq 0x15bc3e
subq $0x8, %rsp
movq %r12, %rdi
movq 0x20(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %rbp, %rcx
movq %r15, %r8
movq %r13, %r9
pushq %r14
pushq $0x1
jmp 0x158ade
movl $0x8, %ecx
movl $0x8, %r8d
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x15bd8d
testb %al, %al
je 0x158af0
subq $0x8, %rsp
movq %r12, %rdi
movq 0x20(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %rbp, %rcx
movq %r15, %r8
movq %r13, %r9
pushq %r14
pushq %rbx
pushq 0x20(%rsp)
callq 0x179784
addq $0x68, %rsp
jmp 0x158c3e
movq %rbx, %rsi
shrq %rsi
addq %r15, %rsi
movl $0x8, %ecx
movl $0x8, %r8d
movl $0x8, %r9d
movq %r12, %rdi
movq %rbx, %rdx
callq 0x15bc3e
movq %r12, %rdi
callq 0x15be41
movq %r13, %r9
movq %rax, %r13
movq %r15, (%rax,%rbx,8)
subq $0x30, %rsp
leaq 0x70(%rsp), %rax
movq %rax, 0x28(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rsp)
movq %r13, 0x10(%rsp)
movq %rbx, 0x8(%rsp)
movq 0x38(%rsp), %rbx
movq %rbx, (%rsp)
movq %r12, %rdi
movq %r14, %rsi
movq 0x40(%rsp), %r12
movq %r12, %rdx
movq %rbp, %rcx
movq %r15, %r8
movq %r9, 0x60(%rsp)
callq 0x158c4e
addq $0x30, %rsp
movq %rax, 0x38(%rsp)
cmpq $0x0, 0x8(%r13)
je 0x158bf8
movq %rbx, %rax
movq %rbp, 0x28(%rsp)
leaq (%r12,%rbp), %rbx
movq $-0x1, %rbp
xorl %r15d, %r15d
movq 0x30(%rsp), %rcx
movzbl (%rcx,%rax), %r12d
movzbl (%rbx,%r15), %edx
movq %r14, %rdi
movl %r12d, %esi
callq 0x171466
testq %rax, %rax
je 0x158bfd
cmpq %rbp, %rax
ja 0x158bbf
movq %r15, (%r13)
movq %rax, %rbp
incq %r15
cmpq 0x8(%r13), %r15
jb 0x158b9e
movq %r14, %rdi
callq 0x171437
addq %rax, %rax
cmpq %rax, %rbp
movq 0x8(%rsp), %rbx
movq 0x28(%rsp), %rbp
movq 0x10(%rsp), %r12
jbe 0x158c10
movq 0x8(%r13), %rax
xorl %r15d, %r15d
subq $0x1, %rax
cmovaeq %rax, %r15
jmp 0x158c0c
xorl %r15d, %r15d
jmp 0x158c0c
movq 0x8(%rsp), %rbx
movq 0x28(%rsp), %rbp
movq 0x10(%rsp), %r12
movq %r15, (%r13)
movq 0x18(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %rbp, %rcx
movq 0x30(%rsp), %r8
movq %rbx, %r9
pushq %r14
pushq 0x28(%rsp)
callq 0x16d0e4
addq $0x10, %rsp
movq 0x38(%rsp), %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x4a7a7