// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/diagonalbandalign_affinegapcost.c
// Function: gt_diagonalbandalign_affinegapcost_in_square_space_generic
GtWord gt_diagonalbandalign_affinegapcost_in_square_space_generic(
                                             GtLinspaceManagement *space,
                                             const GtScoreHandler *scorehandler,
                                             GtAlignment *align,
                                             const GtUchar *useq,
                                             GtUword ustart,
                                             GtUword ulen,
                                             const GtUchar *vseq,
                                             GtUword vstart,
                                             GtUword vlen,
                                             GtWord left_dist,
                                             GtWord right_dist)
{
  GtWord distance;
  GtUword idx;
  GtAffinealignDPentry **Atabcolumn;

  gt_assert(align && scorehandler);
  if (space == NULL)
  {
    gt_array2dim_malloc(Atabcolumn, (ulen+1), (vlen+1));
  }
  else
  {
    gt_assert((ulen+1)*(vlen+1)*sizeof(**Atabcolumn) <=
               gt_linspace_management_get_valueTabsize(space));

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

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

  diagonalband_fillDPtab_affine(Atabcolumn, useq, ustart, ulen, vseq, vstart,
                                vlen, left_dist, right_dist,
                                Affine_X, Affine_X, scorehandler);

  distance = GT_MIN3(Atabcolumn[ulen][vlen].Rvalue,
                  Atabcolumn[ulen][vlen].Dvalue,
                  Atabcolumn[ulen][vlen].Ivalue);

  /* reconstruct alignment from 2dimarray Atabcolumn */
  gt_affinealign_traceback(align, Atabcolumn, ulen, vlen);

  if (space == NULL)
  {
    gt_array2dim_delete(Atabcolumn);
  }
  return distance;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rsi, %rsi
je 0xcb032
testq %rdx, %rdx
je 0xcb032
movq %r9, %rbx
movq %rsi, %r13
movq %rdi, %r14
movq %rcx, (%rsp)
movq %r8, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
movq 0x60(%rsp), %r15
leaq 0x1(%r9), %r12
testq %rdi, %rdi
je 0xcaf20
leaq 0x1(%r15), %rax
imulq %r12, %rax
imulq $0x30, %rax, %r15
movq %r14, %rdi
callq 0xf999b
cmpq %rax, %r15
ja 0xcb060
movq %r14, %rdi
callq 0xf9981
movq %rax, %rbp
movq %r14, %rdi
callq 0xf9975
movq %rax, (%rbp)
pushq $0x1
popq %rax
movq 0x60(%rsp), %r15
imulq $0x30, %r15, %rcx
cmpq %r12, %rax
jae 0xcaf82
movq -0x8(%rbp,%rax,8), %rdx
addq %rcx, %rdx
addq $0x30, %rdx
movq %rdx, (%rbp,%rax,8)
incq %rax
jmp 0xcaf05
leaq (,%r12,8), %rdi
leaq 0x25032b(%rip), %rsi    # 0x31b25a
movl $0xd9, %edx
callq 0x93160
movq %rax, %rbp
incq %r15
movq %r12, %rax
imulq %r15, %rax
imulq $0x30, %rax, %rdi
leaq 0x250309(%rip), %rsi    # 0x31b25a
movl $0xd9, %edx
callq 0x93160
movq %rax, (%rbp)
pushq $0x1
popq %rax
imulq $0x30, %r15, %rcx
cmpq %r12, %rax
jae 0xcaf7d
movq -0x8(%rbp,%rax,8), %rdx
addq %rcx, %rdx
movq %rdx, (%rbp,%rax,8)
incq %rax
jmp 0xcaf66
movq 0x60(%rsp), %r15
movq 0x58(%rsp), %r9
movq 0x50(%rsp), %r8
pushq $0x3
popq %rax
movq %rbp, %rdi
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rbx, %rcx
pushq %r13
pushq %rax
pushq %rax
pushq 0x88(%rsp)
pushq 0x88(%rsp)
pushq %r15
callq 0xcb098
addq $0x30, %rsp
movq (%rbp,%rbx,8), %rax
imulq $0x30, %r15, %rdx
movq %r15, %rcx
movq (%rax,%rdx), %r15
movq 0x8(%rax,%rdx), %r13
movq 0x10(%rax,%rdx), %r12
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x2946d4
testq %r14, %r14
jne 0xcb012
movq (%rbp), %rdi
leaq 0x250265(%rip), %rbx    # 0x31b25a
movq %rbx, %rsi
movl $0xf4, %edx
callq 0x936f9
movq %rbp, %rdi
movq %rbx, %rsi
movl $0xf4, %edx
callq 0x936f9
cmpq %r13, %r15
cmovlq %r15, %r13
cmpq %r12, %r13
cmovgeq %r12, %r13
movq %r13, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x36cf2f(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x219fd0(%rip), %rsi    # 0x2e5013
leaq 0x24feda(%rip), %rdx    # 0x31af24
leaq 0x2501ce(%rip), %rcx    # 0x31b21f
leaq 0x250202(%rip), %r8     # 0x31b25a
movl $0xd6, %r9d
jmp 0xcb08c
movq 0x36cf01(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x219fa2(%rip), %rsi    # 0x2e5013
leaq 0x250211(%rip), %rdx    # 0x31b289
leaq 0x2501a0(%rip), %rcx    # 0x31b21f
leaq 0x2501d4(%rip), %r8     # 0x31b25a
movl $0xde, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390