// File: /workspace/github_cpp_makefile_star2_O1/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 0x3f1bc
testb %al, %al
je 0x3ecae
movq 0x8(%rbx), %rsi
movl 0x30(%rbx), %ecx
cmpl %esi, %ecx
cmovael %esi, %ecx
movl 0x8(%rsp), %eax
testl %eax, %eax
jne 0x3ec84
cmpl %r14d, %ecx
jb 0x3ec84
movq (%rbx), %rcx
movq 0x20(%rbx), %rdx
movslq 0x124(%rdx), %rdx
movq %rsi, %rdi
subq %rdx, %rdi
movq 0x8(%rcx), %r8
movsbl (%r8,%rdi), %ecx
cmpq $0x2, %rdx
jl 0x3ec2e
incq %rdx
addq %r8, %rdi
incq %rdi
shll $0x2, %ecx
movsbl (%rdi), %r8d
orl %r8d, %ecx
decq %rdx
incq %rdi
cmpq $0x2, %rdx
jg 0x3ec18
movq 0x98(%r12), %rdi
movl 0xf8(%r12), %r8d
movl %ecx, %edx
movl (%rdi,%rdx,4), %edx
cmpl %r8d, %edx
jbe 0x3ec59
movq 0xa0(%r12), %r9
notl %edx
addl %edx, %edx
movl 0x4(%r9,%rdx,4), %edx
incl %ecx
movl (%rdi,%rcx,4), %ecx
cmpl %r8d, %ecx
jbe 0x3ec72
movq 0xa0(%r12), %rdi
notl %ecx
addl %ecx, %ecx
movl (%rdi,%rcx,4), %ecx
cmpq %r14, %rsi
jne 0x3ecbe
cmpl %edx, %ecx
jbe 0x3ecbe
cmpl $0x0, 0xa0(%rbx)
je 0x3ecd7
xorl %r9d, %r9d
testl %eax, %eax
setg %r9b
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movl %ebp, %r8d
callq 0x3f262
movl %eax, %ebp
movq %rbx, %rdi
callq 0x3f3fa
movl %eax, %r15d
orb %bpl, %r15b
movl %r15d, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
cmpl %edx, %ecx
jbe 0x3ecd3
xorl %r9d, %r9d
testl %eax, %eax
setg %r9b
movq %rbx, %rdi
movl %r14d, %esi
jmp 0x3ec96
xorl %ebp, %ebp
jmp 0x3eca0
movzwl %bp, %r8d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3f2fc
jmp 0x3ec9e
nop