// File: /workspace/github_c_makefile_star2_O3/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 0x161d3c
movq (%r15), %r12
testq %r12, %r12
je 0x2040aa
cmpq $0x0, 0x8(%r15)
je 0x2040aa
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 0x204075
cmpb $0x1, %r14b
je 0x204011
movzbl %r14b, %eax
cmpl $0x2, %eax
je 0x203fba
cmpl $0x4, %eax
jne 0x2040a5
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 0x203fad
movq %rbx, %rdi
callq 0x161ff7
decq %rbp
jne 0x203fa0
movq %rbx, %rdi
callq 0x161fca
jmp 0x20405f
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 0x204007
movq %rbx, %rdi
callq 0x161ff7
decq %rbp
jne 0x203ffa
movq %rbx, %rdi
callq 0x161fd9
jmp 0x20405f
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 0x204057
movq %rbx, %rdi
callq 0x161ff7
decq %rbp
jne 0x20404a
movq %rbx, %rdi
callq 0x161fe8
testq %r13, %r13
js 0x204070
cmpq %r13, %r12
movq %r13, %r12
jge 0x203f3e
callq 0x7fdb8
testq %r12, %r12
jle 0x20408e
incq %r12
movq %rbx, %rdi
callq 0x161ff7
decq %r12
cmpq $0x1, %r12
ja 0x20407d
testq %r15, %r15
jne 0x2040af
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x7fdf1
callq 0x7fe2a
callq 0x7fd7f