// File: /workspace/github_c_makefile_star2_O3/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 $0x28, %rsp
movq %rcx, 0x8(%rsp)
testq %rdi, %rdi
je 0x132db9
movq %rdi, %r14
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x132db9
movq %r9, %r15
movq %r8, %r12
movq %rdx, %r13
movq %rsi, %rbp
movq 0x68(%rsp), %rbx
callq 0x171437
movq %rbx, %rdi
movq %rax, %r9
movq (%r14), %rax
movq $0x0, (%rax)
testq %rbx, %rbx
je 0x132c2b
movl $0x1, %ecx
movl $0x1, %edx
subq %rdi, %rdx
cmpq $0x3, %rdx
movl $0x2, %eax
cmovaeq %rdx, %rax
movq -0x8(%r14,%rcx,8), %rdx
movq (%rdx), %rdx
leaq (%rdx,%r9), %rsi
cmpq $-0x1, %rdx
cmoveq %rdx, %rsi
movq (%r14,%rcx,8), %rdx
movq %rsi, (%rdx)
incq %rcx
cmpq %rcx, %rax
jne 0x132c06
jmp 0x132c30
movl $0x1, %eax
movq 0x8(%rsp), %rdx
cmpq %rdx, %rax
ja 0x132c4a
movq (%r14,%rax,8), %rcx
movq $-0x1, (%rcx)
incq %rax
jmp 0x132c35
cmpq $0x0, 0x60(%rsp)
je 0x132daa
movq 0x70(%rsp), %r8
negq %rdi
leaq (%r12,%r15), %rax
decq %rax
movq %rax, 0x20(%rsp)
leaq -0x1(,%r13), %rax
addq %rbp, %rax
movq %rax, 0x18(%rsp)
movl $0x1, %r15d
movq $0x0, 0x10(%rsp)
movq 0x10(%rsp), %rbx
leaq 0x1(%rbx), %rax
cmpq $0x1, %rax
adcq $0x1, %rbx
xorl %eax, %eax
movq (%r14,%rax,8), %rcx
movq $-0x1, %rdx
cmpq %r8, %r15
ja 0x132cbd
movq -0x8(%rcx,%r15,8), %rsi
leaq (%rsi,%r9), %rdx
cmpq $-0x1, %rsi
cmoveq %rsi, %rdx
movq %rdx, (%rcx,%r15,8)
incq %rax
cmpq %rax, %rbx
jne 0x132c9c
cmpq %r15, %r8
adcq $0x0, 0x10(%rsp)
cmpq 0x8(%rsp), %rdi
adcq $0x0, %rdi
cmpq %rdi, %rbx
ja 0x132d81
movq (%r14,%rbx,8), %rcx
movq -0x8(%rcx,%r15,8), %rax
leaq (%rax,%r9), %rdx
cmpq $-0x1, %rax
cmoveq %rax, %rdx
movq %rdx, (%rcx,%r15,8)
movq -0x8(%r14,%rbx,8), %rax
movq -0x8(%rax,%r15,8), %r13
cmpq $-0x1, %r13
je 0x132d43
movq 0x18(%rsp), %rax
movzbl (%rax,%rbx), %esi
movq 0x20(%rsp), %rax
movzbl (%rax,%r15), %edx
movq %rdi, %rbp
movq 0x78(%rsp), %rdi
movq %r9, %r12
callq 0x171466
movq %r12, %r9
movq %rbp, %rdi
addq %r13, %rax
movq (%r14,%rbx,8), %rcx
movq (%rcx,%r15,8), %rdx
jmp 0x132d4a
movq $-0x1, %rax
cmpq %rdx, %rax
ja 0x132d56
movq %rax, (%rcx,%r15,8)
movq %rax, %rdx
movq -0x8(%r14,%rbx,8), %rax
movq (%rax,%r15,8), %rsi
leaq (%rsi,%r9), %rax
cmpq $-0x1, %rsi
cmoveq %rsi, %rax
cmpq %rdx, %rax
movq 0x70(%rsp), %r8
jae 0x132d79
movq %rax, (%rcx,%r15,8)
incq %rbx
jmp 0x132cdb
movq 0x8(%rsp), %rcx
cmpq %rcx, %rbx
ja 0x132d9c
movq (%r14,%rbx,8), %rax
movq $-0x1, (%rax,%r15,8)
incq %rbx
jmp 0x132d86
incq %r15
cmpq 0x60(%rsp), %r15
jbe 0x132c89
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x3ef4f