// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x78, %rsp
movq 0x90(%rsp), %rax
movq 0x88(%rsp), %rax
movq 0x80(%rsp), %rax
movq %rdi, 0x70(%rsp)
movq %rsi, 0x68(%rsp)
movq %rdx, 0x60(%rsp)
movq %rcx, 0x58(%rsp)
movq %r8, 0x50(%rsp)
movq %r9, 0x48(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x88(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x60(%rsp), %rax
addq 0x58(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x28(%rsp)
movq 0x48(%rsp), %rax
addq 0x80(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x70(%rsp)
je 0x1c68b5
cmpq $0x0, 0x68(%rsp)
je 0x1c68b5
cmpq $0x0, 0x90(%rsp)
jne 0x1c68ed
movq 0x4756e4(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x34f74d(%rip), %rsi    # 0x516013
leaq 0x39ba78(%rip), %rdx    # 0x562345
leaq 0x39ba8c(%rip), %rcx    # 0x562360
leaq 0x39baa8(%rip), %r8     # 0x562383
movl $0x40, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1c68ef
movq 0x90(%rsp), %rdi
callq 0x1d11d0
movq %rax, 0x30(%rsp)
movb $0x1, %al
cmpq $0x0, 0x40(%rsp)
movb %al, 0x1f(%rsp)
ja 0x1c691c
cmpq $0x0, 0x38(%rsp)
seta %al
movb %al, 0x1f(%rsp)
movb 0x1f(%rsp), %al
testb $0x1, %al
jne 0x1c6929
jmp 0x1c6ae8
cmpq $0x0, 0x40(%rsp)
jbe 0x1c69ec
cmpq $0x0, 0x38(%rsp)
jbe 0x1c69ec
movq 0x68(%rsp), %rax
movq 0x40(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x38(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x10(%rsp)
movq 0x68(%rsp), %rax
movq 0x40(%rsp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
movq 0x38(%rsp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x8(%rsp)
movq 0x90(%rsp), %rdi
movq 0x28(%rsp), %rax
movq 0x40(%rsp), %rcx
movb (%rax,%rcx), %dl
movq 0x20(%rsp), %rax
movq 0x38(%rsp), %rcx
movzbl %dl, %esi
movzbl (%rax,%rcx), %edx
callq 0x1d12c0
movq 0x8(%rsp), %rcx
movq %rax, %rdx
movq 0x10(%rsp), %rax
addq %rdx, %rcx
cmpq %rcx, %rax
jne 0x1c69ec
movq 0x70(%rsp), %rdi
callq 0x12a410
movq 0x40(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x40(%rsp)
movq 0x38(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x38(%rsp)
jmp 0x1c6901
cmpq $0x0, 0x38(%rsp)
jbe 0x1c6a4d
movq 0x68(%rsp), %rax
movq 0x40(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x38(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x68(%rsp), %rcx
movq 0x40(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movq 0x38(%rsp), %rdx
subq $0x1, %rdx
movq (%rcx,%rdx,8), %rcx
addq 0x30(%rsp), %rcx
cmpq %rcx, %rax
jne 0x1c6a4d
movq 0x70(%rsp), %rdi
callq 0x12a4f0
movq 0x38(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x38(%rsp)
jmp 0x1c6901
cmpq $0x0, 0x40(%rsp)
jbe 0x1c6aae
movq 0x68(%rsp), %rax
movq 0x40(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x38(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x68(%rsp), %rcx
movq 0x40(%rsp), %rdx
subq $0x1, %rdx
movq (%rcx,%rdx,8), %rcx
movq 0x38(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
addq 0x30(%rsp), %rcx
cmpq %rcx, %rax
jne 0x1c6aae
movq 0x70(%rsp), %rdi
callq 0x12a480
movq 0x40(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x40(%rsp)
jmp 0x1c6901
jmp 0x1c6ab0
movq 0x4754e9(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x34f552(%rip), %rsi    # 0x516013
leaq 0x39229b(%rip), %rdx    # 0x558d63
leaq 0x39b891(%rip), %rcx    # 0x562360
leaq 0x39b8ad(%rip), %r8     # 0x562383
movl $0x5a, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
addq $0x78, %rsp
retq
nopl (%rax)