// File: /workspace/github_c_makefile_star2_O3/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 0x1597af
cmpq $0x0, (%rsp)
je 0x1597af
movq %rdx, %r12
testq %rdx, %rdx
je 0x1597af
movq %r9, %r13
movq %r8, %r14
movq %rcx, %r15
movq %rdi, %rbx
movq 0xe0(%rsp), %rbp
movq %r9, %rsi
callq 0x15be18
testq %r13, %r13
sete %al
testq %rbp, %rbp
sete %cl
orb %al, %cl
je 0x1593e8
xorl %eax, %eax
addq $0x98, %rsp
jmp 0x159495
movq %r13, 0x10(%rsp)
movq 0xd0(%rsp), %r13
cmpq $0x1, %rbp
jne 0x15943c
movq 0x10(%rsp), %rbp
leaq 0x1(,%rbp,2), %rsi
movl $0x8, %ecx
movl $0x8, %r8d
movq %rbx, %rdi
movq %rbp, %rdx
callq 0x15bd68
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 0x159482
movl $0x8, %ecx
movl $0x10, %r8d
movq %rbx, %rdi
movq %rbp, %r13
movq 0x10(%rsp), %rbp
movq %rbp, %rsi
movq %r13, %rdx
callq 0x15be0d
testb %al, %al
je 0x1594a0
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 0x179e17
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 0x15bd68
movq %rbx, %rdi
callq 0x15be28
movq %rbx, %rdi
movq %rax, %rbx
movq %rdi, 0x28(%rsp)
callq 0x15be34
testq %rbx, %rbx
je 0x1597b4
movq %rax, %r13
testq %rax, %rax
je 0x1597b4
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 0x159507
movq 0x28(%rsp), %rdi
callq 0x15be5e
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 0x1597aa
movq 0x58(%rsp), %rax
movq 0x8(%rsp), %r15
movb (%rax,%r15), %bpl
movq (%rsp), %rdi
callq 0x171437
movq %rax, 0x18(%rsp)
movq (%rbx), %r14
movups (%r13), %xmm0
movaps %xmm0, 0x70(%rsp)
xorl %eax, %eax
movq %rax, (%rbx)
movq %rax, (%r13)
movq %r15, 0x8(%r13)
movl $0x1, %r15d
movzbl %bpl, %eax
movl %eax, 0x20(%rsp)
movq 0x50(%rsp), %r13
movq %r14, %r12
movaps 0x70(%rsp), %xmm0
movaps %xmm0, 0x80(%rsp)
movq (%rbx,%r15,8), %r14
leaq -0x8(%r13), %rbp
movups -0x8(%r13), %xmm0
movaps %xmm0, 0x70(%rsp)
movq 0x18(%rsp), %rax
addq %r14, %rax
movq %rax, (%rbx,%r15,8)
movq 0x68(%rsp), %rax
movzbl -0x1(%rax,%r15), %esi
movq (%rsp), %rdi
movl 0x20(%rsp), %edx
callq 0x171466
addq %r12, %rax
movq (%rbx,%r15,8), %r12
cmpq %r12, %rax
jl 0x159631
movq %rax, (%rbx,%r15,8)
movaps 0x80(%rsp), %xmm0
movups %xmm0, (%rbp)
movq (%rbx,%r15,8), %r12
movq -0x8(%rbx,%r15,8), %rax
addq 0x18(%rsp), %rax
cmpq %r12, %rax
jle 0x159651
movq %rax, (%rbx,%r15,8)
movups -0x18(%r13), %xmm0
movups %xmm0, (%rbp)
movq (%rbx,%r15,8), %r12
testq %r12, %r12
jns 0x15966f
movq $0x0, (%rbx,%r15,8)
movq %r15, -0x8(%r13)
movq 0x8(%rsp), %rax
movq %rax, (%r13)
movq (%rbx,%r15,8), %r12
movq 0x30(%rsp), %rbp
movq %rbp, %rdi
callq 0x1605d7
cmpq %rax, %r12
jle 0x15969d
movq (%rbx,%r15,8), %rsi
movq -0x8(%r13), %rdx
movq (%r13), %rcx
movq %rbp, %rdi
movq %r15, %r8
movq 0x8(%rsp), %r9
callq 0x160636
incq %r15
addq $0x10, %r13
cmpq 0x10(%rsp), %r15
jbe 0x1595cb
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 0x159579
movq %r12, %rdi
callq 0x1606a4
testb %al, %al
movq 0x48(%rsp), %rbp
movq 0x40(%rsp), %r13
movq 0x38(%rsp), %r14
je 0x1593da
movq %r12, %r15
movq %r12, %rdi
callq 0x1605fa
addq %rax, %rbp
movq %r12, %rdi
callq 0x1605fa
movq %rdx, %rbx
addq 0xd8(%rsp), %rbx
movq %r12, %rdi
callq 0x16066c
movq %rax, 0x20(%rsp)
movq %r12, %rdi
callq 0x160688
movq %rax, %r12
movq %r15, %rdi
callq 0x1605d7
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 0x120e01
movq (%rsp), %rdi
callq 0x1714fe
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 0x1589a8
addq $0x20, %rsp
movq %r13, %rdi
callq 0x1713ff
movq 0x18(%rsp), %rax
jmp 0x1593dc
callq 0x4a8fd
callq 0x4a88b
callq 0x4a8c4