// File: /workspace/github_c_makefile_star2_O1/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, 0x8(%rsp)
movq %rcx, 0x18(%rsp)
testq %rdi, %rdi
je 0x175341
movq %rsi, %r14
testq %rsi, %rsi
je 0x175341
movq 0x98(%rsp), %rax
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0x175341
movq %r9, %rbx
movq %rdi, %r13
movq 0x90(%rsp), %r15
movq 0x88(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x30(%rsp)
movq %rdx, 0x38(%rsp)
movq %rdx, %rdi
callq 0x1683e2
cmpq %rbx, %rax
ja 0x175346
movq %rdx, %r12
cmpq %r15, %rdx
ja 0x175346
movq %rax, %rbp
movq 0x20(%rsp), %rdi
callq 0x1797fb
movq %rax, 0x28(%rsp)
testq %r12, %r12
setne %dl
testq %rbp, %rbp
setne %r15b
movq %rbp, %rax
orq %r12, %rax
je 0x17531e
movq 0x8(%rsp), %rax
movq 0x18(%rsp), %rcx
addq %rcx, %rax
decq %rax
movq %rax, 0x18(%rsp)
movq 0x10(%rsp), %rax
movq 0x30(%rsp), %rcx
addq %rcx, %rax
decq %rax
movq %rax, 0x10(%rsp)
movq %r13, 0x40(%rsp)
movb %dl, 0x8(%rsp)
movq (%r14,%rbp,8), %rax
movq (%rax,%r12,8), %rbx
testq %rbx, %rbx
je 0x17531e
movl %r15d, %eax
andb %dl, %al
testb $0x1, %al
je 0x175285
movq -0x8(%r14,%rbp,8), %rax
movq %r14, %r13
movq -0x8(%rax,%r12,8), %r14
movq 0x18(%rsp), %rax
movzbl (%rax,%rbp), %esi
movq 0x10(%rsp), %rax
movzbl (%rax,%r12), %edx
movq 0x20(%rsp), %rdi
callq 0x17982a
movb 0x8(%rsp), %dl
addq %r14, %rax
movq %r13, %r14
movq 0x40(%rsp), %r13
cmpq %rax, %rbx
je 0x1752eb
testb $0x1, %dl
je 0x17529e
movq (%r14,%rbp,8), %rax
movq -0x8(%rax,%r12,8), %rcx
addq 0x28(%rsp), %rcx
cmpq %rcx, (%rax,%r12,8)
je 0x1752f8
testb $0x1, %r15b
je 0x17533c
movq -0x8(%r14,%rbp,8), %rax
movq (%r14,%rbp,8), %rcx
movq (%rax,%r12,8), %rax
addq 0x28(%rsp), %rax
cmpq %rax, (%rcx,%r12,8)
jne 0x17533c
movq %r13, %rdi
callq 0x126d42
leaq -0x1(%rbp), %rax
cmpq $0x1, %rbp
setne %r15b
movl %r15d, %ecx
movb 0x8(%rsp), %dl
orb %dl, %cl
movq %rax, %rbp
testb $0x1, %cl
jne 0x17522d
jmp 0x17531b
movq %r13, %rdi
callq 0x126d25
decq %rbp
jmp 0x175300
movq %r13, %rdi
callq 0x126d5f
decq %r12
setne %dl
testq %rbp, %rbp
setne %r15b
movq %rbp, %rax
orq %r12, %rax
jne 0x175229
jmp 0x17531e
movq %rax, %rbp
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 0x1683a6
callq 0x521c6
callq 0x5218f
callq 0x521ff