// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/diagonalbandalign.c
// Function: diagonalband_linear_distance_only
static GtUword diagonalband_linear_distance_only(const GtUchar *useq,
                                                 GtUword ustart,
                                                 GtUword ulen,
                                                 const GtUchar *vseq,
                                                 GtUword vstart,
                                                 GtUword vlen,
                                                 GtWord left_dist,
                                                 GtWord right_dist,
                                                 GtUword matchcost,
                                                 GtUword mismatchcost,
                                                 GtUword gapcost)
{
  GtUword distance, colindex, rowindex, low_row, high_row, width, val,
        *EDtabcolumn, northwestEDtabentry, westEDtabentry = GT_UWORD_MAX;
  bool last_row = false;

  distance = GT_UWORD_MAX;

  if ((left_dist > GT_MIN(0, (GtWord)vlen-(GtWord)ulen))||
      (right_dist < GT_MAX(0, (GtWord)vlen-(GtWord)ulen)))
  {
    return GT_UWORD_MAX;
  }

  width = right_dist - left_dist + 1;
  EDtabcolumn = gt_malloc(sizeof(*EDtabcolumn) * width);

  low_row = 0;
  high_row = -left_dist;
  EDtabcolumn[low_row] = 0;

  for (rowindex = low_row+1; rowindex <= high_row; rowindex ++)
  {
    EDtabcolumn[rowindex-low_row] = EDtabcolumn[rowindex-low_row-1] + gapcost;
  }
  if (high_row == ulen)
    last_row = true;
  for (colindex = 1; colindex <= vlen; colindex++)
  {
    northwestEDtabentry = EDtabcolumn[0];

    if (colindex > right_dist)
    {
      if (low_row != high_row)
        westEDtabentry = EDtabcolumn[1];
      low_row++;
    }
    else
      westEDtabentry = EDtabcolumn[0];

   if (high_row < ulen)
      high_row ++;
   if (!last_row && low_row == high_row)
        westEDtabentry = GT_UWORD_MAX;
    EDtabcolumn[0] = add_safe_umax(westEDtabentry, gapcost);

    if (low_row > 0 )
    {
      if ((val = add_safe_umax(northwestEDtabentry,
                              (tolower((int)useq[ustart+low_row-1]) ==
                              tolower((int)vseq[vstart+colindex-1])?
                              matchcost : mismatchcost)))
          < EDtabcolumn[0])
      EDtabcolumn[0] = val;
    }
    for (rowindex = low_row + 1; rowindex <= high_row; rowindex++)
    {
      northwestEDtabentry = westEDtabentry;
      if (!last_row && rowindex == high_row)
        westEDtabentry = GT_UWORD_MAX;
      else if (low_row > 0)
        westEDtabentry = EDtabcolumn[rowindex-low_row+1];
      else
        westEDtabentry = EDtabcolumn[rowindex-low_row];

      if (rowindex == ulen)
        last_row = true;
      EDtabcolumn[rowindex-low_row] = add_safe_umax(westEDtabentry, gapcost);

      val = add_safe_umax(northwestEDtabentry,
                        (tolower((int)useq[ustart+rowindex-1]) ==
                         tolower((int)vseq[vstart+colindex-1]) ?
                         matchcost : mismatchcost));
      if (val <= EDtabcolumn[rowindex-low_row])
        EDtabcolumn[rowindex-low_row] = val;

      if ((val = add_safe_umax(EDtabcolumn[rowindex-low_row-1], gapcost))
                                       <= EDtabcolumn[rowindex-low_row])
        EDtabcolumn[rowindex-low_row] = val;
    }
  }

  distance = EDtabcolumn[high_row-low_row];
  gt_free(EDtabcolumn);

  return distance;
}

// Assembly:
subq $0x108, %rsp            # imm = 0x108
movq 0x130(%rsp), %rax
movq 0x128(%rsp), %rax
movq 0x120(%rsp), %rax
movq 0x118(%rsp), %rax
movq 0x110(%rsp), %rax
movq %rdi, 0xf8(%rsp)
movq %rsi, 0xf0(%rsp)
movq %rdx, 0xe8(%rsp)
movq %rcx, 0xe0(%rsp)
movq %r8, 0xd8(%rsp)
movq %r9, 0xd0(%rsp)
movq $-0x1, 0x80(%rsp)
movb $0x0, 0x7f(%rsp)
movq $-0x1, 0xc8(%rsp)
movq 0x110(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0xd0(%rsp), %rcx
subq 0xe8(%rsp), %rcx
xorl %eax, %eax
cmpq %rcx, %rax
jge 0x14e2a9
xorl %eax, %eax
movq %rax, 0x68(%rsp)
jmp 0x14e2be
movq 0xd0(%rsp), %rax
subq 0xe8(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x70(%rsp), %rax
movq 0x68(%rsp), %rcx
cmpq %rcx, %rax
jg 0x14e31e
movq 0x118(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0xd0(%rsp), %rcx
subq 0xe8(%rsp), %rcx
xorl %eax, %eax
cmpq %rcx, %rax
jle 0x14e2fa
xorl %eax, %eax
movq %rax, 0x58(%rsp)
jmp 0x14e30f
movq 0xd0(%rsp), %rax
subq 0xe8(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x60(%rsp), %rax
movq 0x58(%rsp), %rcx
cmpq %rcx, %rax
jge 0x14e32f
movq $-0x1, 0x100(%rsp)
jmp 0x14e9a7
movq 0x118(%rsp), %rax
subq 0x110(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xa0(%rsp)
movq 0xa0(%rsp), %rdi
shlq $0x3, %rdi
leaq 0x3fed3e(%rip), %rsi    # 0x54d09c
movl $0x15c, %edx            # imm = 0x15C
callq 0xe80f0
movq %rax, 0x90(%rsp)
movq $0x0, 0xb0(%rsp)
xorl %eax, %eax
subq 0x110(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0x90(%rsp), %rax
movq 0xb0(%rsp), %rcx
movq $0x0, (%rax,%rcx,8)
movq 0xb0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xb8(%rsp)
movq 0xb8(%rsp), %rax
cmpq 0xa8(%rsp), %rax
ja 0x14e426
movq 0x90(%rsp), %rax
movq 0xb8(%rsp), %rcx
subq 0xb0(%rsp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rdx
addq 0x130(%rsp), %rdx
movq 0x90(%rsp), %rax
movq 0xb8(%rsp), %rcx
subq 0xb0(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0xb8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xb8(%rsp)
jmp 0x14e3ba
movq 0xa8(%rsp), %rax
cmpq 0xe8(%rsp), %rax
jne 0x14e43d
movb $0x1, 0x7f(%rsp)
movq $0x1, 0xc0(%rsp)
movq 0xc0(%rsp), %rax
cmpq 0xd0(%rsp), %rax
ja 0x14e95a
movq 0x90(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x88(%rsp)
movq 0xc0(%rsp), %rax
cmpq 0x118(%rsp), %rax
jbe 0x14e4c0
movq 0xb0(%rsp), %rax
cmpq 0xa8(%rsp), %rax
je 0x14e4aa
movq 0x90(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x80(%rsp)
movq 0xb0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xb0(%rsp)
jmp 0x14e4d3
movq 0x90(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x80(%rsp)
movq 0xa8(%rsp), %rax
cmpq 0xe8(%rsp), %rax
jae 0x14e4f9
movq 0xa8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xa8(%rsp)
testb $0x1, 0x7f(%rsp)
jne 0x14e51e
movq 0xb0(%rsp), %rax
cmpq 0xa8(%rsp), %rax
jne 0x14e51e
movq $-0x1, 0x80(%rsp)
cmpq $-0x1, 0x80(%rsp)
je 0x14e540
movq 0x80(%rsp), %rax
addq 0x130(%rsp), %rax
movq %rax, 0x50(%rsp)
jmp 0x14e54e
movq $-0x1, %rax
movq %rax, 0x50(%rsp)
jmp 0x14e54e
movq 0x50(%rsp), %rcx
movq 0x90(%rsp), %rax
movq %rcx, (%rax)
cmpq $0x0, 0xb0(%rsp)
jbe 0x14e64e
cmpq $-0x1, 0x88(%rsp)
je 0x14e611
movq 0x88(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0xf8(%rsp), %rax
movq 0xf0(%rsp), %rcx
addq 0xb0(%rsp), %rcx
subq $0x1, %rcx
movzbl (%rax,%rcx), %edi
callq 0x19a20
movl %eax, 0x4c(%rsp)
movq 0xe0(%rsp), %rax
movq 0xd8(%rsp), %rcx
addq 0xc0(%rsp), %rcx
subq $0x1, %rcx
movzbl (%rax,%rcx), %edi
callq 0x19a20
movl %eax, %ecx
movl 0x4c(%rsp), %eax
cmpl %ecx, %eax
jne 0x14e5f0
movq 0x120(%rsp), %rax
movq %rax, 0x38(%rsp)
jmp 0x14e5fd
movq 0x128(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x40(%rsp), %rax
movq 0x38(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x30(%rsp)
jmp 0x14e61f
movq $-0x1, %rax
movq %rax, 0x30(%rsp)
jmp 0x14e61f
movq 0x30(%rsp), %rax
movq %rax, 0x98(%rsp)
movq 0x90(%rsp), %rcx
cmpq (%rcx), %rax
jae 0x14e64c
movq 0x98(%rsp), %rcx
movq 0x90(%rsp), %rax
movq %rcx, (%rax)
jmp 0x14e64e
movq 0xb0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xb8(%rsp)
movq 0xb8(%rsp), %rax
cmpq 0xa8(%rsp), %rax
ja 0x14e93f
movq 0x80(%rsp), %rax
movq %rax, 0x88(%rsp)
testb $0x1, 0x7f(%rsp)
jne 0x14e6af
movq 0xb8(%rsp), %rax
cmpq 0xa8(%rsp), %rax
jne 0x14e6af
movq $-0x1, 0x80(%rsp)
jmp 0x14e707
cmpq $0x0, 0xb0(%rsp)
jbe 0x14e6e1
movq 0x90(%rsp), %rax
movq 0xb8(%rsp), %rcx
subq 0xb0(%rsp), %rcx
movq 0x8(%rax,%rcx,8), %rax
movq %rax, 0x80(%rsp)
jmp 0x14e705
movq 0x90(%rsp), %rax
movq 0xb8(%rsp), %rcx
subq 0xb0(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x80(%rsp)
jmp 0x14e707
movq 0xb8(%rsp), %rax
cmpq 0xe8(%rsp), %rax
jne 0x14e71e
movb $0x1, 0x7f(%rsp)
cmpq $-0x1, 0x80(%rsp)
je 0x14e740
movq 0x80(%rsp), %rax
addq 0x130(%rsp), %rax
movq %rax, 0x28(%rsp)
jmp 0x14e74e
movq $-0x1, %rax
movq %rax, 0x28(%rsp)
jmp 0x14e74e
movq 0x28(%rsp), %rdx
movq 0x90(%rsp), %rax
movq 0xb8(%rsp), %rcx
subq 0xb0(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
cmpq $-0x1, 0x88(%rsp)
je 0x14e813
movq 0x88(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0xf8(%rsp), %rax
movq 0xf0(%rsp), %rcx
addq 0xb8(%rsp), %rcx
subq $0x1, %rcx
movzbl (%rax,%rcx), %edi
callq 0x19a20
movl %eax, 0x24(%rsp)
movq 0xe0(%rsp), %rax
movq 0xd8(%rsp), %rcx
addq 0xc0(%rsp), %rcx
subq $0x1, %rcx
movzbl (%rax,%rcx), %edi
callq 0x19a20
movl %eax, %ecx
movl 0x24(%rsp), %eax
cmpl %ecx, %eax
jne 0x14e7f2
movq 0x120(%rsp), %rax
movq %rax, 0x10(%rsp)
jmp 0x14e7ff
movq 0x128(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rax
movq 0x10(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x8(%rsp)
jmp 0x14e821
movq $-0x1, %rax
movq %rax, 0x8(%rsp)
jmp 0x14e821
movq 0x8(%rsp), %rax
movq %rax, 0x98(%rsp)
movq 0x98(%rsp), %rax
movq 0x90(%rsp), %rcx
movq 0xb8(%rsp), %rdx
subq 0xb0(%rsp), %rdx
cmpq (%rcx,%rdx,8), %rax
ja 0x14e878
movq 0x98(%rsp), %rdx
movq 0x90(%rsp), %rax
movq 0xb8(%rsp), %rcx
subq 0xb0(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x90(%rsp), %rax
movq 0xb8(%rsp), %rcx
subq 0xb0(%rsp), %rcx
subq $0x1, %rcx
cmpq $-0x1, (%rax,%rcx,8)
je 0x14e8c9
movq 0x90(%rsp), %rax
movq 0xb8(%rsp), %rcx
subq 0xb0(%rsp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
addq 0x130(%rsp), %rax
movq %rax, (%rsp)
jmp 0x14e8d6
movq $-0x1, %rax
movq %rax, (%rsp)
jmp 0x14e8d6
movq (%rsp), %rax
movq %rax, 0x98(%rsp)
movq 0x90(%rsp), %rcx
movq 0xb8(%rsp), %rdx
subq 0xb0(%rsp), %rdx
cmpq (%rcx,%rdx,8), %rax
ja 0x14e924
movq 0x98(%rsp), %rdx
movq 0x90(%rsp), %rax
movq 0xb8(%rsp), %rcx
subq 0xb0(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x14e926
movq 0xb8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xb8(%rsp)
jmp 0x14e662
jmp 0x14e941
movq 0xc0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xc0(%rsp)
jmp 0x14e449
movq 0x90(%rsp), %rax
movq 0xa8(%rsp), %rcx
subq 0xb0(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0xc8(%rsp)
movq 0x90(%rsp), %rdi
leaq 0x3fe70f(%rip), %rsi    # 0x54d09c
movl $0x1a0, %edx            # imm = 0x1A0
callq 0xe88c0
movq 0xc8(%rsp), %rax
movq %rax, 0x100(%rsp)
movq 0x100(%rsp), %rax
addq $0x108, %rsp            # imm = 0x108
retq
nopw (%rax,%rax)