// File: /workspace/github_c_makefile_star2_O2/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), %r12
movq $0x1, 0x40(%rsp)
testq %rsi, %rsi
je 0xf66d5
movq %r9, %r15
movq %r8, %rbp
movq %rsi, %r14
movq %rdi, %r13
movq %r9, %rsi
callq 0xf9932
movq %r14, %rdi
callq 0x114a6a
testq %r15, %r15
je 0xf64db
movq %rbx, 0x8(%rsp)
movq 0x20(%rsp), %rbx
cmpq $0x1, %rbx
je 0xf64fb
testq %rbx, %rbx
jne 0xf6537
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 0x10ecbc
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 0x10ecf3
leaq 0x1(,%r15,2), %rsi
pushq $0x8
popq %rcx
movq %r13, %rdi
movq %r15, %rdx
movq %rcx, %r8
xorl %r9d, %r9d
callq 0xf9704
subq $0x8, %rsp
movq %r13, %rdi
movq 0x20(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %rbp, %rcx
movq %r15, %r8
movq %r12, %r9
pushq %r14
pushq $0x1
jmp 0xf656c
pushq $0x8
popq %rcx
movq %r13, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %rcx, %r8
callq 0xf9879
testb %al, %al
je 0xf657e
subq $0x8, %rsp
movq %r13, %rdi
movq 0x20(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %rbp, %rcx
movq %r15, %r8
movq %r12, %r9
pushq %r14
pushq %rbx
pushq 0x20(%rsp)
callq 0x11eaa4
addq $0x68, %rsp
jmp 0xf66ca
movq %rbx, %rsi
shrq %rsi
addq %r15, %rsi
pushq $0x8
popq %rcx
movq %r13, %rdi
movq %rbx, %rdx
movq %rcx, %r8
movq %rcx, %r9
callq 0xf9704
movq %r13, %rdi
callq 0xf998e
movq %r12, %r9
movq %rax, %r12
movq %r15, (%rax,%rbx,8)
subq $0x30, %rsp
leaq 0x70(%rsp), %rax
movq %rax, 0x28(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rsp)
movq %r12, 0x10(%rsp)
movq %rbx, 0x8(%rsp)
movq 0x38(%rsp), %rbx
movq %rbx, (%rsp)
movq %r13, %rdi
movq %r14, %rsi
movq 0x40(%rsp), %r13
movq %r13, %rdx
movq %rbp, %rcx
movq %r15, %r8
movq %r9, 0x60(%rsp)
callq 0xf670d
addq $0x30, %rsp
movq %rax, 0x38(%rsp)
movq 0x8(%r12), %rax
testq %rax, %rax
je 0xf6655
movq %rbx, %rcx
movq %rbp, 0x28(%rsp)
movq %r13, %rbx
addq %rbp, %rbx
pushq $-0x1
popq %rbp
xorl %r15d, %r15d
movq 0x30(%rsp), %rdx
movzbl (%rdx,%rcx), %r13d
cmpq %rax, %r15
jae 0xf665a
movzbl (%rbx,%r15), %edx
movq %r14, %rdi
movl %r13d, %esi
callq 0x114b2c
testq %rax, %rax
je 0xf668b
cmpq %rbp, %rax
ja 0xf664b
movq %r15, (%r12)
movq %rax, %rbp
incq %r15
movq 0x8(%r12), %rax
jmp 0xf6625
xorl %r15d, %r15d
jmp 0xf669a
movq %r14, %rdi
callq 0x114a6a
addq %rax, %rax
cmpq %rax, %rbp
movq 0x8(%rsp), %rbx
movq 0x28(%rsp), %rbp
movq 0x10(%rsp), %r13
jbe 0xf669e
movq 0x8(%r12), %rax
xorl %r15d, %r15d
subq $0x1, %rax
cmovaeq %rax, %r15
jmp 0xf669a
movq 0x8(%rsp), %rbx
movq 0x28(%rsp), %rbp
movq 0x10(%rsp), %r13
movq %r15, (%r12)
movq 0x18(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbp, %rcx
movq 0x30(%rsp), %r8
movq %rbx, %r9
pushq %r14
pushq 0x28(%rsp)
callq 0x10f0e2
popq %rax
popq %rcx
movq 0x38(%rsp), %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x34188c(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1ee92d(%rip), %rsi    # 0x2e5013
leaq 0x2397b3(%rip), %rdx    # 0x32fea0
leaq 0x22f84c(%rip), %rcx    # 0x325f40
leaq 0x22f859(%rip), %r8     # 0x325f54
movl $0x17b, %r9d            # imm = 0x17B
xorl %eax, %eax
callq 0x17a50
callq 0x17390