// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/rdj-ovlfind-dp.c
// Function: run_dp
static inline
void run_dp(const char *u, GtUword m, const char *v, GtUword n,
            GtOvlfindDpCell **row, GtOvlfindDpCell **col)
{
  GtUword i, j, cost_r, cost_d, cost_i;
  GtOvlfindDpCell cell_r, next_cell_r;

  /* first row */
  for (i = 0; i <= m; i++)
  {
    (*col)[i].start_i = i;
    (*col)[i].start_j = 0;
    (*col)[i].edist = 0;
  }
  (*row)[0] = (*col)[m];
  /* following (*row)s */
  for (j = 1UL; j <= n; j++)
  {
    (*col)[0].start_j = j;
    cell_r.start_i = 0;
    cell_r.start_j = j - 1;
    cell_r.edist = 0;
    for (i = 1UL; i <= m; i++)
    {
      next_cell_r = (*col)[i];
      cost_i = (*col)[i].edist + 1; /* cost(e --> v[j]) */
      cost_d = (*col)[i - 1].edist + 1; /* cost(u[i] --> e)*/
      cost_r = cell_r.edist + ((u[i - 1] == v[j - 1]) ? 0 : 1);
      if (cost_r < cost_i && cost_r < cost_d)
      {
        /* replacement */
        (*col)[i].start_i = cell_r.start_i;
        (*col)[i].start_j = cell_r.start_j;
        (*col)[i].edist = cost_r;
      }
      else if (cost_i < cost_d)
      {
        /* insertion */
        /* start_i and start_j already correct */
        (*col)[i].edist = cost_i;
      }
      else
      {
        /* deletion */
        (*col)[i].start_i = (*col)[i-1].start_i;
        (*col)[i].start_j = (*col)[i-1].start_j;
        (*col)[i].edist = cost_d;
      }
      cell_r = next_cell_r;
    }
    (*row)[j] = (*col)[m];
  }
}

// Assembly:
pushq %rax
movq %rdi, (%rsp)
movq %rsi, -0x8(%rsp)
movq %rdx, -0x10(%rsp)
movq %rcx, -0x18(%rsp)
movq %r8, -0x20(%rsp)
movq %r9, -0x28(%rsp)
movq $0x0, -0x30(%rsp)
movq -0x30(%rsp), %rax
cmpq -0x8(%rsp), %rax
ja 0x4de75e
movq -0x30(%rsp), %rcx
movq -0x28(%rsp), %rax
movq (%rax), %rax
imulq $0x18, -0x30(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rsp), %rax
movq (%rax), %rax
imulq $0x18, -0x30(%rsp), %rcx
addq %rcx, %rax
movq $0x0, 0x10(%rax)
movq -0x28(%rsp), %rax
movq (%rax), %rax
imulq $0x18, -0x30(%rsp), %rcx
addq %rcx, %rax
movq $0x0, (%rax)
movq -0x30(%rsp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rsp)
jmp 0x4de6f7
movq -0x20(%rsp), %rax
movq (%rax), %rax
movq -0x28(%rsp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x8(%rsp), %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
movq $0x1, -0x38(%rsp)
movq -0x38(%rsp), %rax
cmpq -0x18(%rsp), %rax
ja 0x4dea25
movq -0x38(%rsp), %rcx
movq -0x28(%rsp), %rax
movq (%rax), %rax
movq %rcx, 0x10(%rax)
movq $0x0, -0x60(%rsp)
movq -0x38(%rsp), %rax
subq $0x1, %rax
movq %rax, -0x58(%rsp)
movq $0x0, -0x68(%rsp)
movq $0x1, -0x30(%rsp)
movq -0x30(%rsp), %rax
cmpq -0x8(%rsp), %rax
ja 0x4de9da
movq -0x28(%rsp), %rax
movq (%rax), %rax
imulq $0x18, -0x30(%rsp), %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x80(%rsp)
movq 0x8(%rax), %rcx
movq %rcx, -0x78(%rsp)
movq 0x10(%rax), %rax
movq %rax, -0x70(%rsp)
movq -0x28(%rsp), %rax
movq (%rax), %rax
imulq $0x18, -0x30(%rsp), %rcx
addq %rcx, %rax
movq (%rax), %rax
addq $0x1, %rax
movq %rax, -0x50(%rsp)
movq -0x28(%rsp), %rax
movq (%rax), %rax
movq -0x30(%rsp), %rcx
subq $0x1, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
addq $0x1, %rax
movq %rax, -0x48(%rsp)
movq -0x68(%rsp), %rax
movq (%rsp), %rcx
movq -0x30(%rsp), %rdx
subq $0x1, %rdx
movsbl (%rcx,%rdx), %esi
movq -0x10(%rsp), %rcx
movq -0x38(%rsp), %rdx
subq $0x1, %rdx
movsbl (%rcx,%rdx), %edi
movl $0x1, %ecx
xorl %edx, %edx
cmpl %edi, %esi
cmovel %edx, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rsp)
movq -0x40(%rsp), %rax
cmpq -0x50(%rsp), %rax
jae 0x4de905
movq -0x40(%rsp), %rax
cmpq -0x48(%rsp), %rax
jae 0x4de905
movq -0x60(%rsp), %rcx
movq -0x28(%rsp), %rax
movq (%rax), %rax
imulq $0x18, -0x30(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq -0x58(%rsp), %rcx
movq -0x28(%rsp), %rax
movq (%rax), %rax
imulq $0x18, -0x30(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movq -0x40(%rsp), %rcx
movq -0x28(%rsp), %rax
movq (%rax), %rax
imulq $0x18, -0x30(%rsp), %rdx
addq %rdx, %rax
movq %rcx, (%rax)
jmp 0x4de9a9
movq -0x50(%rsp), %rax
cmpq -0x48(%rsp), %rax
jae 0x4de92c
movq -0x50(%rsp), %rcx
movq -0x28(%rsp), %rax
movq (%rax), %rax
imulq $0x18, -0x30(%rsp), %rdx
addq %rdx, %rax
movq %rcx, (%rax)
jmp 0x4de9a7
movq -0x28(%rsp), %rax
movq (%rax), %rax
movq -0x30(%rsp), %rcx
subq $0x1, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rcx
movq -0x28(%rsp), %rax
movq (%rax), %rax
imulq $0x18, -0x30(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rsp), %rax
movq (%rax), %rax
movq -0x30(%rsp), %rcx
subq $0x1, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rcx
movq -0x28(%rsp), %rax
movq (%rax), %rax
imulq $0x18, -0x30(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movq -0x48(%rsp), %rcx
movq -0x28(%rsp), %rax
movq (%rax), %rax
imulq $0x18, -0x30(%rsp), %rdx
addq %rdx, %rax
movq %rcx, (%rax)
jmp 0x4de9a9
movq -0x80(%rsp), %rax
movq %rax, -0x68(%rsp)
movq -0x78(%rsp), %rax
movq %rax, -0x60(%rsp)
movq -0x70(%rsp), %rax
movq %rax, -0x58(%rsp)
movq -0x30(%rsp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rsp)
jmp 0x4de7e0
movq -0x20(%rsp), %rax
movq (%rax), %rax
imulq $0x18, -0x38(%rsp), %rcx
addq %rcx, %rax
movq -0x28(%rsp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x8(%rsp), %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rsp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rsp)
jmp 0x4de796
popq %rax
retq
nopw (%rax,%rax)