// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/affinealign.c
// Function: gt_affinealign_traceback
GtWord gt_affinealign_traceback(GtAlignment *align,
                                GtAffinealignDPentry * const *dptable,
                                GtUword i, GtUword j)
{
  GtWord minvalue;
  GtAffineAlignEdge edge;
  gt_assert(align && dptable);
  /* determine min{A_affine(m,n,x) | x in {R,D,I}} */
  minvalue = GT_MIN3(dptable[i][j].Rvalue, dptable[i][j].Dvalue,
                  dptable[i][j].Ivalue);
  if (dptable[i][j].Rvalue == minvalue)
    edge = Affine_R;
  else if (dptable[i][j].Dvalue == minvalue)
    edge = Affine_D;
  else /* dptable[i][j].Ivalue == minvalue */
    edge = Affine_I;
  /* backtracing */
  while (i > 0 || j > 0) {
    switch (edge) {
      case Affine_R:
        gt_assert(dptable[i][j].Rvalue != LONG_MAX);
        gt_alignment_add_replacement(align);
        edge = dptable[i][j].Redge;
        gt_assert(i > 0 && j > 0);
        i--;
        j--;
        break;
      case Affine_D:
        gt_alignment_add_deletion(align);
        edge = dptable[i][j].Dedge;
        gt_assert(i);
        i--;
        break;
      case Affine_I:
        gt_alignment_add_insertion(align);
        edge = dptable[i][j].Iedge;
        gt_assert(j);
        j--;
        break;
      default:
        gt_assert(false);
    }
  }
  return minvalue;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x2948f1
movq %rsi, %r15
testq %rsi, %rsi
je 0x2948f1
movq %rcx, %rbx
movq %rdx, %r14
movq %rdi, %r12
movq (%r15,%rdx,8), %rax
imulq $0x30, %rcx, %rcx
movq (%rax,%rcx), %rdx
movq 0x8(%rax,%rcx), %rsi
movq 0x10(%rax,%rcx), %rax
cmpq %rsi, %rdx
movq %rsi, %r13
cmovlq %rdx, %r13
cmpq %rax, %r13
cmovgeq %rax, %r13
xorl %ecx, %ecx
cmpq %r13, %rsi
setne %cl
incl %ecx
xorl %eax, %eax
cmpq %r13, %rdx
cmovnel %ecx, %eax
movq %r14, %rcx
orq %rbx, %rcx
je 0x2947e9
cmpl $0x2, %eax
je 0x2947bf
cmpl $0x1, %eax
je 0x29479a
testl %eax, %eax
jne 0x2947fb
movq (%r15,%r14,8), %rax
imulq $0x30, %rbx, %rbp
movabsq $0x7fffffffffffffff, %rcx # imm = 0x7FFFFFFFFFFFFFFF
cmpq %rcx, (%rax,%rbp)
je 0x29482c
movq %r12, %rdi
callq 0xb5208
testq %r14, %r14
je 0x29485d
testq %rbx, %rbx
je 0x29485d
movq (%r15,%r14,8), %rax
addq %rbp, %rax
addq $0x20, %rax
decq %r14
jmp 0x2947df
movq %r12, %rdi
callq 0xb5258
testq %r14, %r14
je 0x29488b
movq (%r15,%r14,8), %rax
imulq $0x30, %rbx, %rcx
addq %rcx, %rax
addq $0x24, %rax
decq %r14
jmp 0x2947e2
movq %r12, %rdi
callq 0xb52a8
testq %rbx, %rbx
je 0x2948b9
movq (%r15,%r14,8), %rax
imulq $0x30, %rbx, %rcx
addq %rcx, %rax
addq $0x28, %rax
decq %rbx
movl (%rax), %eax
jmp 0x294736
movq %r13, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1a3766(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x50807(%rip), %rsi     # 0x2e5013
leaq 0x921d9(%rip), %rdx     # 0x3269ec
leaq 0xe7be9(%rip), %rcx     # 0x37c403
leaq 0xe7bfb(%rip), %r8      # 0x37c41c
movl $0xb5, %r9d
jmp 0x2948e5
movq 0x1a3735(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x507d6(%rip), %rsi     # 0x2e5013
leaq 0xe7bf3(%rip), %rdx     # 0x37c437
leaq 0xe7bb8(%rip), %rcx     # 0x37c403
leaq 0xe7bca(%rip), %r8      # 0x37c41c
movl $0xa1, %r9d
jmp 0x2948e5
movq 0x1a3704(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x507a5(%rip), %rsi     # 0x2e5013
leaq 0x86d32(%rip), %rdx     # 0x31b5a7
leaq 0xe7b87(%rip), %rcx     # 0x37c403
leaq 0xe7b99(%rip), %r8      # 0x37c41c
movl $0xa4, %r9d
jmp 0x2948e5
movq 0x1a36d6(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x50777(%rip), %rsi     # 0x2e5013
leaq 0x7a300(%rip), %rdx     # 0x30eba3
leaq 0xe7b59(%rip), %rcx     # 0x37c403
leaq 0xe7b6b(%rip), %r8      # 0x37c41c
movl $0xab, %r9d
jmp 0x2948e5
movq 0x1a36a8(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x50749(%rip), %rsi     # 0x2e5013
leaq 0x6ba7e(%rip), %rdx     # 0x30034f
leaq 0xe7b2b(%rip), %rcx     # 0x37c403
leaq 0xe7b3d(%rip), %r8      # 0x37c41c
movl $0xb1, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x1a3670(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x50711(%rip), %rsi     # 0x2e5013
leaq 0xe7ae9(%rip), %rdx     # 0x37c3f2
leaq 0xe7af3(%rip), %rcx     # 0x37c403
leaq 0xe7b05(%rip), %r8      # 0x37c41c
movl $0x93, %r9d
jmp 0x2948e5