// File: /workspace/github_cpp_makefile_star2_O1/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), %rbx
movslq 0x8(%rdi), %rax
movq %rax, 0x70(%rsp)
leaq 0x98(%rbx), %rax
movq %rax, 0x78(%rsp)
movq 0x2149c(%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), %r12
movq 0x78(%rsp), %rdi
callq 0x2d29c
movl 0x70(%rbx), %ecx
movq 0x60(%rbx), %r15
movl $0x3, %r14d
movq %rcx, 0x8(%rsp)
cmpq %rcx, %r15
jb 0x19b3e
movq 0x8(%rsp), %rax
incl %eax
movl %eax, 0x70(%rbx)
xorl %r14d, %r14d
movq 0x78(%rsp), %rdi
callq 0x2d2d8
movq 0x8(%rsp), %r13
cmpq %r13, %r15
leaq 0xa0(%rsp), %r15
jb 0x19e6b
movq (%rbx), %rax
movq %rbx, %rdi
movl %r13d, %esi
movq 0x70(%rsp), %rdx
callq *0x28(%rax)
leaq 0x290(%rsp), %r14
movq %r14, %rdi
callq 0x5490
movq %r14, %rdi
movq %r13, %rsi
callq 0x51e0
leaq 0x20(%rsp), %r14
movq %r14, 0x10(%rsp)
movq 0xa0(%rbx), %rsi
movq 0xa8(%rbx), %rdx
addq %rsi, %rdx
movq %rbp, %rdi
callq 0x10866
movq %rbp, %rdi
leaq 0x15fa3(%rip), %rsi     # 0x2fb5a
callq 0x5720
leaq 0x50(%rsp), %rdi
leaq 0x298(%rsp), %rsi
callq 0x55a0
movq 0x10(%rsp), %rcx
movl $0xf, %esi
cmpq %r14, %rcx
je 0x19be2
movq 0x20(%rsp), %rsi
movq 0x18(%rsp), %r8
movq 0x58(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
jbe 0x19c10
movl $0xf, %esi
leaq 0x60(%rsp), %rdi
cmpq %rdi, 0x50(%rsp)
je 0x19c0b
movq 0x60(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x19c1f
movq 0x50(%rsp), %rsi
movq %rbp, %rdi
callq 0x5120
jmp 0x19c2d
leaq 0x50(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x53e0
movq %r15, 0x90(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x19c56
movq %rdx, 0x90(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xa0(%rsp)
jmp 0x19c5d
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x98(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq %r12, %rdi
leaq 0x16928(%rip), %rsi     # 0x305af
callq 0x5720
leaq 0x40(%rsp), %rsi
movq %rsi, 0x30(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x19cb4
movq %rdx, 0x30(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x40(%rsp)
jmp 0x19cba
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 %r15, %rdi
je 0x19cef
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x5380
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x19d0b
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x5380
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x19d22
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5380
movq 0x30(%rsp), %rsi
movq %r12, %rdi
movl $0x4, %edx
callq 0x53b0
movq 0x90(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0xb0(%rsp,%rax)
jne 0x19e86
movq 0x110(%rbx), %r15
movq 0x70(%rsp), %r14
shlq $0x5, %r14
movl 0x18(%r15,%r14), %eax
cmpb $0x0, 0xc0(%rbx)
movl %eax, %ecx
bswapl %ecx
cmovel %eax, %ecx
movl %ecx, 0x10(%rsp)
movl $0x4, %edx
movq %r12, %rdi
movq %rbp, %rsi
callq 0x5460
addq %r14, %r15
cmpq $0x0, 0x18(%r15)
je 0x19dc5
xorl %r13d, %r13d
movq 0x8(%r15), %rax
movl (%rax,%r13,4), %eax
cmpb $0x0, 0xc0(%rbx)
movl %eax, %ecx
bswapl %ecx
cmovel %eax, %ecx
movl %ecx, 0x10(%rsp)
movl $0x4, %edx
movq %r12, %rdi
movq %rbp, %rsi
callq 0x5460
incq %r13
cmpq 0x18(%r15), %r13
jb 0x19d92
movq %r12, %rdi
callq 0x54e0
movq 0x110(%rbx), %rax
movq $0x0, 0x18(%rax,%r14)
movq 0x128(%rbx), %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 0x52a0
leaq 0x188(%rsp), %rdi
callq 0x5130
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %r13
cmpq %r13, %rdi
je 0x19e47
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x5380
leaq 0x290(%rsp), %rdi
movq 0x21142(%rip), %rsi     # 0x3af98
callq 0x5190
leaq 0x300(%rsp), %rdi
callq 0x5130
xorl %r14d, %r14d
testl %r14d, %r14d
je 0x19b10
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x21163(%rip), %rdi     # 0x3aff0
leaq 0x16754(%rip), %rsi     # 0x305e8
movl $0x34, %edx
callq 0x5400
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq 0x21141(%rip), %rdi     # 0x3aff0
callq 0x5400
movq %rax, %rbx
leaq 0x15e1b(%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 0x2105e(%rip), %rsi     # 0x3af48
movq %rax, %rdi
xorl %edx, %edx
callq 0x5650
jmp 0x19ef6
movq %rax, %rbx
jmp 0x19fa9
jmp 0x19f7d
movq %rax, %rbx
jmp 0x19f8d
movq %rax, %rbx
movq 0x90(%rsp), %rdi
cmpq %r15, %rdi
je 0x19f2d
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x5380
jmp 0x19f2d
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x19f4e
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x5380
jmp 0x19f4e
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
jne 0x19f6c
jmp 0x19fa9
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x19fa9
movq 0x20(%rsp), %rsi
jmp 0x19fa1
jmp 0x19f7d
movq %rax, %rdi
callq 0xdcfa
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x5520
leaq 0x40(%rsp), %r13
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x19fa9
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x5380
movq 0x20fe8(%rip), %rsi     # 0x3af98
leaq 0x290(%rsp), %rdi
callq 0x5190
leaq 0x300(%rsp), %rdi
callq 0x5130
movq %rbx, %rdi
callq 0x56a0