// File: /workspace/github_c_makefile_star2_O1/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r15
movq %rdi, 0x8(%rsp)
callq 0x169b94
movq (%r15), %r12
testq %r12, %r12
je 0x20d9fc
cmpq $0x0, 0x8(%r15)
je 0x20d9fc
movq %rax, %rbx
movq 0x20(%r15), %rcx
movq 0x18(%r15), %r15
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rdx
leaq 0x1(%r15), %rax
imulq %r15, %rax
shlq $0x4, %rax
movq %rdx, 0x10(%rsp)
addq %rdx, %rax
movq %rcx, (%rsp)
shlq $0x4, %rcx
movb 0x8(%rcx,%rax), %r14b
testq %r15, %r15
jle 0x20d9c7
cmpb $0x1, %r14b
je 0x20d963
movzbl %r14b, %eax
cmpl $0x2, %eax
je 0x20d90c
cmpl $0x4, %eax
jne 0x20d9f7
movq 0x8(%rsp), %rax
movslq 0xc(%rax), %rax
subq %rax, %r15
movq (%rsp), %rcx
incq %rcx
leaq 0x1(%r15), %rax
imulq %r15, %rax
shlq $0x4, %rax
addq 0x10(%rsp), %rax
movq %rcx, (%rsp)
shlq $0x4, %rcx
movq (%rcx,%rax), %r13
movb 0x8(%rcx,%rax), %r14b
movq %r12, %rbp
subq %r13, %rbp
je 0x20d8ff
movq %rbx, %rdi
callq 0x169e5f
decq %rbp
jne 0x20d8f2
movq %rbx, %rdi
callq 0x169e32
jmp 0x20d9b1
movq 0x8(%rsp), %rax
movslq 0x10(%rax), %rax
subq %rax, %r15
movq (%rsp), %rcx
decq %rcx
leaq 0x1(%r15), %rax
imulq %r15, %rax
shlq $0x4, %rax
addq 0x10(%rsp), %rax
movq %rcx, (%rsp)
shlq $0x4, %rcx
movq (%rcx,%rax), %r13
movb 0x8(%rcx,%rax), %r14b
movq %r13, %rbp
notq %rbp
addq %r12, %rbp
je 0x20d959
movq %rbx, %rdi
callq 0x169e5f
decq %rbp
jne 0x20d94c
movq %rbx, %rdi
callq 0x169e41
jmp 0x20d9b1
movq 0x8(%rsp), %rax
movslq 0x8(%rax), %rax
subq %rax, %r15
leaq 0x1(%r15), %rax
imulq %r15, %rax
shlq $0x4, %rax
addq 0x10(%rsp), %rax
movq (%rsp), %rcx
shlq $0x4, %rcx
movq (%rcx,%rax), %r13
movb 0x8(%rcx,%rax), %r14b
movq %r13, %rbp
notq %rbp
addq %r12, %rbp
je 0x20d9a9
movq %rbx, %rdi
callq 0x169e5f
decq %rbp
jne 0x20d99c
movq %rbx, %rdi
callq 0x169e50
testq %r13, %r13
js 0x20d9c2
cmpq %r13, %r12
movq %r13, %r12
jge 0x20d890
callq 0x81c6d
testq %r12, %r12
jle 0x20d9e0
incq %r12
movq %rbx, %rdi
callq 0x169e5f
decq %r12
cmpq $0x1, %r12
jg 0x20d9cf
testq %r15, %r15
jne 0x20da01
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x81ca6
callq 0x81cdf
callq 0x81c34