// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/extended/reconstructalignment.c
// Function: gt_reconstructalignment_from_Ltab
void gt_reconstructalignment_from_Ltab(GtAlignment *align,
                                       GtWord **Ltabcolumn,
                                       GtMaxcoordvalue *max,
                                       const GtUchar *useq,
                                       GtUword ustart,
                                       GT_UNUSED GtUword ulen,
                                       const GtUchar *vseq,
                                       GtUword vstart,
                                       GT_UNUSED GtUword vlen,
                                       const GtScoreHandler *scorehandler)
{
  GtUword i, j;
  GtWord gapscore;
  GtUwordPair max_end;

  gt_assert(align && Ltabcolumn && scorehandler);
  max_end = gt_maxcoordvalue_get_end(max);
  i = max_end.a;
  j = max_end.b;
  gt_assert(i <= ulen && j <= vlen);
  gapscore = gt_scorehandler_get_gapscore(scorehandler);
  while ((i > 0 || j > 0) && Ltabcolumn[i][j] != 0)
  {
    if (i > 0 && j > 0 && Ltabcolumn[i][j] == Ltabcolumn[i-1][j-1] +
                                              gt_scorehandler_get_replacement(
                                                    scorehandler,
                                                    useq[ustart+i-1],
                                                    vseq[vstart+j-1]))
    {
      gt_alignment_add_replacement(align);
      i--;
      j--;
      continue;
    }
    if (j > 0 && Ltabcolumn[i][j] == Ltabcolumn[i][j-1] + gapscore)
    {
      gt_alignment_add_insertion(align);
      j--;
      continue;
    }
    if (i > 0 && Ltabcolumn[i][j] == Ltabcolumn[i-1][j] + gapscore)
    {
      gt_alignment_add_deletion(align);
      i--;
      continue;
    }
    gt_assert(false);
  }
  gt_maxcoordvalue_set_start(max,i,j);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
testq %rdi, %rdi
je 0x16d0da
movq %rsi, %r14
testq %rsi, %rsi
je 0x16d0da
movq 0x98(%rsp), %rax
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0x16d0da
movq %r9, %rbx
movq %rdi, %r13
movq 0x90(%rsp), %r15
movq 0x88(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x30(%rsp)
movq %rdx, 0x38(%rsp)
movq %rdx, %rdi
callq 0x160622
cmpq %rbx, %rax
ja 0x16d0df
movq %rdx, %r12
cmpq %r15, %rdx
ja 0x16d0df
movq %rax, %rbp
movq 0x20(%rsp), %rdi
callq 0x171437
movq %rax, 0x28(%rsp)
testq %r12, %r12
setne %dl
testq %rbp, %rbp
setne %r15b
movq %rbp, %rax
orq %r12, %rax
je 0x16d0b2
movq 0x18(%rsp), %rax
movq 0x10(%rsp), %rcx
addq %rcx, %rax
decq %rax
movq %rax, 0x40(%rsp)
movq 0x8(%rsp), %rax
movq 0x30(%rsp), %rcx
addq %rcx, %rax
decq %rax
movq %rax, 0x8(%rsp)
movb %dl, 0x18(%rsp)
movq (%r14,%rbp,8), %rax
movq (%rax,%r12,8), %rbx
testq %rbx, %rbx
je 0x16d0b7
movl %r15d, %ecx
andb %dl, %cl
testb $0x1, %cl
je 0x16d02a
movq -0x8(%r14,%rbp,8), %rax
movq -0x8(%rax,%r12,8), %rax
movq %rax, 0x10(%rsp)
movq 0x40(%rsp), %rax
movzbl (%rax,%rbp), %esi
movq 0x8(%rsp), %rax
movzbl (%rax,%r12), %edx
movq 0x20(%rsp), %rdi
callq 0x171466
addq 0x10(%rsp), %rax
cmpq %rax, %rbx
je 0x16d08c
movq (%r14,%rbp,8), %rax
movq (%rax,%r12,8), %rbx
jmp 0x16d02f
testb $0x1, %dl
je 0x16d03e
movq -0x8(%rax,%r12,8), %rax
addq 0x28(%rsp), %rax
cmpq %rax, %rbx
je 0x16d082
testb $0x1, %r15b
je 0x16d0d5
movq -0x8(%r14,%rbp,8), %rax
movq (%rax,%r12,8), %rax
addq 0x28(%rsp), %rax
cmpq %rax, %rbx
jne 0x16d0d5
movq %r13, %rdi
callq 0x120f4a
cmpq $0x1, %rbp
leaq -0x1(%rbp), %rbp
setne %r15b
movl %r15d, %eax
movb 0x18(%rsp), %dl
orb %dl, %al
testb $0x1, %al
jne 0x16cfcf
jmp 0x16d0b5
movq %r13, %rdi
callq 0x120f67
jmp 0x16d097
movq %r13, %rdi
callq 0x120f2d
decq %rbp
decq %r12
setne %dl
testq %rbp, %rbp
setne %r15b
movq %rbp, %rax
orq %r12, %rax
jne 0x16cfcb
jmp 0x16d0b7
xorl %r12d, %r12d
xorl %ebp, %ebp
movq 0x38(%rsp), %rdi
movq %rbp, %rsi
movq %r12, %rdx
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1605e6
callq 0x51298
callq 0x51261
callq 0x512d1