// File: /workspace/github_c_makefile_star2_O3/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 0x15be18
movq %r14, %rdi
callq 0x171437
movq %rax, %rbp
movq %r14, 0x10(%rsp)
movq %r14, %rdi
callq 0x171427
movq %rax, %r14
testq %r13, %r13
je 0x159efe
movq %rbx, (%rsp)
movq 0x68(%rsp), %r9
movq 0x60(%rsp), %rax
cmpq $0x1, %r15
je 0x159f1e
movq %r15, %rbx
testq %r15, %r15
jne 0x159f6d
movq (%rsp), %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x16cce8
jmp 0x159f0c
movq %rbx, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x16cd21
movq %rax, %r13
addq %r14, %r13
movq %r13, %rax
addq $0x28, %rsp
jmp 0x159fbd
leaq 0x1(,%r13,2), %rsi
movl $0x30, %ecx
movl $0x8, %r8d
movq %r12, %rdi
movq %r13, %rdx
movq %rax, %rbx
movq %r9, %r14
xorl %r9d, %r9d
callq 0x15bc3e
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 0x159fb4
movq %rax, %r15
movl $0x30, %ecx
movl $0x30, %r8d
movq %r12, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x15bd8d
testb %al, %al
je 0x159fc8
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 0x2f976c
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x30, %ecx
movl $0x30, %r8d
movl $0x8, %r9d
movq %r12, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x15bc3e
movq %r12, %rdi
callq 0x15be41
movq %rax, %rbp
movq %r13, (%rax,%rbx,8)
subq $0x8, %rsp
leaq 0x28(%rsp), %rax
movl $0x3, %r10d
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 0x15a0fd
addq $0x40, %rsp
movq %rax, %r13
movq %rbp, %r15
movq 0x8(%rbp), %rdx
cmpq $0x1, %rdx
ja 0x15a070
movq %r15, %r12
movq $0x0, (%r15)
movq (%rsp), %rdi
movq %rbx, %rcx
movq 0x8(%rsp), %rdx
movq 0x60(%rsp), %r8
jmp 0x15a0e1
leaq 0x2(,%rdx,2), %rsi
movl $0x30, %ecx
movl $0x8, %r8d
movq %r12, %rdi
xorl %r9d, %r9d
callq 0x15bc3e
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 0x2f98a0
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 0x16d0e4
addq $0x10, %rsp
jmp 0x159f12