// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/reconstructalignment.c
// Function: gt_reconstructalignment_from_EDtab
void gt_reconstructalignment_from_EDtab(GtAlignment *align,
                                        GtUword * const *E,
                                        const GtUchar *useq,
                                        GtUword ustart,
                                        GtUword ulen,
                                        const GtUchar *vseq,
                                        GtUword vstart,
                                        GtUword vlen,
                                        const GtScoreHandler *scorehandler)
{
  GtUword i = ulen, j = vlen, gapcost;
  const GtUchar *uptr = useq + ustart - 1, *vptr = vseq + vstart - 1;

  gt_assert(align && E && scorehandler);
  gapcost = gt_scorehandler_get_gapscore(scorehandler);
  while (i > 0 || j > 0)
  {
    if (i > 0 && j > 0 && E[i][j] == E[i-1][j-1] +
                                     gt_scorehandler_get_replacement(
                                                          scorehandler,
                                                          uptr[i],vptr[j]))
    {
      gt_alignment_add_replacement(align);
      i--;
      j--;
      continue;
    }
    if (j > 0 && E[i][j] == E[i][j-1] + gapcost)
    {
      gt_alignment_add_insertion(align);
      j--;
      continue;
    }
    if (i > 0 && E[i][j] == E[i-1][j] + gapcost)
    {
      gt_alignment_add_deletion(align);
      i--;
      continue;
    }
    gt_assert(false);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rdi, %rdi
je 0x10ee8a
movq %rsi, %r14
testq %rsi, %rsi
je 0x10ee8a
movq %rdi, %r13
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x10ee8a
movq %r8, %rbx
movq 0x58(%rsp), %rbp
movq 0x50(%rsp), %rax
addq %rdx, %rcx
decq %rcx
movq %rcx, 0x10(%rsp)
addq %r9, %rax
decq %rax
movq %rax, 0x8(%rsp)
callq 0x114a6a
movq %rax, %r12
movq %rax, (%rsp)
movq %rbx, %rax
orq %rbp, %rax
je 0x10ee45
testq %rbx, %rbx
setne %al
testq %rbp, %rbp
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x10edf3
movq -0x8(%r14,%rbx,8), %rax
movq (%r14,%rbx,8), %rcx
movq (%rcx,%rbp,8), %r12
movq -0x8(%rax,%rbp,8), %r15
movq 0x10(%rsp), %rax
movzbl (%rax,%rbx), %esi
movq 0x8(%rsp), %rax
movzbl (%rax,%rbp), %edx
movq 0x60(%rsp), %rdi
callq 0x114b2c
addq %r15, %rax
cmpq %rax, %r12
movq (%rsp), %r12
jne 0x10edf8
movq %r13, %rdi
callq 0xb5208
decq %rbx
jmp 0x10ee3d
testq %rbp, %rbp
je 0x10ee0a
movq (%r14,%rbx,8), %rax
movq -0x8(%rax,%rbp,8), %rcx
addq %r12, %rcx
cmpq %rcx, (%rax,%rbp,8)
je 0x10ee35
testq %rbx, %rbx
je 0x10ee54
movq -0x8(%r14,%rbx,8), %rax
movq (%r14,%rbx,8), %rcx
movq (%rax,%rbp,8), %rax
addq %r12, %rax
cmpq %rax, (%rcx,%rbp,8)
jne 0x10ee54
movq %r13, %rdi
callq 0xb5258
decq %rbx
jmp 0x10ed8d
movq %r13, %rdi
callq 0xb52a8
decq %rbp
jmp 0x10ed8d
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x32910d(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1d61ae(%rip), %rsi    # 0x2e5013
leaq 0x217b80(%rip), %rdx    # 0x3269ec
leaq 0x22103a(%rip), %rcx    # 0x32fead
leaq 0x221056(%rip), %r8     # 0x32fed0
pushq $0x5a
popq %r9
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x3290d7(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1d6178(%rip), %rsi    # 0x2e5013
leaq 0x220ff0(%rip), %rdx    # 0x32fe92
leaq 0x221004(%rip), %rcx    # 0x32fead
leaq 0x221020(%rip), %r8     # 0x32fed0
pushq $0x40
jmp 0x10ee7c