// File: /workspace/github_cpp_makefile_star2_O2/BenLangmead[P]bowtie/./ebwt_search_backtrack.h
// Function: EbwtRangeSource::initBranch(PathManager&)
virtual void
	initBranch(PathManager& pm) {
		assert(curEbwt_ != NULL);
		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;
		this->foundRange = false;
		int nsInSeed = 0; int nsInFtab = 0;
		ASSERT_ONLY(allTops_.clear());
		if(skippingThisRead_) {
			this->done = true;
			return;
		}
		if(qlen_ < 4) {
			uint32_t maxmms = 0;
			if(offRev0_ != offRev1_) maxmms = 1;
			if(offRev1_ != offRev2_) maxmms = 2;
			if(offRev2_ != offRev3_) maxmms = 3;
			if(qlen_ <= maxmms) {
				if(!quiet_) {
					ThreadSafe _ts(&gLock);
					cerr << "Warning: Read (" << (*name_) << ") is less than " << (maxmms+1) << " characters long; skipping..." << endl;
				}
				this->done = true;
				skippingThisRead_ = true;
				return;
			}
		}
		if(!tallyNs(nsInSeed, nsInFtab)) {
			// No alignments are possible because of the distribution
			// of Ns in the read in combination with the backtracking
			// constraints.
			return;
		}
		// icost = total cost penalty (major bits = stratum, minor bits =
		// quality penalty) incurred so far by partial alignment
		uint16_t icost = (seedRange_.valid()) ? seedRange_.cost : 0;
		// iham = total quality penalty incurred so far by partial alignment
		uint16_t iham = (seedRange_.valid() && qualOrder_) ? (seedRange_.cost & ~0xc000): 0;
		assert_leq(iham, qualLim_);
		// m = depth beyond which ftab must not extend or else we might
		// miss some legitimate paths
		uint32_t m = min<uint32_t>(offRev0_, (uint32_t)qlen_);
		// Let skipInvalidExact = true if using the ftab would be a
		// waste because it would jump directly to an alignment we
		// couldn't use.
		bool ftabSkipsToEnd = (qlen_ == (uint32_t)ftabChars);
		bool skipInvalidExact = (!reportExacts_ && ftabSkipsToEnd);

		// If it's OK to use the ftab...
		if(nsInFtab == 0 && m >= (uint32_t)ftabChars && !skipInvalidExact) {
			// Use the ftab to jump 'ftabChars' chars into the read
			// from the right
			uint32_t ftabOff = calcFtabOff();
			TIndexOffU top = ebwt.ftabHi(ftabOff);
			TIndexOffU bot = ebwt.ftabLo(ftabOff+1);
			if(qlen_ == (uint32_t)ftabChars && bot > top) {
				// We found a range with 0 mismatches immediately.  Set
				// fields to indicate we found a range.
				assert(reportExacts_);
				curRange_.top     = top;
				curRange_.bot     = bot;
				curRange_.stratum = (icost >> 14);
				curRange_.cost    = icost;
				curRange_.numMms  = 0;
				curRange_.ebwt    = ebwt_;
				curRange_.fw      = fw_;
				curRange_.mms.clear(); // no mismatches
				curRange_.refcs.clear(); // no mismatches
				// Lump in the edits from the partial alignment
				addPartialEdits();
				assert(curRange_.repOk());
				// no need to do anything with curRange_.refcs
				this->foundRange  = true;
				//this->done = true;
				return;
			} else if (bot > top) {
				// We have a range to extend
				assert_leq(top, ebwt._eh._len);
				assert_leq(bot, ebwt._eh._len);
				Branch *b = pm.bpool.alloc();
				if(b == NULL) {
					assert(pm.empty());
					return;
				}
				if(!b->init(
				        pm.rpool, pm.epool, pm.bpool.lastId(), (uint32_t)qlen_,
				        offRev0_, offRev1_, offRev2_, offRev3_,
				        0, ftabChars, icost, iham, top, bot,
				        ebwt._eh, ebwt._ebwt))
				{
					// Negative result from b->init() indicates we ran
					// out of best-first chunk memory
					assert(pm.empty());
					return;
				}
				assert(!b->curtailed_);
				assert(!b->exhausted_);
				assert_gt(b->depth3_, 0);
				pm.push(b); // insert into priority queue
				assert(!pm.empty());
			} else {
				// The arrows are already closed within the
				// unrevisitable region; give up
			}
		} else {
			// We can't use the ftab, so we start from the rightmost
			// position and use _fchr
			Branch *b = pm.bpool.alloc();
			if(b == NULL) {
				assert(pm.empty());
				return;
			}
			if(!b->init(pm.rpool, pm.epool, pm.bpool.lastId(), (uint32_t)qlen_,
			        offRev0_, offRev1_, offRev2_, offRev3_,
			        0, 0, icost, iham, 0, 0, ebwt._eh, ebwt._ebwt))
			{
				// Negative result from b->init() indicates we ran
				// out of best-first chunk memory
				assert(pm.empty());
				return;
			}
			assert(!b->curtailed_);
			assert(!b->exhausted_);
			assert_gt(b->depth3_, 0);
			pm.push(b); // insert into priority queue
			assert(!pm.empty());
		}
		return;
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movq 0x68(%rdi), %r15
movl 0x124(%r15), %r13d
movb $0x0, 0x9(%rdi)
andl $0x0, 0x14(%rsp)
andl $0x0, 0x10(%rsp)
cmpb $0x1, 0x178(%rdi)
jne 0x2223e
movb $0x1, 0x8(%rbx)
jmp 0x22568
movq 0x50(%rbx), %rax
cmpq $0x3, %rax
ja 0x22275
movl 0x78(%rbx), %ecx
xorl %edx, %edx
cmpl %ecx, 0x74(%rbx)
setne %dl
movl 0x7c(%rbx), %edi
cmpl %edi, %ecx
pushq $0x2
popq %rcx
cmovel %edx, %ecx
cmpl 0x80(%rbx), %edi
pushq $0x3
popq %r12
cmovel %ecx, %r12d
cmpq %r12, %rax
jbe 0x2239e
movq %rsi, 0x8(%rsp)
leaq 0x14(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x23016
testb %al, %al
je 0x22568
movzwl 0x120(%rbx), %r14d
movl %r14d, %r12d
andl $0x3fff, %r12d          # imm = 0x3FFF
xorl %edx, %edx
testb $0x1, 0x85(%rbx)
cmovel %edx, %r12d
cmpl $-0x1, 0x118(%rbx)
cmovel %edx, %r14d
leaq 0xf8(%r15), %rax
movq %rax, 0x20(%rsp)
cmovel %edx, %r12d
movq 0x50(%rbx), %rax
movl 0x74(%rbx), %ecx
cmpl %eax, %ecx
cmovael %eax, %ecx
cmpq %r13, %rax
sete %al
cmpl %edx, 0x10(%rsp)
jne 0x22425
cmpl %r13d, %ecx
jb 0x22425
movb 0x8c(%rbx), %cl
notb %cl
andb %al, %cl
jne 0x22425
movq %rbx, %rdi
callq 0x230b2
movl %eax, %ebp
movq %r15, %rdi
movl %eax, %esi
callq 0x230f4
movq %rax, 0x18(%rsp)
incl %ebp
movq %r15, %rdi
movl %ebp, %esi
callq 0x23118
movl %eax, %ebp
movq 0x18(%rsp), %rax
cmpl %eax, %ebp
jbe 0x224c3
cmpq %r13, 0x50(%rbx)
jne 0x224c3
movl %eax, 0xb8(%rbx)
movl %ebp, 0xbc(%rbx)
movzwl %r14w, %eax
shrl $0xe, %eax
movl %eax, 0xc4(%rbx)
movw %r14w, 0xc0(%rbx)
andl $0x0, 0xc8(%rbx)
movq 0x68(%rbx), %rax
movq %rax, 0x110(%rbx)
movb 0x70(%rbx), %al
movb %al, 0xcc(%rbx)
andq $0x0, 0xe8(%rbx)
andq $0x0, 0x108(%rbx)
movq %rbx, %rdi
callq 0x2313c
movb $0x1, 0x9(%rbx)
jmp 0x22568
cmpb $0x0, 0xb5(%rbx)
jne 0x22415
leaq 0x42e5a(%rip), %rdi     # 0x65208
movq %rdi, 0x28(%rsp)
callq 0x40dda
movq 0x3fc31(%rip), %rdi     # 0x61ff0
leaq 0x28576(%rip), %rsi     # 0x4a93c
callq 0x94e0
movq 0x60(%rbx), %rsi
movq %rax, %rdi
callq 0x1970d
leaq 0x2856e(%rip), %rsi     # 0x4a94c
movq %rax, %rdi
callq 0x94e0
incl %r12d
movq %rax, %rdi
movq %r12, %rsi
callq 0x9310
leaq 0x28561(%rip), %rsi     # 0x4a95c
movq %rax, %rdi
callq 0x94e0
movq %rax, %rdi
callq 0x9210
leaq 0x28(%rsp), %rdi
callq 0x1a9ee
movb $0x1, %al
movb %al, 0x8(%rbx)
movb %al, 0x178(%rbx)
jmp 0x22568
movq 0x8(%rsp), %rax
leaq 0x38(%rax), %rdi
callq 0x231c0
testq %rax, %rax
je 0x22568
movq %rax, %r13
movq 0x8(%rsp), %rax
leaq 0x98(%rax), %rsi
leaq 0xf8(%rax), %rdx
movl 0x68(%rax), %ecx
shll $0x10, %ecx
orl 0x94(%rax), %ecx
movl 0x50(%rbx), %r8d
movzwl 0x74(%rbx), %r9d
movzwl 0x78(%rbx), %eax
movzwl 0x7c(%rbx), %r10d
movzwl 0x80(%rbx), %r11d
movzwl %r12w, %ebx
movzwl %r14w, %r14d
movq %r13, %rdi
pushq $0x0
pushq 0xb8(%r15)
pushq 0x30(%rsp)
pushq $0x0
pushq $0x0
pushq %rbx
pushq %r14
pushq $0x0
pushq $0x0
pushq %r11
pushq %r10
pushq %rax
callq 0x23208
addq $0x60, %rsp
testb %al, %al
je 0x22568
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x233b0
jmp 0x22568
cmpl %eax, %ebp
jbe 0x22568
movq 0x8(%rsp), %rax
leaq 0x38(%rax), %rdi
callq 0x231c0
testq %rax, %rax
je 0x22568
movq 0x8(%rsp), %rdi
leaq 0x98(%rdi), %rsi
leaq 0xf8(%rdi), %rdx
movl 0x68(%rdi), %ecx
shll $0x10, %ecx
orl 0x94(%rdi), %ecx
movl 0x50(%rbx), %r8d
movzwl 0x74(%rbx), %r9d
movzwl 0x78(%rbx), %edi
movq %rdi, 0x30(%rsp)
movzwl 0x7c(%rbx), %r10d
movzwl 0x80(%rbx), %r11d
movzwl %r12w, %ebx
movzwl %r14w, %r14d
movzwl %r13w, %r12d
movq %rax, %r13
movq %rax, %rdi
pushq $0x0
pushq 0xb8(%r15)
pushq 0x30(%rsp)
pushq %rbp
pushq 0x38(%rsp)
pushq %rbx
pushq %r14
pushq %r12
pushq $0x0
pushq %r11
pushq %r10
pushq 0x88(%rsp)
callq 0x23208
addq $0x60, %rsp
testb %al, %al
je 0x22568
jmp 0x224b1
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x1a9ee
movq %rbx, %rdi
callq 0x9950