// File: /workspace/github_cpp_makefile_star2_O3/BenLangmead[P]bowtie/./ebwt_search_backtrack.h
// Function: EbwtRangeSourceDriver::initRangeSource(SStringExpandable<char, 25, 2, 0> const&)
virtual void initRangeSource(const BTString& qual) {
		// If seedLen_ is huge, then it will always cover the whole
		// alignment
		assert_eq(len_, qual.length());
		uint32_t s = (seedLen_ > 0 ? min(seedLen_, len_) : len_);
		uint32_t sLeft  = s >> 1;
		uint32_t sRight = s >> 1;
		// If seed has odd length, then nudge appropriate half up by 1
		if((s & 1) != 0) { if(nudgeLeft_) sLeft++; else sRight++; }
		uint32_t rev0Off = cextToDepth(rev0Off_, sRight, s, len_);
		uint32_t rev1Off = cextToDepth(rev1Off_, sRight, s, len_);
		uint32_t rev2Off = cextToDepth(rev2Off_, sRight, s, len_);
		uint32_t rev3Off = cextToDepth(rev3Off_, sRight, s, len_);
		// Truncate the pattern if necessary
		uint32_t qlen = (uint32_t)qual.length();
		if(seed_) {
			if(len_ > s) {
				rs_->setQlen(s);
				qlen = s;
			}
			assert(!rs_->reportExacts());
		}
		// If there are any Ns in the unrevisitable region, then this
		// driver is guaranteed to yield no fruit.
		uint16_t minCost = 0;
		if(rs_->reportExacts()) {
			// Keep minCost at 0
		} else if (!rs_->halfAndHalf() && rev0Off < s) {
			// Exacts not allowed, so there must be at least 1 mismatch
			// outside of the unrevisitable area
			minCost = 1 << 14;
			if(qualOrder_) {
				uint8_t lowQual = 0xff;
				for(uint32_t d = rev0Off; d < s; d++) {
					uint8_t lowAtPos;
					lowAtPos = qual[qlen - d - 1];
					if(lowAtPos < lowQual) lowQual = lowAtPos;
				}
				assert_lt(lowQual, 0xff);
				minCost += mmPenalty(maqPenalty_, phredCharToPhredQual(lowQual));
			}
		} else if(rs_->halfAndHalf() && sRight > 0 && sRight < (s-1)) {
			// Half-and-half constraints are active, so there must be
			// at least 1 mismatch in both halves of the seed
			assert(rs_->halfAndHalf());
			minCost = (seed_ ? 3 : 2) << 14;
			if(qualOrder_) {
				assert(rs_->halfAndHalf() == 2 || rs_->halfAndHalf() == 3);
				uint8_t lowQual1 = 0xff;
				for(uint32_t d = 0; d < sRight; d++) {
					uint8_t lowAtPos;
					lowAtPos = qual[qlen - d - 1];
					if(lowAtPos < lowQual1) lowQual1 = lowAtPos;
				}
				assert_lt(lowQual1, 0xff);
				minCost += mmPenalty(maqPenalty_, phredCharToPhredQual(lowQual1));
				uint8_t lowQual2_1 = 0xff;
				uint8_t lowQual2_2 = 0xff;
				for(uint32_t d = sRight; d < s; d++) {
					uint8_t lowAtPos;
					lowAtPos = qual[qlen - d - 1];
					if(lowAtPos < lowQual2_1) {
						if(lowQual2_1 != 0xff) {
							lowQual2_2 = lowQual2_1;
						}
						lowQual2_1 = lowAtPos;
					} else if(lowAtPos < lowQual2_2) {
						lowQual2_2 = lowAtPos;
					}
				}
				assert_lt(lowQual2_1, 0xff);
				minCost += mmPenalty(maqPenalty_, phredCharToPhredQual(lowQual2_1));
				if(rs_->halfAndHalf() > 2 && lowQual2_2 != 0xff) {
					minCost += mmPenalty(maqPenalty_, phredCharToPhredQual(lowQual2_2));
				}
			}
		}
		if(verbose_) cout << "initRangeSource minCost: " << minCost << endl;
		this->minCostAdjustment_ = minCost;
		rs_->setOffs(sRight,   // depth of far edge of hi-half (only matters where half-and-half is possible)
		             s,        // depth of far edge of lo-half (only matters where half-and-half is possible)
		             rev0Off,  // depth above which we cannot backtrack
		             rev1Off,  // depth above which we may backtrack just once
		             rev2Off,  // depth above which we may backtrack just twice
		             rev3Off); // depth above which we may backtrack just three times
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl 0x10(%rdi), %eax
movl 0x1c0(%rdi), %r15d
leal -0x1(%r15), %ecx
cmpl %eax, %ecx
cmovael %eax, %r15d
movl 0x1c8(%rdi), %r14d
leal -0x1(%r14), %ecx
cmpl $0x3, %ecx
ja 0x2f987
movq %rdi, %rbx
movl %r15d, %edx
shrl %edx
movl %r15d, %edi
andl $0x1, %edi
negl %edi
movzbl 0x1c4(%rbx), %ebp
xorl $0x1, %ebp
andl %edi, %ebp
addl %edx, %ebp
leaq 0x22ec1(%rip), %rdx     # 0x5248c
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
movl %r15d, %r12d
jmpq *%rcx
xorl %r12d, %r12d
jmp 0x2f5e4
movl %eax, %r12d
jmp 0x2f5e4
movl %ebp, %r12d
movl 0x1cc(%rbx), %r14d
leal -0x1(%r14), %ecx
cmpl $0x3, %ecx
ja 0x2f987
leaq 0x22e9d(%rip), %rdx     # 0x5249c
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
movl %r15d, %r9d
jmpq *%rcx
xorl %r9d, %r9d
jmp 0x2f618
movl %eax, %r9d
jmp 0x2f618
movl %ebp, %r9d
movl 0x1d0(%rbx), %r14d
leal -0x1(%r14), %ecx
cmpl $0x3, %ecx
ja 0x2f987
leaq 0x22e79(%rip), %rdx     # 0x524ac
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
movl %r15d, 0xc(%rsp)
jmpq *%rcx
movl $0x0, 0xc(%rsp)
jmp 0x2f655
movl %eax, 0xc(%rsp)
jmp 0x2f655
movl %ebp, 0xc(%rsp)
movl 0x1d4(%rbx), %r14d
leal -0x1(%r14), %ecx
cmpl $0x3, %ecx
ja 0x2f987
leaq 0x22e4c(%rip), %rdx     # 0x524bc
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
movl %r15d, %r14d
jmpq *%rcx
xorl %r14d, %r14d
jmp 0x2f689
movl %eax, %r14d
jmp 0x2f689
movl %ebp, %r14d
movl 0x20(%rsi), %edx
cmpb $0x1, 0x1b0(%rbx)
jne 0x2f6b6
cmpl %r15d, %eax
jbe 0x2f6b6
movq 0x1b8(%rbx), %rax
movq 0x18(%rax), %rcx
movl 0x20(%rcx), %ecx
cmpl %r15d, %ecx
cmovael %r15d, %ecx
movq %rcx, 0x50(%rax)
movl %r15d, %edx
movq 0x1b8(%rbx), %rax
cmpb $0x0, 0x8c(%rax)
je 0x2f77f
xorl %r13d, %r13d
cmpb $0x1, 0x1d8(%rbx)
jne 0x2f748
movl %r14d, 0x14(%rsp)
movq 0x3a8ce(%rip), %r14     # 0x69fb0
leaq 0x2641f(%rip), %rsi     # 0x55b08
movl $0x19, %edx
movq %r14, %rdi
movl %r12d, 0x10(%rsp)
movl %r9d, %r12d
callq 0x9560
movzwl %r13w, %esi
movq %r14, %rdi
callq 0x92e0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x9480
movsbl %al, %esi
movq %r14, %rdi
movl 0x14(%rsp), %r14d
callq 0x9050
movq %rax, %rdi
callq 0x92f0
movl %r12d, %r9d
movl 0x10(%rsp), %r12d
movq 0x1b8(%rbx), %rax
movw %r13w, 0xc(%rbx)
movl %ebp, 0x98(%rax)
movl %r15d, 0x9c(%rax)
movl %r12d, 0x74(%rax)
movl %r9d, 0x78(%rax)
movl 0xc(%rsp), %ecx
movl %ecx, 0x7c(%rax)
movl %r14d, 0x80(%rax)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x90(%rax), %ecx
testl %ecx, %ecx
setne %dil
cmpl %r15d, %r12d
setae %r8b
orb %dil, %r8b
jne 0x2f80c
movw $0x4000, %r13w          # imm = 0x4000
cmpb $0x1, 0x1b2(%rbx)
jne 0x2f6cd
movq 0x8(%rsi), %rcx
movl %r12d, %edi
movl %r15d, %esi
subq %rdi, %rsi
movl %r12d, %edi
notl %edi
addl %edx, %edi
movb $-0x1, %dl
movl %edi, %r8d
movzbl (%rcx,%r8), %r8d
movzbl %dl, %edx
cmpb %dl, %r8b
cmovbl %r8d, %edx
decl %edi
decq %rsi
jne 0x2f7bf
leal -0x21(%rdx), %ecx
xorl %esi, %esi
cmpb $0x21, %dl
movzbl %cl, %ecx
cmovbl %esi, %ecx
cmpb $0x1, 0x1b1(%rbx)
jne 0x2f7fc
movzbl %cl, %ecx
leaq 0x3d307(%rip), %rdx     # 0x6cb00
movb (%rdx,%rcx), %cl
movzbl %cl, %r13d
orl $0x4000, %r13d          # imm = 0x4000
jmp 0x2f6cd
leal -0x1(%r15), %edi
xorl %r13d, %r13d
cmpl %edi, %ebp
jae 0x2f6cd
testl %ebp, %ebp
je 0x2f6cd
testl %ecx, %ecx
je 0x2f6cd
movl 0x1b0(%rbx), %r13d
orl $0x2, %r13d
shll $0xe, %r13d
cmpb $0x1, 0x1b2(%rbx)
jne 0x2f6cd
movl %r9d, 0x10(%rsp)
movq 0x8(%rsi), %rdi
movl %ebp, %r8d
leal -0x1(%rdx), %esi
movb $-0x1, %r9b
movq %r8, %r10
movl %esi, %r11d
movzbl (%rdi,%r11), %r11d
movzbl %r9b, %r9d
cmpb %r9b, %r11b
cmovbl %r11d, %r9d
decl %esi
decq %r10
jne 0x2f85c
movb 0x1b1(%rbx), %sil
leal -0x21(%r9), %r10d
xorl %r11d, %r11d
cmpb $0x21, %r9b
movzbl %r10b, %r9d
cmovbl %r11d, %r9d
cmpb $0x1, %sil
jne 0x2f8a5
movzbl %r9b, %r9d
leaq 0x3d25f(%rip), %r10     # 0x6cb00
movb (%r10,%r9), %r9b
movzbl %r9b, %r9d
orl %r9d, %r13d
cmpl %r15d, %ebp
jae 0x2f923
movb %sil, 0xb(%rsp)
movl %r14d, 0x14(%rsp)
movl %r15d, %r9d
movl %ebp, %r10d
notl %r10d
addl %edx, %r10d
movb $-0x1, %dl
movb $-0x1, %r11b
movl %r10d, %r14d
movb (%rdi,%r14), %r14b
cmpb $-0x1, %r11b
movzbl %dl, %edx
movzbl %r11b, %r11d
movl %r11d, %esi
cmovel %edx, %esi
movzbl %r14b, %r14d
cmpb %dl, %r14b
cmovbl %r14d, %edx
cmpb %r11b, %r14b
cmovbl %r14d, %r11d
cmovbl %esi, %edx
incq %r8
decl %r10d
cmpq %r9, %r8
jb 0x2f8cc
leal -0x21(%r11), %edi
xorl %r8d, %r8d
cmpb $0x21, %r11b
movzbl %dil, %edi
cmovbl %r8d, %edi
movl 0x14(%rsp), %r14d
movb 0xb(%rsp), %sil
jmp 0x2f928
movb $-0x22, %dil
movb $-0x1, %dl
testb %sil, %sil
movl 0x10(%rsp), %r9d
je 0x2f941
movzbl %dil, %edi
leaq 0x3d1c3(%rip), %r8      # 0x6cb00
movb (%r8,%rdi), %dil
movzbl %dil, %edi
addl %edi, %r13d
cmpl $0x3, %ecx
jl 0x2f6cd
cmpb $-0x1, %dl
je 0x2f6cd
leal -0x21(%rdx), %ecx
movl %esi, %edi
xorl %esi, %esi
cmpb $0x21, %dl
movzbl %cl, %ecx
cmovbl %esi, %ecx
testb %dil, %dil
je 0x2f97c
movzbl %cl, %ecx
leaq 0x3d187(%rip), %rdx     # 0x6cb00
movb (%rdx,%rcx), %cl
movzbl %cl, %ecx
addl %ecx, %r13d
jmp 0x2f6cd
movq 0x3a662(%rip), %rdi     # 0x69ff0
leaq 0x2618d(%rip), %rsi     # 0x55b22
callq 0x9490
movq %rax, %rdi
movl %r14d, %esi
callq 0x9910
movl $0x4, %edi
callq 0x9200
movl $0x1, (%rax)
movq 0x3a57c(%rip), %rsi     # 0x69f38
movq %rax, %rdi
xorl %edx, %edx
callq 0x98f0