// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/affinealign.c
// Function: affinealign_fill_table
static void affinealign_fill_table(GtAffinealignDPentry **dptable,
                                   const GtUchar *u, GtUword ulen,
                                   const GtUchar *v, GtUword vlen,
                                   GtUword matchcost, GtUword mismatchcost,
                                   GtUword gap_opening, GtUword gap_extension,
                                   GtAffineAlignEdge edge,
                                   const GtScoreHandler *scorehandler)
{
  GtUword i, j, Rvalue, Dvalue, Ivalue, minvalue,rcost;
  gt_assert(dptable && u && v);

  if (scorehandler != NULL)/*else work with given constant values*/
  {
    gap_opening = gt_scorehandler_get_gap_opening(scorehandler);
    gap_extension = gt_scorehandler_get_gapscore(scorehandler);
  }

  for (i = 0; i <= ulen; i++) {
    for (j = 0; j <= vlen; j++) {
      if (!i && !j) {
        switch (edge) {
          case Affine_R:
            dptable[0][0].Rvalue = 0;
            dptable[0][0].Dvalue = GT_WORD_MAX;
            dptable[0][0].Ivalue = GT_WORD_MAX;
            break;
          case Affine_D:
            dptable[0][0].Rvalue = GT_WORD_MAX;
            dptable[0][0].Dvalue = 0;
            dptable[0][0].Ivalue = GT_WORD_MAX;
            break;
          case Affine_I:
            dptable[0][0].Rvalue = GT_WORD_MAX;
            dptable[0][0].Dvalue = GT_WORD_MAX;
            dptable[0][0].Ivalue = 0;
            break;
          default:
            dptable[0][0].Rvalue = 0;
            dptable[0][0].Dvalue = gap_opening;
            dptable[0][0].Ivalue = gap_opening;
        }
      }
      else {
        /* compute A_affine(i,j,R) */
        if (!i || !j)
          dptable[i][j].Rvalue = LONG_MAX;
        else {
          if (scorehandler != NULL)
            rcost = gt_scorehandler_get_replacement(scorehandler,
                                                    u[i-1], v[j-1]);
          else
            rcost  = (u[i-1] == v[j-1]) ? matchcost : mismatchcost;

          Rvalue = add_safe_max(dptable[i-1][j-1].Rvalue, rcost);
          Dvalue = add_safe_max(dptable[i-1][j-1].Dvalue, rcost);
          Ivalue = add_safe_max(dptable[i-1][j-1].Ivalue, rcost);
          minvalue = GT_MIN3(Rvalue, Dvalue, Ivalue);
          gt_assert(minvalue != LONG_MAX);
          dptable[i][j].Rvalue = minvalue;
          /* set backtracing edge */
          if (Rvalue == minvalue)
            dptable[i][j].Redge = Affine_R;
          else if (Dvalue == minvalue)
            dptable[i][j].Redge = Affine_D;
          else /* Ivalue == minvalue */
            dptable[i][j].Redge = Affine_I;
        }
        /* compute A_affine(i,j,D) */
        if (!i)
          dptable[i][j].Dvalue = LONG_MAX;
        else {
          Rvalue = add_safe_max(dptable[i-1][j].Rvalue,
                                gap_opening + gap_extension);
          Dvalue = add_safe_max(dptable[i-1][j].Dvalue, gap_extension);
          Ivalue = add_safe_max(dptable[i-1][j].Ivalue,
                                gap_opening + gap_extension);
          minvalue = GT_MIN3(Rvalue, Dvalue, Ivalue);
          gt_assert(minvalue != ULONG_MAX);
          dptable[i][j].Dvalue = minvalue;
          /* set backtracing edge */
          if (Rvalue == minvalue)
            dptable[i][j].Dedge = Affine_R;
          else if (Dvalue == minvalue)
            dptable[i][j].Dedge = Affine_D;
          else /* Ivalue == minvalue */
            dptable[i][j].Dedge = Affine_I;
        }
        /* compute A_affine(i,j,I) */
        if (!j)
          dptable[i][j].Ivalue = LONG_MAX;
        else {
          Rvalue = add_safe_max(dptable[i][j-1].Rvalue,
                                gap_opening + gap_extension);
          Dvalue = add_safe_max(dptable[i][j-1].Dvalue,
                                gap_opening + gap_extension);
          Ivalue = add_safe_max(dptable[i][j-1].Ivalue, gap_extension);
          minvalue = GT_MIN3(Rvalue, Dvalue, Ivalue);
          gt_assert(minvalue != LONG_MAX);
          dptable[i][j].Ivalue = minvalue;
          /* set backtracing edge */
          if (Rvalue == minvalue)
            dptable[i][j].Iedge = Affine_R;
          else if (Dvalue == minvalue)
            dptable[i][j].Iedge = Affine_D;
          else /* Ivalue == minvalue */
            dptable[i][j].Iedge = Affine_I;
        }
      }
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, 0x28(%rsp)
movq %rcx, 0x10(%rsp)
movq %rdx, 0x18(%rsp)
movq %rsi, 0x8(%rsp)
testq %rdi, %rdi
je 0x294e5f
cmpq $0x0, 0x8(%rsp)
je 0x294e5f
cmpq $0x0, 0x10(%rsp)
je 0x294e5f
movq %rdi, %r13
movq 0x90(%rsp), %rbx
testq %rbx, %rbx
movq %r8, (%rsp)
je 0x294af7
movq %rbx, %rdi
callq 0x114a29
movq %rax, %r14
movq %rbx, %rdi
callq 0x114a6a
movq (%rsp), %r8
movq %rax, %r9
jmp 0x294b04
movq 0x80(%rsp), %r9
movq 0x78(%rsp), %r14
movl 0x88(%rsp), %r10d
movabsq $0x7fffffffffffffff, %r15 # imm = 0x7FFFFFFFFFFFFFFF
movq %r14, 0x20(%rsp)
leaq (%r14,%r9), %r11
xorl %r12d, %r12d
cmpq 0x18(%rsp), %r12
ja 0x294dc6
xorl %ebx, %ebx
xorl %r14d, %r14d
movq %r12, 0x30(%rsp)
cmpq %r8, %r14
ja 0x294dbe
movq %r14, %rax
orq %r12, %rax
je 0x294b97
testq %r14, %r14
sete %al
testq %r12, %r12
sete %cl
orb %al, %cl
jne 0x294bc5
movq 0x8(%rsp), %rax
movb -0x1(%rax,%r12), %cl
movq 0x10(%rsp), %rax
movb -0x1(%rax,%r14), %dl
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x294be1
movzbl %cl, %esi
movzbl %dl, %edx
movq %r9, %rbp
movq %r11, %r12
callq 0x114b2c
movq %r12, %r11
movq 0x30(%rsp), %r12
movq %rbp, %r9
jmp 0x294bef
movq (%r13), %rax
cmpl $0x2, %r10d
je 0x294c94
cmpl $0x1, %r10d
je 0x294c87
testl %r10d, %r10d
jne 0x294ca5
andq $0x0, (%rax)
movq %r15, 0x8(%rax)
jmp 0x294d95
movq (%r13,%r12,8), %rax
movq %r15, (%rax,%rbx)
testq %r12, %r12
je 0x294c79
movq -0x8(%r13,%r12,8), %rcx
jmp 0x294cc3
movq 0x28(%rsp), %rax
cmpb %dl, %cl
je 0x294bef
movq 0x70(%rsp), %rax
movq -0x8(%r13,%r12,8), %rcx
movq -0x30(%rcx,%rbx), %rsi
movq -0x28(%rcx,%rbx), %rdi
leaq (%rsi,%rax), %rdx
cmpq %r15, %rsi
cmoveq %r15, %rdx
leaq (%rdi,%rax), %rsi
cmpq %r15, %rdi
cmoveq %r15, %rsi
movq -0x20(%rcx,%rbx), %rdi
addq %rdi, %rax
cmpq %r15, %rdi
cmoveq %r15, %rax
cmpq %rsi, %rdx
movq %rsi, %rdi
cmovbq %rdx, %rdi
cmpq %rax, %rdi
cmovaeq %rax, %rdi
cmpq %r15, %rdi
je 0x294dff
movq (%r13,%r12,8), %rax
movq %rdi, (%rax,%rbx)
cmpq %rdi, %rdx
jne 0x294c5e
andl $0x0, 0x20(%rax,%rbx)
movq (%rsp), %r8
movl 0x88(%rsp), %r10d
jmp 0x294cc3
cmpq %rdi, %rsi
movq (%rsp), %r8
movl 0x88(%rsp), %r10d
jne 0x294cbb
movl $0x1, 0x20(%rax,%rbx)
jmp 0x294cc3
movq (%r13), %rcx
movq %r15, 0x8(%rcx,%rbx)
jmp 0x294d39
movq %r15, (%rax)
andq $0x0, 0x8(%rax)
jmp 0x294d95
movq %r15, (%rax)
movq %r15, 0x8(%rax)
andq $0x0, 0x10(%rax)
jmp 0x294d99
andq $0x0, (%rax)
movq 0x20(%rsp), %rcx
movq %rcx, 0x8(%rax)
movq %rcx, 0x10(%rax)
jmp 0x294d99
movl $0x2, 0x20(%rax,%rbx)
movq (%rcx,%rbx), %rsi
movq 0x8(%rcx,%rbx), %rdi
leaq (%rsi,%r11), %rdx
cmpq %r15, %rsi
cmoveq %r15, %rdx
leaq (%rdi,%r9), %rsi
cmpq %r15, %rdi
cmoveq %r15, %rsi
movq 0x10(%rcx,%rbx), %rdi
leaq (%rdi,%r11), %rcx
cmpq %r15, %rdi
cmoveq %r15, %rcx
cmpq %rsi, %rdx
jae 0x294d00
cmpq %rcx, %rdx
cmovbq %rdx, %rcx
jmp 0x294d11
cmpq %rcx, %rsi
cmovbq %rsi, %rcx
cmpq $-0x1, %rcx
je 0x294e29
movq %rcx, 0x8(%rax,%rbx)
cmpq %rcx, %rdx
jne 0x294d22
andl $0x0, 0x24(%rax,%rbx)
jmp 0x294d39
cmpq %rcx, %rsi
jne 0x294d31
movl $0x1, 0x24(%rax,%rbx)
jmp 0x294d39
movl $0x2, 0x24(%rax,%rbx)
testq %r14, %r14
je 0x294d95
movq -0x30(%rax,%rbx), %rdx
movq -0x28(%rax,%rbx), %rsi
leaq (%rdx,%r11), %rcx
cmpq %r15, %rdx
cmoveq %r15, %rcx
leaq (%rsi,%r11), %rdx
cmpq %r15, %rsi
cmoveq %r15, %rdx
movq -0x20(%rax,%rbx), %rsi
leaq (%rsi,%r9), %rdi
cmpq %r15, %rsi
cmoveq %r15, %rdi
cmpq %rdx, %rcx
movq %rdx, %rsi
cmovbq %rcx, %rsi
cmpq %rdi, %rsi
cmovaeq %rdi, %rsi
cmpq %r15, %rsi
je 0x294dd5
movq %rsi, 0x10(%rax,%rbx)
cmpq %rsi, %rcx
jne 0x294da5
andl $0x0, 0x28(%rax,%rbx)
jmp 0x294d99
movq %r15, 0x10(%rax)
incq %r14
addq $0x30, %rbx
jmp 0x294b37
cmpq %rsi, %rdx
jne 0x294db4
movl $0x1, 0x28(%rax,%rbx)
jmp 0x294d99
movl $0x2, 0x28(%rax,%rbx)
jmp 0x294d99
incq %r12
jmp 0x294b22
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1a318c(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x5022d(%rip), %rsi     # 0x2e5013
leaq 0xe77e1(%rip), %rdx     # 0x37c5ce
leaq 0xe77c3(%rip), %rcx     # 0x37c5b7
leaq 0xe7621(%rip), %r8      # 0x37c41c
pushq $0x7e
jmp 0x294e51
movq 0x1a3162(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x50203(%rip), %rsi     # 0x2e5013
leaq 0xe77b7(%rip), %rdx     # 0x37c5ce
leaq 0xe7799(%rip), %rcx     # 0x37c5b7
leaq 0xe75f7(%rip), %r8      # 0x37c41c
pushq $0x56
jmp 0x294e51
movq 0x1a3138(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x501d9(%rip), %rsi     # 0x2e5013
leaq 0xe77a2(%rip), %rdx     # 0x37c5e3
leaq 0xe776f(%rip), %rcx     # 0x37c5b7
leaq 0xe75cd(%rip), %r8      # 0x37c41c
pushq $0x6a
popq %r9
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x1a3102(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x501a3(%rip), %rsi     # 0x2e5013
leaq 0xe772e(%rip), %rdx     # 0x37c5a5
leaq 0xe7739(%rip), %rcx     # 0x37c5b7
leaq 0xe7597(%rip), %r8      # 0x37c41c
pushq $0x26
jmp 0x294e51