// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/squarealign.c
// Function: gt_squarealign_calculate_local_generic
GtWord gt_squarealign_calculate_local_generic(GtLinspaceManagement
                                              *spacemanager,
                                              GtAlignment *align,
                                              const GtUchar *useq,
                                              GtUword ustart,
                                              GtUword ulen,
                                              const GtUchar *vseq,
                                              GtUword vstart,
                                              GtUword vlen,
                                              const GtScoreHandler
                                              *scorehandler)
{
  GtWord score = 0, **Ltabcolumn;
  GtMaxcoordvalue *max;

  gt_assert(align != NULL);
  if (spacemanager == NULL)
  {
    /*use it in normally case*/
    gt_array2dim_malloc(Ltabcolumn, (ulen+1), (vlen+1));
    max = gt_maxcoordvalue_new();
  }
  else
  {
    /*use it in lineraspace context*/
    Ltabcolumn = (GtWord **)
                 gt_linspace_management_change_to_square(spacemanager,
                                                         ulen, vlen);
    max = gt_linspace_management_get_maxspace(spacemanager);
  }

  score = fillDPtab_in_square_space_local(Ltabcolumn, max, useq, ustart, ulen,
                                          vseq, vstart, vlen, scorehandler);

  /* reconstruct local alignment from 2dimarray Ltabcolumn */
  gt_reconstructalignment_from_Ltab(align, Ltabcolumn, max,
                                    useq, ustart, ulen,
                                    vseq, vstart, vlen,
                                    scorehandler);

  if (gt_maxcoordvalue_get_length_safe(max))
  {
    ustart = ustart + (gt_maxcoordvalue_get_start(max)).a;
    vstart = vstart + (gt_maxcoordvalue_get_start(max)).b;
    ulen = gt_maxcoordvalue_get_row_length(max);
    vlen = gt_maxcoordvalue_get_col_length(max);

    gt_alignment_set_seqs(align, &useq[ustart], ulen,
                                 &vseq[vstart], vlen);
  }

  if (spacemanager == NULL)
  {
    gt_array2dim_delete(Ltabcolumn);
    gt_maxcoordvalue_delete(max);
  }
  return score;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, 0x28(%rsp)
testq %rsi, %rsi
je 0x18269b
movq %r9, %r12
movq %r8, %r15
movq %rcx, %r14
movq %rdx, %r13
movq %rdi, %rbx
movq 0x88(%rsp), %rdx
testq %rdi, %rdi
movq %r15, (%rsp)
movq %rdi, 0x40(%rsp)
movq %rcx, 0x18(%rsp)
je 0x1823ab
movq %rbx, %rdi
movq %r15, %rsi
callq 0x163bd7
movq %rax, %rbp
movq %rbx, %rdi
callq 0x163bca
movq %rax, 0x8(%rsp)
jmp 0x18243c
movq (%rsp), %rax
leaq 0x1(%rax), %r15
movq (%rsp), %rax
leaq 0x8(,%rax,8), %rbx
leaq 0x21b6fe(%rip), %r14    # 0x39dac4
movq %rbx, %rdi
movq %r14, %rsi
movl $0x13c, %edx            # imm = 0x13C
callq 0x1092b2
movq %rax, %rbp
movq 0x88(%rsp), %rax
leaq 0x1(%rax), %rdi
imulq %rbx, %rdi
movq %r14, %rsi
movl $0x13c, %edx            # imm = 0x13C
callq 0x1092b2
movq %rax, (%rbp)
cmpq $0x2, %r15
movq (%rsp), %r15
jb 0x18242d
movq 0x88(%rsp), %rax
leaq 0x8(,%rax,8), %rax
movq (%rbp), %rcx
addq %rax, %rcx
xorl %edx, %edx
movq %rcx, 0x8(%rbp,%rdx,8)
addq %rax, %rcx
incq %rdx
cmpq %rdx, %r15
jne 0x18241d
callq 0x168350
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %r14
movq 0x90(%rsp), %rdi
callq 0x1797fb
movq %rax, %rbx
movq (%rbp), %rax
movq $0x0, (%rax)
testq %r15, %r15
je 0x182486
leaq 0x1(%r15), %rcx
cmpq $0x3, %rcx
movl $0x2, %eax
cmovaeq %rcx, %rax
movl $0x1, %ecx
movq (%rbp,%rcx,8), %rdx
movq $0x0, (%rdx)
incq %rcx
cmpq %rcx, %rax
jne 0x182472
movq 0x80(%rsp), %rcx
movq 0x88(%rsp), %rax
testq %rax, %rax
movq %r12, 0x38(%rsp)
movq %r13, 0x30(%rsp)
je 0x18259b
leaq (%r12,%rcx), %rax
decq %rax
movq %rax, 0x20(%rsp)
addq %r14, %r13
movl $0x1, %r14d
movq $0x0, 0x10(%rsp)
movq (%rbp), %rax
movq $0x0, (%rax,%r14,8)
testq %r15, %r15
je 0x182585
movl $0x1, %r12d
movq (%rbp,%r12,8), %rax
movq -0x8(%rax,%r14,8), %rcx
addq %rbx, %rcx
movq %rcx, (%rax,%r14,8)
movq -0x8(%rbp,%r12,8), %rax
movq -0x8(%rax,%r14,8), %r15
movzbl -0x1(%r13,%r12), %esi
movq 0x20(%rsp), %rax
movzbl (%rax,%r14), %edx
movq 0x90(%rsp), %rdi
callq 0x17982a
addq %r15, %rax
movq (%rbp,%r12,8), %rcx
cmpq (%rcx,%r14,8), %rax
jl 0x18252c
movq %rax, (%rcx,%r14,8)
movq -0x8(%rbp,%r12,8), %rax
movq (%rax,%r14,8), %rax
addq %rbx, %rax
cmpq (%rcx,%r14,8), %rax
jle 0x182542
movq %rax, (%rcx,%r14,8)
movq (%rcx,%r14,8), %r15
testq %r15, %r15
movl $0x0, %eax
cmovleq %rax, %r15
movq %r15, (%rcx,%r14,8)
cmpq 0x10(%rsp), %r15
jle 0x182575
movq 0x8(%rsp), %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x168415
movq %r15, 0x10(%rsp)
incq %r12
movq (%rsp), %r15
cmpq %r15, %r12
jbe 0x1824e2
incq %r14
movq 0x88(%rsp), %rax
cmpq %rax, %r14
jbe 0x1824c7
jmp 0x1825a4
movq $0x0, 0x10(%rsp)
movq 0x28(%rsp), %rdi
movq %rbp, %rsi
movq 0x8(%rsp), %r14
movq %r14, %rdx
movq 0x30(%rsp), %r13
movq %r13, %rcx
movq 0x18(%rsp), %r8
movq %r15, %r9
pushq 0x90(%rsp)
pushq %rax
movq 0x90(%rsp), %r15
pushq %r15
movq 0x50(%rsp), %r12
pushq %r12
callq 0x175142
addq $0x20, %rsp
movq %r14, %rdi
callq 0x168464
testb %al, %al
je 0x18264d
movq %r15, %r14
movq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x1683ba
movq %rax, (%rsp)
movq %r15, %rdi
callq 0x1683ba
movq %rdx, %rbx
movq %r15, %rdi
callq 0x16842c
movq %rax, 0x20(%rsp)
movq %r15, %rdi
callq 0x168448
addq 0x18(%rsp), %r13
addq (%rsp), %r13
addq %rbx, %r12
addq %r14, %r12
movq 0x28(%rsp), %rdi
movq %r13, %rsi
movq 0x20(%rsp), %rdx
movq %r12, %rcx
movq %rax, %r8
callq 0x126bf9
cmpq $0x0, 0x40(%rsp)
jne 0x182687
movq (%rbp), %rdi
leaq 0x21b464(%rip), %rbx    # 0x39dac4
movq %rbx, %rsi
movl $0x15e, %edx            # imm = 0x15E
callq 0x109670
movq %rbp, %rdi
movq %rbx, %rsi
movl $0x15e, %edx            # imm = 0x15E
callq 0x109670
movq 0x8(%rsp), %rdi
callq 0x168380
movq 0x10(%rsp), %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x5702f