// File: /workspace/github_c_makefile_star2_O0/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:
subq $0xc8, %rsp
movq 0xe0(%rsp), %rax
movq 0xd8(%rsp), %rax
movq 0xd0(%rsp), %rax
movq %rdi, 0xb8(%rsp)
movq %rsi, 0xb0(%rsp)
movq %rdx, 0xa8(%rsp)
movq %rcx, 0xa0(%rsp)
movq %r8, 0x98(%rsp)
movq %r9, 0x90(%rsp)
movq 0xb8(%rsp), %rdi
movq 0x90(%rsp), %rsi
callq 0x1a36b0
cmpq $0x0, 0x90(%rsp)
je 0x19fcfa
cmpq $0x0, 0xe0(%rsp)
jne 0x19fd0b
movq $0x0, 0xc0(%rsp)
jmp 0x1a0041
cmpq $0x1, 0xe0(%rsp)
jne 0x19fdc2
movq 0xb8(%rsp), %rdi
movq 0x90(%rsp), %rsi
addq $0x1, %rsi
movq 0xe0(%rsp), %rax
addq $0x1, %rax
imulq %rax, %rsi
subq $0x1, %rsi
movq 0x90(%rsp), %rdx
movl $0x30, %ecx
movl $0x8, %r8d
callq 0x1a3420
movq 0xb8(%rsp), %rdi
movq 0xb0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
movq 0xa0(%rsp), %rcx
movq 0x98(%rsp), %r8
movq 0x90(%rsp), %r9
movq 0xd0(%rsp), %r11
movq 0xd8(%rsp), %r10
movq 0xe0(%rsp), %rax
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x485890
movq %rax, 0xc0(%rsp)
jmp 0x1a0041
movq 0xb8(%rsp), %rdi
movq 0x90(%rsp), %rsi
movq 0xe0(%rsp), %rdx
movl $0x30, %r8d
movq %r8, %rcx
callq 0x1a3660
testb $0x1, %al
jne 0x19fdee
jmp 0x19fe56
movq 0xb8(%rsp), %rdi
movq 0xb0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
movq 0xa0(%rsp), %rcx
movq 0x98(%rsp), %r8
movq 0x90(%rsp), %r9
movq 0xd0(%rsp), %r11
movq 0xd8(%rsp), %r10
movq 0xe0(%rsp), %rax
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x485890
movq %rax, 0xc0(%rsp)
jmp 0x1a0041
jmp 0x19fe58
jmp 0x19fe5a
movq 0xb8(%rsp), %rdi
movq 0x90(%rsp), %rsi
movq 0xe0(%rsp), %rdx
movl $0x30, %r8d
movq %r8, %rcx
callq 0x1a3420
movq 0xb8(%rsp), %rdi
movq 0xb0(%rsp), %rsi
movq 0xa0(%rsp), %rdx
movq 0x98(%rsp), %rcx
movq 0x90(%rsp), %r8
movq 0xd0(%rsp), %r9
movq 0xd8(%rsp), %r10
movq 0xe0(%rsp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x1a0060
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rdi
callq 0x1ac4c0
movq %rax, 0x68(%rsp)
movq 0x50(%rsp), %rdi
callq 0x1acb30
testb $0x1, %al
jne 0x19fef5
jmp 0x1a0026
movq 0xb0(%rsp), %rdi
callq 0x1d1450
movq %rax, 0x48(%rsp)
movq 0x98(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x50(%rsp), %rdi
callq 0x1ac590
movq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x38(%rsp)
movq %rdx, 0x40(%rsp)
addq 0x38(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0xd8(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x50(%rsp), %rdi
callq 0x1ac590
movq %rax, %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
addq 0x30(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x50(%rsp), %rdi
callq 0x1ac970
movq %rax, 0x88(%rsp)
movq 0x50(%rsp), %rdi
callq 0x1aca50
movq %rax, 0x78(%rsp)
movq 0xa8(%rsp), %rdi
movq 0xa0(%rsp), %rsi
addq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rdx
movq 0xd0(%rsp), %rcx
addq 0x70(%rsp), %rcx
movq 0x78(%rsp), %r8
callq 0x129f60
movq 0xb8(%rsp), %rdi
movq 0x48(%rsp), %rsi
movq 0xa8(%rsp), %rdx
movq 0xa0(%rsp), %rcx
movq 0x80(%rsp), %r8
movq 0x88(%rsp), %r9
movq 0xd0(%rsp), %r11
movq 0x70(%rsp), %r10
movq 0x78(%rsp), %rax
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x19e910
movq 0x48(%rsp), %rdi
callq 0x1d1150
jmp 0x1a0034
movq $0x0, 0xc0(%rsp)
jmp 0x1a0041
movq 0x68(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0xc0(%rsp), %rax
addq $0xc8, %rsp
retq
nopw %cs:(%rax,%rax)