// File: /workspace/github_c_makefile_star2_O2/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 %r8, (%rsp)
movq %rcx, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
testq %rsi, %rsi
je 0x11f514
movq %r9, %r14
movq %rdi, %rbx
movq 0x88(%rsp), %rbp
testq %rdi, %rdi
movq %rdi, 0x40(%rsp)
movq %rsi, 0x30(%rsp)
je 0x11f283
movq %rbx, %rdi
movq (%rsp), %rsi
movq %rbp, %rdx
callq 0xf99eb
movq %rax, %r12
movq %rbx, %rdi
callq 0xf99de
movq %rax, 0x8(%rsp)
jmp 0x11f300
movq %rbp, %r13
movq %r14, %rbp
movq (%rsp), %rax
leaq 0x1(%rax), %r15
leaq 0x8(,%rax,8), %rbx
leaq 0x2156f6(%rip), %r14    # 0x334996
movq %rbx, %rdi
movq %r14, %rsi
movl $0x13c, %edx            # imm = 0x13C
callq 0x93160
movq %rax, %r12
incq %r13
imulq %r13, %rbx
movq %rbx, %rdi
movq %r14, %rsi
movl $0x13c, %edx            # imm = 0x13C
callq 0x93160
movq %rax, (%r12)
pushq $0x1
popq %rax
shlq $0x3, %r13
cmpq %r15, %rax
jae 0x11f2eb
movq -0x8(%r12,%rax,8), %rcx
addq %r13, %rcx
movq %rcx, (%r12,%rax,8)
incq %rax
jmp 0x11f2d5
callq 0xff598
movq %rax, 0x8(%rsp)
movq %rbp, %r14
movq 0x88(%rsp), %rbp
movq 0x80(%rsp), %r15
pushq $0x1
popq %rbx
movq 0x90(%rsp), %rdi
callq 0x114a6a
movq %rax, %r13
movq (%r12), %rax
andq $0x0, (%rax)
cmpq (%rsp), %rbx
ja 0x11f336
movq (%r12,%rbx,8), %rax
andq $0x0, (%rax)
incq %rbx
jmp 0x11f323
movq %r14, 0x38(%rsp)
addq %r14, %r15
decq %r15
movq 0x20(%rsp), %rax
movq 0x18(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x28(%rsp)
pushq $0x1
popq %rbx
movq $0x0, 0x10(%rsp)
cmpq %rbp, %rbx
ja 0x11f421
movq (%r12), %rax
andq $0x0, (%rax,%rbx,8)
pushq $0x1
popq %rbp
cmpq (%rsp), %rbp
ja 0x11f411
movq (%r12,%rbp,8), %rax
movq -0x8(%rax,%rbx,8), %rcx
addq %r13, %rcx
movq %rcx, (%rax,%rbx,8)
movq -0x8(%r12,%rbp,8), %rax
movq -0x8(%rax,%rbx,8), %r14
movq 0x28(%rsp), %rax
movzbl -0x1(%rax,%rbp), %esi
movzbl (%r15,%rbx), %edx
movq 0x90(%rsp), %rdi
callq 0x114b2c
addq %r14, %rax
movq (%r12,%rbp,8), %rcx
movq (%rcx,%rbx,8), %rdx
cmpq %rdx, %rax
jl 0x11f3cb
movq %rax, (%rcx,%rbx,8)
movq %rax, %rdx
movq -0x8(%r12,%rbp,8), %rax
movq (%rax,%rbx,8), %r14
addq %r13, %r14
cmpq %rdx, %r14
cmovleq %rdx, %r14
testq %r14, %r14
jg 0x11f3e6
xorl %r14d, %r14d
movq %r14, (%rcx,%rbx,8)
cmpq 0x10(%rsp), %r14
jle 0x11f409
movq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0xff778
movq %r14, 0x10(%rsp)
incq %rbp
jmp 0x11f374
incq %rbx
movq 0x88(%rsp), %rbp
jmp 0x11f35f
movq 0x30(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
movq 0x18(%rsp), %rcx
movq 0x20(%rsp), %r8
movq (%rsp), %r9
pushq 0x90(%rsp)
pushq %rbp
movq 0x90(%rsp), %rax
pushq %rax
movq 0x50(%rsp), %r15
pushq %r15
callq 0x10eeb4
addq $0x20, %rsp
movq %rbx, %rdi
callq 0xff8b0
testb %al, %al
je 0x11f4c6
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xff659
movq %rax, (%rsp)
movq %rbx, %rdi
callq 0xff659
movq %rdx, %r14
movq %rbx, %rdi
callq 0xff7c0
movq %r13, %rbp
movq %rax, %r13
movq %rbx, %rdi
callq 0xff838
movq 0x28(%rsp), %rsi
addq (%rsp), %rsi
addq %r14, %r15
addq 0x80(%rsp), %r15
movq %rbp, %rdi
movq %r13, %rdx
movq %r15, %rcx
movq %rax, %r8
callq 0xb4f1f
cmpq $0x0, 0x40(%rsp)
jne 0x11f500
movq (%r12), %rdi
leaq 0x2154bd(%rip), %rbx    # 0x334996
movq %rbx, %rsi
movl $0x15e, %edx            # imm = 0x15E
callq 0x936f9
movq %r12, %rdi
movq %rbx, %rsi
movl $0x15e, %edx            # imm = 0x15E
callq 0x936f9
movq 0x8(%rsp), %rdi
callq 0xff5bf
movq 0x10(%rsp), %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x318a4d(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1c5aee(%rip), %rsi    # 0x2e5013
leaq 0x20fcd2(%rip), %rdx    # 0x32f1fe
leaq 0x2154f4(%rip), %rcx    # 0x334a27
leaq 0x21545c(%rip), %r8     # 0x334996
movl $0x138, %r9d            # imm = 0x138
xorl %eax, %eax
callq 0x17a50
callq 0x17390