// File: BenLangmead[P]bowtie/./ebwt_search_backtrack.h
// Function: GreedyDFSRangeSource::backtrack(unsigned int)
bool backtrack(uint32_t ham = 0) {
		assert_gt(_qry->length(), 0);
		assert_leq(_qlen, _qry->length());
		assert_geq(_qual->length(), _qry->length());
		const Ebwt& ebwt = *_ebwt;
		int ftabChars = ebwt._eh._ftabChars;
		int nsInSeed = 0; int nsInFtab = 0;
		if(!tallyNs(nsInSeed, nsInFtab)) {
			// No alignments are possible because of the distribution
			// of Ns in the read in combination with the backtracking
			// constraints.
			return false;
		}
		bool ret;
		// m = depth beyond which ftab must not extend or else we might
		// miss some legitimate paths
		uint32_t m = min<uint32_t>(_unrevOff, (uint32_t)_qlen);
		if(nsInFtab == 0 && m >= (uint32_t)ftabChars) {
			uint32_t ftabOff = calcFtabOff();
			TIndexOffU top = ebwt.ftabHi(ftabOff);
			TIndexOffU bot = ebwt.ftabLo(ftabOff+1);
			if(_qlen == (TIndexOffU)ftabChars && bot > top) {
				// We have a match!
				if(_reportPartials > 0) {
					// Oops - we're trying to find seedlings, so we've
					// gone too far; start again
					ret = backtrack(0,   // depth
					                0,   // top
					                0,   // bot
					                ham,
					                nsInFtab > 0);
				} else {
					// We have a match!
					ret = reportAlignment(0, top, bot, ham);
				}
			} else if (bot > top) {
				// We have an arrow pair from which we can backtrack
				ret = backtrack(ftabChars, // depth
				                top,       // top
				                bot,       // bot
				                ham,
				                nsInFtab > 0);
			} else {
				// The arrows are already closed; give up
				ret = false;
			}
		} else {
			// The ftab *does* extend past the unrevisitable portion;
			// we can't use it in this case, because we might jump past
			// a legitimate mismatch
			ret = backtrack(0,   // depth
			                0,   // top
			                0,   // bot
			                ham,
			                // disable ftab jumping if there is more
			                // than 1 N in it
			                nsInFtab > 0);
		}
		if(finalize()) ret = true;
		return ret;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x50(%rbp)
movq 0x20(%rdi), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl 0x124(%rax), %eax
movl %eax, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
leaq -0x28(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x67110
testb $0x1, %al
jne 0x66234
movb $0x0, -0x1(%rbp)
jmp 0x66388
movq -0x50(%rbp), %rax
movq %rax, %rdi
addq $0x30, %rdi
movq 0x8(%rax), %rax
movl %eax, -0x38(%rbp)
leaq -0x38(%rbp), %rsi
callq 0x26c20
movl (%rax), %eax
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x2c(%rbp)
jne 0x66344
movl -0x34(%rbp), %eax
cmpl -0x24(%rbp), %eax
jb 0x66344
movq -0x50(%rbp), %rdi
callq 0x672a0
movl %eax, -0x3c(%rbp)
movq -0x20(%rbp), %rdi
movl -0x3c(%rbp), %esi
callq 0x409f0
movl %eax, -0x40(%rbp)
movq -0x20(%rbp), %rdi
movl -0x3c(%rbp), %esi
addl $0x1, %esi
callq 0x40a40
movl %eax, %ecx
movq -0x50(%rbp), %rax
movl %ecx, -0x44(%rbp)
movq 0x8(%rax), %rax
movl -0x24(%rbp), %ecx
cmpq %rcx, %rax
jne 0x66308
movl -0x44(%rbp), %eax
cmpl -0x40(%rbp), %eax
jbe 0x66308
movq -0x50(%rbp), %rax
cmpl $0x0, 0xa0(%rax)
jbe 0x662e9
movq -0x50(%rbp), %rdi
movl -0x14(%rbp), %r8d
cmpl $0x0, -0x2c(%rbp)
setg %al
xorl %ecx, %ecx
movzbl %al, %r9d
andl $0x1, %r9d
xorl %ecx, %ecx
movl %ecx, %esi
movl %ecx, %edx
callq 0x67330
andb $0x1, %al
movb %al, -0x2d(%rbp)
jmp 0x66306
movq -0x50(%rbp), %rdi
movl -0x40(%rbp), %edx
movl -0x44(%rbp), %ecx
movl -0x14(%rbp), %eax
xorl %esi, %esi
movzwl %ax, %r8d
callq 0x67440
andb $0x1, %al
movb %al, -0x2d(%rbp)
jmp 0x66342
movl -0x44(%rbp), %eax
cmpl -0x40(%rbp), %eax
jbe 0x6633c
movq -0x50(%rbp), %rdi
movl -0x24(%rbp), %esi
movl -0x40(%rbp), %edx
movl -0x44(%rbp), %ecx
movl -0x14(%rbp), %r8d
cmpl $0x0, -0x2c(%rbp)
setg %al
movzbl %al, %r9d
andl $0x1, %r9d
callq 0x67330
andb $0x1, %al
movb %al, -0x2d(%rbp)
jmp 0x66340
movb $0x0, -0x2d(%rbp)
jmp 0x66342
jmp 0x6636d
movq -0x50(%rbp), %rdi
movl -0x14(%rbp), %r8d
cmpl $0x0, -0x2c(%rbp)
setg %al
xorl %ecx, %ecx
movzbl %al, %r9d
andl $0x1, %r9d
xorl %ecx, %ecx
movl %ecx, %esi
movl %ecx, %edx
callq 0x67330
andb $0x1, %al
movb %al, -0x2d(%rbp)
movq -0x50(%rbp), %rdi
callq 0x67580
testb $0x1, %al
jne 0x6637c
jmp 0x66380
movb $0x1, -0x2d(%rbp)
movb -0x2d(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)