// File: BenLangmead[P]bowtie/./aligner.h
// Function: PairedBWAlignerV2<EbwtRangeSource>::advance()
virtual bool advance() {
		assert(!this->done);
		if(chase_) {
			assert(!rangeMode_); // chasing ranges
			if(!rchase_->foundOff() && !rchase_->done) {
				rchase_->advance();
				return false;
			}
			assert(rchase_->foundOff() || rchase_->done);
			if(rchase_->foundOff()) {
				const Range& r = driver_->range();
				assert(r.repOk());
				resolveOutstanding(
					rchase_->off(),
					r.ebwt->_plen[rchase_->off().first], r);
				rchase_->reset();
			} else {
				assert(rchase_->done);
				// Forget this range; keep looking for ranges
				chase_ = false;
				this->done = driver_->done;
			}
		}

		if(!this->done && !chase_) {
			// Search for more ranges for whichever mate currently has
			// fewer candidate alignments
			if(!driver_->done) {
				if(!this->done) {
					//
					// Check whether any of the PE/SE possibilities
					// have become impossible due to the minCost
					//
					if(!donePe_) {
						assert(!this->done);
						donePe_ = sinkPt_->irrelevantCost(driver_->minCost);
						if(donePe_ && (!sinkPt_->empty() || sinkPtSe1_ == NULL)) {
							// Paired-end alignment(s) were found, no
							// more will be found, and no unpaired
							// alignments are requested, so stop
							this->done = true;
						}
						if(donePe_ && sinkPtSe1_ != NULL) {
							// Note: removeMate affects minCost
							if(doneSe1_) driver_->removeMate(1);
							if(doneSe2_) driver_->removeMate(2);
						}
					}
					if(!this->done && sinkPtSe1_ != NULL) {
						if(!doneSe1_) {
							doneSe1_ = sinkPtSe1_->irrelevantCost(driver_->minCost);
							if(doneSe1_ && donePe_) driver_->removeMate(1);
						}
						if(!doneSe2_) {
							doneSe2_ = sinkPtSe2_->irrelevantCost(driver_->minCost);
							if(doneSe2_ && donePe_) driver_->removeMate(2);
						}
						// Do Se1 again, because removing Se2 may have
						// nudged minCost over the threshold
						if(!doneSe1_) {
							doneSe1_ = sinkPtSe1_->irrelevantCost(driver_->minCost);
							if(doneSe1_ && donePe_) driver_->removeMate(1);
						}
						if(doneSe1_ && doneSe2_) assert(donePe_);
						this->done = donePe_ && doneSe1_ && doneSe2_;
					}

					if(!this->done) {
						if(sinkPtSe1_ != NULL) {
							assert(doneSe1_ || !sinkPtSe1_->irrelevantCost(driver_->minCost));
							assert(doneSe2_ || !sinkPtSe2_->irrelevantCost(driver_->minCost));
						}
						assert(donePe_ || !sinkPt_->irrelevantCost(driver_->minCost));
						driver_->advance(ADV_COST_CHANGES);
					}
				}
				if(driver_->foundRange) {
					// Use Burrows-Wheeler for this pair (as usual)
					chase_ = true;
					driver_->foundRange = false;
					const Range& r = driver_->range();
					assert(r.repOk());
					rchase_->setTopBot(r.top, r.bot,
					                   r.mate1 ? qlen1_ : qlen2_,
					                   rand_, r.ebwt);
				}
			} else {
				this->done = true;
			}
		}

		if(this->done) {
			bool reportedPe = (sinkPt_->finishRead(*patsrc_, true, true) > 0);
			if(sinkPtSe1_ != NULL) {
				sinkPtSe1_->finishRead(*patsrc_, !reportedPe, false);
				sinkPtSe2_->finishRead(*patsrc_, !reportedPe, false);
			}
		}
		return this->done;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
testb $0x1, 0x68(%rax)
je 0x63574
movq -0x40(%rbp), %rax
movq 0xc8(%rax), %rdi
callq 0x4bee0
testb $0x1, %al
jne 0x634bb
movq -0x40(%rbp), %rax
movq 0xc8(%rax), %rax
testb $0x1, (%rax)
jne 0x634bb
movq -0x40(%rbp), %rax
movq 0xc8(%rax), %rdi
callq 0x4bf00
movb $0x0, -0x1(%rbp)
jmp 0x6397a
movq -0x40(%rbp), %rax
movq 0xc8(%rax), %rdi
callq 0x4bee0
testb $0x1, %al
jne 0x634d4
jmp 0x6355a
movq -0x40(%rbp), %rax
movq 0xd0(%rax), %rdi
movq (%rdi), %rax
callq *0x30(%rax)
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, -0x18(%rbp)
movq 0xc8(%rax), %rdi
callq 0x4c360
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, -0x20(%rbp)
movq -0x18(%rbp), %rcx
movq 0x58(%rcx), %rcx
movq 0x80(%rcx), %rcx
movq %rcx, -0x48(%rbp)
movq 0xc8(%rax), %rdi
callq 0x4c360
movq -0x40(%rbp), %rdi
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, -0x28(%rbp)
movl -0x28(%rbp), %ecx
movl (%rax,%rcx,4), %edx
movq -0x18(%rbp), %rcx
leaq -0x20(%rbp), %rsi
callq 0x63b60
movq -0x40(%rbp), %rax
movq 0xc8(%rax), %rdi
callq 0x4c3a0
jmp 0x63572
movq -0x40(%rbp), %rax
movb $0x0, 0x68(%rax)
movq 0xd0(%rax), %rcx
movb 0x9(%rcx), %cl
andb $0x1, %cl
movb %cl, 0x8(%rax)
jmp 0x63574
movq -0x40(%rbp), %rax
testb $0x1, 0x8(%rax)
jne 0x638da
movq -0x40(%rbp), %rax
testb $0x1, 0x68(%rax)
jne 0x638da
movq -0x40(%rbp), %rax
movq 0xd0(%rax), %rax
testb $0x1, 0x9(%rax)
jne 0x638d0
movq -0x40(%rbp), %rax
testb $0x1, 0x8(%rax)
jne 0x6382e
movq -0x40(%rbp), %rax
testb $0x1, 0x69(%rax)
jne 0x6367a
movq -0x40(%rbp), %rax
movq 0x80(%rax), %rdi
movq 0xd0(%rax), %rax
movw 0xa(%rax), %cx
movq (%rdi), %rax
movzwl %cx, %esi
callq *0x38(%rax)
movb %al, %cl
movq -0x40(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x69(%rax)
testb $0x1, 0x69(%rax)
je 0x6361e
movq -0x40(%rbp), %rax
movq 0x80(%rax), %rdi
callq 0x63d40
testb $0x1, %al
jne 0x63608
jmp 0x63616
movq -0x40(%rbp), %rax
cmpq $0x0, 0x88(%rax)
jne 0x6361e
movq -0x40(%rbp), %rax
movb $0x1, 0x8(%rax)
movq -0x40(%rbp), %rax
testb $0x1, 0x69(%rax)
je 0x63678
movq -0x40(%rbp), %rax
cmpq $0x0, 0x88(%rax)
je 0x63678
movq -0x40(%rbp), %rax
testb $0x1, 0x6a(%rax)
je 0x63656
movq -0x40(%rbp), %rax
movq 0xd0(%rax), %rdi
movq (%rdi), %rax
movl $0x1, %esi
callq *0x48(%rax)
movq -0x40(%rbp), %rax
testb $0x1, 0x6b(%rax)
je 0x63676
movq -0x40(%rbp), %rax
movq 0xd0(%rax), %rdi
movq (%rdi), %rax
movl $0x2, %esi
callq *0x48(%rax)
jmp 0x63678
jmp 0x6367a
movq -0x40(%rbp), %rax
testb $0x1, 0x8(%rax)
jne 0x637fc
movq -0x40(%rbp), %rax
cmpq $0x0, 0x88(%rax)
je 0x637fc
movq -0x40(%rbp), %rax
testb $0x1, 0x6a(%rax)
jne 0x636f7
movq -0x40(%rbp), %rax
movq 0x88(%rax), %rdi
movq 0xd0(%rax), %rax
movw 0xa(%rax), %cx
movq (%rdi), %rax
movzwl %cx, %esi
callq *0x38(%rax)
movb %al, %cl
movq -0x40(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x6a(%rax)
testb $0x1, 0x6a(%rax)
je 0x636f5
movq -0x40(%rbp), %rax
testb $0x1, 0x69(%rax)
je 0x636f5
movq -0x40(%rbp), %rax
movq 0xd0(%rax), %rdi
movq (%rdi), %rax
movl $0x1, %esi
callq *0x48(%rax)
jmp 0x636f7
movq -0x40(%rbp), %rax
testb $0x1, 0x6b(%rax)
jne 0x63754
movq -0x40(%rbp), %rax
movq 0x90(%rax), %rdi
movq 0xd0(%rax), %rax
movw 0xa(%rax), %cx
movq (%rdi), %rax
movzwl %cx, %esi
callq *0x38(%rax)
movb %al, %cl
movq -0x40(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x6b(%rax)
testb $0x1, 0x6b(%rax)
je 0x63752
movq -0x40(%rbp), %rax
testb $0x1, 0x69(%rax)
je 0x63752
movq -0x40(%rbp), %rax
movq 0xd0(%rax), %rdi
movq (%rdi), %rax
movl $0x2, %esi
callq *0x48(%rax)
jmp 0x63754
movq -0x40(%rbp), %rax
testb $0x1, 0x6a(%rax)
jne 0x637b1
movq -0x40(%rbp), %rax
movq 0x88(%rax), %rdi
movq 0xd0(%rax), %rax
movw 0xa(%rax), %cx
movq (%rdi), %rax
movzwl %cx, %esi
callq *0x38(%rax)
movb %al, %cl
movq -0x40(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x6a(%rax)
testb $0x1, 0x6a(%rax)
je 0x637af
movq -0x40(%rbp), %rax
testb $0x1, 0x69(%rax)
je 0x637af
movq -0x40(%rbp), %rax
movq 0xd0(%rax), %rdi
movq (%rdi), %rax
movl $0x1, %esi
callq *0x48(%rax)
jmp 0x637b1
movq -0x40(%rbp), %rax
testb $0x1, 0x6a(%rax)
je 0x637c7
movq -0x40(%rbp), %rax
testb $0x1, 0x6b(%rax)
je 0x637c7
jmp 0x637c7
movq -0x40(%rbp), %rcx
xorl %eax, %eax
testb $0x1, 0x69(%rcx)
movb %al, -0x49(%rbp)
je 0x637ef
movq -0x40(%rbp), %rcx
xorl %eax, %eax
testb $0x1, 0x6a(%rcx)
movb %al, -0x49(%rbp)
je 0x637ef
movq -0x40(%rbp), %rax
movb 0x6b(%rax), %al
movb %al, -0x49(%rbp)
movq -0x40(%rbp), %rax
movb -0x49(%rbp), %cl
andb $0x1, %cl
movb %cl, 0x8(%rax)
movq -0x40(%rbp), %rax
testb $0x1, 0x8(%rax)
jne 0x6382c
movq -0x40(%rbp), %rax
cmpq $0x0, 0x88(%rax)
je 0x63816
jmp 0x63816
movq -0x40(%rbp), %rax
movq 0xd0(%rax), %rdi
movq (%rdi), %rax
movl $0x2, %esi
callq *0x20(%rax)
jmp 0x6382e
movq -0x40(%rbp), %rax
movq 0xd0(%rax), %rax
testb $0x1, 0x8(%rax)
je 0x638ce
movq -0x40(%rbp), %rax
movb $0x1, 0x68(%rax)
movq 0xd0(%rax), %rcx
movb $0x0, 0x8(%rcx)
movq 0xd0(%rax), %rdi
movq (%rdi), %rax
callq *0x30(%rax)
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, -0x30(%rbp)
movq 0xc8(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x30(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x54(%rbp)
movq -0x30(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x50(%rbp)
movq -0x30(%rbp), %rax
testb $0x1, 0x15(%rax)
je 0x638a2
movq -0x40(%rbp), %rax
movl 0x60(%rax), %eax
movl %eax, -0x64(%rbp)
jmp 0x638ac
movq -0x40(%rbp), %rax
movl 0x64(%rax), %eax
movl %eax, -0x64(%rbp)
movl -0x50(%rbp), %edx
movl -0x54(%rbp), %esi
movq -0x60(%rbp), %rdi
movq -0x40(%rbp), %r8
movl -0x64(%rbp), %ecx
addq $0x38, %r8
movq -0x30(%rbp), %rax
movq 0x58(%rax), %r9
callq 0x4c3c0
jmp 0x638d8
movq -0x40(%rbp), %rax
movb $0x1, 0x8(%rax)
jmp 0x638da
movq -0x40(%rbp), %rax
testb $0x1, 0x8(%rax)
je 0x6396e
movq -0x40(%rbp), %rax
movq 0x80(%rax), %rdi
movq 0x58(%rax), %rsi
movq (%rdi), %rax
movl $0x1, %ecx
movl %ecx, %edx
callq *0x10(%rax)
movl %eax, %ecx
movq -0x40(%rbp), %rax
cmpl $0x0, %ecx
seta %cl
andb $0x1, %cl
movb %cl, -0x31(%rbp)
cmpq $0x0, 0x88(%rax)
je 0x6396c
movq -0x40(%rbp), %rax
movq 0x88(%rax), %rdi
movq 0x58(%rax), %rsi
movb -0x31(%rbp), %cl
xorb $-0x1, %cl
movq (%rdi), %rax
movq 0x10(%rax), %rax
movzbl %cl, %edx
andl $0x1, %edx
xorl %ecx, %ecx
callq *%rax
movq -0x40(%rbp), %rax
movq 0x90(%rax), %rdi
movq 0x58(%rax), %rsi
movb -0x31(%rbp), %cl
xorb $-0x1, %cl
movq (%rdi), %rax
movq 0x10(%rax), %rax
movzbl %cl, %edx
andl $0x1, %edx
xorl %ecx, %ecx
callq *%rax
jmp 0x6396e
movq -0x40(%rbp), %rax
movb 0x8(%rax), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop