// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/diagonalbandalign.c
// Function: diagonalband_fillDPtab_in_square_space
static void diagonalband_fillDPtab_in_square_space(GtUword **EDtabcolumn,
                                                   const GtUchar *useq,
                                                   GtUword ustart,
                                                   GtUword ulen,
                                                   const GtUchar *vseq,
                                                   GtUword vstart,
                                                   GtUword vlen,
                                                   GtWord left_dist,
                                                   GtWord right_dist,
                                                   const GtScoreHandler
                                                   *scorehandler)
{
  GtUword i,j, val, low_row, high_row, gapcost;
  gt_assert(EDtabcolumn && scorehandler);

  low_row = 0;
  high_row = -left_dist;
  gapcost = gt_scorehandler_get_gapscore(scorehandler);

  /* first column */
  EDtabcolumn[0][0] = 0;

  for (i = 1; i <= high_row; i++)
  {
      EDtabcolumn[i][0] = add_safe_umax(EDtabcolumn[i-1][0], gapcost);
  }
  for (; i <= ulen; i++)
  {
      EDtabcolumn[i][0] = GT_UWORD_MAX; /* invalid value */
  }

  /* next columns */
  for (j = 1; j <= vlen; j++)
  {
    /* below diagonal band*/
    for (i = 0; i <= low_row; i++)
    {
      if (j <= right_dist)
      {
        EDtabcolumn[i][j] = add_safe_umax(EDtabcolumn[i][j-1], gapcost);
      }
      else{
        EDtabcolumn[i][j] = GT_UWORD_MAX;
      }
    }
    if (j > right_dist)
      low_row ++;
    if (high_row < ulen)
      high_row ++;

    /* diagonaldband */
    for (; i <= high_row; i++)
    {
      EDtabcolumn[i][j] = add_safe_umax(EDtabcolumn[i][j-1], gapcost);

      val = add_safe_umax(EDtabcolumn[i-1][j-1],
                          gt_scorehandler_get_replacement(scorehandler,
                                    useq[ustart+i-1],vseq[vstart+j-1]));
      if (val <= EDtabcolumn[i][j])
      {
        EDtabcolumn[i][j] = val;
      }

      if ((val = add_safe_umax(EDtabcolumn[i-1][j],gapcost))
                                        < EDtabcolumn[i][j])
      {
        EDtabcolumn[i][j] = val;
      }
    }
    /* above diagonal band */
    for (; i <= ulen; i++)
      EDtabcolumn[i][j] = GT_UWORD_MAX;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, 0x10(%rsp)
movq %rsi, 0x18(%rsp)
testq %rdi, %rdi
je 0xc959a
movq %rdi, %r15
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0xc959a
movq %r9, %rbx
movq %r8, %r12
movq %rdx, %r14
movq 0x78(%rsp), %rax
negq %rax
movq %rax, 0x8(%rsp)
callq 0x114a6a
movq %rax, %r13
movq (%r15), %rax
andq $0x0, (%rax)
pushq $0x1
popq %rax
cmpq 0x8(%rsp), %rax
ja 0xc9445
movq -0x8(%r15,%rax,8), %rcx
movq (%r15,%rax,8), %rdx
movq (%rcx), %rcx
leaq (%rcx,%r13), %rsi
cmpq $-0x1, %rcx
cmoveq %rcx, %rsi
movq %rsi, (%rdx)
incq %rax
jmp 0xc9413
movq (%r15,%rax,8), %rcx
orq $-0x1, (%rcx)
incq %rax
cmpq 0x10(%rsp), %rax
jbe 0xc943a
leaq (%r12,%rbx), %rax
decq %rax
movq %rax, 0x30(%rsp)
addq %r14, 0x18(%rsp)
pushq $0x1
popq %r14
xorl %eax, %eax
pushq $-0x1
popq %rbp
cmpq 0x70(%rsp), %r14
ja 0xc958b
movq %rax, 0x28(%rsp)
leaq 0x1(%rax), %rbx
xorl %eax, %eax
cmpq %rax, %rbx
je 0xc94ac
movq (%r15,%rax,8), %rcx
movq %rbp, %rdx
cmpq 0x80(%rsp), %r14
ja 0xc94a3
movq -0x8(%rcx,%r14,8), %rsi
leaq (%rsi,%r13), %rdx
cmpq $-0x1, %rsi
cmoveq %rsi, %rdx
movq %rdx, (%rcx,%r14,8)
incq %rax
jmp 0xc947c
xorl %eax, %eax
cmpq 0x80(%rsp), %r14
seta %al
movq %rax, 0x20(%rsp)
movq 0x8(%rsp), %rax
cmpq 0x10(%rsp), %rax
adcq $0x0, %rax
movq %rax, 0x8(%rsp)
cmpq 0x8(%rsp), %rbx
ja 0xc9572
movq (%r15,%rbx,8), %rcx
movq -0x8(%rcx,%r14,8), %rax
leaq (%rax,%r13), %rdx
cmpq $-0x1, %rax
cmoveq %rax, %rdx
movq %rdx, (%rcx,%r14,8)
movq -0x8(%r15,%rbx,8), %rax
movq -0x8(%rax,%r14,8), %r12
movq %rbp, %rax
cmpq $-0x1, %r12
je 0xc9534
movq 0x18(%rsp), %rax
movzbl -0x1(%rax,%rbx), %esi
movq 0x30(%rsp), %rax
movzbl (%rax,%r14), %edx
movq 0x88(%rsp), %rdi
callq 0x114b2c
addq %r12, %rax
movq (%r15,%rbx,8), %rcx
movq (%rcx,%r14,8), %rdx
cmpq %rdx, %rax
ja 0xc9540
movq %rax, (%rcx,%r14,8)
movq %rax, %rdx
movq -0x8(%r15,%rbx,8), %rax
movq (%rax,%r14,8), %rsi
leaq (%rsi,%r13), %rax
cmpq $-0x1, %rsi
cmoveq %rsi, %rax
cmpq %rdx, %rax
jae 0xc955e
movq %rax, (%rcx,%r14,8)
incq %rbx
jmp 0xc94d1
movq (%r15,%rbx,8), %rax
orq $-0x1, (%rax,%r14,8)
incq %rbx
cmpq 0x10(%rsp), %rbx
jbe 0xc9566
movq 0x28(%rsp), %rax
addq 0x20(%rsp), %rax
incq %r14
jmp 0xc9466
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x36e9c7(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x21ba68(%rip), %rsi    # 0x2e5013
leaq 0x251b5d(%rip), %rdx    # 0x31b10f
leaq 0x251b72(%rip), %rcx    # 0x31b12b
leaq 0x2519ab(%rip), %r8     # 0x31af6b
pushq $0x30
popq %r9
xorl %eax, %eax
callq 0x17a50
callq 0x17390