// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/reconstructalignment.c
// Function: gt_reconstructalignment_from_Dtab
void gt_reconstructalignment_from_Dtab(GtAlignment *align,
                                       const GtDiagAlignentry *Dtab,
                                       GtUword ulen, GtUword vlen)
{
  GtUword i,j;

  gt_assert(align && Dtab);

  for (j = ulen; j > Dtab[vlen].currentrowindex; j--)
  {
    gt_alignment_add_deletion(align);
  }
  for (i = vlen; i > 0; i--) {
    gt_assert(Dtab[i].currentrowindex != GT_UWORD_MAX);
    if (Dtab[i].currentrowindex == Dtab[i-1].currentrowindex + 1)
    {
      if (Dtab[i].last_type == Linear_R)
       gt_alignment_add_replacement(align);

      else if (Dtab[i].last_type == Linear_D)
      {
         gt_alignment_add_deletion(align);
         gt_alignment_add_insertion(align);
      }
      else if (Dtab[i].last_type == Linear_I)
      {
         gt_alignment_add_insertion(align);
         gt_alignment_add_deletion(align);
      }
    }
    else if (Dtab[i].currentrowindex == Dtab[i-1].currentrowindex)
      gt_alignment_add_insertion(align);

    else if (Dtab[i].currentrowindex > Dtab[i-1].currentrowindex)
    {
      if (Dtab[i].last_type == Linear_R)
      {
        gt_alignment_add_replacement(align);
        for (j = 0; j < (Dtab[i].currentrowindex -
                         Dtab[i-1].currentrowindex)-1; j++)
        {
          gt_alignment_add_deletion(align);
        }
      }
      else if (Dtab[i].last_type == Linear_I)
      {
        gt_alignment_add_insertion(align);
        for (j = 0; j < (Dtab[i].currentrowindex -
                         Dtab[i-1].currentrowindex); j++)
        {
          gt_alignment_add_deletion(align);
        }
      }
      else
      {
        gt_assert(false);
        /*for (j = 0; j < (Dtab[i].currentrowindex -
                         Dtab[i-1].currentrowindex)-1; j++)
        {
          gt_alignment_add_deletion(align);
        }
          gt_alignment_add_replacement(align);*/

      }
    }
  }
  for (j = Dtab[0].currentrowindex; j > 0; j--)
  {
    gt_alignment_add_deletion(align);
  }
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
movq %rcx, 0x18(%rsp)
cmpq $0x0, 0x30(%rsp)
je 0x1c7238
cmpq $0x0, 0x28(%rsp)
jne 0x1c7270
movq 0x474d61(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x34edca(%rip), %rsi    # 0x516013
leaq 0x39b1f4(%rip), %rdx    # 0x562444
leaq 0x39b1fb(%rip), %rcx    # 0x562452
leaq 0x39b125(%rip), %r8     # 0x562383
movl $0xda, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1c7272
movq 0x20(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq 0x28(%rsp), %rcx
imulq $0x18, 0x18(%rsp), %rdx
addq %rdx, %rcx
cmpq 0x8(%rcx), %rax
jbe 0x1c72af
movq 0x30(%rsp), %rdi
callq 0x12a480
movq 0x8(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x8(%rsp)
jmp 0x1c727c
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jbe 0x1c7580
jmp 0x1c72c7
movq 0x28(%rsp), %rax
imulq $0x18, 0x10(%rsp), %rcx
addq %rcx, %rax
cmpq $-0x1, 0x8(%rax)
jne 0x1c7314
movq 0x474cbd(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x34ed26(%rip), %rsi    # 0x516013
leaq 0x39b180(%rip), %rdx    # 0x562474
leaq 0x39b157(%rip), %rcx    # 0x562452
leaq 0x39b081(%rip), %r8     # 0x562383
movl $0xe1, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1c7316
movq 0x28(%rsp), %rax
imulq $0x18, 0x10(%rsp), %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq 0x28(%rsp), %rcx
movq 0x10(%rsp), %rdx
subq $0x1, %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jne 0x1c73c5
movq 0x28(%rsp), %rax
imulq $0x18, 0x10(%rsp), %rcx
addq %rcx, %rax
cmpl $0x0, 0x10(%rax)
jne 0x1c736a
movq 0x30(%rsp), %rdi
callq 0x12a410
jmp 0x1c73c0
movq 0x28(%rsp), %rax
imulq $0x18, 0x10(%rsp), %rcx
addq %rcx, %rax
cmpl $0x1, 0x10(%rax)
jne 0x1c7394
movq 0x30(%rsp), %rdi
callq 0x12a480
movq 0x30(%rsp), %rdi
callq 0x12a4f0
jmp 0x1c73be
movq 0x28(%rsp), %rax
imulq $0x18, 0x10(%rsp), %rcx
addq %rcx, %rax
cmpl $0x2, 0x10(%rax)
jne 0x1c73bc
movq 0x30(%rsp), %rdi
callq 0x12a4f0
movq 0x30(%rsp), %rdi
callq 0x12a480
jmp 0x1c73be
jmp 0x1c73c0
jmp 0x1c756b
movq 0x28(%rsp), %rax
imulq $0x18, 0x10(%rsp), %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq 0x28(%rsp), %rcx
movq 0x10(%rsp), %rdx
subq $0x1, %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpq 0x8(%rcx), %rax
jne 0x1c7401
movq 0x30(%rsp), %rdi
callq 0x12a4f0
jmp 0x1c7569
movq 0x28(%rsp), %rax
imulq $0x18, 0x10(%rsp), %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq 0x28(%rsp), %rcx
movq 0x10(%rsp), %rdx
subq $0x1, %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpq 0x8(%rcx), %rax
jbe 0x1c7567
movq 0x28(%rsp), %rax
imulq $0x18, 0x10(%rsp), %rcx
addq %rcx, %rax
cmpl $0x0, 0x10(%rax)
jne 0x1c74b1
movq 0x30(%rsp), %rdi
callq 0x12a410
movq $0x0, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq 0x28(%rsp), %rcx
imulq $0x18, 0x10(%rsp), %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
movq 0x28(%rsp), %rdx
movq 0x10(%rsp), %rsi
subq $0x1, %rsi
imulq $0x18, %rsi, %rsi
addq %rsi, %rdx
subq 0x8(%rdx), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x1c74ac
movq 0x30(%rsp), %rdi
callq 0x12a480
movq 0x8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x8(%rsp)
jmp 0x1c7459
jmp 0x1c7565
movq 0x28(%rsp), %rax
imulq $0x18, 0x10(%rsp), %rcx
addq %rcx, %rax
cmpl $0x2, 0x10(%rax)
jne 0x1c7529
movq 0x30(%rsp), %rdi
callq 0x12a4f0
movq $0x0, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq 0x28(%rsp), %rcx
imulq $0x18, 0x10(%rsp), %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
movq 0x28(%rsp), %rdx
movq 0x10(%rsp), %rsi
subq $0x1, %rsi
imulq $0x18, %rsi, %rsi
addq %rsi, %rdx
subq 0x8(%rdx), %rcx
cmpq %rcx, %rax
jae 0x1c7527
movq 0x30(%rsp), %rdi
callq 0x12a480
movq 0x8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x8(%rsp)
jmp 0x1c74d8
jmp 0x1c7563
jmp 0x1c752b
movq 0x474a6e(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x34ead7(%rip), %rsi    # 0x516013
leaq 0x391820(%rip), %rdx    # 0x558d63
leaq 0x39af08(%rip), %rcx    # 0x562452
leaq 0x39ae32(%rip), %r8     # 0x562383
movl $0x10b, %r9d            # imm = 0x10B
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1c7565
jmp 0x1c7567
jmp 0x1c7569
jmp 0x1c756b
jmp 0x1c756d
movq 0x10(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x10(%rsp)
jmp 0x1c72b9
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
jbe 0x1c75b0
movq 0x30(%rsp), %rdi
callq 0x12a480
movq 0x8(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x8(%rsp)
jmp 0x1c758e
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)