// File: /workspace/github_cpp_makefile_star2_O3/BenLangmead[P]bowtie/./blockwise_sa.h
// Function: KarkkainenBlockwiseSA<SString<char>>::nextBlock_Worker(void*)
static void nextBlock_Worker(void *vp) {

		pair<KarkkainenBlockwiseSA*, int> param = *(pair<KarkkainenBlockwiseSA*, int>*)vp;
		KarkkainenBlockwiseSA* sa = param.first;
		int tid = param.second;
		while(true) {
			size_t cur = 0;
			{
				ThreadSafe ts(&sa->_mutex);
				cur = sa->_cur;
				if(cur > sa->_sampleSuffs.size()) break;
				sa->_cur++;
			}
			sa->nextBlock((int)cur, tid);
			// Write suffixes into a file
			std::ostringstream number; number << cur;
			const string fname = sa->_base_fname + "." + number.str() + ".sa";
			ofstream sa_file(fname.c_str(), ios::binary);
			if(!sa_file.good()) {
				cerr << "Could not open file for writing a reference graph: \"" << fname << "\"" << endl;
				throw 1;
			}
			const EList<TIndexOffU>& bucket = sa->_itrBuckets[tid];
			writeU<TIndexOffU>(sa_file, (TIndexOffU)bucket.size(), sa->_bigEndian);
			for(size_t i = 0; i < bucket.size(); i++) {
				writeU<TIndexOffU>(sa_file, bucket[i], sa->_bigEndian);
			}
			sa_file.close();
			sa->_itrBuckets[tid].clear();
			sa->_done[cur] = true;
		}
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq (%rdi), %r14
movslq 0x8(%rdi), %rax
movq %rax, 0x50(%rsp)
leaq 0x98(%r14), %rax
movq %rax, 0x58(%rsp)
movq 0x21550(%rip), %rax     # 0x3af88
movq (%rax), %rcx
movq %rcx, 0x88(%rsp)
movq 0x18(%rax), %rax
movq %rax, 0x80(%rsp)
leaq 0x10(%rsp), %rbp
leaq 0x90(%rsp), %rbx
movq 0x58(%rsp), %rdi
callq 0x2cb70
movl 0x70(%r14), %ecx
movq 0x60(%r14), %r12
movl $0x3, %r15d
movq %rcx, 0x8(%rsp)
cmpq %rcx, %r12
jb 0x19a8c
movq 0x8(%rsp), %rax
incl %eax
movl %eax, 0x70(%r14)
xorl %r15d, %r15d
movq 0x58(%rsp), %rdi
callq 0x2cbac
movq 0x8(%rsp), %r13
cmpq %r13, %r12
leaq 0xa0(%rsp), %r12
jb 0x19dbd
movq (%r14), %rax
movq %r14, %rdi
movl %r13d, %esi
movq 0x50(%rsp), %rdx
callq *0x28(%rax)
leaq 0x290(%rsp), %r15
movq %r15, %rdi
callq 0x5480
movq %r15, %rdi
movq %r13, %rsi
callq 0x51e0
leaq 0x20(%rsp), %r15
movq %r15, 0x10(%rsp)
movq 0xa0(%r14), %rsi
movq 0xa8(%r14), %rdx
addq %rsi, %rdx
movq %rbp, %rdi
callq 0x10798
movq %rbp, %rdi
leaq 0x160a5(%rip), %rsi     # 0x2fbaa
callq 0x5700
leaq 0x60(%rsp), %rdi
leaq 0x298(%rsp), %rsi
callq 0x5580
movq 0x10(%rsp), %rcx
movl $0xf, %edi
cmpq %r15, %rcx
je 0x19b30
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %r8
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rdi, %rax
jbe 0x19b61
movl $0xf, %edi
leaq 0x70(%rsp), %r9
cmpq %r9, %rsi
je 0x19b5c
movq 0x70(%rsp), %rdi
cmpq %rdi, %rax
jbe 0x19b6b
movq %rbp, %rdi
callq 0x5120
jmp 0x19b79
leaq 0x60(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x53d0
movq %r12, 0x90(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x19ba2
movq %rdx, 0x90(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xa0(%rsp)
jmp 0x19baa
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x98(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq %rbx, %rdi
leaq 0x16a2b(%rip), %rsi     # 0x305ff
callq 0x5700
leaq 0x40(%rsp), %rsi
movq %rsi, 0x30(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x19c01
movq %rdx, 0x30(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x40(%rsp)
jmp 0x19c07
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x38(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x90(%rsp), %rdi
cmpq %r12, %rdi
je 0x19c3c
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x5370
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x19c58
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x5370
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x19c6f
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5370
movq 0x30(%rsp), %rsi
movq %rbx, %rdi
movl $0x4, %edx
callq 0x53a0
movq 0x90(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0xb0(%rsp,%rax)
jne 0x19dd8
movq 0x110(%r14), %r12
movq 0x50(%rsp), %r15
shlq $0x5, %r15
movl 0x18(%r12,%r15), %eax
cmpb $0x0, 0xc0(%r14)
movl %eax, %ecx
bswapl %ecx
cmovel %eax, %ecx
movl %ecx, 0x10(%rsp)
movl $0x4, %edx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x5450
addq %r15, %r12
cmpq $0x0, 0x18(%r12)
je 0x19d17
xorl %r13d, %r13d
movq 0x8(%r12), %rax
movl (%rax,%r13,4), %eax
cmpb $0x0, 0xc0(%r14)
movl %eax, %ecx
bswapl %ecx
cmovel %eax, %ecx
movl %ecx, 0x10(%rsp)
movl $0x4, %edx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x5450
incq %r13
cmpq 0x18(%r12), %r13
jb 0x19ce1
movq %rbx, %rdi
callq 0x54c0
movq 0x110(%r14), %rax
movq $0x0, 0x18(%rax,%r15)
movq 0x128(%r14), %rax
movq 0x8(%rsp), %rcx
movb $0x1, (%rax,%rcx)
movq 0x88(%rsp), %rax
movq %rax, 0x90(%rsp)
movq -0x18(%rax), %rax
movq 0x80(%rsp), %rcx
movq %rcx, 0x90(%rsp,%rax)
leaq 0x98(%rsp), %rdi
callq 0x5290
leaq 0x188(%rsp), %rdi
callq 0x5130
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %r13
cmpq %r13, %rdi
je 0x19d99
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x5370
leaq 0x290(%rsp), %rdi
movq 0x211f0(%rip), %rsi     # 0x3af98
callq 0x5190
leaq 0x300(%rsp), %rdi
callq 0x5130
xorl %r15d, %r15d
testl %r15d, %r15d
je 0x19a5c
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x21211(%rip), %rdi     # 0x3aff0
leaq 0x16852(%rip), %rsi     # 0x30638
movl $0x34, %edx
callq 0x53f0
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq 0x211ef(%rip), %rdi     # 0x3aff0
callq 0x53f0
movq %rax, %rbx
leaq 0x15f19(%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 0x2110c(%rip), %rsi     # 0x3af48
movq %rax, %rdi
xorl %edx, %edx
callq 0x5630
jmp 0x19e48
movq %rax, %rbx
jmp 0x19efb
jmp 0x19ecf
movq %rax, %rbx
jmp 0x19edf
movq %rax, %rbx
movq 0x90(%rsp), %rdi
cmpq %r12, %rdi
je 0x19e7f
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x5370
jmp 0x19e7f
movq %rax, %rbx
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x19ea0
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x5370
jmp 0x19ea0
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
jne 0x19ebe
jmp 0x19efb
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x19efb
movq 0x20(%rsp), %rsi
jmp 0x19ef3
jmp 0x19ecf
movq %rax, %rdi
callq 0xdbdd
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x5500
leaq 0x40(%rsp), %r13
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x19efb
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x5370
movq 0x21096(%rip), %rsi     # 0x3af98
leaq 0x290(%rsp), %rdi
callq 0x5190
leaq 0x300(%rsp), %rdi
callq 0x5130
movq %rbx, %rdi
callq 0x5680