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

  gt_assert(align != NULL);
  if (spacemanager == NULL)
  {
    /*use it in normally case*/
    gt_array2dim_malloc(Atabcolumn,(ulen+1),(vlen+1));
    max = gt_maxcoordvalue_new();
  }
  else
  {
    /*use it in lineraspace context*/
    gt_assert((ulen+1)*(vlen+1)*sizeof(**Atabcolumn) <=
               gt_linspace_management_get_valueTabsize(spacemanager));

    Atabcolumn = gt_linspace_management_get_rTabspace(spacemanager);
    *Atabcolumn = gt_linspace_management_get_valueTabspace(spacemanager);

    GtUword idx;
    for (idx = 1;idx < ulen+1;idx++)
      Atabcolumn[idx] = Atabcolumn[idx-1] + vlen + 1;
    max = gt_linspace_management_get_maxspace(spacemanager);
  }

  score = affinealign_fill_table_local(Atabcolumn, scorehandler, max,
                                       useq, ustart, ulen,
                                       vseq, vstart, vlen,
                                       GT_WORD_MAX, GT_WORD_MAX,
                                       GT_WORD_MAX, GT_WORD_MAX);

  /* reconstruct local alignment from 2dimarray Atabcolumn */
  affinealign_traceback_local(align, Atabcolumn, max);

  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(Atabcolumn);
    gt_maxcoordvalue_delete(max);
  }
  return score;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %r8, 0x28(%rsp)
movq %rcx, 0x30(%rsp)
movq %rdx, 0x48(%rsp)
testq %rdx, %rdx
je 0x2fa24f
movq %r9, %rbp
movq %rsi, %r12
movq %rdi, %r13
movq 0xc0(%rsp), %rax
leaq 0x1(%r9), %r15
testq %rdi, %rdi
je 0x2f9b75
incq %rax
imulq %r15, %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %rbx
movq %r13, %rdi
callq 0x15be4e
cmpq %rax, %rbx
ja 0x2fa259
movq %r13, %rdi
callq 0x15be34
movq %rax, %r14
movq %r13, %rdi
callq 0x15be28
movq %rax, (%r14)
cmpq $0x2, %r15
jb 0x2f9b6b
movq 0xc0(%rsp), %rax
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
addq $0x30, %rax
movq (%r14), %rcx
addq %rax, %rcx
xorl %edx, %edx
movq %rcx, 0x8(%r14,%rdx,8)
addq %rax, %rcx
incq %rdx
cmpq %rdx, %rbp
jne 0x2f9b5b
movq %r13, %rdi
callq 0x15be5e
jmp 0x2f9bee
leaq (,%r15,8), %rdi
leaq 0xe24c8(%rip), %r14     # 0x3dc04c
movq %r14, %rsi
movq %rax, %rbx
movl $0x215, %edx            # imm = 0x215
callq 0x104226
leaq 0x1(%rbx), %rcx
imulq %r15, %rcx
shlq $0x4, %rcx
leaq (%rcx,%rcx,2), %rdi
movq %r14, %rsi
movq %rax, %r14
movl $0x215, %edx            # imm = 0x215
callq 0x104226
movq %rax, (%r14)
cmpq $0x2, %r15
jb 0x2f9be9
movq 0xc0(%rsp), %rax
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
addq $0x30, %rax
movq (%r14), %rcx
addq %rax, %rcx
xorl %edx, %edx
movq %rcx, 0x8(%r14,%rdx,8)
addq %rax, %rcx
incq %rdx
cmpq %rdx, %rbp
jne 0x2f9bd9
callq 0x160590
movq %rax, 0x8(%rsp)
movabsq $-0x8000000000000000, %rbx # imm = 0x8000000000000000
testq %r12, %r12
movq %r12, 0x70(%rsp)
je 0x2f9c21
movq %r12, %rdi
callq 0x171427
movq %r12, %rdi
movq %rax, %r12
callq 0x171437
movq %rax, 0x20(%rsp)
jmp 0x2f9c2a
leaq -0x1(%rbx), %r12
movq %r12, 0x20(%rsp)
movq %r13, 0x40(%rsp)
movq (%r14), %rax
movq %rbx, (%rax)
movq %rbx, 0x8(%rax)
movq %rbx, 0x10(%rax)
movq $0x0, 0x18(%rax)
movabsq $0x300000003, %rcx      # imm = 0x300000003
movq %rcx, 0x20(%rax)
movl $0x3, 0x28(%rax)
testq %rbp, %rbp
je 0x2f9cad
movq 0x20(%rsp), %rax
addq %r12, %rax
cmpq $0x3, %r15
movl $0x2, %ecx
cmovaeq %r15, %rcx
movl $0x1, %edx
movabsq $0x100000003, %rsi      # imm = 0x100000003
movq (%r14,%rdx,8), %rdi
movq %rbx, (%rdi)
movq %rax, 0x8(%rdi)
movq %rbx, 0x10(%rdi)
movq $0x0, 0x18(%rdi)
movq %rsi, 0x20(%rdi)
movl $0x3, 0x28(%rdi)
incq %rdx
cmpq %rdx, %rcx
jne 0x2f9c83
cmpq $0x0, 0xc0(%rsp)
movq %r14, 0x10(%rsp)
je 0x2fa001
movq 0xb0(%rsp), %rax
movq 0xb8(%rsp), %rcx
addq %rcx, %rax
decq %rax
movq %rax, 0x60(%rsp)
addq 0x20(%rsp), %r12
movq 0x30(%rsp), %rax
movq 0x28(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x58(%rsp)
xorl %eax, %eax
testq %r12, %r12
cmovgq %r12, %rax
movq %rax, 0x50(%rsp)
movl $0x1, %r10d
leaq -0x1(%rbx), %rax
movq %rax, 0x68(%rsp)
movq %rbp, 0x38(%rsp)
movq (%r14), %rax
movq %r10, 0x18(%rsp)
leaq (%r10,%r10,2), %r13
shlq $0x4, %r13
movq %rbx, (%rax,%r13)
movq %rbx, 0x8(%rax,%r13)
movq %r12, 0x10(%rax,%r13)
movq 0x50(%rsp), %r15
movq %r15, 0x18(%rax,%r13)
movabsq $0x300000003, %rcx      # imm = 0x300000003
movq %rcx, 0x20(%rax,%r13)
movl $0x2, 0x28(%rax,%r13)
movq 0x8(%rsp), %rdi
callq 0x1605d7
cmpq %rax, %r15
jle 0x2f9d7d
movq (%r14), %rax
movq 0x18(%rax,%r13), %rsi
movq 0x8(%rsp), %rdi
xorl %edx, %edx
movq 0x18(%rsp), %rcx
callq 0x160655
testq %rbp, %rbp
movq 0x18(%rsp), %r10
je 0x2f9feb
leaq -0x1(%r10), %rax
movl $0x1, %ebp
leaq (%rax,%rax,2), %r15
shlq $0x4, %r15
movq 0x68(%rsp), %rax
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x2f9dc9
movq 0x58(%rsp), %rax
movzbl -0x1(%rax,%rbp), %esi
movq 0x60(%rsp), %rax
movzbl (%rax,%r10), %edx
callq 0x171466
movq 0x18(%rsp), %r10
movq -0x8(%r14,%rbp,8), %rsi
movq (%rsi,%r15), %rcx
movq 0x8(%rsi,%r15), %rdx
leaq (%rcx,%rax), %r8
cmpq %rbx, %rcx
cmoveq %rbx, %r8
leaq (%rdx,%rax), %rdi
cmpq %rbx, %rdx
cmoveq %rbx, %rdi
movq 0x10(%rsi,%r15), %rcx
leaq (%rcx,%rax), %r9
cmpq %rbx, %rcx
cmoveq %rbx, %r9
movq 0x18(%rsi,%r15), %rcx
addq %rcx, %rax
cmpq %rbx, %rcx
cmoveq %rbx, %rax
cmpq %rdi, %r8
movq %rdi, %rcx
cmovgq %r8, %rcx
cmpq %rax, %r9
cmovgq %r9, %rax
cmpq %rax, %rcx
cmovgq %rcx, %rax
movq (%r14,%rbp,8), %rcx
leaq (%rcx,%r13), %rdx
movq %rax, (%rcx,%r13)
cmpq %rax, %r8
jne 0x2f9e3e
movl $0x0, 0x20(%rdx)
jmp 0x2f9e61
cmpq %rax, %rdi
jne 0x2f9e4c
movl $0x1, 0x20(%rdx)
jmp 0x2f9e61
cmpq %rax, %r9
jne 0x2f9e5a
movl $0x2, 0x20(%rdx)
jmp 0x2f9e61
movl $0x3, 0x20(%rdx)
movq %r10, %rdi
shlq $0x4, %rdi
leaq (%rdi,%rdi,2), %r9
movq (%rsi,%r9), %rdi
movq 0x8(%rsi,%r9), %r8
leaq (%rdi,%r12), %r10
cmpq %rbx, %rdi
cmoveq %rbx, %r10
movq 0x20(%rsp), %rdi
addq %r8, %rdi
cmpq %rbx, %r8
cmoveq %rbx, %rdi
movq 0x10(%rsi,%r9), %r11
leaq (%r11,%r12), %r8
cmpq %rbx, %r11
cmoveq %rbx, %r8
movq 0x18(%rsi,%r9), %rsi
leaq (%rsi,%r12), %r14
cmpq %rbx, %rsi
cmoveq %rbx, %r14
cmpq %rdi, %r10
movq %rdi, %rsi
cmovgq %r10, %rsi
cmpq %r14, %r8
cmovgq %r8, %r14
cmpq %r14, %rsi
cmovgq %rsi, %r14
movq %r14, 0x8(%rcx,%r9)
cmpq %r14, %r10
jne 0x2f9eda
movl $0x0, 0x24(%rdx)
jmp 0x2f9efd
cmpq %r14, %rdi
jne 0x2f9ee8
movl $0x1, 0x24(%rdx)
jmp 0x2f9efd
cmpq %r14, %r8
jne 0x2f9ef6
movl $0x2, 0x24(%rdx)
jmp 0x2f9efd
movl $0x3, 0x24(%rdx)
movq (%rcx,%r15), %rsi
movq 0x8(%rcx,%r15), %r8
leaq (%rsi,%r12), %r9
cmpq %rbx, %rsi
cmoveq %rbx, %r9
leaq (%r8,%r12), %rdi
cmpq %rbx, %r8
cmoveq %rbx, %rdi
movq 0x10(%rcx,%r15), %rsi
movq 0x20(%rsp), %r8
addq %rsi, %r8
cmpq %rbx, %rsi
cmoveq %rbx, %r8
movq 0x18(%rcx,%r15), %r10
leaq (%r10,%r12), %rsi
cmpq %rbx, %r10
cmoveq %rbx, %rsi
cmpq %rdi, %r9
movq %rdi, %r10
cmovgq %r9, %r10
cmpq %rsi, %r8
cmovgq %r8, %rsi
cmpq %rsi, %r10
cmovgq %r10, %rsi
movq %rsi, 0x10(%rcx,%r13)
cmpq %rsi, %r9
jne 0x2f9f6b
movl $0x0, 0x28(%rdx)
jmp 0x2f9f8e
cmpq %rsi, %rdi
jne 0x2f9f79
movl $0x1, 0x28(%rdx)
jmp 0x2f9f8e
cmpq %rsi, %r8
jne 0x2f9f87
movl $0x2, 0x28(%rdx)
jmp 0x2f9f8e
movl $0x3, 0x28(%rdx)
cmpq %r14, %rax
cmovgq %rax, %r14
cmpq %rsi, %r14
cmovleq %rsi, %r14
testq %r14, %r14
jg 0x2f9fa4
xorl %r14d, %r14d
movq %r14, 0x18(%rcx,%r13)
movq 0x8(%rsp), %rdi
callq 0x1605d7
cmpq %rax, %r14
movq 0x10(%rsp), %r14
jle 0x2f9fd8
movq (%r14,%rbp,8), %rax
movq 0x18(%rax,%r13), %rsi
movq 0x8(%rsp), %rdi
movq %rbp, %rdx
movq 0x18(%rsp), %rcx
callq 0x160655
incq %rbp
cmpq 0x38(%rsp), %rbp
movq 0x18(%rsp), %r10
jbe 0x2f9d9c
incq %r10
cmpq 0xc0(%rsp), %r10
movq 0x38(%rsp), %rbp
jbe 0x2f9d15
movq 0x8(%rsp), %rbp
movq %rbp, %rdi
callq 0x1605d7
movq %rax, 0x18(%rsp)
movq %rbp, %rdi
callq 0x160622
movq %rax, %r15
movq %r14, %rax
movq %rdx, %r14
movq (%rax,%r15,8), %rax
leaq (%rdx,%rdx,2), %r12
shlq $0x4, %r12
movq (%rax,%r12), %rcx
movq 0x8(%rax,%r12), %rdx
cmpq %rdx, %rcx
cmovgq %rcx, %rdx
movq 0x10(%rax,%r12), %rcx
movq 0x18(%rax,%r12), %r13
cmpq %r13, %rcx
cmovgq %rcx, %r13
cmpq %r13, %rdx
cmovgq %rdx, %r13
movq %rbp, %rdi
callq 0x1605d7
cmpq %r13, %rax
jne 0x2fa254
movq 0x10(%rsp), %rax
movq (%rax,%r15,8), %rcx
xorl %eax, %eax
cmpq %r13, (%rcx,%r12)
je 0x2fa088
addq %r12, %rcx
xorl %eax, %eax
cmpq %r13, 0x8(%rcx)
setne %al
incl %eax
decq %rbx
movq 0x48(%rsp), %r13
movq %r15, %rcx
orq %r14, %rcx
je 0x2fa163
cmpl $0x2, %eax
je 0x2fa12a
cmpl $0x1, %eax
je 0x2fa0fc
testl %eax, %eax
jne 0x2fa236
movq 0x10(%rsp), %rax
movq (%rax,%r15,8), %rax
leaq (%r14,%r14,2), %r12
shlq $0x4, %r12
cmpq %rbx, (%rax,%r12)
je 0x2fa240
movq %r13, %rdi
callq 0x120f2d
testq %r15, %r15
je 0x2fa23b
testq %r14, %r14
je 0x2fa23b
movq 0x10(%rsp), %rax
movq (%rax,%r15,8), %rax
addq %r12, %rax
addq $0x20, %rax
decq %r15
jmp 0x2fa153
movq %r13, %rdi
callq 0x120f4a
testq %r15, %r15
je 0x2fa245
movq 0x10(%rsp), %rax
movq (%rax,%r15,8), %rax
leaq (%r14,%r14,2), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
addq $0x24, %rax
decq %r15
jmp 0x2fa156
movq %r13, %rdi
callq 0x120f67
testq %r14, %r14
je 0x2fa24a
movq 0x10(%rsp), %rax
movq (%rax,%r15,8), %rax
leaq (%r14,%r14,2), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
addq $0x28, %rax
decq %r14
movl (%rax), %eax
cmpl $0x3, %eax
jne 0x2fa090
jmp 0x2fa169
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x1605e6
movq %rbx, %rdi
callq 0x1606a4
testb %al, %al
je 0x2fa1e4
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x1605fa
movq %rax, %r14
movq %rbx, %rdi
callq 0x1605fa
movq %rdx, %r15
movq %rbx, %rdi
callq 0x16066c
movq %rax, %r12
movq %rbx, %rdi
callq 0x160688
movq 0x30(%rsp), %rsi
addq 0x28(%rsp), %rsi
addq %r14, %rsi
movq 0xb0(%rsp), %rcx
addq %r15, %rcx
addq 0xb8(%rsp), %rcx
movq %r13, %rdi
movq %r12, %rdx
movq %rax, %r8
callq 0x120e01
cmpq $0x0, 0x40(%rsp)
jne 0x2fa222
movq 0x10(%rsp), %rbx
movq (%rbx), %rdi
leaq 0xe1e51(%rip), %r14     # 0x3dc04c
movq %r14, %rsi
movl $0x23d, %edx            # imm = 0x23D
callq 0x1045eb
movq %rbx, %rdi
movq %r14, %rsi
movl $0x23d, %edx            # imm = 0x23D
callq 0x1045eb
movq 0x8(%rsp), %rdi
callq 0x1605c0
movq 0x18(%rsp), %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x89a1a
callq 0x899a8
callq 0x899e1
callq 0x8996f
callq 0x89936
callq 0x89a53
callq 0x898fd
callq 0x898c4