// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/linearalign.c
// Function: gt_linearalign_compute_local_generic
GtWord gt_linearalign_compute_local_generic(GtLinspaceManagement *spacemanager,
                                            const GtScoreHandler *scorehandler,
                                            GtAlignment *align,
                                            const GtUchar *useq,
                                            GtUword ustart,
                                            GtUword ulen,
                                            const GtUchar *vseq,
                                            GtUword vstart,
                                            GtUword vlen)
{
  GtWord *Ltabcolumn,
         score = GT_WORD_MAX;
  GtUwordPair *Starttabcolumn;
  GtUword ulen_part, ustart_part, vlen_part, vstart_part;
  GtMaxcoordvalue *max;

  gt_assert(spacemanager && scorehandler && align);
  gt_linspace_management_set_ulen(spacemanager,ulen);

  if (ulen == 0UL || vlen == 0UL)
  {
     /* empty alignment */
    return 0;
  }
  else if (vlen == 1UL)
  {
    gt_linspace_management_check_local(spacemanager,
                                       (ulen+1)*(vlen+1)-1, ulen,
                                       sizeof (GtWord),
                                       sizeof (GtWord *));
    return gt_squarealign_calculate_local_generic(spacemanager, align,
                                                  useq, ustart, ulen,
                                                  vseq, vstart, vlen,
                                                  scorehandler);
  }
  else if (gt_linspace_management_checksquare_local(spacemanager, ulen, vlen,
                                                    sizeof (*Ltabcolumn),
                                                    sizeof (*Starttabcolumn)))
  {
    /* call 2dim */
    return gt_squarealign_calculate_local_generic(spacemanager, align,
                                                  useq, ustart, ulen,
                                                  vseq, vstart, vlen,
                                                  scorehandler);
  }

  gt_linspace_management_check_local(spacemanager,
                                     ulen, vlen,
                                     sizeof (*Ltabcolumn),
                                     sizeof (*Starttabcolumn));

  max = evaluateallLScolumns(spacemanager, scorehandler,
                             useq, ustart, ulen,
                             vseq, vstart, vlen);

  if (gt_maxcoordvalue_get_length_safe(max))
  {
    GtScoreHandler *costhandler;

    ustart_part = ustart+(gt_maxcoordvalue_get_start(max)).a;
    vstart_part = vstart+(gt_maxcoordvalue_get_start(max)).b;
    ulen_part = gt_maxcoordvalue_get_row_length(max);
    vlen_part = gt_maxcoordvalue_get_col_length(max);
    score = gt_maxcoordvalue_get_value(max);

    gt_alignment_set_seqs(align, useq + ustart_part, ulen_part,
                                 vseq + vstart_part, vlen_part);
    costhandler = gt_scorehandler2costhandler(scorehandler);
    /* call global function */
    gt_calc_linearalign(spacemanager,
                        costhandler, align,
                        useq, ustart_part, ulen_part,
                        vseq, vstart_part, vlen_part);
    gt_scorehandler_delete(costhandler);
  } else
  {
    /*empty alignment */
    return 0;
  }
  return score;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, (%rsp)
testq %rdi, %rdi
je 0x161486
cmpq $0x0, (%rsp)
je 0x161486
movq %rdx, %r12
testq %rdx, %rdx
je 0x161486
movq %r9, %r13
movq %r8, %r14
movq %rcx, %r15
movq %rdi, %rbx
movq 0xe0(%rsp), %rbp
movq %r9, %rsi
callq 0x163b84
testq %r13, %r13
sete %al
testq %rbp, %rbp
sete %cl
orb %al, %cl
je 0x1610c7
xorl %eax, %eax
addq $0x98, %rsp
jmp 0x161174
movq %r13, 0x10(%rsp)
movq 0xd0(%rsp), %r13
cmpq $0x1, %rbp
jne 0x16111b
movq 0x10(%rsp), %rbp
leaq 0x1(,%rbp,2), %rsi
movl $0x8, %ecx
movl $0x8, %r8d
movq %rbx, %rdi
movq %rbp, %rdx
callq 0x163ad4
subq $0x8, %rsp
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r14, %rcx
movq %rbp, %r8
movq %r13, %r9
pushq 0x8(%rsp)
pushq $0x1
jmp 0x161161
movl $0x8, %ecx
movl $0x10, %r8d
movq %rbx, %rdi
movq %rbp, %r13
movq 0x10(%rsp), %rbp
movq %rbp, %rsi
movq %r13, %rdx
callq 0x163b79
testb %al, %al
je 0x16117f
subq $0x8, %rsp
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r14, %rcx
movq %rbp, %r8
movq 0xd8(%rsp), %r9
pushq 0x8(%rsp)
pushq %r13
pushq 0xf0(%rsp)
callq 0x182345
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %ecx
movl $0x10, %r8d
movq %rbx, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x163ad4
movq %rbx, %rdi
callq 0x163b94
movq %rbx, %rdi
movq %rax, %rbx
movq %rdi, 0x28(%rsp)
callq 0x163ba0
testq %rbx, %rbx
je 0x16148b
movq %rax, %r13
testq %rax, %rax
je 0x16148b
movq %r12, 0x38(%rsp)
movq 0x10(%rsp), %rcx
leaq 0x1(%rcx), %rax
cmpq $0x1, %rax
movq %rcx, %rax
adcq $0x1, %rax
leaq 0x8(%r13), %rcx
xorl %edx, %edx
xorl %esi, %esi
movq %rdx, (%rbx,%rsi,8)
movq %rsi, -0x8(%rcx)
movq %rdx, (%rcx)
incq %rsi
addq $0x10, %rcx
cmpq %rsi, %rax
jne 0x1611e6
movq 0x28(%rsp), %rdi
callq 0x163bca
movq %rax, %r12
movq 0xd8(%rsp), %rax
movq 0xd0(%rsp), %rcx
addq %rcx, %rax
decq %rax
movq %rax, 0x58(%rsp)
movq %r14, 0x48(%rsp)
movq %r15, 0x40(%rsp)
leaq (%r15,%r14), %rax
movq %rax, 0x68(%rsp)
movq %r13, %rax
addq $0x18, %rax
movq %rax, 0x50(%rsp)
movl $0x1, %eax
movq %rax, 0x8(%rsp)
movq %r13, 0x60(%rsp)
movq %r12, 0x30(%rsp)
testq %r12, %r12
je 0x161481
movq 0x58(%rsp), %rax
movq 0x8(%rsp), %r14
movb (%rax,%r14), %bpl
movq (%rsp), %rdi
callq 0x1797fb
movq %rax, 0x18(%rsp)
movq (%rbx), %r12
movups (%r13), %xmm0
movaps %xmm0, 0x70(%rsp)
xorl %eax, %eax
movq %rax, (%rbx)
movq %rax, (%r13)
movq %r14, 0x8(%r13)
movl $0x1, %r15d
movzbl %bpl, %eax
movl %eax, 0x20(%rsp)
movq 0x50(%rsp), %r13
movq %r12, %r14
movaps 0x70(%rsp), %xmm0
movaps %xmm0, 0x80(%rsp)
movq (%rbx,%r15,8), %r12
leaq -0x8(%r13), %rbp
movups -0x8(%r13), %xmm0
movaps %xmm0, 0x70(%rsp)
movq 0x18(%rsp), %rax
addq %r12, %rax
movq %rax, (%rbx,%r15,8)
movq 0x68(%rsp), %rax
movzbl -0x1(%rax,%r15), %esi
movq (%rsp), %rdi
movl 0x20(%rsp), %edx
callq 0x17982a
addq %r14, %rax
cmpq (%rbx,%r15,8), %rax
jl 0x161309
movq %rax, (%rbx,%r15,8)
movaps 0x80(%rsp), %xmm0
movups %xmm0, (%rbp)
movq -0x8(%rbx,%r15,8), %rax
addq 0x18(%rsp), %rax
cmpq (%rbx,%r15,8), %rax
jle 0x161326
movq %rax, (%rbx,%r15,8)
movups -0x18(%r13), %xmm0
movups %xmm0, (%rbp)
cmpq $0x0, (%rbx,%r15,8)
jns 0x161342
movq $0x0, (%rbx,%r15,8)
movq %r15, -0x8(%r13)
movq 0x8(%rsp), %rax
movq %rax, (%r13)
movq (%rbx,%r15,8), %r14
movq 0x30(%rsp), %rbp
movq %rbp, %rdi
callq 0x168397
cmpq %rax, %r14
jle 0x161374
movq (%rbx,%r15,8), %rsi
movq -0x8(%r13), %rdx
movq (%r13), %rcx
movq %rbp, %rdi
movq %r15, %r8
movq 0x8(%rsp), %r9
callq 0x1683f6
incq %r15
addq $0x10, %r13
cmpq 0x10(%rsp), %r15
jbe 0x1612aa
movq 0x8(%rsp), %rcx
incq %rcx
movq 0xe0(%rsp), %rax
movq %rcx, 0x8(%rsp)
cmpq %rax, %rcx
movq 0x60(%rsp), %r13
movq 0x30(%rsp), %r12
jbe 0x161258
movq %r12, %rdi
callq 0x168464
testb %al, %al
movq 0x48(%rsp), %rbp
movq 0x40(%rsp), %r13
movq 0x38(%rsp), %r14
je 0x1610b9
movq %r12, %r15
movq %r12, %rdi
callq 0x1683ba
addq %rax, %rbp
movq %r12, %rdi
callq 0x1683ba
movq %rdx, %rbx
addq 0xd8(%rsp), %rbx
movq %r12, %rdi
callq 0x16842c
movq %rax, 0x20(%rsp)
movq %r12, %rdi
callq 0x168448
movq %rax, %r12
movq %r15, %rdi
callq 0x168397
movq %rax, 0x18(%rsp)
movq %r13, %rsi
addq %rbp, %rsi
movq 0xd0(%rsp), %rax
leaq (%rax,%rbx), %rcx
movq %r14, %rdi
movq 0x20(%rsp), %r15
movq %r15, %rdx
movq %r12, %r8
callq 0x126bf9
movq (%rsp), %rdi
callq 0x1798c2
movq %r13, %rcx
movq %rax, %r13
subq $0x8, %rsp
movq 0x30(%rsp), %rdi
movq %rax, %rsi
movq %r14, %rdx
movq %rbp, %r8
movq %r15, %r9
pushq %r12
pushq %rbx
pushq 0xe8(%rsp)
callq 0x160748
addq $0x20, %rsp
movq %r13, %rdi
callq 0x1797c3
movq 0x18(%rsp), %rax
jmp 0x1610bb
callq 0x4b710
callq 0x4b69e
callq 0x4b6d7