// File: /workspace/github_cpp_makefile_star2_O1/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), %rax
movq $0x0, 0x60(%rdi)
movq %rax, 0x28(%rsp)
xorl %edx, %edx
movq %rcx, 0x98(%rsp)
divq %rcx
leal 0x2(,%rax,2), %r13d
cmpb $0x1, 0x16(%rdi)
movl %r13d, %ebp
jne 0x1ba1b
leaq 0xb0(%rsp), %rdi
callq 0x5200
leaq 0xc0(%rsp), %r14
leaq 0x14e59(%rip), %rsi     # 0x307c3
movl $0x14, %edx
movq %r14, %rdi
callq 0x5400
movq %r14, %rdi
movq %rbp, %rsi
callq 0x51e0
movq %rax, %r14
leaq 0x14e4c(%rip), %rsi     # 0x307d8
movl $0x10, %edx
movq %rax, %rdi
callq 0x5400
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x5340
movsbl %al, %esi
movq %r14, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x51f0
leaq 0xc8(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x55a0
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x1b894
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1b9fa
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5380
movq 0x1f557(%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, 0x50(%rsp)
jne 0x1bb4c
movq %rbp, %rsi
callq 0x1a064
cmpb $0x1, 0x16(%rbx)
jne 0x1baf0
leaq 0xb0(%rsp), %rdi
callq 0x5200
leaq 0xc0(%rsp), %r14
leaq 0x14d8d(%rip), %rsi     # 0x307e9
movl $0x1a, %edx
movq %r14, %rdi
callq 0x5400
movq 0xc0(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x5340
movsbl %al, %esi
movq %r14, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x51f0
leaq 0xc8(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x55a0
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x1b894
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1bacf
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5380
movq 0x1f482(%rip), %rsi     # 0x3af58
leaq 0xb0(%rsp), %rdi
callq 0x5230
leaq 0x130(%rsp), %rdi
callq 0x5130
testl %r13d, %r13d
movq 0x28(%rsp), %r13
je 0x1bc61
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 %r13
movq 0x50(%rbx), %rax
movl %edx, (%rax,%rcx,4)
incq %rcx
cmpq %rbp, %rcx
jb 0x1bb00
jmp 0x1bc61
movq %rbp, %rsi
callq 0x1a064
cmpb $0x1, 0x16(%rbx)
jne 0x1bc0e
leaq 0xb0(%rsp), %rdi
callq 0x5200
leaq 0xc0(%rsp), %r14
leaq 0x14c6f(%rip), %rsi     # 0x307e9
movl $0x1a, %edx
movq %r14, %rdi
callq 0x5400
movq 0xc0(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x5340
movsbl %al, %esi
movq %r14, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x51f0
leaq 0xc8(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x55a0
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x1b894
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1bbed
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5380
movq 0x1f364(%rip), %rsi     # 0x3af58
leaq 0xb0(%rsp), %rdi
callq 0x5230
leaq 0x130(%rsp), %rdi
callq 0x5130
testl %r13d, %r13d
movq 0x28(%rsp), %r13
je 0x1bc61
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 %r13
movq 0x50(%rbx), %rax
movl %edx, (%rax,%rcx,4)
incq %rcx
cmpq %rbp, %rcx
jb 0x1bc1a
movb 0x16(%rbx), %bpl
xorl %edi, %edi
callq 0x5300
movq %rax, 0x8(%rsp)
movq 0x1f328(%rip), %rax     # 0x3afa0
movq %rax, 0x10(%rsp)
leaq 0x14c19(%rip), %rax     # 0x3089d
movq %rax, 0x18(%rsp)
movb %bpl, 0x20(%rsp)
cmpb $0x1, 0x16(%rbx)
movq 0x50(%rsp), %r15
jne 0x1bd6b
leaq 0xb0(%rsp), %rdi
callq 0x5200
leaq 0xc0(%rsp), %r14
leaq 0x14c6f(%rip), %rsi     # 0x30928
movl $0x9, %edx
movq %r14, %rdi
callq 0x5400
movq 0x60(%rbx), %rsi
movq %r14, %rdi
callq 0x51e0
movq %rax, %r14
leaq 0x14bf8(%rip), %rsi     # 0x308d4
movl $0x27, %edx
movq %rax, %rdi
callq 0x5400
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x5340
movsbl %al, %esi
movq %r14, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x51f0
leaq 0xc8(%rsp), %rsi
leaq 0x30(%rsp), %rdi
callq 0x55a0
leaq 0x30(%rsp), %rsi
movq %rbx, %rdi
callq 0x1b894
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1bd4a
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x5380
movq 0x1f207(%rip), %rsi     # 0x3af58
leaq 0xb0(%rsp), %rdi
callq 0x5230
leaq 0x130(%rsp), %rdi
callq 0x5130
movq 0x60(%rbx), %rdx
movq %r15, %rdi
xorl %esi, %esi
callq 0x1e7b2
movq 0x60(%rbx), %rdx
movq %rdx, %rcx
decq %rcx
je 0x1bdd7
xorl %eax, %eax
movq 0x50(%rbx), %rsi
movl (%rsi,%rax,4), %edi
cmpl 0x4(%rsi,%rax,4), %edi
jne 0x1bdcb
movq 0x60(%rbx), %rdx
decq %rdx
cmpq %rax, %rdx
jbe 0x1bdc1
movq %rax, %rsi
movq 0x50(%rbx), %rdx
movl 0x4(%rdx,%rsi,4), %edi
movl %edi, (%rdx,%rsi,4)
leaq 0x1(%rsi), %rdi
movq 0x60(%rbx), %rdx
decq %rdx
movq %rdi, %rsi
cmpq %rdx, %rdi
jb 0x1bda3
decq %rax
movq %rdx, 0x60(%rbx)
movq %rcx, %rdx
incq %rax
leaq -0x1(%rdx), %rcx
cmpq %rcx, %rax
jb 0x1bd87
movb 0x16(%rbx), %bpl
xorl %edi, %edi
callq 0x5300
movq %rax, 0x30(%rsp)
movq 0x1f1b2(%rip), %rax     # 0x3afa0
movq %rax, 0x38(%rsp)
leaq 0x14b02(%rip), %rax     # 0x308fc
movq %rax, 0x40(%rsp)
movb %bpl, 0x48(%rsp)
cmpb $0x0, 0x16(%rbx)
je 0x1bedc
leaq 0xb0(%rsp), %rdi
callq 0x5200
leaq 0xc0(%rsp), %r14
leaq 0x14af5(%rip), %rsi     # 0x3091f
movl $0x12, %edx
movq %r14, %rdi
callq 0x5400
movq 0x60(%rbx), %rsi
movq %r14, %rdi
callq 0x51e0
movq %rax, %r14
leaq 0x147d8(%rip), %rsi     # 0x30625
movl $0x8, %edx
movq %rax, %rdi
callq 0x5400
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x5340
movsbl %al, %esi
movq %r14, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x51f0
leaq 0xc8(%rsp), %rsi
leaq 0x68(%rsp), %rdi
callq 0x55a0
leaq 0x68(%rsp), %rsi
movq %rbx, %rdi
callq 0x1b894
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1bebb
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x5380
movq 0x1f096(%rip), %rsi     # 0x3af58
leaq 0xb0(%rsp), %rdi
callq 0x5230
leaq 0x130(%rsp), %rdi
callq 0x5130
movq (%rbx), %rax
movq %rbx, %rdi
movq 0x50(%rsp), %rsi
callq *0x38(%rax)
leaq 0x30(%rsp), %rdi
callq 0xff2c
leaq 0x8(%rsp), %rdi
callq 0xff2c
cmpb $0x1, 0x16(%rbx)
jne 0x1bfb8
leaq 0xb0(%rsp), %rdi
callq 0x5200
leaq 0xc0(%rsp), %r14
leaq 0x14a0e(%rip), %rsi     # 0x30932
movl $0x18, %edx
movq %r14, %rdi
callq 0x5400
movq 0xc0(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x5340
movsbl %al, %esi
movq %r14, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x51f0
leaq 0xc8(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x55a0
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x1b894
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1bf97
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5380
movq 0x1efba(%rip), %rsi     # 0x3af58
leaq 0xb0(%rsp), %rdi
callq 0x5230
leaq 0x130(%rsp), %rdi
callq 0x5130
leaq 0xb0(%rsp), %rax
addq $0x80, %rax
movq %rax, 0x88(%rsp)
movl $0x5, %eax
subl $0x1, %eax
jb 0x1c5e1
movl %eax, 0x64(%rsp)
movl 0x60(%rbx), %r13d
movslq 0x68(%rbx), %r14
leaq (,%r14,8), %r15
testq %r14, %r14
movq %r15, %rdi
movq $-0x1, %rax
cmovsq %rax, %rdi
callq 0x5030
movq %rax, 0x58(%rsp)
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %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)
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x1e74c
incl %r13d
cmpl $0x0, 0x68(%rbx)
movl %r13d, %r14d
movq 0x50(%rsp), %r15
jle 0x1c1d0
movq %r13, 0x90(%rsp)
xorl %r13d, %r13d
movq 0x10(%rsp), %rax
leaq (,%r13,2), %r12
addq %r13, %r12
shlq $0x5, %r12
leaq (%rax,%r12), %rdi
addq $0x10, %rdi
movq %r14, %rsi
callq 0x1a064
movq 0x10(%rsp), %rax
leaq (%rax,%r12), %rdi
addq $0x30, %rdi
movq %r14, %rsi
callq 0x1a064
movq 0x10(%rsp), %rax
cmpq $0x0, 0x28(%rax,%r12)
je 0x1c0ed
xorl %ecx, %ecx
movq %r13, %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 0x1c0b1
addq %rdx, %rax
jmp 0x1c0f0
addq %r12, %rax
movq 0xa0(%rsp), %rcx
movq %rcx, (%rax)
movq 0x10(%rsp), %rax
movq %r15, 0x8(%rax,%r12)
testq %r13, %r13
je 0x1c121
movslq 0x68(%rbx), %rcx
movq 0x28(%rsp), %rsi
movq %rsi, %rax
xorl %edx, %edx
divq %rcx
imulq %r13, %rax
jmp 0x1c128
xorl %eax, %eax
movq 0x28(%rsp), %rsi
movq 0x10(%rsp), %rcx
movq %rax, 0x50(%rcx,%r12)
leaq 0x1(%r13), %rbp
movl 0x68(%rbx), %ecx
cmpq %rcx, %rbp
je 0x1c152
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,%r12)
cmpl $0x1, 0x68(%rbx)
jne 0x1c171
addq 0x10(%rsp), %r12
movq %r12, %rdi
callq 0xd7c6
jmp 0x1c1ab
movl $0x8, %edi
callq 0x5370
movq %rax, %r15
addq 0x10(%rsp), %r12
movq %r12, 0xb0(%rsp)
movq %rax, %rdi
leaq -0xe9cf(%rip), %rsi     # 0xd7c6
leaq 0xb0(%rsp), %rdx
callq 0x19fd2
movq 0x58(%rsp), %rax
movq %r15, (%rax,%r13,8)
movslq 0x68(%rbx), %rax
movq %rbp, %r13
cmpq %rax, %rbp
movq 0x50(%rsp), %r15
jl 0x1c069
cmpl $0x2, %eax
setge %al
movq 0x90(%rsp), %r13
jmp 0x1c1d2
xorl %eax, %eax
testb %al, %al
leaq 0x68(%rsp), %r12
je 0x1c1fe
cmpl $0x0, 0x68(%rbx)
jle 0x1c1fe
xorl %r15d, %r15d
movq 0x58(%rsp), %rax
movq (%rax,%r15,8), %rdi
callq 0x5640
incq %r15
movslq 0x68(%rbx), %rax
cmpq %rax, %r15
jl 0x1c1e4
movq 0x10(%rsp), %r15
cmpl $0x2, 0x68(%rbx)
jl 0x1c25f
movl $0x1, %eax
testl %r13d, %r13d
je 0x1c253
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 0x1c24b
movq 0x10(%rsp), %rdi
movq 0x38(%rdi,%rdx), %rdx
movl (%rdx,%rcx,4), %edx
movl %edx, (%rsi,%rcx,4)
incq %rcx
cmpq %rcx, %r14
jne 0x1c215
incq %rax
movslq 0x68(%rbx), %rcx
cmpq %rcx, %rax
jl 0x1c20e
movb 0x16(%rbx), %bpl
xorl %edi, %edi
callq 0x5300
movq %rax, 0x30(%rsp)
movq 0x1ed2a(%rip), %rax     # 0x3afa0
movq %rax, 0x38(%rsp)
leaq 0x14769(%rip), %rax     # 0x309eb
movq %rax, 0x40(%rsp)
movb %bpl, 0x48(%rsp)
cmpb $0x0, 0x16(%rbx)
je 0x1c34d
leaq 0xb0(%rsp), %rdi
callq 0x5200
movl $0x15, %edx
leaq 0xc0(%rsp), %rdi
leaq 0x14753(%rip), %rsi     # 0x30a0a
callq 0x5400
movq 0xc0(%rsp), %rax
movq -0x18(%rax), %rdi
leaq 0xc0(%rsp), %rax
addq %rax, %rdi
movl $0xa, %esi
callq 0x5340
movsbl %al, %esi
leaq 0xc0(%rsp), %rdi
callq 0x5040
movq %rax, %rdi
callq 0x51f0
movq %r12, %rdi
leaq 0xc8(%rsp), %rsi
callq 0x55a0
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1b894
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x1c32c
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x5380
leaq 0xb0(%rsp), %rdi
movq 0x1ec1d(%rip), %rsi     # 0x3af58
callq 0x5230
movq 0x88(%rsp), %rdi
callq 0x5130
testl %r13d, %r13d
je 0x1c48a
movq %r13, %rcx
xorl %r13d, %r13d
xorl %r14d, %r14d
xorl %r12d, %r12d
movq %rcx, %rbp
leal -0x1(%rcx), %eax
movl %r13d, %esi
movq 0xa8(%rsp), %rcx
cmpl %eax, %r13d
jae 0x1c387
movq 0x18(%r15), %rcx
movl (%rcx,%rsi,4), %edx
movl 0x4(%rcx,%rsi,4), %ecx
addl %edx, %ecx
incl %ecx
movq 0x98(%rsp), %rdx
cmpl %edx, %ecx
jbe 0x1c3bc
movq 0x18(%r15), %rax
cmpl %edx, (%rax,%rsi,4)
jbe 0x1c3b5
shlq $0x2, %rsi
addq 0x38(%r15), %rsi
leal (%r12,%r13), %edx
movq 0x50(%rsp), %rdi
callq 0x1793e
incl %r12d
movl %ebp, %eax
jmp 0x1c47a
movq 0x18(%r15), %rcx
movl (%rcx,%rsi,4), %edx
leal 0x1(%r13), %edi
movl (%rcx,%rdi,4), %r8d
addl %r8d, %edx
incl %edx
movl %edx, (%rcx,%rdi,4)
leal (%r13,%r12), %ecx
movq 0x50(%rbx), %rdx
movl (%rdx,%rcx,4), %edx
movq 0x38(%r15), %r8
movl %edx, (%r8,%rdi,4)
movq 0x60(%rbx), %rdx
decq %rdx
cmpq %rcx, %rdx
jbe 0x1c411
movq 0x50(%rbx), %rdx
movl 0x4(%rdx,%rcx,4), %edi
movl %edi, (%rdx,%rcx,4)
leaq 0x1(%rcx), %rdi
movq 0x60(%rbx), %rdx
decq %rdx
movq %rdi, %rcx
cmpq %rdx, %rdi
jb 0x1c3f3
movq %rdx, 0x60(%rbx)
movq 0x28(%r15), %rcx
decq %rcx
cmpq %rsi, %rcx
jbe 0x1c442
movq %rsi, %rdx
movq 0x18(%r15), %rcx
movl 0x4(%rcx,%rdx,4), %edi
movl %edi, (%rcx,%rdx,4)
leaq 0x1(%rdx), %rdi
movq 0x28(%r15), %rcx
decq %rcx
movq %rdi, %rdx
cmpq %rcx, %rdi
jb 0x1c424
movq %rcx, 0x28(%r15)
movq 0x48(%r15), %rcx
decq %rcx
cmpq %rsi, %rcx
jbe 0x1c470
movq 0x38(%r15), %rcx
movl 0x4(%rcx,%rsi,4), %edx
movl %edx, (%rcx,%rsi,4)
leaq 0x1(%rsi), %rdx
movq 0x48(%r15), %rcx
decq %rcx
movq %rdx, %rsi
cmpq %rcx, %rdx
jb 0x1c452
movq %rcx, 0x48(%r15)
decl %r13d
incl %r14d
incl %r13d
movl %eax, %ecx
cmpl %eax, %r13d
jb 0x1c362
jmp 0x1c490
xorl %r12d, %r12d
xorl %r14d, %r14d
leaq 0x30(%rsp), %rdi
callq 0xff2c
testl %r12d, %r12d
je 0x1c5c8
cmpb $0x1, 0x16(%rbx)
movq 0x28(%rsp), %r13
jne 0x1c5a5
leaq 0xb0(%rsp), %rdi
callq 0x5200
movl $0x6, %edx
leaq 0xc0(%rsp), %rdi
leaq 0x1454d(%rip), %rsi     # 0x30a20
callq 0x5400
leaq 0xc0(%rsp), %rdi
movl %r12d, %esi
callq 0x5680
movq %rax, %r15
movl $0x9, %edx
movq %rax, %rdi
leaq 0x1452d(%rip), %rsi     # 0x30a27
callq 0x5400
movq %r15, %rdi
movl %r14d, %esi
callq 0x5680
movq %rax, %r14
movl $0xe, %edx
movq %rax, %rdi
leaq 0x14515(%rip), %rsi     # 0x30a31
callq 0x5400
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x5340
movsbl %al, %esi
movq %r14, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x51f0
leaq 0x30(%rsp), %r14
movq %r14, %rdi
leaq 0xc8(%rsp), %rsi
callq 0x55a0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1b894
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x1c584
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x5380
leaq 0xb0(%rsp), %rdi
movq 0x1e9c5(%rip), %rsi     # 0x3af58
callq 0x5230
movq 0x88(%rsp), %rdi
callq 0x5130
leaq 0x8(%rsp), %rdi
callq 0x1f412
movq 0x58(%rsp), %rdi
callq 0x5450
testl %r12d, %r12d
movl 0x64(%rsp), %eax
jne 0x1bfd3
jmp 0x1c5e1
leaq 0x8(%rsp), %rdi
callq 0x1f412
movq 0x58(%rsp), %rdi
callq 0x5450
movq 0x28(%rsp), %r13
cmpb $0x1, 0x16(%rbx)
jne 0x1c72c
leaq 0xb0(%rsp), %rdi
callq 0x5200
leaq 0xc0(%rsp), %r14
leaq 0x14439(%rip), %rsi     # 0x30a40
movl $0x11, %edx
movq %r14, %rdi
callq 0x5400
movq 0x60(%rbx), %rax
subq %rax, %r13
movq %r13, %xmm1
movq 0x11a78(%rip), %xmm2    # 0x2e0a0
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x11a7c(%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 %r14, %rdi
callq 0x55b0
movq %rax, %r14
leaq 0x143dc(%rip), %rsi     # 0x30a52
movl $0xa, %edx
movq %rax, %rdi
callq 0x5400
movq %r14, %rdi
movq 0x98(%rsp), %rsi
callq 0x51e0
movq %rax, %r14
leaq 0x11da5(%rip), %rsi     # 0x2e442
movl $0x1, %edx
movq %rax, %rdi
callq 0x5400
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x5340
movsbl %al, %esi
movq %r14, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x51f0
leaq 0xc8(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x55a0
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x1b894
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1c70b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5380
movq 0x1e846(%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 0x1c82d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5380
jmp 0x1c82d
jmp 0x1c827
jmp 0x1c7e3
jmp 0x1c9bd
jmp 0x1c80f
jmp 0x1c7e3
jmp 0x1c9bd
jmp 0x1c7e3
jmp 0x1c9bd
movq %rax, %r14
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1c95b
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x5380
jmp 0x1c95b
jmp 0x1c958
movq %rax, %r14
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1c98b
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x5380
jmp 0x1c98b
jmp 0x1c988
jmp 0x1c817
jmp 0x1c81f
movq %rax, %r14
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1c9c0
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5380
jmp 0x1c9c0
jmp 0x1c9bd
movq %rdx, %r15
movq %rax, %r14
jmp 0x1c84e
movq %rax, %r14
jmp 0x1c97c
movq %rax, %r14
jmp 0x1c9ac
movq %rdx, %r15
movq %rax, %r14
movq 0x1e724(%rip), %rsi     # 0x3af58
leaq 0xb0(%rsp), %rdi
callq 0x5230
leaq 0x130(%rsp), %rdi
callq 0x5130
cmpl $0x1, %r15d
jne 0x1cbd1
movq %r14, %rdi
callq 0x5140
cmpb $0x1, 0x15(%rbx)
jne 0x1c899
movl $0x8, %edi
callq 0x5180
movq 0x1e719(%rip), %rcx     # 0x3af90
addq $0x10, %rcx
movq %rcx, (%rax)
movq 0x1e723(%rip), %rsi     # 0x3afa8
movq 0x1e6ec(%rip), %rdx     # 0x3af78
movq %rax, %rdi
callq 0x5650
jmp 0x1cbb5
movq 0x1e750(%rip), %rdi     # 0x3aff0
leaq 0x13f5d(%rip), %rsi     # 0x30804
movl $0x2e, %edx
callq 0x5400
shll $0x2, %r13d
movq 0x1e734(%rip), %rdi     # 0x3aff0
movq %r13, %rsi
callq 0x51e0
movq %rax, %rbx
leaq 0x13f65(%rip), %rsi     # 0x30833
movl $0x7, %edx
movq %rax, %rdi
callq 0x5400
movq %rbx, %rdi
callq 0x5170
movq %rax, %rbx
leaq 0x13f4e(%rip), %rsi     # 0x3083b
movl $0x4c, %edx
movq %rax, %rdi
callq 0x5400
movq %rbx, %rdi
callq 0x5170
movq %rax, %rbx
leaq 0x13f7c(%rip), %rsi     # 0x30888
movl $0x14, %edx
movq %rax, %rdi
callq 0x5400
movq %rbx, %rdi
callq 0x5170
movl $0x4, %edi
callq 0x5180
movl $0x1, (%rax)
movq 0x1e610(%rip), %rsi     # 0x3af48
movq %rax, %rdi
xorl %edx, %edx
callq 0x5650
jmp 0x1cbb5
jmp 0x1c9bd
movq %rax, %r14
callq 0x55d0
jmp 0x1cbd1
jmp 0x1c9bd
movq %rax, %r14
movq 0x1e5f6(%rip), %rsi     # 0x3af58
leaq 0xb0(%rsp), %rdi
callq 0x5230
leaq 0x130(%rsp), %rdi
callq 0x5130
leaq 0x30(%rsp), %rdi
callq 0xff2c
jmp 0x1c9ac
movq %rax, %r14
movq 0x1e5c6(%rip), %rsi     # 0x3af58
leaq 0xb0(%rsp), %rdi
callq 0x5230
leaq 0x130(%rsp), %rdi
callq 0x5130
leaq 0x8(%rsp), %rdi
callq 0xff2c
jmp 0x1cbd1
jmp 0x1c9bd
movq %rax, %r14
movq 0x1e591(%rip), %rsi     # 0x3af58
leaq 0xb0(%rsp), %rdi
callq 0x5230
leaq 0x130(%rsp), %rdi
callq 0x5130
jmp 0x1cbd1
jmp 0x1caad
movq %rax, %r14
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x1ca5e
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x5380
jmp 0x1ca5e
jmp 0x1ca5b
movq %rax, %r14
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x1ca38
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x5380
jmp 0x1ca38
jmp 0x1ca35
jmp 0x1ca84
jmp 0x1caad
movq %rax, %r14
movq 0x1e519(%rip), %rsi     # 0x3af58
leaq 0xb0(%rsp), %rdi
callq 0x5230
leaq 0x130(%rsp), %rdi
callq 0x5130
jmp 0x1ca87
movq %rax, %r14
movq 0x1e4f3(%rip), %rsi     # 0x3af58
leaq 0xb0(%rsp), %rdi
callq 0x5230
leaq 0x130(%rsp), %rdi
callq 0x5130
jmp 0x1cbbd
movq %rax, %r14
leaq 0x30(%rsp), %rdi
callq 0xff2c
jmp 0x1cbbd
jmp 0x1caad
movq %rax, %r14
movl $0x8, %esi
movq %r15, %rdi
callq 0x5380
jmp 0x1cbbd
movq %rax, %r14
jmp 0x1cbbd
movq %rax, %r14
cmpl $0x1, %edx
jne 0x1cbbd
movq %r14, %rdi
callq 0x5140
cmpb $0x1, 0x15(%rbx)
jne 0x1cb02
movl $0x8, %edi
callq 0x5180
movq 0x1e4b0(%rip), %rcx     # 0x3af90
addq $0x10, %rcx
movq %rcx, (%rax)
movq 0x1e4ba(%rip), %rsi     # 0x3afa8
movq 0x1e483(%rip), %rdx     # 0x3af78
movq %rax, %rdi
callq 0x5650
jmp 0x1cbb5
movq 0x1e4e7(%rip), %rdi     # 0x3aff0
leaq 0x13e3b(%rip), %rsi     # 0x3094b
movl $0x2b, %edx
callq 0x5400
movq 0x90(%rsp), %rsi
shrl $0x7, %esi
andl $0x3fffff, %esi         # imm = 0x3FFFFF
movq 0x1e4be(%rip), %rdi     # 0x3aff0
callq 0x51e0
movq %rax, %rbx
leaq 0x13e36(%rip), %rsi     # 0x30977
movl $0x10, %edx
movq %rax, %rdi
callq 0x5400
movq %rbx, %rdi
callq 0x5170
movq %rax, %rbx
leaq 0x13e28(%rip), %rsi     # 0x30988
movl $0x4e, %edx
movq %rax, %rdi
callq 0x5400
movq %rbx, %rdi
callq 0x5170
movq %rax, %rbx
leaq 0x13e58(%rip), %rsi     # 0x309d7
movl $0x13, %edx
movq %rax, %rdi
callq 0x5400
movq %rbx, %rdi
callq 0x5170
movl $0x4, %edi
callq 0x5180
movl $0x1, (%rax)
movq 0x1e39d(%rip), %rsi     # 0x3af48
movq %rax, %rdi
xorl %edx, %edx
callq 0x5650
movq %rax, %r14
callq 0x55d0
leaq 0x8(%rsp), %rdi
callq 0x1f412
movq 0x58(%rsp), %rdi
callq 0x5450
movq %r14, %rdi
callq 0x56a0
movq %rax, %rdi
callq 0xdcfa
nop