// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movq 0x20(%rdi), %r12
movl 0x124(%r12), %r14d
xorl %r15d, %r15d
leaq 0xc(%rsp), %rsi
movl %r15d, (%rsi)
leaq 0x8(%rsp), %rdx
movl %r15d, (%rdx)
callq 0x3e51e
testb %al, %al
je 0x3e04e
movq 0x8(%rbx), %rax
movl 0x30(%rbx), %edx
cmpl %eax, %edx
cmovael %eax, %edx
movl 0x8(%rsp), %ecx
testl %ecx, %ecx
jne 0x3e012
cmpl %r14d, %edx
jb 0x3e012
movq (%rbx), %rcx
movq 0x20(%rbx), %rdx
movslq 0x124(%rdx), %rdx
movq %rax, %rsi
subq %rdx, %rsi
movq 0x8(%rcx), %rdi
movsbl (%rdi,%rsi), %ecx
cmpq $0x2, %rdx
jl 0x3dfb3
incq %rdx
addq %rdi, %rsi
incq %rsi
shll $0x2, %ecx
movsbl (%rsi), %edi
orl %edi, %ecx
decq %rdx
incq %rsi
cmpq $0x2, %rdx
ja 0x3df9f
movq 0x98(%r12), %rsi
movl 0xf8(%r12), %edi
movl %ecx, %edx
movl (%rsi,%rdx,4), %edx
cmpl %edi, %edx
jbe 0x3dfdd
movq 0xa0(%r12), %r8
notl %edx
addl %edx, %edx
movl 0x4(%r8,%rdx,4), %edx
incl %ecx
movl (%rsi,%rcx,4), %ecx
cmpl %edi, %ecx
jbe 0x3dff5
movq 0xa0(%r12), %rsi
notl %ecx
addl %ecx, %ecx
movl (%rsi,%rcx,4), %ecx
cmpq %r14, %rax
jne 0x3e029
cmpl %edx, %ecx
jbe 0x3e029
cmpl $0x0, 0xa0(%rbx)
je 0x3e062
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
jmp 0x3e033
xorl %r9d, %r9d
testl %ecx, %ecx
setg %r9b
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movl %ebp, %r8d
jmp 0x3e039
cmpl %edx, %ecx
jbe 0x3e05e
movq %rbx, %rdi
movl %r14d, %esi
movl %ebp, %r8d
xorl %r9d, %r9d
callq 0x3e5c2
movl %eax, %ebp
movq %rbx, %rdi
callq 0x3e75a
movl %eax, %r15d
orb %bpl, %r15b
movl %r15d, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
jmp 0x3e040
movzwl %bp, %r8d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3e65c
jmp 0x3e03e