// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/reconstructalignment.c
// Function: gt_reconstructalignment_from_affineDtab
void gt_reconstructalignment_from_affineDtab(GtAlignment *align,
                                             const GtAffineDiagAlignentry *Dtab,
                                             GtAffineAlignEdge edge,
                                             GT_UNUSED const GtUchar *useq,
                                             GtUword ulen,
                                             GT_UNUSED const GtUchar *vseq,
                                             GtUword vlen)
{
  GtUword i,j;
  GtDiagAlignentry node, prevnode;
  GtAffineAlignEdge prevedge;
  gt_assert(align != NULL && Dtab != NULL);

  switch (edge) {
    case Affine_R:
      node = Dtab[vlen].val_R;
      break;
    case Affine_D:
      node = Dtab[vlen].val_D;
      break;
    case Affine_I:
      node = Dtab[vlen].val_I;
      break;
    default:
      gt_assert(false);
#ifdef NDEBUG
      exit(GT_EXIT_PROGRAMMING_ERROR);
#endif
  }

  for (j = ulen; j > node.currentrowindex; j--)
  {
    gt_alignment_add_deletion(align);
  }
  prevedge = edge;
  /*consider pairwise distance between prevnode and node */
  /*prevedge->prevnode, prevnode.edge->node, node.edge->nextnode*/
  for (i = vlen; i > 0; i--)
  {
    prevnode = node;
    switch (prevnode.last_type) {
      case Affine_R:
        node = Dtab[i-1].val_R;
        break;
      case Affine_D:
        node = Dtab[i-1].val_D;
        break;
      case Affine_I:
        node = Dtab[i-1].val_I;
        break;
      default:
        gt_assert(false);
#ifdef NDEBUG
        exit(GT_EXIT_PROGRAMMING_ERROR);
#endif
    }

    gt_assert(prevnode.currentrowindex != GT_UWORD_MAX);
    if (prevnode.currentrowindex == node.currentrowindex + 1)
    {
      if (prevedge == Affine_R)
      {
        gt_alignment_add_replacement(align);
      }
      else if (prevedge == Affine_D)
      {
         gt_alignment_add_deletion(align);
         gt_alignment_add_insertion(align);
      }
      else if (prevedge == Affine_I)
      {
         gt_alignment_add_insertion(align);
         gt_alignment_add_deletion(align);
      }
    }
    else if (prevnode.currentrowindex == node.currentrowindex)
    {
      gt_alignment_add_insertion(align);
    }
    else if (prevnode.currentrowindex > node.currentrowindex)
    {
      if (prevedge == Affine_R)
      {
        gt_alignment_add_replacement(align);

        for (j = 0; j < prevnode.currentrowindex - node.currentrowindex - 1;
             j++)
        {
          gt_alignment_add_deletion(align);
        }
      }
      else if (prevedge == Affine_I)
      {
        gt_alignment_add_insertion(align);
        for (j = 0; j < prevnode.currentrowindex - node.currentrowindex; j++)
        {
          gt_alignment_add_deletion(align);
        }
      }
      else
      {
        gt_assert(false);
      }
    }
    prevedge = prevnode.last_type;
  }
  for (j = node.currentrowindex; j > 0; j--)
  {
    gt_alignment_add_deletion(align);
  }
}

// Assembly:
subq $0x88, %rsp
movq 0x90(%rsp), %rax
movq %rdi, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
movl %edx, 0x74(%rsp)
movq %rcx, 0x68(%rsp)
movq %r8, 0x60(%rsp)
movq %r9, 0x58(%rsp)
cmpq $0x0, 0x80(%rsp)
je 0x1c7602
cmpq $0x0, 0x78(%rsp)
jne 0x1c763a
movq 0x474997(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x34ea00(%rip), %rsi    # 0x516013
leaq 0x39ae82(%rip), %rdx    # 0x56249c
leaq 0x39ae99(%rip), %rcx    # 0x5624ba
leaq 0x39ad5b(%rip), %r8     # 0x562383
movl $0x129, %r9d            # imm = 0x129
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1c763c
movl 0x74(%rsp), %eax
movl %eax, 0x8(%rsp)
testl %eax, %eax
je 0x1c7663
jmp 0x1c764a
movl 0x8(%rsp), %eax
subl $0x1, %eax
je 0x1c7693
jmp 0x1c7655
movl 0x8(%rsp), %eax
subl $0x2, %eax
je 0x1c76c1
jmp 0x1c76ef
movq 0x78(%rsp), %rax
imulq $0x48, 0x90(%rsp), %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, 0x30(%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x38(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x40(%rsp)
jmp 0x1c7729
movq 0x78(%rsp), %rax
imulq $0x48, 0x90(%rsp), %rcx
addq %rcx, %rax
movq 0x18(%rax), %rcx
movq %rcx, 0x30(%rsp)
movq 0x20(%rax), %rcx
movq %rcx, 0x38(%rsp)
movq 0x28(%rax), %rax
movq %rax, 0x40(%rsp)
jmp 0x1c7729
movq 0x78(%rsp), %rax
imulq $0x48, 0x90(%rsp), %rcx
addq %rcx, %rax
movq 0x30(%rax), %rcx
movq %rcx, 0x30(%rsp)
movq 0x38(%rax), %rcx
movq %rcx, 0x38(%rsp)
movq 0x40(%rax), %rax
movq %rax, 0x40(%rsp)
jmp 0x1c7729
jmp 0x1c76f1
movq 0x4748a8(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x34e911(%rip), %rsi    # 0x516013
leaq 0x39165a(%rip), %rdx    # 0x558d63
leaq 0x39adaa(%rip), %rcx    # 0x5624ba
leaq 0x39ac6c(%rip), %r8     # 0x562383
movl $0x136, %r9d            # imm = 0x136
movb $0x0, %al
callq 0x199f0
callq 0x19370
movq 0x60(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rax
cmpq 0x38(%rsp), %rax
jbe 0x1c775c
movq 0x80(%rsp), %rdi
callq 0x12a480
movq 0x48(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x48(%rsp)
jmp 0x1c7733
movl 0x74(%rsp), %eax
movl %eax, 0xc(%rsp)
movq 0x90(%rsp), %rax
movq %rax, 0x50(%rsp)
cmpq $0x0, 0x50(%rsp)
jbe 0x1c7a76
movq 0x40(%rsp), %rax
movq %rax, 0x20(%rsp)
movups 0x30(%rsp), %xmm0
movaps %xmm0, 0x10(%rsp)
movl 0x20(%rsp), %eax
movl %eax, 0x4(%rsp)
testl %eax, %eax
je 0x1c77b8
jmp 0x1c779f
movl 0x4(%rsp), %eax
subl $0x1, %eax
je 0x1c77ec
jmp 0x1c77aa
movl 0x4(%rsp), %eax
subl $0x2, %eax
je 0x1c781e
jmp 0x1c7850
movq 0x78(%rsp), %rax
movq 0x50(%rsp), %rcx
subq $0x1, %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, 0x30(%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x38(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x40(%rsp)
jmp 0x1c788a
movq 0x78(%rsp), %rax
movq 0x50(%rsp), %rcx
subq $0x1, %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rcx
movq %rcx, 0x30(%rsp)
movq 0x20(%rax), %rcx
movq %rcx, 0x38(%rsp)
movq 0x28(%rax), %rax
movq %rax, 0x40(%rsp)
jmp 0x1c788a
movq 0x78(%rsp), %rax
movq 0x50(%rsp), %rcx
subq $0x1, %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq 0x30(%rax), %rcx
movq %rcx, 0x30(%rsp)
movq 0x38(%rax), %rcx
movq %rcx, 0x38(%rsp)
movq 0x40(%rax), %rax
movq %rax, 0x40(%rsp)
jmp 0x1c788a
jmp 0x1c7852
movq 0x474747(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x34e7b0(%rip), %rsi    # 0x516013
leaq 0x3914f9(%rip), %rdx    # 0x558d63
leaq 0x39ac49(%rip), %rcx    # 0x5624ba
leaq 0x39ab0b(%rip), %r8     # 0x562383
movl $0x151, %r9d            # imm = 0x151
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1c788c
cmpq $-0x1, 0x18(%rsp)
jne 0x1c78cc
movq 0x474705(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x34e76e(%rip), %rsi    # 0x516013
leaq 0x39ac36(%rip), %rdx    # 0x5624e2
leaq 0x39ac07(%rip), %rcx    # 0x5624ba
leaq 0x39aac9(%rip), %r8     # 0x562383
movl $0x157, %r9d            # imm = 0x157
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1c78ce
movq 0x18(%rsp), %rax
movq 0x38(%rsp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jne 0x1c7944
cmpl $0x0, 0xc(%rsp)
jne 0x1c78f7
movq 0x80(%rsp), %rdi
callq 0x12a410
jmp 0x1c793f
cmpl $0x1, 0xc(%rsp)
jne 0x1c791a
movq 0x80(%rsp), %rdi
callq 0x12a480
movq 0x80(%rsp), %rdi
callq 0x12a4f0
jmp 0x1c793d
cmpl $0x2, 0xc(%rsp)
jne 0x1c793b
movq 0x80(%rsp), %rdi
callq 0x12a4f0
movq 0x80(%rsp), %rdi
callq 0x12a480
jmp 0x1c793d
jmp 0x1c793f
jmp 0x1c7a5b
movq 0x18(%rsp), %rax
cmpq 0x38(%rsp), %rax
jne 0x1c7962
movq 0x80(%rsp), %rdi
callq 0x12a4f0
jmp 0x1c7a59
movq 0x18(%rsp), %rax
cmpq 0x38(%rsp), %rax
jbe 0x1c7a57
cmpl $0x0, 0xc(%rsp)
jne 0x1c79c9
movq 0x80(%rsp), %rdi
callq 0x12a410
movq $0x0, 0x48(%rsp)
movq 0x48(%rsp), %rax
movq 0x18(%rsp), %rcx
subq 0x38(%rsp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x1c79c4
movq 0x80(%rsp), %rdi
callq 0x12a480
movq 0x48(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x48(%rsp)
jmp 0x1c798f
jmp 0x1c7a55
cmpl $0x2, 0xc(%rsp)
jne 0x1c7a19
movq 0x80(%rsp), %rdi
callq 0x12a4f0
movq $0x0, 0x48(%rsp)
movq 0x48(%rsp), %rax
movq 0x18(%rsp), %rcx
subq 0x38(%rsp), %rcx
cmpq %rcx, %rax
jae 0x1c7a17
movq 0x80(%rsp), %rdi
callq 0x12a480
movq 0x48(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x48(%rsp)
jmp 0x1c79e6
jmp 0x1c7a53
jmp 0x1c7a1b
movq 0x47457e(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x34e5e7(%rip), %rsi    # 0x516013
leaq 0x391330(%rip), %rdx    # 0x558d63
leaq 0x39aa80(%rip), %rcx    # 0x5624ba
leaq 0x39a942(%rip), %r8     # 0x562383
movl $0x183, %r9d            # imm = 0x183
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1c7a55
jmp 0x1c7a57
jmp 0x1c7a59
jmp 0x1c7a5b
movl 0x20(%rsp), %eax
movl %eax, 0xc(%rsp)
movq 0x50(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x50(%rsp)
jmp 0x1c7771
movq 0x38(%rsp), %rax
movq %rax, 0x48(%rsp)
cmpq $0x0, 0x48(%rsp)
jbe 0x1c7aa5
movq 0x80(%rsp), %rdi
callq 0x12a480
movq 0x48(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x48(%rsp)
jmp 0x1c7a80
addq $0x88, %rsp
retq
nopl (%rax)