// File: /workspace/github_cpp_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x1, 0x8(%rdi)
jne 0x235c1
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, %al
xorl %ebp, %ebp
testb $0x1, %al
je 0x2358c
testb $0x1, %bpl
jne 0x235b2
movq %r14, %rdi
callq 0x4c244
movl %eax, %ebp
movb $0x1, %r12b
testb $0x1, %bpl
je 0x235a1
movq 0x50(%r14), %rax
movq 0x58(%r14), %rcx
addq %rax, %rcx
movl 0xc(%rbx), %edx
cmpq %rdx, %rcx
jae 0x2359e
movq 0x38(%r14), %rcx
imulq $0x268, %rax, %rax      # imm = 0x268
movzbl 0x190(%rcx,%rax), %r15d
movl %r15d, %r13d
xorb $0x1, %r13b
movq 0x28(%rbx,%r15,8), %rax
movq 0x8(%rax), %rax
movq (%rax), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x18(%rax)
movq 0x28(%rbx,%r15,8), %rax
movq 0x8(%rax), %rax
movq (%rax), %r15
movq 0x38(%rbx), %rax
movb %r13b, (%rax)
jmp 0x235a1
cmpb $0x0, 0x8(%r15)
jne 0x23517
movq (%r15), %rax
movq %r15, %rdi
callq *0x10(%rax)
jmp 0x2358c
xorl %r12d, %r12d
shrl $0x8, %ebp
andl $0x1, %ebp
xorl %eax, %eax
testb %r12b, %r12b
jne 0x23513
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %al
movl %eax, %ebp
xorl %eax, %eax
cmpl $0x0, 0x8(%rbx)
je 0x235c3
movl $0x1, %r15d
xorl %r12d, %r12d
testb $0x1, %bpl
jne 0x235fd
movq 0x38(%rbx), %rax
movzbl -0x1(%rax,%r15), %eax
xorl $0x1, %eax
movq 0x28(%rbx,%rax,8), %rax
movq 0x8(%rax), %rax
movq -0x8(%rax,%r15,8), %rdi
cmpb $0x0, 0x8(%rdi)
je 0x23675
testb $0x1, %r12b
je 0x23608
xorl %r13d, %r13d
jmp 0x2367e
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rax
movq -0x8(%rax,%r15,8), %r14
movq %r14, %rdi
callq 0x4c244
movl %eax, %r12d
shrl $0x8, %r12d
movb $0x1, %r13b
testb $0x1, %al
je 0x2367e
movq 0x50(%r14), %rax
movq 0x58(%r14), %rcx
addq %rax, %rcx
movl 0xc(%rbx), %edx
cmpq %rdx, %rcx
jae 0x23603
movq 0x38(%r14), %rcx
imulq $0x268, %rax, %rax      # imm = 0x268
cmpb $0x1, 0x190(%rcx,%rax)
jne 0x236a1
movq 0x30(%rbx), %rax
movq 0x8(%rax), %rax
movq -0x8(%rax,%r15,8), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x18(%rax)
movq 0x38(%rbx), %rax
movb $0x0, -0x1(%rax,%r15)
jmp 0x2367e
movq (%rdi), %rax
callq *0x10(%rax)
movb $0x1, %r13b
movl 0x8(%rbx), %edx
leaq 0x1(%r15), %rcx
xorl %eax, %eax
testb %r13b, %r13b
je 0x235c3
cmpq %rdx, %r15
movq %rcx, %r15
jb 0x235d6
jmp 0x235c3
movq 0x28(%rbx), %rax
movq 0x8(%rax), %rax
movq -0x8(%rax,%r15,8), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x18(%rax)
movq 0x38(%rbx), %rax
movb $0x1, -0x1(%rax,%r15)
jmp 0x2367e
nop