// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/linearalign_affinegapcost.c
// Function: gt_calc_affinealign_linear
GtUword gt_calc_affinealign_linear(GtLinspaceManagement *spacemanager,
                                   const GtScoreHandler *scorehandler,
                                   GtAlignment *align,
                                   const GtUchar *useq,
                                   GtUword ustart,
                                   GtUword ulen,
                                   const GtUchar *vseq,
                                   GtUword vstart,
                                   GtUword vlen)
{
  GtUword distance, *Ctab, threadcount = 1;
  GtWord gap_extension, gap_opening;
  GtAffinealignDPentry *Atabcolumn;
  GtAffineAlignRtabentry *Rtabcolumn;

  gt_linspace_management_set_ulen(spacemanager, ulen);
  gap_extension = gt_scorehandler_get_gapscore(scorehandler);
  gap_opening = gt_scorehandler_get_gap_opening(scorehandler);
  if (ulen == 0UL)
  {
      distance = gt_reconstructalignment_trivial_insertion(align, vlen,
                                                           gap_extension);
      distance += gap_opening;
      return distance;
  }
  else if (vlen == 0UL)
  {
      distance = gt_reconstructalignment_trivial_deletion(align, ulen,
                                                          gap_extension);
      distance += gap_opening;
      return distance;
  }
  else if (vlen == 1UL)
  {
     gt_linspace_management_check(spacemanager, (ulen+1)*(vlen+1)-1, ulen,
                                  sizeof (*Atabcolumn), sizeof (Atabcolumn), 0);
    return gt_affinealign_with_Management(spacemanager, scorehandler, align,
                                   useq+ustart, ulen, vseq+vstart, vlen);
  }
  if (gt_linspace_management_checksquare(spacemanager, ulen, vlen,
                                         sizeof (*Atabcolumn),
                                         sizeof (*Rtabcolumn)))
  {
    return gt_affinealign_with_Management(spacemanager, scorehandler, align,
                                   useq+ustart, ulen, vseq+vstart, vlen);
  }
  else
  {
    gt_linspace_management_check(spacemanager, ulen, vlen, sizeof (*Atabcolumn),
                                 sizeof (*Rtabcolumn), sizeof (*Ctab));
    Ctab = gt_linspace_management_get_crosspointTabspace(spacemanager);
    Ctab[vlen] = ulen;
    distance = evaluateaffinecrosspoints(spacemanager, scorehandler,
                                         useq, ustart, ulen,
                                         vseq, vstart, vlen,
                                         Ctab, 0, Affine_X,
                                         Affine_X, &threadcount);

    affine_determineCtab0(Ctab, spacemanager, scorehandler,
                          useq, ustart, vseq, vstart);

    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 $0x28, %rsp
movq %r9, %r13
movq %r8, 0x18(%rsp)
movq %rcx, 0x8(%rsp)
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r12
movq 0x70(%rsp), %r15
movq $0x1, 0x20(%rsp)
movq %r9, %rsi
callq 0xf9932
movq %r14, %rdi
callq 0x114a6a
movq %rax, %rbp
movq %r14, 0x10(%rsp)
movq %r14, %rdi
callq 0x114a29
movq %rax, %r14
testq %r13, %r13
je 0xf79a8
movq %rbx, (%rsp)
movq 0x68(%rsp), %r9
movq 0x60(%rsp), %rax
cmpq $0x1, %r15
je 0xf79c8
movq %r15, %rbx
testq %r15, %r15
jne 0xf7a13
movq (%rsp), %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x10ecbc
jmp 0xf79b6
movq %rbx, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x10ecf3
movq %rax, %r13
addq %r14, %r13
movq %r13, %rax
addq $0x28, %rsp
jmp 0xf7a5e
leaq 0x1(,%r13,2), %rsi
pushq $0x30
popq %rcx
pushq $0x8
popq %r8
movq %r12, %rdi
movq %r13, %rdx
movq %rax, %rbx
movq %r9, %r14
xorl %r9d, %r9d
callq 0xf9704
movq 0x8(%rsp), %rcx
addq 0x18(%rsp), %rcx
addq %r14, %rbx
subq $0x8, %rsp
movq %r12, %rdi
movq 0x18(%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r13, %r8
movq %rbx, %r9
pushq $0x1
jmp 0xf7a55
movq %rax, %r15
pushq $0x30
popq %rcx
movq %r12, %rdi
movq %r13, %rsi
movq %rbx, %rdx
movq %rcx, %r8
callq 0xf9879
testb %al, %al
je 0xf7a69
movq 0x8(%rsp), %rcx
addq 0x18(%rsp), %rcx
movq %r15, %r9
addq 0x68(%rsp), %r9
subq $0x8, %rsp
movq %r12, %rdi
movq 0x18(%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r13, %r8
pushq %rbx
callq 0x294e89
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x30
popq %rcx
pushq $0x8
popq %r9
movq %r12, %rdi
movq %r13, %rsi
movq %rbx, %rdx
movq %rcx, %r8
callq 0xf9704
movq %r12, %rdi
callq 0xf998e
movq %rax, %rbp
movq %r13, (%rax,%rbx,8)
subq $0x8, %rsp
leaq 0x28(%rsp), %rax
pushq $0x3
popq %r10
movq %r12, %rdi
movq 0x18(%rsp), %r14
movq %r14, %rsi
movq %rbx, %r11
movq 0x10(%rsp), %rdx
movq 0x20(%rsp), %rbx
movq %rbx, %rcx
movq %r13, %r8
movq %r15, %r9
pushq %rax
pushq %r10
pushq %r10
pushq $0x0
pushq %rbp
pushq %r11
movq 0xa0(%rsp), %r15
pushq %r15
callq 0xf7b8c
addq $0x40, %rsp
movq %rax, %r13
movq %rbp, %r15
movq 0x8(%rbp), %rdx
cmpq $0x1, %rdx
ja 0xf7b05
movq %r15, %r12
andq $0x0, (%r15)
movq (%rsp), %rdi
movq %rbx, %rcx
movq 0x8(%rsp), %rdx
movq 0x60(%rsp), %r8
jmp 0xf7b72
leaq 0x2(,%rdx,2), %rsi
pushq $0x30
popq %rcx
pushq $0x8
popq %r8
movq %r12, %rdi
xorl %r9d, %r9d
callq 0xf9704
movq 0x8(%r15), %r9
xorl %eax, %eax
cmpq 0x10(%r15), %r9
sete %al
addl %eax, %eax
movq %r12, %rdi
movq %r15, %r12
movq %r14, %rsi
movq %r15, %rdx
movq 0x8(%rsp), %r15
movq %r15, %rcx
movq %rbx, %r8
pushq %rax
pushq $0x3
pushq $0x0
pushq $0x1
pushq 0x88(%rsp)
movq 0x88(%rsp), %rbp
pushq %rbp
callq 0x295005
addq $0x30, %rsp
movq (%rsp), %rdi
movq %rbx, %rcx
movq %r15, %rdx
movq %rbp, %r8
movq %r12, %rsi
movq 0x68(%rsp), %r9
pushq %r14
pushq 0x78(%rsp)
callq 0x10f0e2
popq %rax
popq %rcx
jmp 0xf79bc