// File: /workspace/github_cpp_makefile_star2_O3/BenLangmead[P]bowtie/./blockwise_sa.h
// Function: KarkkainenBlockwiseSA<SString<char>>::nextSuffix()
virtual TIndexOffU nextSuffix() {
		// Launch threads if not
		if(this->_nthreads > 1) {
			if(_threads.size() == 0) {
				_done = new volatile bool[_sampleSuffs.size()+1];
				for (size_t i = 0; i < _sampleSuffs.size() + 1; i++) {
					_done[i] = false;
				}
				_itrBuckets.resize(this->_nthreads);
				_tparams.resize(this->_nthreads);
				for(int tid = 0; tid < this->_nthreads; tid++) {
					_tparams[tid].first = this;
					_tparams[tid].second = tid;
#if (__cplusplus >= 201103L)
					_threads.push_back(new std::thread(nextBlock_Worker, (void*)&_tparams[tid]));
#else
					_threads.push_back(new tthread::thread(nextBlock_Worker, (void*)&_tparams[tid]));
#endif
				}
				assert_eq(_threads.size(), (size_t)this->_nthreads);
			}
		}
		if(this->_itrPushedBackSuffix != OFF_MASK) {
			TIndexOffU tmp = this->_itrPushedBackSuffix;
			this->_itrPushedBackSuffix = OFF_MASK;
			return tmp;
		}
		while(this->_itrBucketPos >= this->_itrBucket.size() ||
		      this->_itrBucket.size() == 0)
		{
			if(!hasMoreBlocks()) {
				throw out_of_range("No more suffixes");
			}
			if(this->_nthreads == 1) {
				nextBlock((int)_cur);
				_cur++;
			} else {
				while(!_done[this->_itrBucketIdx]) {
					SLEEP(1);
				}
				// Read suffixes from a file
				std::ostringstream number; number << this->_itrBucketIdx;
				const string fname = _base_fname + "." + number.str() + ".sa";
				ifstream sa_file(fname.c_str(), ios::binary);
				if(!sa_file.good()) {
					cerr << "Could not open file for reading a reference graph: \"" << fname << "\"" << endl;
					throw 1;
				}
				size_t numSAs = readU<TIndexOffU>(sa_file, false /* don't endian swap */);
				this->_itrBucket.resize(numSAs);
				for(size_t i = 0; i < numSAs; i++) {
					this->_itrBucket[i] = readU<TIndexOffU>(sa_file, false);
				}
				sa_file.close();
				std::remove(fname.c_str());
			}
			this->_itrBucketIdx++;
			this->_itrBucketPos = 0;
		}
		return this->_itrBucket[this->_itrBucketPos++];
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3e8, %rsp            # imm = 0x3E8
movq %rdi, %r14
movl 0x68(%rdi), %ebx
cmpl $0x2, %ebx
jl 0x17a92
cmpq $0x0, 0xe0(%r14)
jne 0x17a92
movq 0x60(%r14), %r15
leaq 0x1(%r15), %rdi
callq 0x5030
movq %rax, 0x128(%r14)
incq %r15
je 0x179ed
xorl %eax, %eax
movq 0x128(%r14), %rcx
movb $0x0, (%rcx,%rax)
incq %rax
movq 0x60(%r14), %rcx
incq %rcx
cmpq %rcx, %rax
jb 0x179cf
movl 0x68(%r14), %ebx
leaq 0x108(%r14), %rdi
movslq %ebx, %rsi
callq 0x198ac
leaq 0xe8(%r14), %rdi
movslq 0x68(%r14), %rsi
callq 0x19912
cmpl $0x0, 0x68(%r14)
jle 0x17a92
leaq 0xc8(%r14), %rbx
xorl %r15d, %r15d
leaq 0x68(%rsp), %r13
xorl %r12d, %r12d
movq 0xf0(%r14), %rax
movq %r14, (%rax,%r15)
movq 0xf0(%r14), %rax
movl %r12d, 0x8(%rax,%r15)
movl $0x8, %edi
callq 0x5360
movq %rax, %rbp
movq 0xf0(%r14), %rax
addq %r15, %rax
movq %rax, 0x270(%rsp)
movq %rbp, %rdi
leaq 0x1fa3(%rip), %rsi      # 0x19a08
leaq 0x270(%rsp), %rdx
callq 0x19f24
movq %rbp, 0x68(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x19978
incq %r12
movslq 0x68(%r14), %rax
addq $0x10, %r15
cmpq %rax, %r12
jl 0x17a25
movl 0x3c(%r14), %eax
cmpl $-0x1, %eax
je 0x17aa8
movl $0xffffffff, 0x3c(%r14) # imm = 0xFFFFFFFF
jmp 0x17dd3
movl 0x38(%r14), %eax
movq %rax, %rcx
cmpq %rax, 0x30(%r14)
ja 0x17dc6
leaq 0x18(%r14), %rax
movq %rax, 0x60(%rsp)
leaq 0x30(%rsp), %r15
movq %rsp, %rbp
leaq 0x68(%rsp), %rbx
leaq 0x1939a(%rip), %r12     # 0x30e70
movq (%r14), %rax
movq %r14, %rdi
callq *0x30(%rax)
testb %al, %al
je 0x17de5
cmpl $0x1, 0x68(%r14)
jne 0x17b06
movl 0x70(%r14), %esi
movq (%r14), %rax
movq %r14, %rdi
xorl %edx, %edx
callq *0x28(%rax)
incl 0x70(%r14)
jmp 0x17dab
movq 0x128(%r14), %rax
movl 0x6c(%r14), %ecx
cmpb $0x0, (%rax,%rcx)
jne 0x17b33
movq %r12, %rdi
xorl %esi, %esi
callq 0x5110
movq 0x128(%r14), %rax
movl 0x6c(%r14), %ecx
movb (%rax,%rcx), %al
cmpb $0x1, %al
jne 0x17b17
leaq 0x270(%rsp), %r13
movq %r13, %rdi
callq 0x5480
movl 0x6c(%r14), %esi
movq %r13, %rdi
callq 0x51e0
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq 0xa0(%r14), %rsi
movq 0xa8(%r14), %rdx
addq %rsi, %rdx
movq %rbp, %rdi
callq 0x10798
movq %rbp, %rdi
leaq 0x1802f(%rip), %rsi     # 0x2fbaa
callq 0x5700
leaq 0x40(%rsp), %rdi
leaq 0x278(%rsp), %rsi
callq 0x5580
movq (%rsp), %rcx
movl $0xf, %edi
leaq 0x10(%rsp), %rax
cmpq %rax, %rcx
je 0x17baa
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %r8
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rdi, %rax
jbe 0x17bdb
movl $0xf, %edi
leaq 0x50(%rsp), %r9
cmpq %r9, %rsi
je 0x17bd6
movq 0x50(%rsp), %rdi
cmpq %rdi, %rax
jbe 0x17be5
movq %rbp, %rdi
callq 0x5120
jmp 0x17bf3
leaq 0x40(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x53d0
leaq 0x78(%rsp), %rsi
movq %rsi, 0x68(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x17c18
movq %rdx, 0x68(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x78(%rsp)
jmp 0x17c1e
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x70(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq %rbx, %rdi
leaq 0x189ba(%rip), %rsi     # 0x305ff
callq 0x5700
movq %r15, 0x20(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x17c6d
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x17c74
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x28(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x17ca8
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x5370
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x17cc4
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x5370
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x17cdf
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x5370
movq 0x20(%rsp), %rsi
movq %rbx, %rdi
movl $0x4, %edx
callq 0x56b0
movq 0x68(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x88(%rsp,%rax)
jne 0x17e17
movl $0x4, %edx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x5430
movl (%rsp), %r15d
movq 0x60(%rsp), %rdi
movq %r15, %rsi
callq 0x19fa4
testq %r15, %r15
je 0x17d54
xorl %r13d, %r13d
movl $0x4, %edx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x5430
movl (%rsp), %eax
movq 0x20(%r14), %rcx
movl %eax, (%rcx,%r13,4)
incq %r13
cmpq %r13, %r15
jne 0x17d31
movq %rbx, %rdi
callq 0x50a0
movq 0x20(%rsp), %rdi
callq 0x56a0
movq %rbx, %rdi
callq 0x50d0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %r15
cmpq %r15, %rdi
je 0x17d8a
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x5370
leaq 0x270(%rsp), %rdi
movq 0x231ff(%rip), %rsi     # 0x3af98
callq 0x5190
leaq 0x2e0(%rsp), %rdi
callq 0x5130
incl 0x6c(%r14)
movl $0x0, 0x38(%r14)
cmpq $0x0, 0x30(%r14)
je 0x17ad6
xorl %eax, %eax
xorl %ecx, %ecx
incl %eax
movl %eax, 0x38(%r14)
movq 0x20(%r14), %rax
movl (%rax,%rcx,4), %eax
addq $0x3e8, %rsp            # imm = 0x3E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x5180
movq %rax, %r14
leaq 0x187f5(%rip), %rsi     # 0x305ee
movq %rax, %rdi
callq 0x5080
movq 0x231c0(%rip), %rsi     # 0x3afc8
movq 0x231a9(%rip), %rdx     # 0x3afb8
movq %r14, %rdi
callq 0x5630
movq 0x231d2(%rip), %rdi     # 0x3aff0
leaq 0x187de(%rip), %rsi     # 0x30603
movl $0x34, %edx
callq 0x53f0
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq 0x231b0(%rip), %rdi     # 0x3aff0
callq 0x53f0
movq %rax, %rbx
leaq 0x17eda(%rip), %rsi     # 0x2fd29
movl $0x1, %edx
movq %rax, %rdi
callq 0x53f0
movq %rbx, %rdi
callq 0x5170
movl $0x4, %edi
callq 0x5180
movl $0x1, (%rax)
movq 0x230cd(%rip), %rsi     # 0x3af48
movq %rax, %rdi
xorl %edx, %edx
callq 0x5630
movq %rax, %rbx
movq %r14, %rdi
callq 0x5220
jmp 0x17f68
jmp 0x17ea6
jmp 0x17eae
movq %rax, %rbx
jmp 0x17ed2
movq %rax, %rbx
jmp 0x17f2b
movq %rax, %rbx
jmp 0x17f47
movq %rax, %rbx
jmp 0x17eee
movq %rax, %rbx
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x17ed2
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x5370
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x17eee
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x5370
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x17f47
movq 0x10(%rsp), %rsi
jmp 0x17f3f
jmp 0x17f1e
movq %rax, %rbx
movl $0x8, %esi
movq %rbp, %rdi
callq 0x5370
jmp 0x17f68
movq %rax, %rbx
jmp 0x17f68
jmp 0x17f1e
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x50d0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x17f47
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x5370
movq 0x2304a(%rip), %rsi     # 0x3af98
leaq 0x270(%rsp), %rdi
callq 0x5190
leaq 0x2e0(%rsp), %rdi
callq 0x5130
movq %rbx, %rdi
callq 0x5680