// File: /workspace/github_c_makefile_star2_O1/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 $0x68, %rsp
movq %r8, 0x20(%rsp)
movq %rcx, 0x28(%rsp)
movq %rdx, 0x40(%rsp)
testq %rdx, %rdx
je 0x303ef7
movq %r9, %rbp
movq %rsi, %r12
movq %rdi, %r13
movq 0xb0(%rsp), %rax
leaq 0x1(%r9), %r15
testq %rdi, %rdi
je 0x30381d
incq %rax
imulq %r15, %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %rbx
movq %r13, %rdi
callq 0x163bba
cmpq %rax, %rbx
ja 0x303f01
movq %r13, %rdi
callq 0x163ba0
movq %rax, %r14
movq %r13, %rdi
callq 0x163b94
movq %rax, (%r14)
cmpq $0x2, %r15
jb 0x303813
movq 0xb0(%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 0x303803
movq %r13, %rdi
callq 0x163bca
jmp 0x303896
leaq (,%r15,8), %rdi
leaq 0xe1f20(%rip), %r14     # 0x3e574c
movq %r14, %rsi
movq %rax, %rbx
movl $0x215, %edx            # imm = 0x215
callq 0x1092b2
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 0x1092b2
movq %rax, (%r14)
cmpq $0x2, %r15
jb 0x303891
movq 0xb0(%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 0x303881
callq 0x168350
movq %rax, (%rsp)
movabsq $-0x8000000000000000, %rbx # imm = 0x8000000000000000
testq %r12, %r12
movq %r12, 0x60(%rsp)
je 0x3038c8
movq %r12, %rdi
callq 0x1797eb
movq %r12, %rdi
movq %rax, %r12
callq 0x1797fb
movq %rax, 0x18(%rsp)
jmp 0x3038d1
leaq -0x1(%rbx), %r12
movq %r12, 0x18(%rsp)
movq %r13, 0x38(%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 0x303954
movq 0x18(%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 0x30392a
cmpq $0x0, 0xb0(%rsp)
movq %r14, 0x8(%rsp)
je 0x303cb5
movq 0xa0(%rsp), %rax
movq 0xa8(%rsp), %rcx
addq %rcx, %rax
decq %rax
movq %rax, 0x50(%rsp)
addq 0x18(%rsp), %r12
movq 0x28(%rsp), %rax
movq 0x20(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x48(%rsp)
movl $0x1, %r10d
leaq -0x1(%rbx), %rax
movq %rax, 0x58(%rsp)
movq %rbp, 0x30(%rsp)
movq (%r14), %rax
movq %r10, 0x10(%rsp)
leaq (%r10,%r10,2), %r13
shlq $0x4, %r13
movq %rbx, (%rax,%r13)
cmpq %r12, %rbx
movq %r12, %r14
cmovgq %rbx, %r14
movq %rbx, 0x8(%rax,%r13)
testq %r14, %r14
movl $0x0, %ecx
cmovleq %rcx, %r14
movq %r12, 0x10(%rax,%r13)
movq %r14, 0x18(%rax,%r13)
movabsq $0x300000003, %rcx      # imm = 0x300000003
movq %rcx, 0x20(%rax,%r13)
movl $0x2, 0x28(%rax,%r13)
movq (%rsp), %rdi
callq 0x168397
cmpq %rax, %r14
movq 0x8(%rsp), %r14
jle 0x303a2a
movq (%r14), %rax
movq 0x18(%rax,%r13), %rsi
movq (%rsp), %rdi
xorl %edx, %edx
movq 0x10(%rsp), %rcx
callq 0x168415
testq %rbp, %rbp
movq 0x10(%rsp), %r10
je 0x303c9f
leaq -0x1(%r10), %rax
movl $0x1, %ebp
leaq (%rax,%rax,2), %r15
shlq $0x4, %r15
movq 0x58(%rsp), %rax
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x303a76
movq 0x48(%rsp), %rax
movzbl -0x1(%rax,%rbp), %esi
movq 0x50(%rsp), %rax
movzbl (%rax,%r10), %edx
callq 0x17982a
movq 0x10(%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 0x303aeb
movl $0x0, 0x20(%rdx)
jmp 0x303b0e
cmpq %rax, %rdi
jne 0x303af9
movl $0x1, 0x20(%rdx)
jmp 0x303b0e
cmpq %rax, %r9
jne 0x303b07
movl $0x2, 0x20(%rdx)
jmp 0x303b0e
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 0x18(%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), %r11
cmpq %rbx, %rsi
cmoveq %rbx, %r11
cmpq %rdi, %r10
movq %rdi, %rsi
cmovgq %r10, %rsi
cmpq %r11, %r8
cmovgq %r8, %r11
cmpq %r11, %rsi
cmovgq %rsi, %r11
movq %r11, 0x8(%rcx,%r9)
movq 0x8(%rdx), %r14
cmpq %r14, %r10
jne 0x303b8b
movl $0x0, 0x24(%rdx)
jmp 0x303bae
cmpq %r14, %rdi
jne 0x303b99
movl $0x1, 0x24(%rdx)
jmp 0x303bae
cmpq %r14, %r8
jne 0x303ba7
movl $0x2, 0x24(%rdx)
jmp 0x303bae
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 0x18(%rsp), %r8
addq %rsi, %r8
cmpq %rbx, %rsi
cmoveq %rbx, %r8
movq 0x18(%rcx,%r15), %rsi
leaq (%rsi,%r12), %r10
cmpq %rbx, %rsi
cmoveq %rbx, %r10
cmpq %rdi, %r9
movq %rdi, %rsi
cmovgq %r9, %rsi
cmpq %r10, %r8
cmovgq %r8, %r10
cmpq %r10, %rsi
cmovgq %rsi, %r10
movq %r10, 0x10(%rcx,%r13)
movq 0x10(%rdx), %rsi
cmpq %rsi, %r9
jne 0x303c20
movl $0x0, 0x28(%rdx)
jmp 0x303c43
cmpq %rsi, %rdi
jne 0x303c2e
movl $0x1, 0x28(%rdx)
jmp 0x303c43
cmpq %rsi, %r8
jne 0x303c3c
movl $0x2, 0x28(%rdx)
jmp 0x303c43
movl $0x3, 0x28(%rdx)
cmpq %r14, %rax
cmovgq %rax, %r14
cmpq %rsi, %r14
jg 0x303c52
movq %rsi, %r14
testq %r14, %r14
jg 0x303c5a
xorl %r14d, %r14d
movq %r14, 0x18(%rcx,%r13)
movq (%rsp), %rdi
callq 0x168397
cmpq %rax, %r14
movq 0x8(%rsp), %r14
jle 0x303c8c
movq (%r14,%rbp,8), %rax
movq 0x18(%rax,%r13), %rsi
movq (%rsp), %rdi
movq %rbp, %rdx
movq 0x10(%rsp), %rcx
callq 0x168415
incq %rbp
cmpq 0x30(%rsp), %rbp
movq 0x10(%rsp), %r10
jbe 0x303a49
incq %r10
cmpq 0xb0(%rsp), %r10
movq 0x30(%rsp), %rbp
jbe 0x3039ae
movq (%rsp), %rbp
movq %rbp, %rdi
callq 0x168397
movq %rax, 0x10(%rsp)
movq %rbp, %rdi
callq 0x1683e2
movq %r14, %rcx
movq %rax, %r14
movq %rdx, %r15
movq (%rcx,%rax,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 0x168397
cmpq %r13, %rax
jne 0x303efc
movq 0x8(%rsp), %rax
movq (%rax,%r14,8), %rcx
xorl %eax, %eax
cmpq %r13, (%rcx,%r12)
je 0x303d3b
addq %r12, %rcx
xorl %eax, %eax
cmpq %r13, 0x8(%rcx)
setne %al
incl %eax
decq %rbx
movq 0x40(%rsp), %r13
movq %r14, %rcx
orq %r15, %rcx
je 0x303e14
cmpl $0x2, %eax
je 0x303ddd
cmpl $0x1, %eax
je 0x303daf
testl %eax, %eax
jne 0x303ede
movq 0x8(%rsp), %rax
movq (%rax,%r14,8), %rax
leaq (%r15,%r15,2), %r12
shlq $0x4, %r12
cmpq %rbx, (%rax,%r12)
je 0x303ee8
movq %r13, %rdi
callq 0x126d25
testq %r14, %r14
je 0x303ee3
testq %r15, %r15
je 0x303ee3
movq 0x8(%rsp), %rax
movq (%rax,%r14,8), %rax
addq %r12, %rax
addq $0x20, %rax
decq %r14
jmp 0x303e06
movq %r13, %rdi
callq 0x126d42
testq %r14, %r14
je 0x303eed
movq 0x8(%rsp), %rax
movq (%rax,%r14,8), %rax
leaq (%r15,%r15,2), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
addq $0x24, %rax
decq %r14
jmp 0x303e09
movq %r13, %rdi
callq 0x126d5f
testq %r15, %r15
je 0x303ef2
movq 0x8(%rsp), %rax
movq (%rax,%r14,8), %rax
leaq (%r15,%r15,2), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
addq $0x28, %rax
decq %r15
movl (%rax), %eax
cmpl $0x3, %eax
jne 0x303d43
movq (%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x1683a6
movq %rbx, %rdi
callq 0x168464
testb %al, %al
je 0x303e8d
movq (%rsp), %rbx
movq %rbx, %rdi
callq 0x1683ba
movq %rax, %r14
movq %rbx, %rdi
callq 0x1683ba
movq %rdx, %r15
movq %rbx, %rdi
callq 0x16842c
movq %rax, %r12
movq %rbx, %rdi
callq 0x168448
movq 0x28(%rsp), %rsi
addq 0x20(%rsp), %rsi
addq %r14, %rsi
movq 0xa0(%rsp), %rcx
addq %r15, %rcx
addq 0xa8(%rsp), %rcx
movq %r13, %rdi
movq %r12, %rdx
movq %rax, %r8
callq 0x126bf9
cmpq $0x0, 0x38(%rsp)
jne 0x303eca
movq 0x8(%rsp), %rbx
movq (%rbx), %rdi
leaq 0xe18a8(%rip), %r14     # 0x3e574c
movq %r14, %rsi
movl $0x23d, %edx            # imm = 0x23D
callq 0x109670
movq %rbx, %rdi
movq %r14, %rsi
movl $0x23d, %edx            # imm = 0x23D
callq 0x109670
movq (%rsp), %rdi
callq 0x168380
movq 0x10(%rsp), %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x8b6fd
callq 0x8b68b
callq 0x8b6c4
callq 0x8b652
callq 0x8b619
callq 0x8b736
callq 0x8b5e0
callq 0x8b5a7