// File: /workspace/github_cpp_makefile_star2_O3/BenLangmead[P]bowtie/./blockwise_sa.h
// Function: KarkkainenBlockwiseSA<SString<char>>::buildSamples()
void KarkkainenBlockwiseSA<TStr>::buildSamples() {
	const TStr& t = this->text();
	TIndexOffU bsz = this->bucketSz()-1; // subtract 1 to leave room for sample
	size_t len = this->text().length();
	// Prepare _sampleSuffs array
	_sampleSuffs.clear();
	TIndexOffU numSamples = (TIndexOffU)((len/bsz)+1)<<1; // ~len/bsz x 2
	assert_gt(numSamples, 0);
	VMSG_NL("Reserving space for " << numSamples << " sample suffixes");
	if(this->_passMemExc) {
		// reserve(_sampleSuffs, numSamples, Exact());
		_sampleSuffs.resize(numSamples);
		// Randomly generate samples.  Allow duplicates for now.
		VMSG_NL("Generating random suffixes");
		for(size_t i = 0; i < numSamples; i++) {
#ifdef BOWTIE_64BIT_INDEX
			_sampleSuffs[i] = (TIndexOffU)(_randomSrc.nextU64() % len);
#else
			_sampleSuffs[i] = (TIndexOffU)(_randomSrc.nextU32() % len);
#endif
		}
	} else {
		try {
			_sampleSuffs.resize(numSamples);
			// Randomly generate samples.  Allow duplicates for now.
			VMSG_NL("Generating random suffixes");
			for(size_t i = 0; i < numSamples; i++) {
#ifdef BOWTIE_64BIT_INDEX
				_sampleSuffs[i] = (TIndexOffU)(_randomSrc.nextU64() % len);
#else
				_sampleSuffs[i] = (TIndexOffU)(_randomSrc.nextU32() % len);
#endif
			}
		} catch(bad_alloc &e) {
			if(this->_passMemExc) {
				throw e; // rethrow immediately
			} else {
				cerr << "Could not allocate sample suffix container of " << (numSamples * OFF_SIZE) << " bytes." << endl
				     << "Please try using a smaller number of blocks by specifying a larger --bmax or" << endl
				     << "a smaller --bmaxdivn" << endl;
				throw 1;
			}
		}
	}
	// Remove duplicates; very important to do this before the call to
	// mkeyQSortSuf so that it doesn't try to calculate lexicographical
	// relationships between very long, identical strings, which takes
	// an extremely long time in general, and causes the stack to grow
	// linearly with the size of the input
	{
		Timer timer(cout, "QSorting sample offsets, eliminating duplicates time: ", this->verbose());
		VMSG_NL("QSorting " << _sampleSuffs.size() << " sample offsets, eliminating duplicates");
		_sampleSuffs.sort();
		size_t sslen = _sampleSuffs.size();
		for (size_t i = 0; i < sslen-1; i++) {
			if (_sampleSuffs[i] == _sampleSuffs[i+1]) {
				_sampleSuffs.erase(i--);
				sslen--;
			}
		}
		// Multikey quicksort the samples
		{
			Timer timer(cout, "  Multikey QSorting samples time: ", this->verbose());
			VMSG_NL("Multikey QSorting " << _sampleSuffs.size() << " samples");
			this->qsort(_sampleSuffs);
		}
	}
	// Calculate bucket sizes
	VMSG_NL("Calculating bucket sizes");
	int limit = 5;
	// Iterate until all buckets are less than
	while(--limit >= 0) {
		TIndexOffU numBuckets = (TIndexOffU)_sampleSuffs.size()+1;
#if (__cplusplus >= 201103l)
		AutoArray<std::thread*> threads(this->_nthreads);
#else
		AutoArray<tthread::thread*> threads(this->_nthreads);
#endif
		EList<BinarySortingParam<TStr> > tparams;
		tparams.resize(this->_nthreads);
		for(int tid = 0; tid < this->_nthreads; tid++) {
			// Calculate bucket sizes by doing a binary search for each
			// suffix and noting where it lands
			try {
				// Allocate and initialize containers for holding bucket
				// sizes and representatives.
				tparams[tid].bucketSzs.resize(numBuckets);
				tparams[tid].bucketReps.resize(numBuckets);
				for (size_t i = 0; i < tparams[tid].bucketSzs.size(); i++) {
					tparams[tid].bucketSzs[i] = 0;
					tparams[tid].bucketReps[i] = OFF_MASK;
				}
			} catch(bad_alloc &e) {
				if(this->_passMemExc) {
					throw e; // rethrow immediately
				} else {
					cerr << "Could not allocate sizes, representatives (" << ((numBuckets*8)>>10) << " KB) for blocks." << endl
					     << "Please try using a smaller number of blocks by specifying a larger --bmax or a" << endl
					     << "smaller --bmaxdivn." << endl;
					throw 1;
				}
			}
			tparams[tid].t = &t;
			tparams[tid].sampleSuffs = &_sampleSuffs;
			tparams[tid].begin = (tid == 0 ? 0 : len / this->_nthreads * tid);
			tparams[tid].end = (tid + 1 == this->_nthreads ? len : len / this->_nthreads * (tid + 1));
			if(this->_nthreads == 1) {
				BinarySorting_worker<TStr>((void*)&tparams[tid]);
			} else {
#if (__cplusplus >= 201103l)
				threads[tid] = new std::thread(BinarySorting_worker<TStr>, (void*)&tparams[tid]);
#else
				threads[tid] = new tthread::thread(BinarySorting_worker<TStr>, (void*)&tparams[tid]);
#endif
			}
		}
		if(this->_nthreads > 1) {
			for (int tid = 0; tid < this->_nthreads; tid++) {
				threads[tid]->join();
			}
		}


		EList<TIndexOffU>& bucketSzs = tparams[0].bucketSzs;
		EList<TIndexOffU>& bucketReps = tparams[0].bucketReps;
		for(int tid = 1; tid < this->_nthreads; tid++) {
			for(size_t j = 0; j < numBuckets; j++) {
				bucketSzs[j] += tparams[tid].bucketSzs[j];
				if(bucketReps[j] == OFF_MASK) {
					bucketReps[j] = tparams[tid].bucketReps[j];
				}
			}
		}

		// Check for large buckets and mergeable pairs of small buckets
		// and split/merge as necessary
		TIndexOff added = 0;
		TIndexOff merged = 0;
		assert_eq(bucketSzs.size(), numBuckets);
		assert_eq(bucketReps.size(), numBuckets);
		{
			Timer timer(cout, "  Splitting and merging time: ", this->verbose());
			VMSG_NL("Splitting and merging");
			for(TIndexOffU i = 0; i < numBuckets; i++) {
				TIndexOffU mergedSz = bsz + 1;
				assert(bucketSzs[i] == 0 || bucketReps[i] != OFF_MASK);
				if(i < (TIndexOffU)numBuckets-1) {
					mergedSz = bucketSzs[(size_t)i] + bucketSzs[(size_t)i+1] + 1;
				}
				// Merge?
				if(mergedSz <= bsz) {
					bucketSzs[i+1] += (bucketSzs[i]+1);
					// The following may look strange, but it's necessary
					// to ensure that the merged bucket has a representative
					bucketReps[i+1] = _sampleSuffs[i+added];
					erase(_sampleSuffs, i+added);
					erase(bucketSzs, i);
					erase(bucketReps, i);
					i--; // might go to -1 but ++ will overflow back to 0
					numBuckets--;
					merged++;
					assert_eq(numBuckets, _sampleSuffs.size()+1-added);
					assert_eq(numBuckets, bucketSzs.size());
				}
				// Split?
				else if(bucketSzs[i] > bsz) {
					// Add an additional sample from the bucketReps[]
					// set accumulated in the binarySASearch loop; this
					// effectively splits the bucket
					_sampleSuffs.insert(bucketReps[(size_t)i], (TIndexOffU)(i + (added++)));
				}
			}
		}
		if(added == 0) {
			//if(this->verbose()) {
			//	cout << "Final bucket sizes:" << endl;
			//	cout << "  (begin): " << bucketSzs[0] << " (" << (int)(bsz - bucketSzs[0]) << ")" << endl;
			//	for(uint32_t i = 1; i < numBuckets; i++) {
			//		cout << "  " << bucketSzs[i] << " (" << (int)(bsz - bucketSzs[i]) << ")" << endl;
			//	}
			//}
			break;
		}
		// Otherwise, continue until no more buckets need to be
		// split
		VMSG_NL("Split " << added << ", merged " << merged << "; iterating...");
	}
// Do *not* force a do-over
//	if(limit == 0) {
//		VMSG_NL("Iterated too many times; trying again...");
//		buildSamples();
//	}
	VMSG_NL("Avg bucket size: " << ((double)(len-_sampleSuffs.size()) / (_sampleSuffs.size()+1)) << " (target: " << bsz << ")");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movq %rdi, %rbx
movq 0x8(%rdi), %rax
movl 0x10(%rdi), %ecx
movq %rcx, 0xa8(%rsp)
decl %ecx
movq %rax, 0xa0(%rsp)
movq 0x18(%rax), %r14
movq $0x0, 0x60(%rdi)
movq %r14, %rax
xorl %edx, %edx
movq %rcx, 0x98(%rsp)
divq %rcx
leal 0x2(,%rax,2), %r13d
cmpb $0x1, 0x16(%rdi)
movl %r13d, %ebp
jne 0x1b89c
leaq 0xb0(%rsp), %rdi
callq 0x5200
leaq 0xc0(%rsp), %r15
leaq 0x15029(%rip), %rsi     # 0x30813
movl $0x14, %edx
movq %r15, %rdi
callq 0x53f0
movq %r15, %rdi
movq %rbp, %rsi
callq 0x51e0
movq %rax, %r12
leaq 0x1501c(%rip), %rsi     # 0x30828
movl $0x10, %edx
movq %rax, %rdi
callq 0x53f0
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x5330
movsbl %al, %esi
movq %r12, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x51f0
leaq 0xc8(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x5580
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x1b716
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1b87b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5370
movq 0x1f6d6(%rip), %rsi     # 0x3af58
leaq 0xb0(%rsp), %rdi
callq 0x5230
leaq 0x130(%rsp), %rdi
callq 0x5130
leaq 0x48(%rbx), %rdi
cmpb $0x1, 0x15(%rbx)
movq %rdi, 0x58(%rsp)
jne 0x1b9c8
movq %rbp, %rsi
callq 0x19fa4
cmpb $0x1, 0x16(%rbx)
jne 0x1b971
leaq 0xb0(%rsp), %rdi
callq 0x5200
leaq 0xc0(%rsp), %r12
leaq 0x14f5c(%rip), %rsi     # 0x30839
movl $0x1a, %edx
movq %r12, %rdi
callq 0x53f0
movq 0xc0(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x5330
movsbl %al, %esi
movq %r12, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x51f0
leaq 0xc8(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x5580
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x1b716
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1b950
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5370
movq 0x1f601(%rip), %rsi     # 0x3af58
leaq 0xb0(%rsp), %rdi
callq 0x5230
leaq 0x130(%rsp), %rdi
callq 0x5130
testl %r13d, %r13d
je 0x1bad8
xorl %ecx, %ecx
movl 0x84(%rbx), %edx
movl 0x8c(%rbx), %eax
imull %edx, %eax
movl 0x88(%rbx), %esi
addl %esi, %eax
movl %eax, %edi
shrl $0x10, %edi
imull %edx, %eax
addl %esi, %eax
movl %eax, 0x8c(%rbx)
xorl %edi, %eax
movl $0x0, 0x90(%rbx)
xorl %edx, %edx
divq %r14
movq 0x50(%rbx), %rax
movl %edx, (%rax,%rcx,4)
incq %rcx
cmpq %rbp, %rcx
jb 0x1b97c
jmp 0x1bad8
movq %rbp, %rsi
callq 0x19fa4
cmpb $0x1, 0x16(%rbx)
jne 0x1ba8a
leaq 0xb0(%rsp), %rdi
callq 0x5200
leaq 0xc0(%rsp), %r12
leaq 0x14e43(%rip), %rsi     # 0x30839
movl $0x1a, %edx
movq %r12, %rdi
callq 0x53f0
movq 0xc0(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x5330
movsbl %al, %esi
movq %r12, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x51f0
leaq 0xc8(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x5580
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x1b716
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1ba69
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5370
movq 0x1f4e8(%rip), %rsi     # 0x3af58
leaq 0xb0(%rsp), %rdi
callq 0x5230
leaq 0x130(%rsp), %rdi
callq 0x5130
testl %r13d, %r13d
je 0x1bad8
xorl %ecx, %ecx
movl 0x84(%rbx), %edx
movl 0x8c(%rbx), %eax
imull %edx, %eax
movl 0x88(%rbx), %esi
addl %esi, %eax
movl %eax, %edi
shrl $0x10, %edi
imull %edx, %eax
addl %esi, %eax
movl %eax, 0x8c(%rbx)
xorl %edi, %eax
movl $0x0, 0x90(%rbx)
xorl %edx, %edx
divq %r14
movq 0x50(%rbx), %rax
movl %edx, (%rax,%rcx,4)
incq %rcx
cmpq %rbp, %rcx
jb 0x1ba91
movb 0x16(%rbx), %bpl
xorl %edi, %edi
callq 0x52f0
movq %rax, 0x8(%rsp)
movq 0x1f4b1(%rip), %rax     # 0x3afa0
movq %rax, 0x10(%rsp)
leaq 0x14df2(%rip), %rax     # 0x308ed
movq %rax, 0x18(%rsp)
movb %bpl, 0x20(%rsp)
cmpb $0x1, 0x16(%rbx)
movq 0x58(%rsp), %r13
jne 0x1bbe3
leaq 0xb0(%rsp), %rdi
callq 0x5200
leaq 0xc0(%rsp), %r15
leaq 0x14e48(%rip), %rsi     # 0x30978
movl $0x9, %edx
movq %r15, %rdi
callq 0x53f0
movq 0x60(%rbx), %rsi
movq %r15, %rdi
callq 0x51e0
movq %rax, %r12
leaq 0x14dd1(%rip), %rsi     # 0x30924
movl $0x27, %edx
movq %rax, %rdi
callq 0x53f0
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x5330
movsbl %al, %esi
movq %r12, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x51f0
leaq 0xc8(%rsp), %rsi
leaq 0x30(%rsp), %rdi
callq 0x5580
leaq 0x30(%rsp), %rsi
movq %rbx, %rdi
callq 0x1b716
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1bbc2
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x5370
movq 0x1f38f(%rip), %rsi     # 0x3af58
leaq 0xb0(%rsp), %rdi
callq 0x5230
leaq 0x130(%rsp), %rdi
callq 0x5130
movq 0x60(%rbx), %rdx
movq %r13, %rdi
xorl %esi, %esi
callq 0x1e57c
movq 0x60(%rbx), %rcx
movq %rcx, %rdx
decq %rdx
je 0x1bc50
xorl %eax, %eax
movq %rcx, %rsi
movq 0x50(%rbx), %rdi
movl (%rdi,%rax,4), %r8d
cmpl 0x4(%rdi,%rax,4), %r8d
jne 0x1bc44
decq %rcx
cmpq %rax, %rcx
jbe 0x1bc3a
movq %rax, %rsi
movq 0x50(%rbx), %rcx
movl 0x4(%rcx,%rsi,4), %edi
movl %edi, (%rcx,%rsi,4)
leaq 0x1(%rsi), %rdi
movq 0x60(%rbx), %rcx
decq %rcx
movq %rdi, %rsi
cmpq %rcx, %rdi
jb 0x1bc1c
decq %rax
movq %rcx, 0x60(%rbx)
movq %rdx, %rsi
incq %rax
leaq -0x1(%rsi), %rdx
cmpq %rdx, %rax
jb 0x1bc02
movb 0x16(%rbx), %bpl
xorl %edi, %edi
callq 0x52f0
movq %rax, 0x30(%rsp)
movq 0x1f339(%rip), %rax     # 0x3afa0
movq %rax, 0x38(%rsp)
leaq 0x14cd9(%rip), %rax     # 0x3094c
movq %rax, 0x40(%rsp)
movb %bpl, 0x48(%rsp)
cmpb $0x0, 0x16(%rbx)
movq 0x58(%rsp), %r13
je 0x1bd61
leaq 0xb0(%rsp), %rdi
callq 0x5200
leaq 0xc0(%rsp), %r15
leaq 0x14cc7(%rip), %rsi     # 0x3096f
movl $0x12, %edx
movq %r15, %rdi
callq 0x53f0
movq 0x60(%rbx), %rsi
movq %r15, %rdi
callq 0x51e0
movq %rax, %r12
leaq 0x149aa(%rip), %rsi     # 0x30675
movl $0x8, %edx
movq %rax, %rdi
callq 0x53f0
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x5330
movsbl %al, %esi
movq %r12, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x51f0
leaq 0xc8(%rsp), %rsi
leaq 0x78(%rsp), %rdi
callq 0x5580
leaq 0x78(%rsp), %rsi
movq %rbx, %rdi
callq 0x1b716
leaq 0x88(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1bd40
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x5370
movq 0x1f211(%rip), %rsi     # 0x3af58
leaq 0xb0(%rsp), %rdi
callq 0x5230
leaq 0x130(%rsp), %rdi
callq 0x5130
movq (%rbx), %rax
movq %rbx, %rdi
movq %r13, %rsi
callq *0x38(%rax)
leaq 0x30(%rsp), %rdi
callq 0xfe36
leaq 0x8(%rsp), %rdi
callq 0xfe36
cmpb $0x1, 0x16(%rbx)
jne 0x1be3b
leaq 0xb0(%rsp), %rdi
callq 0x5200
leaq 0xc0(%rsp), %r12
leaq 0x14bdb(%rip), %rsi     # 0x30982
movl $0x18, %edx
movq %r12, %rdi
callq 0x53f0
movq 0xc0(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x5330
movsbl %al, %esi
movq %r12, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x51f0
leaq 0xc8(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x5580
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x1b716
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1be1a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5370
movq 0x1f137(%rip), %rsi     # 0x3af58
leaq 0xb0(%rsp), %rdi
callq 0x5230
leaq 0x130(%rsp), %rdi
callq 0x5130
leaq 0xb0(%rsp), %rax
addq $0x80, %rax
movq %rax, 0x68(%rsp)
movl $0x4, %eax
leaq 0x8(%rsp), %r13
movq %r14, 0x28(%rsp)
movl %eax, 0x60(%rsp)
movl 0x60(%rbx), %ebp
movslq 0x68(%rbx), %r15
leaq (,%r15,8), %r12
testq %r15, %r15
movq %r12, %rdi
movq $-0x1, %rax
cmovsq %rax, %rdi
callq 0x5030
movq %rax, 0x50(%rsp)
movq %rax, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x51b0
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %rax, 0x8(%rsp)
xorl %eax, %eax
movq %rax, 0x10(%rsp)
movq $0x80, 0x18(%rsp)
movq %rax, 0x20(%rsp)
movq %r13, %rdi
movq %r15, %rsi
callq 0x1e516
incl %ebp
movq %rbp, 0x70(%rsp)
cmpl $0x0, 0x68(%rbx)
movq 0x58(%rsp), %r15
leaq 0x78(%rsp), %r13
jle 0x1c0d9
movl 0x70(%rsp), %r12d
xorl %r14d, %r14d
movq 0x10(%rsp), %rax
leaq (%r14,%r14,2), %r13
shlq $0x5, %r13
leaq (%rax,%r13), %rdi
addq $0x10, %rdi
movq %r12, %rsi
callq 0x19fa4
movq 0x10(%rsp), %rax
leaq (%rax,%r13), %rdi
addq $0x30, %rdi
movq %r12, %rsi
callq 0x19fa4
movq 0x10(%rsp), %rax
cmpq $0x0, 0x28(%rax,%r13)
je 0x1bf67
xorl %ecx, %ecx
movq %r14, %rdx
shlq $0x5, %rdx
leaq (%rdx,%rdx,2), %rdx
movq 0x18(%rax,%rdx), %rax
movl $0x0, (%rax,%rcx,4)
movq 0x10(%rsp), %rax
movq 0x38(%rax,%rdx), %rax
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
incq %rcx
movq 0x10(%rsp), %rax
cmpq 0x28(%rax,%rdx), %rcx
jb 0x1bf2b
addq %rdx, %rax
jmp 0x1bf6a
addq %r13, %rax
movq 0xa0(%rsp), %rcx
movq %rcx, (%rax)
movq 0x10(%rsp), %rax
movq %r15, 0x8(%rax,%r13)
testq %r14, %r14
je 0x1bf9b
movslq 0x68(%rbx), %rcx
movq 0x28(%rsp), %rsi
movq %rsi, %rax
xorl %edx, %edx
divq %rcx
imulq %r14, %rax
jmp 0x1bfa2
xorl %eax, %eax
movq 0x28(%rsp), %rsi
movq 0x10(%rsp), %rcx
movq %rax, 0x50(%rcx,%r13)
leaq 0x1(%r14), %rbp
movl 0x68(%rbx), %ecx
cmpq %rcx, %rbp
je 0x1bfcc
movslq %ecx, %rcx
movq 0x28(%rsp), %rax
xorl %edx, %edx
divq %rcx
movq %rax, %rsi
imulq %rbp, %rsi
movq 0x10(%rsp), %rcx
movq %rsi, 0x58(%rcx,%r13)
cmpl $0x1, 0x68(%rbx)
jne 0x1bfeb
addq 0x10(%rsp), %r13
movq %r13, %rdi
callq 0xd707
jmp 0x1c025
movl $0x8, %edi
callq 0x5360
movq %rax, %r15
addq 0x10(%rsp), %r13
movq %r13, 0xb0(%rsp)
movq %rax, %rdi
leaq -0xe908(%rip), %rsi     # 0xd707
leaq 0xb0(%rsp), %rdx
callq 0x19f24
movq 0x50(%rsp), %rax
movq %r15, (%rax,%r14,8)
leaq 0x78(%rsp), %r13
movslq 0x68(%rbx), %rax
movq %rbp, %r14
cmpq %rax, %rbp
movq 0x58(%rsp), %r15
jl 0x1beea
cmpl $0x2, %eax
movq 0x28(%rsp), %r14
jl 0x1c0d9
xorl %r14d, %r14d
movq 0x50(%rsp), %rax
movq (%rax,%r14,8), %rdi
callq 0x5620
incq %r14
movslq 0x68(%rbx), %rcx
cmpq %rcx, %r14
jl 0x1c050
movq 0x10(%rsp), %r15
cmpl $0x2, %ecx
jl 0x1c459
movl $0x1, %eax
movq 0x28(%rsp), %r14
cmpl $0x0, 0x70(%rsp)
je 0x1c0cc
xorl %ecx, %ecx
movq 0x10(%rsp), %rsi
leaq (%rax,%rax,2), %rdx
shlq $0x5, %rdx
movq 0x18(%rsi,%rdx), %rsi
movl (%rsi,%rcx,4), %esi
movq 0x18(%r15), %rdi
addl %esi, (%rdi,%rcx,4)
movq 0x38(%r15), %rsi
cmpl $-0x1, (%rsi,%rcx,4)
jne 0x1c0c1
movq 0x10(%rsp), %rdi
movq 0x38(%rdi,%rdx), %rdx
movl (%rdx,%rcx,4), %edx
movl %edx, (%rsi,%rcx,4)
incq %rcx
cmpq %rcx, %r12
jne 0x1c08b
movl 0x68(%rbx), %ecx
incq %rax
movslq %ecx, %rdx
cmpq %rdx, %rax
jl 0x1c082
jmp 0x1c0de
movq 0x10(%rsp), %r15
movb 0x16(%rbx), %bpl
xorl %edi, %edi
callq 0x52f0
movq %rax, 0x30(%rsp)
movq 0x1eeab(%rip), %rax     # 0x3afa0
movq %rax, 0x38(%rsp)
leaq 0x1493a(%rip), %rax     # 0x30a3b
movq %rax, 0x40(%rsp)
movb %bpl, 0x48(%rsp)
cmpb $0x0, 0x16(%rbx)
movq 0x98(%rsp), %rbp
movq 0x70(%rsp), %r12
je 0x1c1dc
leaq 0xb0(%rsp), %rdi
callq 0x5200
movl $0x15, %edx
leaq 0xc0(%rsp), %rdi
leaq 0x14917(%rip), %rsi     # 0x30a5a
callq 0x53f0
movq 0xc0(%rsp), %rax
movq -0x18(%rax), %rdi
leaq 0xc0(%rsp), %rax
addq %rax, %rdi
movl $0xa, %esi
callq 0x5330
movsbl %al, %esi
leaq 0xc0(%rsp), %rdi
callq 0x5040
movq %rax, %rdi
callq 0x51f0
movq %r13, %rdi
leaq 0xc8(%rsp), %rsi
callq 0x5580
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1b716
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x1c1be
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x5370
leaq 0xb0(%rsp), %rdi
movq 0x1ed8b(%rip), %rsi     # 0x3af58
callq 0x5230
movq 0x68(%rsp), %rdi
callq 0x5130
testl %r12d, %r12d
je 0x1c463
xorl %r14d, %r14d
movq %r12, %rcx
movl $0x0, 0x64(%rsp)
xorl %r13d, %r13d
movq %rcx, %r12
leal -0x1(%rcx), %eax
movl %r14d, %ecx
movq 0xa8(%rsp), %rdx
cmpl %eax, %r14d
jae 0x1c21b
movq 0x18(%r15), %rdx
movl (%rdx,%rcx,4), %esi
movl 0x4(%rdx,%rcx,4), %edx
addl %esi, %edx
incl %edx
movq 0x18(%r15), %rdi
movl (%rdi,%rcx,4), %esi
movq %rbp, %r8
cmpl %r8d, %edx
jbe 0x1c254
cmpl %r8d, %esi
jbe 0x1c24c
leaq (,%rcx,4), %rsi
addq 0x38(%r15), %rsi
leal (%r14,%r13), %edx
movq 0x58(%rsp), %rdi
callq 0x17826
incl %r13d
movl %r12d, %eax
jmp 0x1c307
movl 0x4(%rdi,%rcx,4), %edx
addl %esi, %edx
incl %edx
movl %edx, 0x4(%rdi,%rcx,4)
leal (%r14,%r13), %edx
movq 0x50(%rbx), %rsi
movl (%rsi,%rdx,4), %esi
movq 0x38(%r15), %rdi
movl %esi, 0x4(%rdi,%rcx,4)
movq 0x60(%rbx), %rsi
decq %rsi
cmpq %rdx, %rsi
jbe 0x1c29d
movq 0x50(%rbx), %rsi
movl 0x4(%rsi,%rdx,4), %edi
movl %edi, (%rsi,%rdx,4)
leaq 0x1(%rdx), %rdi
movq 0x60(%rbx), %rsi
decq %rsi
movq %rdi, %rdx
cmpq %rsi, %rdi
jb 0x1c27f
movq %rsi, 0x60(%rbx)
movq 0x28(%r15), %rdx
decq %rdx
cmpq %rcx, %rdx
jbe 0x1c2ce
movq %rcx, %rsi
movq 0x18(%r15), %rdx
movl 0x4(%rdx,%rsi,4), %edi
movl %edi, (%rdx,%rsi,4)
leaq 0x1(%rsi), %rdi
movq 0x28(%r15), %rdx
decq %rdx
movq %rdi, %rsi
cmpq %rdx, %rdi
jb 0x1c2b0
movq %rdx, 0x28(%r15)
movq 0x48(%r15), %rdx
decq %rdx
cmpq %rcx, %rdx
jbe 0x1c2fc
movq 0x38(%r15), %rdx
movl 0x4(%rdx,%rcx,4), %esi
movl %esi, (%rdx,%rcx,4)
leaq 0x1(%rcx), %rsi
movq 0x48(%r15), %rdx
decq %rdx
movq %rsi, %rcx
cmpq %rdx, %rsi
jb 0x1c2de
movq %rdx, 0x48(%r15)
decl %r14d
incl 0x64(%rsp)
incl %r14d
movl %eax, %ecx
cmpl %eax, %r14d
jb 0x1c1f6
leaq 0x30(%rsp), %rdi
callq 0xfe36
testl %r13d, %r13d
movq 0x28(%rsp), %r14
je 0x1c46d
cmpb $0x1, 0x16(%rbx)
movl 0x60(%rsp), %r15d
jne 0x1c433
leaq 0xb0(%rsp), %rdi
callq 0x5200
movl $0x6, %edx
leaq 0xc0(%rsp), %rdi
leaq 0x14713(%rip), %rsi     # 0x30a70
callq 0x53f0
leaq 0xc0(%rsp), %rdi
movl %r13d, %esi
callq 0x5660
movq %rax, %r15
movl $0x9, %edx
movq %rax, %rdi
leaq 0x146f3(%rip), %rsi     # 0x30a77
callq 0x53f0
movq %r15, %rdi
movl 0x64(%rsp), %esi
callq 0x5660
movq %rax, %r12
movl $0xe, %edx
movq %rax, %rdi
leaq 0x146da(%rip), %rsi     # 0x30a81
callq 0x53f0
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x5330
movsbl %al, %esi
movq %r12, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x51f0
leaq 0x30(%rsp), %r15
movq %r15, %rdi
leaq 0xc8(%rsp), %rsi
callq 0x5580
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1b716
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x1c410
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x5370
leaq 0xb0(%rsp), %rdi
movq 0x1eb39(%rip), %rsi     # 0x3af58
callq 0x5230
movq 0x68(%rsp), %rdi
callq 0x5130
movl 0x60(%rsp), %r15d
leaq 0x8(%rsp), %r13
movq %r13, %rdi
callq 0x1f202
movq 0x50(%rsp), %rdi
callq 0x5440
subl $0x1, %r15d
movl %r15d, %eax
jae 0x1be5d
jmp 0x1c481
movq 0x28(%rsp), %r14
jmp 0x1c0de
leaq 0x30(%rsp), %rdi
callq 0xfe36
leaq 0x8(%rsp), %rdi
callq 0x1f202
movq 0x50(%rsp), %rdi
callq 0x5440
cmpb $0x1, 0x16(%rbx)
jne 0x1c5c7
leaq 0xb0(%rsp), %rdi
callq 0x5200
leaq 0xc0(%rsp), %r12
leaq 0x145e9(%rip), %rsi     # 0x30a90
movl $0x11, %edx
movq %r12, %rdi
callq 0x53f0
movq 0x60(%rbx), %rax
subq %rax, %r14
movq %r14, %xmm1
movq 0x11bd8(%rip), %xmm2    # 0x2e0a0
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x11bdc(%rip), %xmm3    # 0x2e0b0
subpd %xmm3, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
incq %rax
movq %rax, %xmm1
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
subpd %xmm3, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %xmm0
movq %r12, %rdi
callq 0x5590
movq %rax, %r15
leaq 0x1458c(%rip), %rsi     # 0x30aa2
movl $0xa, %edx
movq %rax, %rdi
callq 0x53f0
movq %r15, %rdi
movq %rbp, %rsi
callq 0x51e0
movq %rax, %r14
leaq 0x11f5a(%rip), %rsi     # 0x2e492
movl $0x1, %edx
movq %rax, %rdi
callq 0x53f0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x5330
movsbl %al, %esi
movq %r14, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x51f0
leaq 0xc8(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x5580
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x1b716
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1c5a6
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5370
movq 0x1e9ab(%rip), %rsi     # 0x3af58
leaq 0xb0(%rsp), %rdi
callq 0x5230
leaq 0x130(%rsp), %rdi
callq 0x5130
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdx, %r15
movq %rax, %r14
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1c6ce
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5370
jmp 0x1c6ce
jmp 0x1c6c8
jmp 0x1c684
jmp 0x1c85e
jmp 0x1c6b0
jmp 0x1c684
jmp 0x1c85e
jmp 0x1c684
jmp 0x1c85e
movq %rax, %r14
leaq 0x88(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1c7fc
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x5370
jmp 0x1c7fc
jmp 0x1c7f9
movq %rax, %r14
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1c82c
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x5370
jmp 0x1c82c
jmp 0x1c829
jmp 0x1c6b8
jmp 0x1c6c0
movq %rax, %r14
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1c861
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5370
jmp 0x1c861
jmp 0x1c85e
movq %rdx, %r15
movq %rax, %r14
jmp 0x1c6ef
movq %rax, %r14
jmp 0x1c81d
movq %rax, %r14
jmp 0x1c84d
movq %rdx, %r15
movq %rax, %r14
movq 0x1e883(%rip), %rsi     # 0x3af58
leaq 0xb0(%rsp), %rdi
callq 0x5230
leaq 0x130(%rsp), %rdi
callq 0x5130
cmpl $0x1, %r15d
jne 0x1ca6f
movq %r14, %rdi
callq 0x5140
cmpb $0x1, 0x15(%rbx)
jne 0x1c73a
movl $0x8, %edi
callq 0x5180
movq 0x1e878(%rip), %rcx     # 0x3af90
addq $0x10, %rcx
movq %rcx, (%rax)
movq 0x1e882(%rip), %rsi     # 0x3afa8
movq 0x1e84b(%rip), %rdx     # 0x3af78
movq %rax, %rdi
callq 0x5630
jmp 0x1ca53
movq 0x1e8af(%rip), %rdi     # 0x3aff0
leaq 0x1410c(%rip), %rsi     # 0x30854
movl $0x2e, %edx
callq 0x53f0
shll $0x2, %r13d
movq 0x1e893(%rip), %rdi     # 0x3aff0
movq %r13, %rsi
callq 0x51e0
movq %rax, %rbx
leaq 0x14114(%rip), %rsi     # 0x30883
movl $0x7, %edx
movq %rax, %rdi
callq 0x53f0
movq %rbx, %rdi
callq 0x5170
movq %rax, %rbx
leaq 0x140fd(%rip), %rsi     # 0x3088b
movl $0x4c, %edx
movq %rax, %rdi
callq 0x53f0
movq %rbx, %rdi
callq 0x5170
movq %rax, %rbx
leaq 0x1412b(%rip), %rsi     # 0x308d8
movl $0x14, %edx
movq %rax, %rdi
callq 0x53f0
movq %rbx, %rdi
callq 0x5170
movl $0x4, %edi
callq 0x5180
movl $0x1, (%rax)
movq 0x1e76f(%rip), %rsi     # 0x3af48
movq %rax, %rdi
xorl %edx, %edx
callq 0x5630
jmp 0x1ca53
jmp 0x1c85e
movq %rax, %r14
callq 0x55b0
jmp 0x1ca6f
jmp 0x1c85e
movq %rax, %r14
movq 0x1e755(%rip), %rsi     # 0x3af58
leaq 0xb0(%rsp), %rdi
callq 0x5230
leaq 0x130(%rsp), %rdi
callq 0x5130
leaq 0x30(%rsp), %rdi
callq 0xfe36
jmp 0x1c84d
movq %rax, %r14
movq 0x1e725(%rip), %rsi     # 0x3af58
leaq 0xb0(%rsp), %rdi
callq 0x5230
leaq 0x130(%rsp), %rdi
callq 0x5130
leaq 0x8(%rsp), %rdi
callq 0xfe36
jmp 0x1ca6f
jmp 0x1c85e
movq %rax, %r14
movq 0x1e6f0(%rip), %rsi     # 0x3af58
leaq 0xb0(%rsp), %rdi
callq 0x5230
leaq 0x130(%rsp), %rdi
callq 0x5130
jmp 0x1ca6f
movq %rax, %r14
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x1c902
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x5370
jmp 0x1c902
jmp 0x1c8ff
jmp 0x1c939
movq %rax, %r14
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x1c8df
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x5370
jmp 0x1c8df
jmp 0x1c8dc
jmp 0x1c925
jmp 0x1c939
movq %rax, %r14
movq 0x1e672(%rip), %rsi     # 0x3af58
leaq 0xb0(%rsp), %rdi
callq 0x5230
movq 0x68(%rsp), %rdi
callq 0x5130
jmp 0x1c928
movq %rax, %r14
movq 0x1e64f(%rip), %rsi     # 0x3af58
leaq 0xb0(%rsp), %rdi
callq 0x5230
movq 0x68(%rsp), %rdi
callq 0x5130
jmp 0x1ca5b
movq %rax, %r14
leaq 0x30(%rsp), %rdi
callq 0xfe36
jmp 0x1ca5b
jmp 0x1c939
movq %rax, %r14
jmp 0x1ca5b
movq %rax, %r14
movl $0x8, %esi
movq %r15, %rdi
callq 0x5370
jmp 0x1ca5b
movq %rax, %r14
cmpl $0x1, %edx
jne 0x1ca5b
movq %r14, %rdi
callq 0x5140
cmpb $0x1, 0x15(%rbx)
jne 0x1c9a3
movl $0x8, %edi
callq 0x5180
movq 0x1e60f(%rip), %rcx     # 0x3af90
addq $0x10, %rcx
movq %rcx, (%rax)
movq 0x1e619(%rip), %rsi     # 0x3afa8
movq 0x1e5e2(%rip), %rdx     # 0x3af78
movq %rax, %rdi
callq 0x5630
jmp 0x1ca53
movq 0x1e646(%rip), %rdi     # 0x3aff0
leaq 0x13fea(%rip), %rsi     # 0x3099b
movl $0x2b, %edx
callq 0x53f0
movq 0x70(%rsp), %rsi
shrl $0x7, %esi
andl $0x3fffff, %esi         # imm = 0x3FFFFF
movq 0x1e620(%rip), %rdi     # 0x3aff0
callq 0x51e0
movq %rax, %rbx
leaq 0x13fe8(%rip), %rsi     # 0x309c7
movl $0x10, %edx
movq %rax, %rdi
callq 0x53f0
movq %rbx, %rdi
callq 0x5170
movq %rax, %rbx
leaq 0x13fda(%rip), %rsi     # 0x309d8
movl $0x4e, %edx
movq %rax, %rdi
callq 0x53f0
movq %rbx, %rdi
callq 0x5170
movq %rax, %rbx
leaq 0x1400a(%rip), %rsi     # 0x30a27
movl $0x13, %edx
movq %rax, %rdi
callq 0x53f0
movq %rbx, %rdi
callq 0x5170
movl $0x4, %edi
callq 0x5180
movl $0x1, (%rax)
movq 0x1e4ff(%rip), %rsi     # 0x3af48
movq %rax, %rdi
xorl %edx, %edx
callq 0x5630
movq %rax, %r14
callq 0x55b0
leaq 0x8(%rsp), %rdi
callq 0x1f202
movq 0x50(%rsp), %rdi
callq 0x5440
movq %r14, %rdi
callq 0x5680
movq %rax, %rdi
callq 0xdbdd
nop