// File: /workspace/github_cpp_makefile_star2_O1/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, %rbx
cmpl $0x2, 0x68(%rdi)
jl 0x17baf
cmpq $0x0, 0xe0(%rbx)
jne 0x17baf
movq 0x60(%rbx), %r14
leaq 0x1(%r14), %rdi
callq 0x5030
movq %rax, 0x128(%rbx)
incq %r14
je 0x17b03
xorl %eax, %eax
movq 0x128(%rbx), %rcx
movb $0x0, (%rcx,%rax)
incq %rax
movq 0x60(%rbx), %rcx
incq %rcx
cmpq %rcx, %rax
jb 0x17ae9
leaq 0x108(%rbx), %rdi
movslq 0x68(%rbx), %rsi
callq 0x1996a
leaq 0xe8(%rbx), %rdi
movslq 0x68(%rbx), %rsi
callq 0x199d0
cmpl $0x0, 0x68(%rbx)
jle 0x17baf
leaq 0xc8(%rbx), %r14
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0xf0(%rbx), %rax
movq %rbx, (%rax,%r15)
movq 0xf0(%rbx), %rax
movl %r12d, 0x8(%rax,%r15)
movl $0x8, %edi
callq 0x5370
movq %rax, %rbp
movq 0xf0(%rbx), %rax
addq %r15, %rax
movq %rax, 0x270(%rsp)
movb $0x1, %r13b
movq %rbp, %rdi
leaq 0x1f3f(%rip), %rsi      # 0x19abc
leaq 0x270(%rsp), %rdx
callq 0x19fd2
movq %rbp, 0x68(%rsp)
xorl %r13d, %r13d
movq %r14, %rdi
leaq 0x68(%rsp), %rsi
callq 0x19a36
incq %r12
movslq 0x68(%rbx), %rax
addq $0x10, %r15
cmpq %rax, %r12
jl 0x17b3a
movl 0x3c(%rbx), %eax
cmpl $-0x1, %eax
je 0x17bc3
movl $0xffffffff, 0x3c(%rbx) # imm = 0xFFFFFFFF
jmp 0x17ee6
movl 0x38(%rbx), %eax
movq %rax, %rcx
cmpq %rax, 0x30(%rbx)
ja 0x17eda
leaq 0x18(%rbx), %rax
movq %rax, 0x60(%rsp)
leaq 0x30(%rsp), %r14
movq %rsp, %rbp
leaq 0x68(%rsp), %r15
leaq 0x19230(%rip), %r12     # 0x30e20
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x30(%rax)
testb %al, %al
je 0x17ef8
cmpl $0x1, 0x68(%rbx)
jne 0x17c1d
movl 0x70(%rbx), %esi
movq (%rbx), %rax
movq %rbx, %rdi
xorl %edx, %edx
callq *0x28(%rax)
incl 0x70(%rbx)
jmp 0x17ec1
movq 0x128(%rbx), %rax
movl 0x6c(%rbx), %ecx
cmpb $0x0, (%rax,%rcx)
jne 0x17c48
movq %r12, %rdi
xorl %esi, %esi
callq 0x5110
movq 0x128(%rbx), %rax
movl 0x6c(%rbx), %ecx
movb (%rax,%rcx), %al
cmpb $0x1, %al
jne 0x17c2d
leaq 0x270(%rsp), %r13
movq %r13, %rdi
callq 0x5490
movl 0x6c(%rbx), %esi
movq %r13, %rdi
callq 0x51e0
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq 0xa0(%rbx), %rsi
movq 0xa8(%rbx), %rdx
addq %rsi, %rdx
movq %rbp, %rdi
callq 0x10866
movq %rbp, %rdi
leaq 0x17ecb(%rip), %rsi     # 0x2fb5a
callq 0x5720
leaq 0x40(%rsp), %rdi
leaq 0x278(%rsp), %rsi
callq 0x55a0
movq (%rsp), %rcx
movl $0xf, %esi
leaq 0x10(%rsp), %rax
cmpq %rax, %rcx
je 0x17cbe
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %r8
movq 0x48(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
jbe 0x17cec
movl $0xf, %esi
leaq 0x50(%rsp), %rdi
cmpq %rdi, 0x40(%rsp)
je 0x17ce7
movq 0x50(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x17cfb
movq 0x40(%rsp), %rsi
movq %rbp, %rdi
callq 0x5120
jmp 0x17d09
leaq 0x40(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x53e0
leaq 0x78(%rsp), %rsi
movq %rsi, 0x68(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x17d2e
movq %rdx, 0x68(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x78(%rsp)
jmp 0x17d34
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 %r15, %rdi
leaq 0x18854(%rip), %rsi     # 0x305af
callq 0x5720
movq %r14, 0x20(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x17d83
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x17d8a
movups (%rcx), %xmm0
movups %xmm0, (%r14)
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 0x17dbe
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x5380
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x17dda
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x5380
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x17df5
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x5380
movq 0x20(%rsp), %rsi
movq %r15, %rdi
movl $0x4, %edx
callq 0x56d0
movq 0x68(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x88(%rsp,%rax)
jne 0x17f2a
movl $0x4, %edx
movq %r15, %rdi
movq %rbp, %rsi
callq 0x5440
movl (%rsp), %r14d
movq 0x60(%rsp), %rdi
movq %r14, %rsi
callq 0x1a064
testq %r14, %r14
je 0x17e6a
xorl %r13d, %r13d
movl $0x4, %edx
movq %r15, %rdi
movq %rbp, %rsi
callq 0x5440
movl (%rsp), %eax
movq 0x20(%rbx), %rcx
movl %eax, (%rcx,%r13,4)
incq %r13
cmpq %r13, %r14
jne 0x17e47
movq %r15, %rdi
callq 0x50a0
movq 0x20(%rsp), %rdi
callq 0x56c0
movq %r15, %rdi
callq 0x50d0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %r14
cmpq %r14, %rdi
je 0x17ea0
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x5380
leaq 0x270(%rsp), %rdi
movq 0x230e9(%rip), %rsi     # 0x3af98
callq 0x5190
leaq 0x2e0(%rsp), %rdi
callq 0x5130
incl 0x6c(%rbx)
movl $0x0, 0x38(%rbx)
cmpq $0x0, 0x30(%rbx)
je 0x17bf0
xorl %eax, %eax
xorl %ecx, %ecx
incl %eax
movl %eax, 0x38(%rbx)
movq 0x20(%rbx), %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 0x18692(%rip), %rsi     # 0x3059e
movq %rax, %rdi
callq 0x5080
movq 0x230ad(%rip), %rsi     # 0x3afc8
movq 0x23096(%rip), %rdx     # 0x3afb8
movq %r14, %rdi
callq 0x5650
movq 0x230bf(%rip), %rdi     # 0x3aff0
leaq 0x1867b(%rip), %rsi     # 0x305b3
movl $0x34, %edx
callq 0x5400
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq 0x2309d(%rip), %rdi     # 0x3aff0
callq 0x5400
movq %rax, %rbx
leaq 0x17d77(%rip), %rsi     # 0x2fcd9
movl $0x1, %edx
movq %rax, %rdi
callq 0x5400
movq %rbx, %rdi
callq 0x5170
movl $0x4, %edi
callq 0x5180
movl $0x1, (%rax)
movq 0x22fba(%rip), %rsi     # 0x3af48
movq %rax, %rdi
xorl %edx, %edx
callq 0x5650
movq %rax, %rbx
movq %r14, %rdi
callq 0x5220
jmp 0x1807b
jmp 0x17fb9
jmp 0x17fc1
movq %rax, %rbx
jmp 0x17fe5
movq %rax, %rbx
jmp 0x1803e
movq %rax, %rbx
jmp 0x1805a
movq %rax, %rbx
jmp 0x18001
movq %rax, %rbx
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x17fe5
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x5380
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x18001
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x5380
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x1805a
movq 0x10(%rsp), %rsi
jmp 0x18052
jmp 0x18031
movq %rax, %rbx
testb %r13b, %r13b
je 0x1807b
movl $0x8, %esi
movq %rbp, %rdi
callq 0x5380
jmp 0x1807b
jmp 0x18031
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x50d0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1805a
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x5380
movq 0x22f37(%rip), %rsi     # 0x3af98
leaq 0x270(%rsp), %rdi
callq 0x5190
leaq 0x2e0(%rsp), %rdi
callq 0x5130
movq %rbx, %rdi
callq 0x56a0
nop