// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/xdrop.c
// Function: gt_xdrop_backtrack
GtMultieoplist * gt_xdrop_backtrack(const GtXdropresources *res,
                                    const GtXdropbest *best)
{
  GtMultieoplist *meops = gt_multieoplist_new();
  GtUword idx, i;
  GtWord k = best->best_k,
       d = best->best_d,
       old_row = (GtWord) best->ivalue;
  GtXdropfrontvalue *fronts = res->fronts.spaceGtXdropfrontvalue,
                    currfront;
  gt_assert(best->ivalue != 0 && best->jvalue != 0);

  idx = GT_XDROP_FRONTIDX(d, k);
  currfront = fronts[idx];

  while (d > 0) {
    if (currfront.direction == GT_XDROP_INSERTIONBIT) {
      d -= res->arbitdistances.ins; k++;
      idx = GT_XDROP_FRONTIDX(d, k);
      currfront = fronts[idx];
      for (i = 0; i < (GtUword) old_row - (currfront.row); ++i) {
        gt_multieoplist_add_match(meops);
      }
      gt_multieoplist_add_insertion(meops);
    }
    else if (currfront.direction == GT_XDROP_DELETIONBIT) {
      d -= res->arbitdistances.del; k--;
      idx = GT_XDROP_FRONTIDX(d, k);
      currfront = fronts[idx];
      for (i = 0; i < (GtUword) old_row - (currfront.row + 1); ++i) {
        gt_multieoplist_add_match(meops);
      }
      gt_multieoplist_add_deletion(meops);
    }
    else if (currfront.direction == GT_XDROP_REPLACEMENTBIT) {
      d -= res->arbitdistances.mis;
      idx = GT_XDROP_FRONTIDX(d, k);
      currfront = fronts[idx];
      for (i = 0; i < (GtUword) old_row - (currfront.row + 1); ++i) {
        gt_multieoplist_add_match(meops);
      }
      gt_multieoplist_add_mismatch(meops);
    }
    else {
      gt_assert(false && "this should not be reached");
    }

    gt_assert(currfront.row >= 0 && old_row >= currfront.row);
    old_row = currfront.row;
  }
  while (old_row > 0) {
    gt_multieoplist_add_match(meops);
    old_row--;
  }
  gt_assert(d == 0);
  return meops;
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
callq 0x1af960
movq %rax, 0x40(%rsp)
movq 0x48(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x48(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x48(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x50(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x48(%rsp), %rax
cmpq $0x0, (%rax)
je 0x2f9946
movq 0x48(%rsp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x2f997e
movq 0x342653(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x21c6bc(%rip), %rsi    # 0x516013
leaq 0x29666c(%rip), %rdx    # 0x58ffca
leaq 0x29668c(%rip), %rcx    # 0x58fff1
leaq 0x296596(%rip), %r8     # 0x58ff02
movl $0x1bb, %r9d            # imm = 0x1BB
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2f9980
movq 0x20(%rsp), %rax
imulq 0x20(%rsp), %rax
addq 0x20(%rsp), %rax
addq 0x28(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x10(%rsp), %rax
movq 0x38(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x20(%rsp)
jle 0x2f9c74
movzbl 0x8(%rsp), %eax
cmpl $0x4, %eax
jne 0x2f9a79
movq 0x50(%rsp), %rax
movslq 0xc(%rax), %rcx
movq 0x20(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x20(%rsp)
movq 0x28(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x28(%rsp)
movq 0x20(%rsp), %rax
imulq 0x20(%rsp), %rax
addq 0x20(%rsp), %rax
addq 0x28(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x10(%rsp), %rax
movq 0x38(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
movq $0x0, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq 0x18(%rsp), %rcx
subq (%rsp), %rcx
cmpq %rcx, %rax
jae 0x2f9a6a
movq 0x40(%rsp), %rdi
callq 0x1b0030
movq 0x30(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x30(%rsp)
jmp 0x2f9a3d
movq 0x40(%rsp), %rdi
callq 0x1affd0
jmp 0x2f9c18
movzbl 0x8(%rsp), %eax
cmpl $0x2, %eax
jne 0x2f9b32
movq 0x50(%rsp), %rax
movslq 0x10(%rax), %rcx
movq 0x20(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x20(%rsp)
movq 0x28(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x28(%rsp)
movq 0x20(%rsp), %rax
imulq 0x20(%rsp), %rax
addq 0x20(%rsp), %rax
addq 0x28(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x10(%rsp), %rax
movq 0x38(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
movq $0x0, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq 0x18(%rsp), %rcx
movq (%rsp), %rdx
addq $0x1, %rdx
subq %rdx, %rcx
cmpq %rcx, %rax
jae 0x2f9b23
movq 0x40(%rsp), %rdi
callq 0x1b0030
movq 0x30(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x30(%rsp)
jmp 0x2f9aef
movq 0x40(%rsp), %rdi
callq 0x1afff0
jmp 0x2f9c16
movzbl 0x8(%rsp), %eax
cmpl $0x1, %eax
jne 0x2f9bda
movq 0x50(%rsp), %rax
movslq 0x8(%rax), %rcx
movq 0x20(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
imulq 0x20(%rsp), %rax
addq 0x20(%rsp), %rax
addq 0x28(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x10(%rsp), %rax
movq 0x38(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
movq $0x0, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq 0x18(%rsp), %rcx
movq (%rsp), %rdx
addq $0x1, %rdx
subq %rdx, %rcx
cmpq %rcx, %rax
jae 0x2f9bce
movq 0x40(%rsp), %rdi
callq 0x1b0030
movq 0x30(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x30(%rsp)
jmp 0x2f9b9a
movq 0x40(%rsp), %rdi
callq 0x1b0010
jmp 0x2f9c14
jmp 0x2f9bdc
movq 0x3423bd(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x21c426(%rip), %rsi    # 0x516013
leaq 0x296410(%rip), %rdx    # 0x590004
leaq 0x2963f6(%rip), %rcx    # 0x58fff1
leaq 0x296300(%rip), %r8     # 0x58ff02
movl $0x1dd, %r9d            # imm = 0x1DD
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2f9c16
jmp 0x2f9c18
jmp 0x2f9c1a
cmpq $0x0, (%rsp)
jl 0x2f9c2c
movq 0x18(%rsp), %rax
cmpq (%rsp), %rax
jge 0x2f9c64
movq 0x34236d(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x21c3d6(%rip), %rsi    # 0x516013
leaq 0x2963e6(%rip), %rdx    # 0x59002a
leaq 0x2963a6(%rip), %rcx    # 0x58fff1
leaq 0x2962b0(%rip), %r8     # 0x58ff02
movl $0x1e0, %r9d            # imm = 0x1E0
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2f9c66
movq (%rsp), %rax
movq %rax, 0x18(%rsp)
jmp 0x2f99bb
jmp 0x2f9c76
cmpq $0x0, 0x18(%rsp)
jle 0x2f9c98
movq 0x40(%rsp), %rdi
callq 0x1b0030
movq 0x18(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x18(%rsp)
jmp 0x2f9c76
jmp 0x2f9c9a
cmpq $0x0, 0x20(%rsp)
je 0x2f9cda
movq 0x3422f7(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x21c360(%rip), %rsi    # 0x516013
leaq 0x25d2af(%rip), %rdx    # 0x556f69
leaq 0x296330(%rip), %rcx    # 0x58fff1
leaq 0x29623a(%rip), %r8     # 0x58ff02
movl $0x1e7, %r9d            # imm = 0x1E7
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2f9cdc
movq 0x40(%rsp), %rax
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)