// File: /workspace/github_cpp_makefile_star2_O3/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), %r12
movl 0x124(%r12), %r13d
movb $0x0, 0x9(%rdi)
xorl %eax, %eax
movl %eax, 0x24(%rsp)
movl %eax, 0x14(%rsp)
cmpb $0x1, 0x178(%rdi)
jne 0x2a143
movb $0x1, 0x8(%rbx)
jmp 0x2a53c
movq 0x50(%rbx), %rax
cmpq $0x3, %rax
ja 0x2a17e
movl 0x78(%rbx), %ecx
xorl %edx, %edx
cmpl %ecx, 0x74(%rbx)
setne %dl
movl 0x7c(%rbx), %edi
cmpl %edi, %ecx
movl $0x2, %ecx
cmovel %edx, %ecx
cmpl 0x80(%rbx), %edi
movl $0x3, %r15d
cmovel %ecx, %r15d
cmpq %r15, %rax
jbe 0x2a304
movq %rsi, 0x8(%rsp)
leaq 0x24(%rsp), %rsi
leaq 0x14(%rsp), %rdx
movq %rbx, %rdi
callq 0x2b26a
testb %al, %al
je 0x2a53c
movzwl 0x120(%rbx), %r10d
movl %r10d, %ebp
andl $0x3fff, %ebp           # imm = 0x3FFF
xorl %esi, %esi
testb $0x1, 0x85(%rbx)
cmovel %esi, %ebp
cmpl $-0x1, 0x118(%rbx)
cmovel %esi, %r10d
leaq 0xf8(%r12), %r9
cmovel %esi, %ebp
movq 0x50(%rbx), %rax
movl 0x74(%rbx), %edx
cmpl %eax, %edx
cmovael %eax, %edx
cmpq %r13, %rax
sete %cl
cmpl %esi, 0x14(%rsp)
jne 0x2a3c4
cmpl %r13d, %edx
jb 0x2a3c4
movb 0x8c(%rbx), %dl
notb %dl
andb %cl, %dl
jne 0x2a3c4
movq 0x18(%rbx), %rdx
movq 0x68(%rbx), %rcx
movslq 0x124(%rcx), %rsi
movq %rax, %rdi
subq %rsi, %rdi
movq 0x8(%rdx), %r8
movsbl (%r8,%rdi), %edx
cmpq $0x2, %rsi
jl 0x2a248
incq %rsi
addq %r8, %rdi
incq %rdi
shll $0x2, %edx
movsbl (%rdi), %r8d
orl %r8d, %edx
decq %rsi
incq %rdi
cmpq $0x2, %rsi
ja 0x2a232
movq 0x98(%r12), %rsi
movl 0xf8(%r12), %edi
movl %edx, %r8d
movl (%rsi,%r8,4), %r14d
cmpl %edi, %r14d
jbe 0x2a277
movq 0xa0(%r12), %r8
notl %r14d
addl %r14d, %r14d
movl 0x4(%r8,%r14,4), %r14d
incl %edx
movl (%rsi,%rdx,4), %r15d
cmpl %edi, %r15d
jbe 0x2a294
movq 0xa0(%r12), %rdx
notl %r15d
addl %r15d, %r15d
movl (%rdx,%r15,4), %r15d
cmpq %r13, %rax
jne 0x2a47f
cmpl %r14d, %r15d
jbe 0x2a47f
movl %r14d, 0xb8(%rbx)
movl %r15d, 0xbc(%rbx)
movzwl %r10w, %eax
shrl $0xe, %eax
movl %eax, 0xc4(%rbx)
movw %r10w, 0xc0(%rbx)
movl $0x0, 0xc8(%rbx)
movq %rcx, 0x110(%rbx)
movb 0x70(%rbx), %al
movb %al, 0xcc(%rbx)
xorl %eax, %eax
movq %rax, 0xe8(%rbx)
movq %rax, 0x108(%rbx)
movq %rbx, %rdi
callq 0x2b316
movb $0x1, 0x9(%rbx)
jmp 0x2a53c
cmpb $0x0, 0xb5(%rbx)
jne 0x2a3b4
leaq 0x42ee0(%rip), %rdi     # 0x6d1f8
callq 0x4ac58
movq 0x3fccc(%rip), %rdi     # 0x69ff0
leaq 0x2b6a6(%rip), %rsi     # 0x559d1
movl $0xf, %edx
callq 0x9560
movq 0x60(%rbx), %rsi
movq 0x3fcb0(%rip), %rdi     # 0x69ff0
callq 0x1fb3f
movq %rax, %r14
leaq 0x2b692(%rip), %rsi     # 0x559e1
movl $0xf, %edx
movq %rax, %rdi
callq 0x9560
incl %r15d
movq %r14, %rdi
movq %r15, %rsi
callq 0x92e0
movq %rax, %r14
leaq 0x2b67d(%rip), %rsi     # 0x559f1
movl $0x1d, %edx
movq %rax, %rdi
callq 0x9560
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x9480
movsbl %al, %esi
movq %r14, %rdi
callq 0x9050
movq %rax, %rdi
callq 0x92f0
leaq 0x42e49(%rip), %rdi     # 0x6d1f8
callq 0x4ac94
movb $0x1, %al
movb %al, 0x8(%rbx)
movb %al, 0x178(%rbx)
jmp 0x2a53c
movl %r10d, %r15d
movq %r9, 0x18(%rsp)
movq 0x8(%rsp), %rax
leaq 0x38(%rax), %rdi
callq 0x2b39c
testq %rax, %rax
je 0x2a53c
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
xorl %ebx, %ebx
movzwl %bp, %r14d
movzwl %r15w, %ebp
movq %r13, %rdi
pushq $0x0
pushq 0xb8(%r12)
pushq 0x28(%rsp)
pushq %rbx
pushq %rbx
pushq %r14
pushq %rbp
pushq %rbx
pushq %rbx
pushq %r11
pushq %r10
pushq %rax
callq 0x2b3e8
addq $0x60, %rsp
testb %al, %al
je 0x2a53c
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2c310
movq %rbx, %rdi
callq 0x2c500
movzwl 0x10(%rax), %eax
movw %ax, 0x158(%rbx)
jmp 0x2a53c
movl %r10d, 0x20(%rsp)
movq %r9, 0x18(%rsp)
cmpl %r14d, %r15d
jbe 0x2a53c
movq 0x8(%rsp), %rax
leaq 0x38(%rax), %rdi
callq 0x2b39c
testq %rax, %rax
je 0x2a53c
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), %edi
movq %rdi, 0x28(%rsp)
movzwl 0x80(%rbx), %r11d
movzwl %bp, %ebx
movzwl 0x20(%rsp), %ebp
movzwl %r13w, %r10d
movq %rax, %r13
movq %rax, %rdi
pushq $0x0
pushq 0xb8(%r12)
pushq 0x28(%rsp)
pushq %r15
pushq %r14
pushq %rbx
pushq %rbp
pushq %r10
pushq $0x0
pushq %r11
pushq 0x78(%rsp)
pushq 0x88(%rsp)
callq 0x2b3e8
addq $0x60, %rsp
testb %al, %al
je 0x2a53c
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x2b5de
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2a564
movq %rax, %rbx
leaq 0x42ca1(%rip), %rdi     # 0x6d1f8
callq 0x4ac94
movq %rbx, %rdi
callq 0x9930
movq %rax, %rdi
callq 0x1afa3