// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/reconstructalignment.c
// Function: gt_reconstructalignment_from_Ctab
void gt_reconstructalignment_from_Ctab(GtAlignment *align,
                                       const GtUword *Ctab,
                                       const GtUchar *useq,
                                       GtUword ustart,
                                       const GtUchar *vseq,
                                       GtUword vstart,
                                       GtUword vlen,
                                       const GtScoreHandler *scorehandler)
{
  GtUword i,j, repl, indel, gap_opening, gap_extension;
  gt_assert(align && Ctab && scorehandler);

  gap_opening = gt_scorehandler_get_gap_opening(scorehandler);
  gap_extension = gt_scorehandler_get_gapscore(scorehandler);

  for (i = vlen; i > 0; i--) {
    if (Ctab[i] == Ctab[i-1] + 1)
    {
      if (i > 1 && Ctab[i-2] == Ctab[i-1])
        indel = 2*gap_extension + gap_opening;
      else
        indel = (2*gap_extension + 2*gap_opening);

      repl = gt_scorehandler_get_replacement(scorehandler,
                                             vseq[vstart+i-1],
                                             useq[ustart+Ctab[i]-1]);

      if (indel>repl)
        gt_alignment_add_replacement(align);
      else
      {
        gt_alignment_add_deletion(align);
        gt_alignment_add_insertion(align);
      }
    }
    else if (Ctab[i] == Ctab[i-1])
      gt_alignment_add_insertion(align);
    else if (Ctab[i] > Ctab[i-1]) {
      indel = 0; repl = 0;
      for (j = 0; j < (Ctab[i]-Ctab[i-1])-1; j++)
       gt_alignment_add_deletion(align);
      /*replacmente or insertion+deletion*/
      if (i > 1 && Ctab[i-2] == Ctab[i-1])
        indel = 2*gap_extension;
      else
        indel = (2*gap_extension+gap_opening);

      repl = gt_scorehandler_get_replacement (scorehandler,
                                              vseq[vstart+i-1],
                                              useq[ustart+Ctab[i]-j-1]);
      if (indel > repl)
        gt_alignment_add_replacement(align);
      else
      {
        gt_alignment_add_deletion(align);
        gt_alignment_add_insertion(align);
      }
    }
  }
  for (j = Ctab[0]; j > 0; j--)
    gt_alignment_add_deletion(align);
}

// Assembly:
subq $0x68, %rsp
movq 0x78(%rsp), %rax
movq 0x70(%rsp), %rax
movq %rdi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
movq %rcx, 0x48(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x38(%rsp)
cmpq $0x0, 0x60(%rsp)
je 0x1c6ec4
cmpq $0x0, 0x58(%rsp)
je 0x1c6ec4
cmpq $0x0, 0x78(%rsp)
jne 0x1c6efc
movq 0x4750d5(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x34f13e(%rip), %rsi    # 0x516013
leaq 0x39b528(%rip), %rdx    # 0x562404
leaq 0x39b53f(%rip), %rcx    # 0x562422
leaq 0x39b499(%rip), %r8     # 0x562383
movl $0x9e, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1c6efe
movq 0x78(%rsp), %rdi
callq 0x1d1180
movq %rax, 0x10(%rsp)
movq 0x78(%rsp), %rdi
callq 0x1d11d0
movq %rax, 0x8(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x30(%rsp)
cmpq $0x0, 0x30(%rsp)
jbe 0x1c71cf
movq 0x58(%rsp), %rax
movq 0x30(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x58(%rsp), %rcx
movq 0x30(%rsp), %rdx
subq $0x1, %rdx
movq (%rcx,%rdx,8), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jne 0x1c7032
cmpq $0x1, 0x30(%rsp)
jbe 0x1c6fa1
movq 0x58(%rsp), %rax
movq 0x30(%rsp), %rcx
subq $0x2, %rcx
movq (%rax,%rcx,8), %rax
movq 0x58(%rsp), %rcx
movq 0x30(%rsp), %rdx
subq $0x1, %rdx
cmpq (%rcx,%rdx,8), %rax
jne 0x1c6fa1
movq 0x8(%rsp), %rax
shlq %rax
addq 0x10(%rsp), %rax
movq %rax, 0x18(%rsp)
jmp 0x1c6fb9
movq 0x8(%rsp), %rax
shlq %rax
movq 0x10(%rsp), %rcx
shlq %rcx
addq %rcx, %rax
movq %rax, 0x18(%rsp)
movq 0x78(%rsp), %rdi
movq 0x40(%rsp), %rax
movq 0x38(%rsp), %rcx
addq 0x30(%rsp), %rcx
subq $0x1, %rcx
movb (%rax,%rcx), %dl
movq 0x50(%rsp), %rax
movq 0x48(%rsp), %rcx
movq 0x58(%rsp), %rsi
movq 0x30(%rsp), %r8
addq (%rsi,%r8,8), %rcx
subq $0x1, %rcx
movzbl %dl, %esi
movzbl (%rax,%rcx), %edx
callq 0x1d12c0
movq %rax, 0x20(%rsp)
movq 0x18(%rsp), %rax
cmpq 0x20(%rsp), %rax
jbe 0x1c7019
movq 0x60(%rsp), %rdi
callq 0x12a410
jmp 0x1c702d
movq 0x60(%rsp), %rdi
callq 0x12a480
movq 0x60(%rsp), %rdi
callq 0x12a4f0
jmp 0x1c71ba
movq 0x58(%rsp), %rax
movq 0x30(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x58(%rsp), %rcx
movq 0x30(%rsp), %rdx
subq $0x1, %rdx
cmpq (%rcx,%rdx,8), %rax
jne 0x1c7063
movq 0x60(%rsp), %rdi
callq 0x12a4f0
jmp 0x1c71b8
movq 0x58(%rsp), %rax
movq 0x30(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x58(%rsp), %rcx
movq 0x30(%rsp), %rdx
subq $0x1, %rdx
cmpq (%rcx,%rdx,8), %rax
jbe 0x1c71b6
movq $0x0, 0x18(%rsp)
movq $0x0, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movq 0x28(%rsp), %rax
movq 0x58(%rsp), %rcx
movq 0x30(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movq 0x58(%rsp), %rdx
movq 0x30(%rsp), %rsi
subq $0x1, %rsi
subq (%rdx,%rsi,8), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x1c70ec
movq 0x60(%rsp), %rdi
callq 0x12a480
movq 0x28(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x28(%rsp)
jmp 0x1c70a4
cmpq $0x1, 0x30(%rsp)
jbe 0x1c7129
movq 0x58(%rsp), %rax
movq 0x30(%rsp), %rcx
subq $0x2, %rcx
movq (%rax,%rcx,8), %rax
movq 0x58(%rsp), %rcx
movq 0x30(%rsp), %rdx
subq $0x1, %rdx
cmpq (%rcx,%rdx,8), %rax
jne 0x1c7129
movq 0x8(%rsp), %rax
shlq %rax
movq %rax, 0x18(%rsp)
jmp 0x1c713b
movq 0x8(%rsp), %rax
shlq %rax
addq 0x10(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x78(%rsp), %rdi
movq 0x40(%rsp), %rax
movq 0x38(%rsp), %rcx
addq 0x30(%rsp), %rcx
subq $0x1, %rcx
movb (%rax,%rcx), %dl
movq 0x50(%rsp), %rax
movq 0x48(%rsp), %rcx
movq 0x58(%rsp), %rsi
movq 0x30(%rsp), %r8
addq (%rsi,%r8,8), %rcx
subq 0x28(%rsp), %rcx
subq $0x1, %rcx
movzbl %dl, %esi
movzbl (%rax,%rcx), %edx
callq 0x1d12c0
movq %rax, 0x20(%rsp)
movq 0x18(%rsp), %rax
cmpq 0x20(%rsp), %rax
jbe 0x1c71a0
movq 0x60(%rsp), %rdi
callq 0x12a410
jmp 0x1c71b4
movq 0x60(%rsp), %rdi
callq 0x12a480
movq 0x60(%rsp), %rdi
callq 0x12a4f0
jmp 0x1c71b6
jmp 0x1c71b8
jmp 0x1c71ba
jmp 0x1c71bc
movq 0x30(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x30(%rsp)
jmp 0x1c6f26
movq 0x58(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x28(%rsp)
cmpq $0x0, 0x28(%rsp)
jbe 0x1c71fe
movq 0x60(%rsp), %rdi
callq 0x12a480
movq 0x28(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x28(%rsp)
jmp 0x1c71dc
addq $0x68, %rsp
retq
nopw %cs:(%rax,%rax)