// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/linearalign_affinegapcost.c
// Function: gt_linearalign_affinegapcost_compute_local_generic
GtWord gt_linearalign_affinegapcost_compute_local_generic(
                                            GtLinspaceManagement *spacemanager,
                                            const GtScoreHandler *scorehandler,
                                            GtAlignment *align,
                                            const GtUchar *useq,
                                            GtUword ustart,
                                            GtUword ulen,
                                            const GtUchar *vseq,
                                            GtUword vstart,
                                            GtUword vlen)
{
  GtUword ulen_part, ustart_part, vlen_part, vstart_part;
  GtWord score;
  GtAffinealignDPentry *Atabcolumn;
  Starttabentry *Starttabcolumn;
  GtMaxcoordvalue *max;

  gt_linspace_management_set_ulen(spacemanager, ulen);
  if (ulen == 0UL || vlen == 0UL)
  {
     /* empty alignment */
    return 0;
  }
  else if (vlen == 1UL)
  {
    gt_linspace_management_check_local(spacemanager,
                                       (ulen+1)*(vlen+1)-1, ulen,
                                       sizeof (*Atabcolumn),
                                       sizeof (Atabcolumn));
    return gt_affinealign_calculate_local_generic(spacemanager,scorehandler,
                                                  align,
                                                  useq, ustart, ulen,
                                                  vseq, vstart, vlen);
  }
  else if (gt_linspace_management_checksquare_local(spacemanager, ulen, vlen,
                                                    sizeof (*Atabcolumn),
                                                    sizeof (*Starttabcolumn)))
  {
    /* call alignment function for square space */
    return gt_affinealign_calculate_local_generic(spacemanager, scorehandler,
                                                  align, useq, ustart, ulen,
                                                  vseq, vstart, vlen);
  }

  gt_linspace_management_check_local(spacemanager, ulen, vlen,
                                     sizeof (*Atabcolumn),
                                     sizeof (*Starttabcolumn));

  max = evaluateallAStabcolumns(spacemanager, scorehandler,
                                useq, ustart, ulen,
                                vseq, vstart, vlen);

  score = gt_maxcoordvalue_get_value(max);

  if (gt_maxcoordvalue_get_length_safe(max))
  {
    GtScoreHandler *costhandler = gt_scorehandler2costhandler(scorehandler);

    ustart_part = ustart+(gt_maxcoordvalue_get_start(max)).a;
    vstart_part = vstart+(gt_maxcoordvalue_get_start(max)).b;
    ulen_part = gt_maxcoordvalue_get_row_length(max);
    vlen_part = gt_maxcoordvalue_get_col_length(max);

    gt_alignment_set_seqs(align,useq + ustart_part,ulen_part,
                                vseq + vstart_part,vlen_part);

    /* change score to cost, from maximizing to minimizing */

    gt_calc_affinealign_linear(spacemanager,
                               costhandler,
                               align,
                               useq, ustart_part, ulen_part,
                               vseq, vstart_part, vlen_part);
    gt_scorehandler_delete(costhandler);
  } else
  {
     /* empty alignment */
     return 0;
  }
  return score;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %r9, %rbp
movq %r8, %rbx
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, 0x8(%rsp)
movq %rdi, %r13
movq 0x190(%rsp), %r14
movq 0x188(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x180(%rsp), %rax
movq %rax, 0x30(%rsp)
movq %r9, %rsi
callq 0x163b84
testq %rbp, %rbp
sete %al
testq %r14, %r14
sete %cl
orb %al, %cl
je 0x162c66
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x148, %rsp            # imm = 0x148
jmp 0x162cb8
cmpq $0x1, %r14
jne 0x162cc3
leaq 0x1(,%rbp,2), %rsi
movl $0x30, %ecx
movl $0x8, %r8d
movq %r13, %rdi
movq %rbp, %rdx
callq 0x163ad4
subq $0x8, %rsp
movq %r13, %rdi
movq 0x10(%rsp), %rsi
movq %r12, %rdx
movq %r15, %rcx
movq %rbx, %r8
movq %rbp, %r9
pushq $0x1
pushq 0x50(%rsp)
pushq 0x48(%rsp)
callq 0x30376b
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, 0x38(%rsp)
movl $0x30, %r15d
movl $0x30, %ecx
movl $0x30, %r8d
movq %r13, %rdi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x163b79
testb %al, %al
je 0x162d17
movq %r13, %rdi
movq 0x8(%rsp), %rsi
movq %r12, %rdx
movq 0x38(%rsp), %rcx
movq %rbx, %r8
movq %rbp, %r9
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x30376b
movq %r12, 0xf8(%rsp)
movq %rbx, 0x78(%rsp)
movl $0x30, %ecx
movl $0x30, %r8d
movq %r13, %rdi
movq %rbp, %rsi
movq %r14, 0x130(%rsp)
movq %r14, %rdx
callq 0x163ad4
movq %r13, %rdi
callq 0x163b94
movq %rax, %r14
movq %r13, %rdi
callq 0x163ba0
movq %rax, %rbx
movq %rbp, 0x80(%rsp)
movq 0x8(%rsp), %rbp
movq %rbp, %rdi
callq 0x1797eb
movq %rax, %r12
movq %rbp, %rdi
callq 0x1797fb
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
movq %rdi, (%r14)
movq %rdi, 0x8(%r14)
movq %rdi, 0x10(%r14)
movq $0x0, 0x18(%r14)
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movups %xmm0, 0x10(%rbx)
movups %xmm0, 0x20(%rbx)
addq %r12, %rax
movq 0x80(%rsp), %rcx
leaq 0x1(%rcx), %rdx
cmpq $0x3, %rdx
movl $0x2, %ecx
cmovaeq %rdx, %rcx
movl $0x1, %edx
xorl %esi, %esi
movq %rdi, (%r14,%r15)
movq %rax, 0x8(%r14,%r15)
movq %rdi, 0x10(%r14,%r15)
movq %rsi, 0x18(%r14,%r15)
movq %rdx, (%rbx,%r15)
movq %rsi, 0x8(%rbx,%r15)
movq %rdx, 0x10(%rbx,%r15)
movq %rsi, 0x18(%rbx,%r15)
movq %rdx, 0x20(%rbx,%r15)
movq %rsi, 0x28(%rbx,%r15)
incq %rdx
addq $0x30, %r15
cmpq %rdx, %rcx
jne 0x162dc9
movq %r13, %rdi
callq 0x163bca
movq %rax, %r12
movq 0x30(%rsp), %rax
movq 0x40(%rsp), %rcx
addq %rcx, %rax
decq %rax
movq %rax, 0x128(%rsp)
leaq 0x8(%rbx), %rax
movq %rax, 0x120(%rsp)
leaq 0x10(%rbx), %rax
movq %rax, 0x118(%rsp)
leaq 0x18(%rbx), %rax
movq %rax, 0x110(%rsp)
leaq 0x20(%rbx), %rax
movq %rax, 0x108(%rsp)
leaq 0x28(%rbx), %rax
movq %rax, 0x100(%rsp)
movq 0x78(%rsp), %rax
movq 0x38(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x138(%rsp)
movl $0x1, %ecx
movq %r13, 0xf0(%rsp)
movq %r12, 0x58(%rsp)
movq 0x128(%rsp), %rax
movq %rcx, 0x10(%rsp)
movb (%rax,%rcx), %al
movb %al, 0x7(%rsp)
movq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x1797eb
movq %rax, %r13
movq %r15, %rdi
callq 0x1797fb
movq %rax, %rcx
movq (%r14), %rax
movq %rax, 0x18(%rsp)
movq 0x8(%r14), %rax
movq %rax, 0xa0(%rsp)
movq 0x10(%r14), %rbp
movq 0x18(%r14), %rax
movq %rax, 0x70(%rsp)
movq (%rbx), %rax
movq %rax, 0x68(%rsp)
movq 0x8(%rbx), %rax
movq %rax, 0x60(%rsp)
movq 0x10(%rbx), %rax
movq %rax, 0xb0(%rsp)
movq 0x18(%rbx), %rax
movq %rax, 0xa8(%rsp)
movq 0x20(%rbx), %rax
movq %rax, 0x90(%rsp)
movq 0x28(%rbx), %rax
movq %rax, 0x98(%rsp)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, (%r14)
movq %rax, 0x8(%r14)
movq %rcx, 0xb8(%rsp)
addq %rcx, %r13
movq %r13, 0x10(%r14)
movl $0x0, %r15d
testq %r13, %r13
cmovgq %r13, %r15
movq %r15, 0x18(%r14)
jg 0x162f6d
xorl %ecx, %ecx
movq %rcx, (%rbx)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rbx)
movq %rcx, 0x10(%rbx)
movq %rax, 0x18(%rbx)
movq %rcx, 0x20(%rbx)
movq %rax, 0x28(%rbx)
movq %r12, %rdi
callq 0x168397
cmpq %rax, %r15
movq %r13, 0x88(%rsp)
jle 0x162fe8
movq 0x18(%r14), %rsi
movq %rbx, %rax
movq 0x120(%rsp), %rcx
cmpq (%r14), %rsi
je 0x162fc6
movq 0x118(%rsp), %rax
movq 0x110(%rsp), %rcx
cmpq 0x8(%r14), %rsi
je 0x162fc6
movq 0x108(%rsp), %rax
movq 0x100(%rsp), %rcx
cmpq 0x10(%r14), %rsi
jne 0x1633ed
movq (%rax), %rdx
movq (%rcx), %rcx
movq %r12, %rdi
movq %rdx, 0x50(%rsp)
movq %rcx, 0x48(%rsp)
xorl %r8d, %r8d
movq 0x10(%rsp), %r9
callq 0x1683f6
jmp 0x162ffa
movq $0x0, 0x50(%rsp)
movq $0x0, 0x48(%rsp)
movl $0x1, %r12d
xorl %r15d, %r15d
movq %rbp, 0x140(%rsp)
movq 0x18(%rsp), %rbp
movq 0x70(%rsp), %r13
movq 0x30(%r14,%r15), %rax
movq %rax, 0x18(%rsp)
movq 0x38(%r14,%r15), %rax
movq %rax, 0xd8(%rsp)
movq 0x40(%r14,%r15), %rax
movq %rax, 0xe8(%rsp)
movq 0x48(%r14,%r15), %rax
movq %rax, 0x70(%rsp)
movq 0x30(%rbx,%r15), %rax
movq %rax, 0x28(%rsp)
movq 0x38(%rbx,%r15), %rax
movq %rax, 0x20(%rsp)
movq 0x40(%rbx,%r15), %rax
movq %rax, 0xe0(%rsp)
movq 0x48(%rbx,%r15), %rax
movq %rax, 0xd0(%rsp)
movq 0x50(%rbx,%r15), %rax
movq %rax, 0xc8(%rsp)
movq 0x58(%rbx,%r15), %rax
movq %rax, 0xc0(%rsp)
movq 0x138(%rsp), %rax
movzbl -0x1(%rax,%r12), %esi
movzbl 0x7(%rsp), %edx
movq 0x8(%rsp), %rdi
callq 0x17982a
leaq (%rax,%r13), %rcx
movabsq $-0x8000000000000000, %r8 # imm = 0x8000000000000000
cmpq %r8, %r13
cmoveq %r8, %rcx
movq %rcx, 0x30(%r14,%r15)
addq %rax, %rbp
cmpq %rcx, %rbp
jne 0x1630de
movq 0x68(%rsp), %rdx
movq 0x60(%rsp), %rsi
movq 0x88(%rsp), %r9
jmp 0x163133
movq 0xa0(%rsp), %rdx
addq %rax, %rdx
cmpq %rcx, %rdx
movq 0x88(%rsp), %r9
movq 0xb0(%rsp), %rdx
movq 0xa8(%rsp), %rsi
je 0x163133
addq 0x140(%rsp), %rax
cmpq %rcx, %rax
movq 0x68(%rsp), %rax
cmoveq 0x90(%rsp), %rax
movq 0x60(%rsp), %rcx
cmoveq 0x98(%rsp), %rcx
movq %rax, %rdx
movq %rcx, %rsi
leaq (%r12,%r12,2), %rbp
shlq $0x4, %rbp
movq %rdx, 0x30(%rbx,%r15)
movq %rsi, 0x38(%rbx,%r15)
movq 0x8(%r14,%r15), %rax
movq 0x18(%r14,%r15), %rcx
movq 0xb8(%rsp), %rdx
leaq (%rax,%rdx), %rsi
cmpq %r8, %rax
movq %rsi, %rax
cmoveq %r8, %rax
leaq (%rcx,%r9), %rdx
cmpq %r8, %rcx
cmoveq %r8, %rdx
cmpq %rdx, %rax
cmovgq %rax, %rdx
movq %rdx, 0x38(%r14,%r15)
leaq (%rbx,%rbp), %rax
addq $-0x30, %rax
movq (%r14,%r15), %rdi
addq %r9, %rdi
movl $0x8, %ecx
cmpq %rdx, %rdi
je 0x1631c3
cmpq %rdx, %rsi
jne 0x1631a5
addq $0x10, %rax
movl $0x18, %ecx
jmp 0x1631c3
movq 0x10(%r14,%r15), %rax
addq %r9, %rax
xorl %ecx, %ecx
cmpq %rdx, %rax
sete %cl
shll $0x5, %ecx
leaq (%rbx,%r15), %rax
addq %rcx, %rax
orq $0x8, %rcx
leaq (%rbx,%r15), %rdx
movq (%rcx,%rdx), %rcx
movq (%rax), %rax
movq %rax, 0x40(%rbx,%r15)
movq %rcx, 0x48(%rbx,%r15)
movq 0xb8(%rsp), %rax
movq 0xe8(%rsp), %rcx
addq %rcx, %rax
cmpq %r8, %rcx
movq %rax, %rdx
cmoveq %r8, %rdx
movq 0x70(%rsp), %rsi
leaq (%rsi,%r9), %rcx
cmpq %r8, %rsi
cmoveq %r8, %rcx
cmpq %rcx, %rdx
cmovgq %rdx, %rcx
movq %rcx, 0x40(%r14,%r15)
movq 0x18(%rsp), %rdx
leaq (%rdx,%r9), %rdi
movq 0x28(%rsp), %rdx
movq 0x20(%rsp), %rsi
cmpq %rcx, %rdi
je 0x163269
movq 0xd8(%rsp), %rdx
leaq (%rdx,%r9), %rdi
movq 0xe0(%rsp), %rdx
movq 0xd0(%rsp), %rsi
cmpq %rcx, %rdi
je 0x163269
cmpq %rcx, %rax
movq 0x28(%rsp), %rdx
cmoveq 0xc8(%rsp), %rdx
movq 0x20(%rsp), %rsi
cmoveq 0xc0(%rsp), %rsi
movq %rdx, 0x50(%rbx,%r15)
movq %rsi, 0x58(%rbx,%r15)
movq 0x30(%r14,%r15), %rax
movq 0x38(%r14,%r15), %r13
cmpq %r13, %rax
cmovgq %rax, %r13
movq 0x40(%r14,%r15), %rax
cmpq %rax, %r13
cmovleq %rax, %r13
testq %r13, %r13
movl $0x0, %eax
cmovleq %rax, %r13
movq %r13, 0x48(%r14,%r15)
jg 0x1632c6
movq %r12, 0x30(%rbx,%r15)
movq 0x10(%rsp), %rax
movq %rax, 0x38(%rbx,%r15)
movq %r12, 0x40(%rbx,%r15)
movq %rax, 0x48(%rbx,%r15)
movq %r12, 0x50(%rbx,%r15)
movq %rax, 0x58(%rbx,%r15)
movq 0x58(%rsp), %rdi
callq 0x168397
cmpq %rax, %r13
jle 0x16334f
movq 0x48(%r14,%r15), %rsi
cmpq 0x30(%r14,%r15), %rsi
jne 0x1632f3
leaq (%rbx,%r15), %rax
addq $0x30, %rax
leaq (%rbx,%rbp), %rcx
addq $0x8, %rcx
jmp 0x16332d
cmpq 0x38(%r14,%r15), %rsi
jne 0x16330c
leaq (%rbx,%rbp), %rax
addq $0x10, %rax
leaq (%rbx,%rbp), %rcx
addq $0x18, %rcx
jmp 0x16332d
cmpq 0x40(%r14,%r15), %rsi
movq 0x50(%rsp), %rdx
movq 0x48(%rsp), %rcx
jne 0x163333
leaq (%rbx,%rbp), %rax
addq $0x20, %rax
leaq (%rbx,%r15), %rcx
addq $0x58, %rcx
movq (%rax), %rdx
movq (%rcx), %rcx
movq 0x58(%rsp), %rdi
movq %rdx, 0x50(%rsp)
movq %rcx, 0x48(%rsp)
movq %r12, %r8
movq 0x10(%rsp), %r9
callq 0x1683f6
incq %r12
addq $0x30, %r15
movq 0xe8(%rsp), %rbp
movq 0xd8(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0xc0(%rsp), %rax
movq %rax, 0x98(%rsp)
movq 0xc8(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0xd0(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0xe0(%rsp), %rax
movq %rax, 0xb0(%rsp)
cmpq 0x80(%rsp), %r12
jbe 0x163003
movq 0x10(%rsp), %rcx
incq %rcx
cmpq 0x130(%rsp), %rcx
movq 0x58(%rsp), %r12
jbe 0x162e8b
jmp 0x1633f6
xorl %ecx, %ecx
xorl %edx, %edx
jmp 0x162fcc
movq %r12, %rdi
callq 0x168397
movq %rax, %rbx
movq %r12, %rdi
callq 0x168464
testb %al, %al
je 0x162c58
movq 0x8(%rsp), %rdi
callq 0x1798c2
movq %rax, 0x28(%rsp)
movq %r12, %rdi
callq 0x1683ba
movq 0x78(%rsp), %rbp
addq %rax, %rbp
movq %r12, %rdi
callq 0x1683ba
movq %rdx, %r15
addq 0x40(%rsp), %r15
movq %r12, %rdi
callq 0x16842c
movq %rax, %r13
movq %rax, 0x20(%rsp)
movq %r12, %rdi
callq 0x168448
movq %rax, %r8
movq %rax, 0x18(%rsp)
movq 0x38(%rsp), %r12
leaq (%r12,%rbp), %rsi
movq 0x30(%rsp), %rax
leaq (%rax,%r15), %rcx
movq 0xf8(%rsp), %r14
movq %r14, %rdi
movq %r13, %rdx
callq 0x126bf9
subq $0x8, %rsp
movq 0xf8(%rsp), %rdi
movq 0x30(%rsp), %r13
movq %r13, %rsi
movq %r14, %rdx
movq %r12, %rcx
movq %rbp, %r8
movq 0x28(%rsp), %r9
pushq 0x20(%rsp)
pushq %r15
pushq 0x48(%rsp)
callq 0x161b57
addq $0x20, %rsp
movq %r13, %rdi
callq 0x1797c3
jmp 0x162c5a