// File: /workspace/github_cpp_makefile_star2_O2/BenLangmead[P]bowtie/./aligner.h
// Function: MixedMultiAligner::run(bool, int)
void run(bool verbose = false, int tid = -1) {
#ifdef PER_THREAD_TIMING
		uint64_t ncpu_changeovers = 0;
		uint64_t nnuma_changeovers = 0;

		int current_cpu = 0, current_node = 0;
		get_cpu_and_node(current_cpu, current_node);

		std::stringstream ss;
		std::string msg;
		ss << "thread: " << tid << " time: ";
		msg = ss.str();
		Timer timer(std::cout, msg.c_str());
#endif
		bool first = true;
		bool saw_last_read = false;
		if(n_ == 1) {
			Aligner *al = seOrPe_[0] ? (*alignersSE_)[0] : (*alignersPE_)[0];
			PatternSourcePerThread *ps = (*patsrcs_)[0];
			while(true) {
#ifdef PER_THREAD_TIMING
				int cpu = 0, node = 0;
				get_cpu_and_node(cpu, node);
				if(cpu != current_cpu) {
					ncpu_changeovers++;
					current_cpu = cpu;
				}
				if(node != current_node) {
					nnuma_changeovers++;
					current_node = node;
				}
#endif
				if(!first && !al->done) {
					// Advance an aligner already in progress; this is
					// the common case
					al->advance();
				} else {
					if(saw_last_read) {
						break;
					}
					// Get a new read
					pair<bool, bool> ret = ps->nextReadPair();
					saw_last_read = ret.second;
					if(ret.first && ps->rdid() < qUpto_) {
						if(ps->paired()) {
							// Read currently in buffer is paired-end
							(*alignersPE_)[0]->setQuery(ps);
							al = (*alignersPE_)[0];
							seOrPe_[0] = false; // false -> paired
						} else {
							// Read currently in buffer is single-end
							(*alignersSE_)[0]->setQuery(ps);
							al = (*alignersSE_)[0];
							seOrPe_[0] = true; // true = unpaired
						}
					} else if (ret.first) {
						break;
					}
				}
				first = false;
			}
		} else {
			while(true) {
#ifdef PER_THREAD_TIMING
				int cpu = 0, node = 0;
				get_cpu_and_node(cpu, node);
				if(cpu != current_cpu) {
					ncpu_changeovers++;
					current_cpu = cpu;
				}
				if(node != current_node) {
					nnuma_changeovers++;
					current_node = node;
				}
#endif
				bool saw_last_read = false;
				for(uint32_t i = 0; i < n_; i++) {
					Aligner *al = seOrPe_[i] ? (*alignersSE_)[i] :
											   (*alignersPE_)[i];
					if(!first && !al->done) {
						// Advance an aligner already in progress; this is
						// the common case
						al->advance();
					} else {
						if(saw_last_read) {
							break;
						}
						// Feed a new read to a vacant aligner
						PatternSourcePerThread *ps = (*patsrcs_)[i];
						// Get a new read
						pair<bool, bool> ret = ps->nextReadPair();
						saw_last_read = ret.second;
						if (ret.first && ps->rdid() < qUpto_) {
							if(ps->paired()) {
								// Read currently in buffer is paired-end
								(*alignersPE_)[i]->setQuery(ps);
								seOrPe_[i] = false; // false -> paired
							} else {
								// Read currently in buffer is single-end
								(*alignersSE_)[i]->setQuery(ps);
								seOrPe_[i] = true; // true = unpaired
							}
						} else if (ret.first) {
							break;
						}
					}
				}
				first = false;
			}
		}
#ifdef PER_THREAD_TIMING
		ss.str("");
		ss.clear();
		ss << "thread: " << tid << " cpu_changeovers: " << ncpu_changeovers << std::endl
		   << "thread: " << tid << " node_changeovers: " << nnuma_changeovers << std::endl;
		std::cout << ss.str();
#endif
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
cmpl $0x1, 0x8(%rdi)
jne 0x1c690
movq 0x38(%rbx), %rax
movq 0x40(%rbx), %rcx
movzbl (%rax), %eax
xorl $0x1, %eax
movq 0x28(%rbx,%rax,8), %rax
movq 0x8(%rax), %rax
movq (%rax), %r15
movq 0x8(%rcx), %rax
movq (%rax), %r14
movb $0x1, %cl
xorl %ebp, %ebp
testb $0x1, %cl
je 0x1c651
testb $0x1, %bpl
jne 0x1c774
movq %r14, %rdi
callq 0x41068
movl %eax, %ebp
shrl $0x8, %ebp
andl $0x1, %ebp
xorl %ecx, %ecx
testb $0x1, %al
je 0x1c5d6
movq 0x50(%r14), %rax
movq 0x58(%r14), %rcx
addq %rax, %rcx
movl 0xc(%rbx), %edx
cmpq %rdx, %rcx
jae 0x1c774
movq 0x38(%r14), %rcx
imulq $0x268, %rax, %rax      # imm = 0x268
cmpb $0x1, 0x190(%rcx,%rax)
jne 0x1c663
movq 0x30(%rbx), %rax
movq 0x8(%rax), %rax
movq (%rax), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x18(%rax)
movq 0x30(%rbx), %rax
movq 0x38(%rbx), %rcx
movq 0x8(%rax), %rax
movq (%rax), %r15
movb $0x0, (%rcx)
xorl %ecx, %ecx
jmp 0x1c5d6
cmpb $0x0, 0x8(%r15)
jne 0x1c5db
movq (%r15), %rax
movq %r15, %rdi
callq *0x10(%rax)
jmp 0x1c651
movq 0x28(%rbx), %rax
movq 0x8(%rax), %rax
movq (%rax), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x18(%rax)
movq 0x28(%rbx), %rax
movq 0x38(%rbx), %rcx
movq 0x8(%rax), %rax
movq (%rax), %r15
movb $0x1, (%rcx)
xorl %ecx, %ecx
jmp 0x1c5d6
movb $0x1, %bpl
xorl %r15d, %r15d
xorl %r12d, %r12d
movl 0x8(%rbx), %eax
cmpq %rax, %r15
jae 0x1c76d
testb $0x1, %bpl
jne 0x1c6ca
movq 0x38(%rbx), %rax
movzbl (%rax,%r15), %eax
xorl $0x1, %eax
movq 0x28(%rbx,%rax,8), %rax
movq 0x8(%rax), %rax
movq (%rax,%r15,8), %rdi
cmpb $0x0, 0x8(%rdi)
je 0x1c73f
testb $0x1, %r12b
jne 0x1c76d
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rax
movq (%rax,%r15,8), %r14
movq %r14, %rdi
callq 0x41068
movl %eax, %r12d
shrl $0x8, %r12d
andl $0x1, %r12d
testb $0x1, %al
je 0x1c765
movq 0x50(%r14), %rax
movq 0x58(%r14), %rcx
addq %rax, %rcx
movl 0xc(%rbx), %edx
cmpq %rdx, %rcx
jae 0x1c76d
movq 0x38(%r14), %rcx
imulq $0x268, %rax, %rax      # imm = 0x268
cmpb $0x1, 0x190(%rcx,%rax)
jne 0x1c747
movq 0x30(%rbx), %rax
movq 0x8(%rax), %rax
movq (%rax,%r15,8), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x18(%rax)
movq 0x38(%rbx), %rax
movb $0x0, (%rax,%r15)
jmp 0x1c765
movq (%rdi), %rax
callq *0x10(%rax)
jmp 0x1c765
movq 0x28(%rbx), %rax
movq 0x8(%rax), %rax
movq (%rax,%r15,8), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x18(%rax)
movq 0x38(%rbx), %rax
movb $0x1, (%rax,%r15)
incq %r15
jmp 0x1c699
xorl %ebp, %ebp
jmp 0x1c693
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop