// File: /workspace/github_c_makefile_star2_O3/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 $0x28, %rsp
testq %rsi, %rsi
je 0x134734
movq %rdx, %r15
testq %rdx, %rdx
je 0x134734
movq %r9, %rbx
movq %rsi, %r13
movq %rdi, %rbp
movq %rcx, 0x10(%rsp)
movq %r8, 0x8(%rsp)
movq 0x70(%rsp), %r14
leaq 0x1(%r9), %r12
testq %rdi, %rdi
movq %r15, 0x20(%rsp)
movq %rdi, 0x18(%rsp)
je 0x1345f5
leaq 0x1(%r14), %rax
imulq %r12, %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %r15
movq %rbp, %rdi
callq 0x15be4e
cmpq %rax, %r15
ja 0x134739
movq %rbp, %rdi
callq 0x15be34
movq %rbp, %rdi
movq %rax, %rbp
callq 0x15be28
movq %rax, (%rbp)
cmpq $0x2, %r12
jb 0x134672
movq 0x70(%rsp), %rax
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
addq $0x30, %rax
movq (%rbp), %rcx
addq %rax, %rcx
xorl %edi, %edi
movq 0x8(%rsp), %rdx
movq 0x10(%rsp), %rsi
movq %rcx, 0x8(%rbp,%rdi,8)
addq %rax, %rcx
incq %rdi
cmpq %rdi, %rbx
jne 0x1345e0
jmp 0x13467c
leaq (,%r12,8), %rdi
leaq 0x246906(%rip), %rsi    # 0x37af0a
movl $0xd9, %edx
callq 0x104226
movq %rax, %rbp
leaq 0x1(%r14), %rax
imulq %r12, %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %rdi
leaq 0x2468e2(%rip), %rsi    # 0x37af0a
movl $0xd9, %edx
callq 0x104226
movq %rax, (%rbp)
cmpq $0x2, %r12
jb 0x134672
movq 0x70(%rsp), %rax
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
addq $0x30, %rax
movq (%rbp), %rcx
addq %rax, %rcx
xorl %edi, %edi
movq 0x8(%rsp), %rdx
movq 0x10(%rsp), %rsi
movq %rcx, 0x8(%rbp,%rdi,8)
addq %rax, %rcx
incq %rdi
cmpq %rdi, %rbx
jne 0x134660
jmp 0x13467c
movq 0x8(%rsp), %rdx
movq 0x10(%rsp), %rsi
movq 0x68(%rsp), %r9
movq 0x60(%rsp), %r8
movl $0x3, %eax
movq %rbp, %rdi
movq %rbx, %rcx
pushq %r13
pushq %rax
pushq %rax
pushq 0x98(%rsp)
pushq 0x98(%rsp)
movq 0x98(%rsp), %r14
pushq %r14
callq 0x13473e
addq $0x30, %rsp
movq (%rbp,%rbx,8), %rax
leaq (%r14,%r14,2), %rcx
shlq $0x4, %rcx
movq (%rax,%rcx), %r15
movq 0x8(%rax,%rcx), %r13
movq 0x10(%rax,%rcx), %r12
movq 0x20(%rsp), %rdi
movq %rbp, %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x2f9138
cmpq $0x0, 0x18(%rsp)
jne 0x134714
movq (%rbp), %rdi
leaq 0x246813(%rip), %rbx    # 0x37af0a
movq %rbx, %rsi
movl $0xf4, %edx
callq 0x1045eb
movq %rbp, %rdi
movq %rbx, %rsi
movl $0xf4, %edx
callq 0x1045eb
cmpq %r13, %r15
cmovlq %r15, %r13
cmpq %r12, %r13
cmovgeq %r12, %r13
movq %r13, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x3f309
callq 0x3f342