// File: /workspace/github_c_makefile_star2_O2/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 0x101648
movq (%r15), %rbp
testq %rbp, %rbp
je 0x1b82e2
cmpq $0x0, 0x8(%r15)
je 0x1b82e2
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 0x1b828e
cmpb $0x1, %r14b
je 0x1b81f4
movzbl %r14b, %eax
cmpl $0x2, %eax
je 0x1b81a2
cmpl $0x4, %eax
jne 0x1b82aa
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), %r12
movb 0x8(%rcx,%rax), %r14b
movq %rbp, %r13
movq %rbx, %rdi
cmpq %r13, %r12
je 0x1b823f
callq 0x101982
decq %r13
jmp 0x1b818c
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), %r12
movb 0x8(%rcx,%rax), %r14b
leaq -0x1(%rbp), %r13
movq %rbx, %rdi
cmpq %r13, %r12
je 0x1b81ed
callq 0x101982
decq %r13
jmp 0x1b81db
callq 0x10196c
jmp 0x1b8244
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), %r12
movb 0x8(%rcx,%rax), %r14b
leaq -0x1(%rbp), %r13
movq %rbx, %rdi
cmpq %r13, %r12
je 0x1b8238
callq 0x101982
decq %r13
jmp 0x1b8226
callq 0x101977
jmp 0x1b8244
callq 0x101961
testq %r12, %r12
js 0x1b8255
cmpq %r12, %rbp
movq %r12, %rbp
jge 0x1b812f
movq 0x27fd0c(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x12cdad(%rip), %rsi    # 0x2e5013
leaq 0x1a506f(%rip), %rdx    # 0x35d2dc
leaq 0x1a502f(%rip), %rcx    # 0x35d2a3
leaq 0x1a4f77(%rip), %r8     # 0x35d1f2
movl $0x1e0, %r9d            # imm = 0x1E0
jmp 0x1b82d6
movq %rbx, %rdi
callq 0x101982
decq %rbp
testq %rbp, %rbp
jg 0x1b8283
testq %r15, %r15
jne 0x1b8310
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x27fcb7(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x12cd58(%rip), %rsi    # 0x2e5013
leaq 0x1a4ff4(%rip), %rdx    # 0x35d2b6
leaq 0x1a4fda(%rip), %rcx    # 0x35d2a3
leaq 0x1a4f22(%rip), %r8     # 0x35d1f2
movl $0x1dd, %r9d            # imm = 0x1DD
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x27fc7f(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x12cd20(%rip), %rsi    # 0x2e5013
leaq 0x1a4f82(%rip), %rdx    # 0x35d27c
leaq 0x1a4fa2(%rip), %rcx    # 0x35d2a3
leaq 0x1a4eea(%rip), %r8     # 0x35d1f2
movl $0x1bb, %r9d            # imm = 0x1BB
jmp 0x1b82d6
movq 0x27fc51(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x12ccf2(%rip), %rsi    # 0x2e5013
leaq 0x16c8f9(%rip), %rdx    # 0x324c21
leaq 0x1a4f74(%rip), %rcx    # 0x35d2a3
leaq 0x1a4ebc(%rip), %r8     # 0x35d1f2
movl $0x1e7, %r9d            # imm = 0x1E7
jmp 0x1b82d6