// File: /workspace/github_c_makefile_star2_O2/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 $0x1b8, %rsp            # imm = 0x1B8
movq %r9, %rbp
movq %r8, %r13
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, 0x30(%rsp)
movq %rdi, %r15
movq 0x200(%rsp), %r14
movq 0x1f8(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x1f0(%rsp), %rax
movq %rax, 0x60(%rsp)
movq %r9, %rsi
callq 0xf9932
testq %rbp, %rbp
sete %al
testq %r14, %r14
sete %cl
orb %al, %cl
je 0xf8844
xorl %ebx, %ebx
movq %rbx, %rax
jmp 0xf8899
cmpq $0x1, %r14
jne 0xf88ab
leaq 0x1(,%rbp,2), %rsi
pushq $0x30
popq %rcx
pushq $0x8
popq %r8
movq %r15, %rdi
movq %rbp, %rdx
callq 0xf9854
movq 0x58(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x60(%rsp), %rax
movq %rax, (%rsp)
movq $0x1, 0x10(%rsp)
movq %r15, %rdi
movq 0x30(%rsp), %rsi
movq %r12, %rdx
movq %rbx, %rcx
movq %r13, %r8
movq %rbp, %r9
callq 0x29531f
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, 0x50(%rsp)
movq %r15, %r13
pushq $0x30
popq %r15
movq %r13, %rdi
movq %rbp, %rsi
movq %r14, %rdx
movq %r15, %rcx
movq %r15, %r8
callq 0xf9929
testb %al, %al
je 0xf88fb
movq %r13, %rdi
movq 0x30(%rsp), %rsi
movq %r12, %rdx
movq %rbx, %rcx
movq 0x50(%rsp), %r8
movq %rbp, %r9
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x29531f
movq %r12, 0x98(%rsp)
movq %rbx, 0x48(%rsp)
movq %r13, %rdi
movq %rbp, %rsi
movq %r14, 0xc0(%rsp)
movq %r14, %rdx
movq %r15, %rcx
movq %r15, %r8
callq 0xf9854
movq %r13, %rdi
callq 0xf9975
movq %rax, %r14
movq %r13, 0xa0(%rsp)
movq %r13, %rdi
callq 0xf9981
movq %rax, %rbx
movq %rbp, 0x80(%rsp)
movq 0x30(%rsp), %rbp
movq %rbp, %rdi
callq 0x114a29
movq %rax, %r12
movq %rbp, %rdi
movq 0x80(%rsp), %rbp
callq 0x114a6a
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
movq %rcx, (%r14)
movq %rcx, 0x8(%r14)
movq %rcx, 0x10(%r14)
andq $0x0, 0x18(%r14)
addq %r12, %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movups %xmm0, 0x10(%rbx)
movq %rbx, 0x28(%rsp)
movups %xmm0, 0x20(%rbx)
pushq $0x1
popq %rcx
cmpq %rbp, %rcx
ja 0xf89ee
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
movq %rdx, (%r14,%r15)
movq %rax, 0x8(%r14,%r15)
movq %rdx, 0x10(%r14,%r15)
andq $0x0, 0x18(%r14,%r15)
movq 0x28(%rsp), %rdx
movq %rcx, (%rdx,%r15)
andq $0x0, 0x8(%rdx,%r15)
movq %rcx, 0x10(%rdx,%r15)
andq $0x0, 0x18(%rdx,%r15)
movq %rcx, 0x20(%rdx,%r15)
andq $0x0, 0x28(%rdx,%r15)
incq %rcx
addq $0x30, %r15
jmp 0xf899d
movq 0xa0(%rsp), %rdi
callq 0xf99de
movq %rax, %rbx
movq 0x60(%rsp), %rax
movq 0x58(%rsp), %rcx
addq %rcx, %rax
decq %rax
movq %rax, 0xb8(%rsp)
movq 0x28(%rsp), %rcx
leaq 0x10(%rcx), %rax
movq %rax, 0xb0(%rsp)
leaq 0x20(%rcx), %rax
movq %rax, 0xa8(%rsp)
movq 0x50(%rsp), %rax
movq 0x48(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0xc8(%rsp)
pushq $0x1
popq %r13
movq %rbx, 0x88(%rsp)
cmpq 0xc0(%rsp), %r13
ja 0xf8f3b
movq 0xb8(%rsp), %rax
movb (%rax,%r13), %al
movb %al, 0x27(%rsp)
movq 0x30(%rsp), %r15
movq %r15, %rdi
callq 0x114a29
movq %rax, %r12
movq %r15, %rdi
callq 0x114a6a
movq %rax, %rcx
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movaps %xmm0, 0x120(%rsp)
movaps %xmm1, 0x130(%rsp)
movaps %xmm2, 0x140(%rsp)
movq 0x28(%rsp), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movaps %xmm0, 0x180(%rsp)
movaps %xmm1, 0x190(%rsp)
movaps %xmm2, 0x1a0(%rsp)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, (%r14)
movq %rax, 0x8(%r14)
movq %r12, 0x38(%rsp)
movq %rcx, 0xd8(%rsp)
leaq (%rcx,%r12), %rax
movq %rax, 0x10(%r14)
movl $0x0, %r15d
testq %rax, %rax
movq %rax, 0xd0(%rsp)
cmovgq %rax, %r15
movq %r15, 0x18(%r14)
jg 0xf8b3b
movq 0x28(%rsp), %rax
andq $0x0, (%rax)
movq %r13, 0x8(%rax)
andq $0x0, 0x10(%rax)
movq %r13, 0x18(%rax)
andq $0x0, 0x20(%rax)
movq %r13, 0x28(%rax)
movq %rbx, %rdi
callq 0xff5d4
cmpq %rax, %r15
movq %r13, 0x78(%rsp)
jle 0xf8baa
movq 0x18(%r14), %rsi
movq 0x28(%rsp), %rax
pushq $0x8
popq %rcx
cmpq (%r14), %rsi
je 0xf8b84
movq 0xb0(%rsp), %rax
pushq $0x18
popq %rcx
cmpq 0x8(%r14), %rsi
je 0xf8b84
movq 0xa8(%rsp), %rax
pushq $0x28
popq %rcx
cmpq 0x10(%r14), %rsi
jne 0xf8f32
movq (%rax), %rdx
movq 0x28(%rsp), %rax
movq (%rax,%rcx), %rcx
movq %rbx, %rdi
movq %rdx, 0x68(%rsp)
movq %rcx, 0x70(%rsp)
xorl %r8d, %r8d
movq %r13, %r9
callq 0xff728
jmp 0xf8bbc
movq $0x0, 0x70(%rsp)
movq $0x0, 0x68(%rsp)
xorl %r13d, %r13d
pushq $0x1
popq %rbx
cmpq %rbp, %rbx
ja 0xf8f1d
leaq (%r14,%r13), %rax
movq %rax, 0xe8(%rsp)
movups 0x30(%r14,%r13), %xmm0
movups 0x40(%r14,%r13), %xmm1
movups 0x50(%r14,%r13), %xmm2
movaps %xmm2, 0x110(%rsp)
movaps %xmm1, 0x100(%rsp)
movaps %xmm0, 0xf0(%rsp)
movq %r14, %r12
movq 0x28(%rsp), %r14
leaq (%r14,%r13), %rax
movq %rax, 0xe0(%rsp)
movups 0x30(%r14,%r13), %xmm0
movups 0x40(%r14,%r13), %xmm1
movups 0x50(%r14,%r13), %xmm2
movaps %xmm0, 0x150(%rsp)
movaps %xmm1, 0x160(%rsp)
movaps %xmm2, 0x170(%rsp)
movq 0xc8(%rsp), %rax
movq %rbx, 0x90(%rsp)
movzbl -0x1(%rax,%rbx), %esi
movzbl 0x27(%rsp), %edx
movq 0x30(%rsp), %rdi
callq 0x114b2c
movq 0x138(%rsp), %rcx
leaq (%rcx,%rax), %rdi
movq %rax, 0x40(%rsp)
movabsq $-0x8000000000000000, %rbp # imm = 0x8000000000000000
cmpq %rbp, %rcx
cmoveq %rbp, %rdi
movq %rdi, 0x30(%r12,%r13)
andl $0x0, (%rsp)
leaq 0x120(%rsp), %rsi
leaq 0x180(%rsp), %rdx
movq %rax, %rcx
movq 0x38(%rsp), %r8
movq 0xd8(%rsp), %rbx
movq %rbx, %r9
callq 0xf958e
movq %rax, 0x30(%r14,%r13)
movq %rdx, 0x38(%r14,%r13)
movq 0x8(%r12,%r13), %rax
movq 0x18(%r12,%r13), %rcx
leaq (%rax,%rbx), %rdx
cmpq %rbp, %rax
cmoveq %rbp, %rdx
movq 0xd0(%rsp), %r15
leaq (%rcx,%r15), %rdi
cmpq %rbp, %rcx
cmoveq %rbp, %rdi
cmpq %rdi, %rdx
cmovgq %rdx, %rdi
movq %rdi, 0x38(%r12,%r13)
movl $0x1, (%rsp)
movq 0xe8(%rsp), %rsi
movq 0xe0(%rsp), %rdx
movq 0x40(%rsp), %rcx
movq 0x38(%rsp), %r8
movq %rbx, %r9
callq 0xf958e
movq %rax, 0x40(%r14,%r13)
movq %rdx, 0x48(%r14,%r13)
movq 0x100(%rsp), %rax
movq 0x108(%rsp), %rcx
leaq (%rax,%rbx), %rdx
cmpq %rbp, %rax
cmoveq %rbp, %rdx
leaq (%rcx,%r15), %rdi
cmpq %rbp, %rcx
cmoveq %rbp, %rdi
cmpq %rdi, %rdx
cmovgq %rdx, %rdi
movq %rdi, 0x40(%r12,%r13)
movl $0x2, (%rsp)
leaq 0xf0(%rsp), %rsi
leaq 0x150(%rsp), %rdx
movq 0x40(%rsp), %rcx
movq 0x38(%rsp), %r8
movq %rbx, %r9
callq 0xf958e
movq %rax, 0x50(%r14,%r13)
movq %rdx, 0x58(%r14,%r13)
movq %r12, %r14
movq 0x30(%r12,%r13), %rax
movq 0x38(%r12,%r13), %r15
cmpq %r15, %rax
cmovgq %rax, %r15
movq 0x40(%r12,%r13), %rax
cmpq %rax, %r15
cmovleq %rax, %r15
testq %r15, %r15
movl $0x0, %eax
cmovleq %rax, %r15
movq %r15, 0x48(%r12,%r13)
jg 0xf8def
movq 0x28(%rsp), %rcx
movq 0x90(%rsp), %rdx
movq %rdx, 0x30(%rcx,%r13)
movq 0x78(%rsp), %rax
movq %rax, 0x38(%rcx,%r13)
movq %rdx, 0x40(%rcx,%r13)
movq %rax, 0x48(%rcx,%r13)
movq %rdx, 0x50(%rcx,%r13)
movq %rax, 0x58(%rcx,%r13)
movq 0x88(%rsp), %rdi
callq 0xff5d4
cmpq %rax, %r15
jle 0xf8e37
movq 0x90(%rsp), %rbx
imulq $0x30, %rbx, %rax
movq 0x48(%r14,%r13), %rsi
cmpq 0x30(%r14,%r13), %rsi
movq 0x80(%rsp), %rbp
jne 0xf8e49
movq 0x28(%rsp), %rdx
leaq (%rdx,%r13), %rcx
addq $0x30, %rcx
addq %rdx, %rax
addq $0x8, %rax
jmp 0xf8e8c
movq 0x80(%rsp), %rbp
movq 0x90(%rsp), %rbx
jmp 0xf8eb1
cmpq 0x38(%r14,%r13), %rsi
jne 0xf8e66
movq 0x28(%rsp), %rdx
leaq (%rdx,%rax), %rcx
addq $0x10, %rcx
addq %rdx, %rax
addq $0x18, %rax
jmp 0xf8e8c
cmpq 0x40(%r14,%r13), %rsi
movq 0x70(%rsp), %rcx
movq 0x68(%rsp), %rdx
jne 0xf8e92
movq 0x28(%rsp), %rdx
leaq (%rdx,%rax), %rcx
addq $0x20, %rcx
leaq (%rdx,%r13), %rax
addq $0x58, %rax
movq (%rcx), %rdx
movq (%rax), %rcx
movq 0x88(%rsp), %rdi
movq %rdx, 0x68(%rsp)
movq %rcx, 0x70(%rsp)
movq %rbx, %r8
movq 0x78(%rsp), %r9
callq 0xff728
movaps 0xf0(%rsp), %xmm0
movaps 0x100(%rsp), %xmm1
movaps 0x110(%rsp), %xmm2
movaps %xmm2, 0x140(%rsp)
movaps %xmm1, 0x130(%rsp)
movaps %xmm0, 0x120(%rsp)
movaps 0x150(%rsp), %xmm0
movaps 0x160(%rsp), %xmm1
movaps 0x170(%rsp), %xmm2
movaps %xmm0, 0x180(%rsp)
movaps %xmm1, 0x190(%rsp)
movaps %xmm2, 0x1a0(%rsp)
incq %rbx
addq $0x30, %r13
jmp 0xf8bc2
movq 0x78(%rsp), %r13
incq %r13
movq 0x88(%rsp), %rbx
jmp 0xf8a54
xorl %ecx, %ecx
xorl %edx, %edx
jmp 0xf8b90
movq %rbx, %rdi
callq 0xff5d4
movq %rbx, %r12
movq %rax, %rbx
movq %r12, %rdi
callq 0xff8b0
testb %al, %al
je 0xf883d
movq 0x30(%rsp), %rdi
callq 0x114c1c
movq %rax, 0x38(%rsp)
movq %r12, %rdi
callq 0xff659
movq 0x50(%rsp), %rbp
addq %rax, %rbp
movq %r12, %rdi
callq 0xff659
movq %rdx, %r15
addq 0x58(%rsp), %r15
movq %r12, %rdi
callq 0xff7c0
movq %rax, %r14
movq %rax, 0x40(%rsp)
movq %r12, %rdi
callq 0xff838
movq %rax, %r13
movq 0x48(%rsp), %rax
leaq (%rax,%rbp), %rsi
movq 0x60(%rsp), %r12
leaq (%r12,%r15), %rcx
movq 0x98(%rsp), %rdi
movq %r14, %rdx
movq %r13, %r8
callq 0xb4f1f
movq %r13, 0x10(%rsp)
movq %r15, 0x8(%rsp)
movq %r12, (%rsp)
movq 0xa0(%rsp), %rdi
movq 0x38(%rsp), %r14
movq %r14, %rsi
movq 0x98(%rsp), %rdx
movq 0x48(%rsp), %rcx
movq %rbp, %r8
movq 0x40(%rsp), %r9
callq 0xf7921
movq %r14, %rdi
callq 0x114a03
jmp 0xf883f