// File: /workspace/github_c_makefile_star2_O1/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 $0x28, %rsp
movq %rcx, (%rsp)
movq %rdx, 0x8(%rsp)
testq %rdi, %rdi
je 0x17513d
movq %rsi, %rbx
testq %rsi, %rsi
je 0x17513d
movq %rdi, %r13
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x17513d
movq %r9, %r14
movq %r8, %r15
movq 0x68(%rsp), %rbp
callq 0x1797fb
movq %rax, %r12
movq %r15, %rax
orq %rbp, %rax
je 0x175129
movq 0x60(%rsp), %rax
movq (%rsp), %rcx
movq 0x8(%rsp), %rdx
addq %rdx, %rcx
decq %rcx
movq %rcx, 0x18(%rsp)
addq %r14, %rax
decq %rax
movq %rax, 0x10(%rsp)
testq %r15, %r15
setne %r14b
testq %rbp, %rbp
setne %cl
movq %r12, 0x20(%rsp)
movb %cl, (%rsp)
movl %r14d, %eax
andb %cl, %al
testb $0x1, %al
je 0x1750a2
movq -0x8(%rbx,%r15,8), %rax
movq (%rbx,%r15,8), %rcx
movq (%rcx,%rbp,8), %rcx
movq %rcx, 0x8(%rsp)
movq %r13, %r12
movq %rbx, %r13
movq -0x8(%rax,%rbp,8), %rbx
movq 0x18(%rsp), %rax
movzbl (%rax,%r15), %esi
movq 0x10(%rsp), %rax
movzbl (%rax,%rbp), %edx
movq 0x70(%rsp), %rdi
callq 0x17982a
movb (%rsp), %cl
addq %rbx, %rax
movq %r13, %rbx
movq %r12, %r13
movq 0x20(%rsp), %r12
cmpq %rax, 0x8(%rsp)
je 0x1750fb
testb $0x1, %cl
je 0x1750b9
movq (%rbx,%r15,8), %rax
movq -0x8(%rax,%rbp,8), %rcx
addq %r12, %rcx
cmpq %rcx, (%rax,%rbp,8)
je 0x175108
testb $0x1, %r14b
je 0x175138
movq -0x8(%rbx,%r15,8), %rax
movq (%rbx,%r15,8), %rcx
movq (%rax,%rbp,8), %rax
addq %r12, %rax
cmpq %rax, (%rcx,%rbp,8)
jne 0x175138
movq %r13, %rdi
callq 0x126d42
cmpq $0x1, %r15
leaq -0x1(%r15), %r15
setne %r14b
movl %r14d, %eax
movb (%rsp), %cl
orb %cl, %al
testb $0x1, %al
jne 0x175047
jmp 0x175129
movq %r13, %rdi
callq 0x126d25
decq %r15
jmp 0x175110
movq %r13, %rdi
callq 0x126d5f
decq %rbp
setne %cl
testq %r15, %r15
setne %r14b
movq %r15, %rax
orq %rbp, %rax
jne 0x175044
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x52158
callq 0x52121