// File: /workspace/github_cpp_makefile_star2_O2/BenLangmead[P]bowtie/./blockwise_sa.h
// Function: KarkkainenBlockwiseSA<S2bDnaString>::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 $0x258, %rsp            # imm = 0x258
movq %rdi, %rbx
movq 0x8(%rdi), %rax
movl 0x10(%rdi), %ecx
movq %rcx, 0x88(%rsp)
decl %ecx
movq %rax, 0x90(%rsp)
movq 0x18(%rax), %r14
andq $0x0, 0x60(%rdi)
movq %r14, %rax
xorl %edx, %edx
movq %rcx, 0x70(%rsp)
divq %rcx
leal 0x2(,%rax,2), %ebp
cmpb $0x1, 0x16(%rdi)
movl %ebp, %r13d
jne 0x202d2
leaq 0xd0(%rsp), %rdi
callq 0x5200
leaq 0xe0(%rsp), %rdi
leaq 0x6561(%rip), %rsi      # 0x267d6
callq 0x5350
movq %rax, %rdi
movq %r13, %rsi
callq 0x51e0
leaq 0x655f(%rip), %rsi      # 0x267eb
movq %rax, %rdi
callq 0x5350
movq %rax, %rdi
callq 0x5180
leaq 0xe8(%rsp), %rsi
leaq 0x10(%rsp), %rdi
callq 0x5580
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0xb3e8
leaq 0x10(%rsp), %rdi
callq 0x5778
leaq 0xd0(%rsp), %rdi
callq 0x5240
leaq 0x48(%rbx), %rdi
cmpb $0x1, 0x15(%rbx)
movq %rbx, 0x8(%rsp)
movq %r14, 0x30(%rsp)
movq %rdi, 0x38(%rsp)
jne 0x20390
movq %r13, %rsi
callq 0x14752
cmpb $0x1, 0x16(%rbx)
jne 0x2035c
leaq 0xd0(%rsp), %rdi
callq 0x5200
leaq 0xe0(%rsp), %rdi
leaq 0x64e3(%rip), %rsi      # 0x267fc
callq 0x5350
movq %rax, %rdi
callq 0x5180
leaq 0xe8(%rsp), %rsi
leaq 0x10(%rsp), %rdi
callq 0x5580
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0xb3e8
leaq 0x10(%rsp), %rdi
callq 0x5778
leaq 0xd0(%rsp), %rdi
callq 0x5240
leaq 0x84(%rbx), %r14
xorl %ebx, %ebx
cmpq %r13, %rbx
jae 0x2042d
movq %r14, %rdi
callq 0x17f34
movl %eax, %eax
xorl %edx, %edx
divq 0x30(%rsp)
movq 0x8(%rsp), %rax
movq 0x50(%rax), %rax
movl %edx, (%rax,%rbx,4)
incq %rbx
jmp 0x20365
movq %r13, %rsi
callq 0x14752
cmpb $0x1, 0x16(%rbx)
jne 0x203fd
leaq 0xd0(%rsp), %rdi
callq 0x5200
leaq 0xe0(%rsp), %rdi
leaq 0x6442(%rip), %rsi      # 0x267fc
callq 0x5350
movq %rax, %rdi
callq 0x5180
leaq 0xe8(%rsp), %rsi
leaq 0x10(%rsp), %rdi
callq 0x5580
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0xb3e8
leaq 0x10(%rsp), %rdi
callq 0x5778
leaq 0xd0(%rsp), %rdi
callq 0x5240
leaq 0x84(%rbx), %r14
xorl %ebx, %ebx
cmpq %r13, %rbx
jae 0x2042d
movq %r14, %rdi
callq 0x17f34
movl %eax, %eax
xorl %edx, %edx
divq 0x30(%rsp)
movq 0x8(%rsp), %rax
movq 0x50(%rax), %rax
movl %edx, (%rax,%rbx,4)
incq %rbx
jmp 0x20406
movq 0x8(%rsp), %r14
movb 0x16(%r14), %bl
xorl %edi, %edi
callq 0x5300
movq %rax, 0x10(%rsp)
movq 0x11b57(%rip), %rax     # 0x31fa0
movq %rax, 0x18(%rsp)
leaq 0x645b(%rip), %rax      # 0x268b0
movq %rax, 0x20(%rsp)
movb %bl, 0x28(%rsp)
movq %r14, %rbx
cmpb $0x1, 0x16(%r14)
movq 0x38(%rsp), %r14
jne 0x204e7
leaq 0xd0(%rsp), %rdi
callq 0x5200
leaq 0xe0(%rsp), %rdi
leaq 0x64b2(%rip), %rsi      # 0x2693b
callq 0x5350
movq 0x60(%rbx), %rsi
movq %rax, %rdi
callq 0x51e0
leaq 0x6446(%rip), %rsi      # 0x268e7
movq %rax, %rdi
callq 0x5350
movq %rax, %rdi
callq 0x5180
leaq 0xe8(%rsp), %rsi
leaq 0x48(%rsp), %rdi
callq 0x5580
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0xb3e8
leaq 0x48(%rsp), %rdi
callq 0x5778
leaq 0xd0(%rsp), %rdi
callq 0x5240
movq %r14, %rdi
callq 0x17f56
movq 0x60(%rbx), %rax
xorl %esi, %esi
leaq -0x1(%rax), %rbx
cmpq %rbx, %rsi
jae 0x20529
movq 0x8(%rsp), %rcx
movq 0x50(%rcx), %rcx
movl (%rcx,%rsi,4), %edx
cmpl 0x4(%rcx,%rsi,4), %edx
jne 0x20524
leaq -0x1(%rsi), %r14
movq 0x38(%rsp), %rdi
callq 0x17f62
movq %r14, %rsi
movq %rbx, %rax
incq %rsi
jmp 0x204f5
movq 0x8(%rsp), %r14
movb 0x16(%r14), %bl
xorl %edi, %edi
callq 0x5300
movq %rax, 0x48(%rsp)
movq 0x11a5b(%rip), %rax     # 0x31fa0
movq %rax, 0x50(%rsp)
leaq 0x63be(%rip), %rax      # 0x2690f
movq %rax, 0x58(%rsp)
movb %bl, 0x60(%rsp)
movq %r14, %rbx
cmpb $0x0, 0x16(%r14)
movq 0x30(%rsp), %r14
je 0x205f0
leaq 0xd0(%rsp), %rdi
callq 0x5200
leaq 0xe0(%rsp), %rdi
leaq 0x63a9(%rip), %rsi      # 0x26932
callq 0x5350
movq 0x60(%rbx), %rsi
movq %rax, %rdi
callq 0x51e0
leaq 0x6097(%rip), %rsi      # 0x26638
movq %rax, %rdi
callq 0x5350
movq %rax, %rdi
callq 0x5180
leaq 0xe8(%rsp), %rsi
leaq 0xb0(%rsp), %rdi
callq 0x5580
leaq 0xb0(%rsp), %rsi
movq %rbx, %rdi
callq 0xb3e8
leaq 0xb0(%rsp), %rdi
callq 0x5778
leaq 0xd0(%rsp), %rdi
callq 0x5240
movq (%rbx), %rax
movq %rbx, %rdi
movq 0x38(%rsp), %rsi
callq *0x38(%rax)
leaq 0x48(%rsp), %rdi
callq 0xcb3e
leaq 0x10(%rsp), %rdi
callq 0xcb3e
cmpb $0x1, 0x16(%rbx)
jne 0x20677
leaq 0xd0(%rsp), %rdi
callq 0x5200
leaq 0xe0(%rsp), %rdi
leaq 0x6311(%rip), %rsi      # 0x26945
callq 0x5350
movq %rax, %rdi
callq 0x5180
leaq 0xe8(%rsp), %rsi
leaq 0x10(%rsp), %rdi
callq 0x5580
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0xb3e8
leaq 0x10(%rsp), %rdi
callq 0x5778
leaq 0xd0(%rsp), %rdi
callq 0x5240
pushq $0x5
popq %rax
subl $0x1, %eax
jb 0x20b22
movl %eax, 0x6c(%rsp)
movl 0x60(%rbx), %ebp
movslq 0x68(%rbx), %rsi
leaq 0x98(%rsp), %rdi
xorl %edx, %edx
callq 0x16974
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %rax, 0x10(%rsp)
andq $0x0, 0x18(%rsp)
movq $0x80, 0x20(%rsp)
andq $0x0, 0x28(%rsp)
movslq 0x68(%rbx), %rsi
leaq 0x10(%rsp), %rdi
callq 0x21ad6
incl %ebp
movl %ebp, %r14d
xorl %ebx, %ebx
movq 0x8(%rsp), %rax
movslq 0x68(%rax), %rcx
cmpq %rcx, %rbx
jge 0x20821
movq 0x18(%rsp), %rax
imulq $0x60, %rbx, %r15
leaq (%rax,%r15), %rdi
addq $0x10, %rdi
movq %r14, %rsi
callq 0x14752
movq 0x18(%rsp), %rax
leaq (%rax,%r15), %rdi
addq $0x30, %rdi
movq %r14, %rsi
callq 0x14752
xorl %eax, %eax
movq 0x18(%rsp), %rdx
leaq (%rdx,%r15), %rcx
cmpq 0x28(%rdx,%r15), %rax
jae 0x20743
movq 0x18(%rcx), %rcx
andl $0x0, (%rcx,%rax,4)
movq 0x18(%rsp), %rcx
movq 0x38(%rcx,%r15), %rcx
orl $-0x1, (%rcx,%rax,4)
incq %rax
jmp 0x20718
movq 0x90(%rsp), %rax
movq %rax, (%rcx)
movq 0x18(%rsp), %rax
movq 0x38(%rsp), %rcx
movq %rcx, 0x8(%rax,%r15)
testq %rbx, %rbx
je 0x2077e
movq 0x8(%rsp), %rsi
movslq 0x68(%rsi), %rcx
movq 0x30(%rsp), %rdi
movq %rdi, %rax
xorl %edx, %edx
divq %rcx
imulq %rbx, %rax
jmp 0x2078a
xorl %eax, %eax
movq 0x8(%rsp), %rsi
movq 0x30(%rsp), %rdi
movq 0x18(%rsp), %rcx
movq %rax, 0x50(%rcx,%r15)
leaq 0x1(%rbx), %r13
movl 0x68(%rsi), %ecx
cmpq %rcx, %r13
je 0x207b4
movslq %ecx, %rcx
movq 0x30(%rsp), %rax
xorl %edx, %edx
divq %rcx
movq %rax, %rdi
imulq %r13, %rdi
movq 0x18(%rsp), %rcx
movq %rdi, 0x58(%rcx,%r15)
movq 0x8(%rsp), %rax
cmpl $0x1, 0x68(%rax)
jne 0x207de
addq 0x18(%rsp), %r15
movq %r15, %rdi
callq 0xb381
movq %r13, %rbx
jmp 0x206d6
pushq $0x8
popq %rdi
callq 0x5370
movq %rax, %r12
addq 0x18(%rsp), %r15
movq %r15, 0xd0(%rsp)
movq %rax, %rdi
leaq -0x1547f(%rip), %rsi    # 0xb381
leaq 0xd0(%rsp), %rdx
callq 0x14670
movq 0xa0(%rsp), %rax
movq %r12, (%rax,%rbx,8)
movq %r13, %rbx
jmp 0x206d6
cmpl $0x2, %ecx
jl 0x2084e
xorl %ebx, %ebx
movslq %ecx, %rax
cmpq %rax, %rbx
jge 0x2084e
movq 0xa0(%rsp), %rax
movq (%rax,%rbx,8), %rdi
callq 0x5620
incq %rbx
movq 0x8(%rsp), %rax
movl 0x68(%rax), %ecx
jmp 0x20828
movq 0x18(%rsp), %r15
leaq 0x10(%r15), %rax
movq %rax, 0x80(%rsp)
pushq $0x1
popq %rax
movq 0x8(%rsp), %r8
movslq %ecx, %rcx
cmpq %rcx, %rax
jge 0x208b6
xorl %ecx, %ecx
cmpq %rcx, %r14
je 0x208ad
movq 0x18(%rsp), %rsi
imulq $0x60, %rax, %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 0x208a8
movq 0x18(%rsp), %rdi
movq 0x38(%rdi,%rdx), %rdx
movl (%rdx,%rcx,4), %edx
movl %edx, (%rsi,%rcx,4)
incq %rcx
jmp 0x20871
incq %rax
movl 0x68(%r8), %ecx
jmp 0x20867
movq 0x8(%rsp), %rax
movb 0x16(%rax), %bl
xorl %edi, %edi
callq 0x5300
movq %rax, 0x48(%rsp)
movq 0x116cf(%rip), %rax     # 0x31fa0
movq %rax, 0x50(%rsp)
leaq 0x6121(%rip), %rax      # 0x269fe
movq %rax, 0x58(%rsp)
movb %bl, 0x60(%rsp)
movq 0x8(%rsp), %rbx
cmpb $0x0, 0x16(%rbx)
je 0x20952
leaq 0xd0(%rsp), %rdi
callq 0x5200
leaq 0xe0(%rsp), %rdi
leaq 0x6110(%rip), %rsi      # 0x26a1d
callq 0x5350
movq %rax, %rdi
callq 0x5180
leaq 0xb0(%rsp), %r14
movq %r14, %rdi
leaq 0xe8(%rsp), %rsi
callq 0x5580
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb3e8
movq %r14, %rdi
callq 0x5778
leaq 0xd0(%rsp), %rdi
callq 0x5240
leaq 0x30(%r15), %rax
movq %rax, 0x78(%rsp)
xorl %r12d, %r12d
movl $0x0, 0x44(%rsp)
xorl %ebx, %ebx
cmpl %ebp, %ebx
jae 0x20a29
leal -0x1(%rbp), %r14d
movl %ebx, %r13d
movq 0x88(%rsp), %rax
movl %eax, %edx
cmpl %r14d, %ebx
jae 0x20998
movq 0x18(%r15), %rax
movl (%rax,%r13,4), %ecx
movl 0x4(%rax,%r13,4), %eax
leal (%rcx,%rax), %edx
incl %edx
movq 0x18(%r15), %rcx
movl (%rcx,%r13,4), %eax
movq 0x70(%rsp), %rsi
cmpl %esi, %edx
jbe 0x209ce
cmpl %esi, %eax
jbe 0x209c9
shlq $0x2, %r13
addq 0x38(%r15), %r13
leal (%rbx,%r12), %edx
movq 0x38(%rsp), %rdi
movq %r13, %rsi
callq 0x12b34
incl %r12d
movl %ebp, %r14d
jmp 0x20a1f
leal 0x1(%rbx), %edx
movl (%rcx,%rdx,4), %esi
addl %esi, %eax
incl %eax
movl %eax, (%rcx,%rdx,4)
leal (%rbx,%r12), %esi
movq 0x8(%rsp), %rax
movq 0x50(%rax), %rax
movl (%rax,%rsi,4), %eax
movq 0x38(%r15), %rcx
movl %eax, (%rcx,%rdx,4)
movq 0x38(%rsp), %rdi
callq 0x17fc5
movq 0x80(%rsp), %rdi
movq %r13, %rsi
callq 0x17fc5
movq 0x78(%rsp), %rdi
movq %r13, %rsi
callq 0x17fc5
decl %ebx
incl 0x44(%rsp)
incl %ebx
movl %r14d, %ebp
jmp 0x20968
leaq 0x48(%rsp), %r15
movq %r15, %rdi
callq 0xcb3e
testl %r12d, %r12d
je 0x20b01
movq 0x8(%rsp), %rbx
cmpb $0x1, 0x16(%rbx)
movq 0x30(%rsp), %r14
jne 0x20ae1
leaq 0xd0(%rsp), %rdi
callq 0x5200
leaq 0xe0(%rsp), %rdi
leaq 0x5fc4(%rip), %rsi      # 0x26a33
callq 0x5350
movq %rax, %rdi
movl %r12d, %esi
callq 0x5660
movq %rax, %rdi
leaq 0x5fb1(%rip), %rsi      # 0x26a3a
callq 0x5350
movq %rax, %rdi
movl 0x44(%rsp), %esi
callq 0x5660
movq %rax, %rdi
leaq 0x5fa0(%rip), %rsi      # 0x26a44
callq 0x5350
movq %rax, %rdi
callq 0x5180
movq %r15, %rdi
leaq 0xe8(%rsp), %rsi
callq 0x5580
movq %rbx, %rdi
movq %r15, %rsi
callq 0xb3e8
movq %r15, %rdi
callq 0x5778
leaq 0xd0(%rsp), %rdi
callq 0x5240
leaq 0x10(%rsp), %rdi
callq 0x21d06
leaq 0x98(%rsp), %rdi
callq 0x16a02
movl 0x6c(%rsp), %eax
jmp 0x2067a
leaq 0x10(%rsp), %rdi
callq 0x21d06
leaq 0x98(%rsp), %rdi
callq 0x16a02
movq 0x8(%rsp), %rbx
movq 0x30(%rsp), %r14
cmpb $0x1, 0x16(%rbx)
jne 0x20c0e
leaq 0xd0(%rsp), %rdi
callq 0x5200
leaq 0xe0(%rsp), %rdi
leaq 0x5f0b(%rip), %rsi      # 0x26a53
callq 0x5350
movq 0x60(%rbx), %rcx
subq %rcx, %r14
movq %r14, %xmm1
movq 0x353f(%rip), %xmm2     # 0x240a0
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x3543(%rip), %xmm3     # 0x240b0
subpd %xmm3, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
incq %rcx
movq %rcx, %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 %rax, %rdi
callq 0x55a0
leaq 0x5eb9(%rip), %rsi      # 0x26a65
movq %rax, %rdi
callq 0x5350
movq %rax, %rdi
movq 0x70(%rsp), %rsi
callq 0x51e0
leaq 0x388d(%rip), %rsi      # 0x24455
movq %rax, %rdi
callq 0x5350
movq %rax, %rdi
callq 0x5180
leaq 0xe8(%rsp), %rsi
leaq 0x10(%rsp), %rdi
callq 0x5580
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0xb3e8
leaq 0x10(%rsp), %rdi
callq 0x5778
leaq 0xd0(%rsp), %rdi
callq 0x5240
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdx, %r15
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x5778
jmp 0x20c8c
jmp 0x20c86
jmp 0x20ca0
jmp 0x20cb7
jmp 0x20deb
jmp 0x20ca0
jmp 0x20deb
jmp 0x20ca0
jmp 0x20deb
movq %rax, %r14
leaq 0xb0(%rsp), %rdi
callq 0x5778
jmp 0x20db1
jmp 0x20dae
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0x5778
jmp 0x20dcd
jmp 0x20da4
jmp 0x20dca
jmp 0x20da9
movq %rdx, %r15
movq %rax, %r14
leaq 0xd0(%rsp), %rdi
callq 0x5240
jmp 0x20cbd
jmp 0x20deb
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x5778
jmp 0x20dee
jmp 0x20deb
movq %rdx, %r15
movq %rax, %r14
cmpl $0x1, %r15d
jne 0x20f7b
movq %r14, %rdi
callq 0x5150
movq 0x8(%rsp), %rax
cmpb $0x1, 0x15(%rax)
jne 0x20d0b
pushq $0x8
popq %rdi
callq 0x5190
movq 0x112af(%rip), %rcx     # 0x31f98
addq $0x10, %rcx
movq %rcx, (%rax)
movq 0x112b1(%rip), %rsi     # 0x31fa8
movq 0x1128a(%rip), %rdx     # 0x31f88
movq %rax, %rdi
callq 0x5630
jmp 0x20f5c
movq 0x112de(%rip), %rdi     # 0x31ff0
leaq 0x5afe(%rip), %rsi      # 0x26817
callq 0x5350
shll $0x2, %ebp
movq %rax, %rdi
movq %rbp, %rsi
callq 0x51e0
leaq 0x5b13(%rip), %rsi      # 0x26846
movq %rax, %rdi
callq 0x5350
movq %rax, %rdi
callq 0x5180
leaq 0x5b04(%rip), %rsi      # 0x2684e
movq %rax, %rdi
callq 0x5350
movq %rax, %rdi
callq 0x5180
leaq 0x5b3a(%rip), %rsi      # 0x2689b
movq %rax, %rdi
callq 0x5350
movq %rax, %rdi
callq 0x5180
pushq $0x4
popq %rdi
callq 0x5190
movl $0x1, (%rax)
movq 0x111da(%rip), %rsi     # 0x31f60
movq %rax, %rdi
xorl %edx, %edx
callq 0x5630
jmp 0x20f5c
movq %rax, %r14
callq 0x55c0
jmp 0x20f7b
jmp 0x20deb
movq %rax, %r14
jmp 0x20dbe
movq %rax, %r14
jmp 0x20dda
movq %rax, %r14
leaq 0xd0(%rsp), %rdi
callq 0x5240
leaq 0x48(%rsp), %rdi
callq 0xcb3e
jmp 0x20dda
movq %rax, %r14
leaq 0xd0(%rsp), %rdi
callq 0x5240
leaq 0x10(%rsp), %rdi
callq 0xcb3e
jmp 0x20f7b
jmp 0x20deb
movq %rax, %r14
leaq 0xd0(%rsp), %rdi
callq 0x5240
jmp 0x20f7b
jmp 0x20e3d
jmp 0x20e67
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0x5778
jmp 0x20e40
movq %rax, %r14
leaq 0xb0(%rsp), %rdi
callq 0x5778
jmp 0x20e2c
jmp 0x20e29
jmp 0x20e6f
movq %rax, %r14
leaq 0xd0(%rsp), %rdi
callq 0x5240
jmp 0x20e72
jmp 0x20e67
movq %rax, %r14
leaq 0xd0(%rsp), %rdi
callq 0x5240
jmp 0x20f64
jmp 0x20e67
movq %rax, %r14
pushq $0x8
popq %rsi
movq %r12, %rdi
callq 0x5380
jmp 0x20f64
movq %rax, %r14
jmp 0x20f64
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0xcb3e
jmp 0x20f64
movq %rax, %r14
cmpl $0x1, %edx
jne 0x20f64
movq %r14, %rdi
callq 0x5150
movq 0x8(%rsp), %rax
cmpb $0x1, 0x15(%rax)
jne 0x20ed1
pushq $0x8
popq %rdi
callq 0x5190
movq 0x110e9(%rip), %rcx     # 0x31f98
addq $0x10, %rcx
movq %rcx, (%rax)
movq 0x110eb(%rip), %rsi     # 0x31fa8
movq 0x110c4(%rip), %rdx     # 0x31f88
movq %rax, %rdi
callq 0x5630
jmp 0x20f5c
movq 0x11118(%rip), %rdi     # 0x31ff0
leaq 0x5a7f(%rip), %rsi      # 0x2695e
callq 0x5350
shrl $0x7, %ebp
andl $0x3fffff, %ebp         # imm = 0x3FFFFF
movq %rax, %rdi
movq %rbp, %rsi
callq 0x51e0
leaq 0x5a8b(%rip), %rsi      # 0x2698a
movq %rax, %rdi
callq 0x5350
movq %rax, %rdi
callq 0x5180
leaq 0x5a85(%rip), %rsi      # 0x2699b
movq %rax, %rdi
callq 0x5350
movq %rax, %rdi
callq 0x5180
leaq 0x5abd(%rip), %rsi      # 0x269ea
movq %rax, %rdi
callq 0x5350
movq %rax, %rdi
callq 0x5180
pushq $0x4
popq %rdi
callq 0x5190
movl $0x1, (%rax)
movq 0x1100e(%rip), %rsi     # 0x31f60
movq %rax, %rdi
xorl %edx, %edx
callq 0x5630
movq %rax, %r14
callq 0x55c0
leaq 0x10(%rsp), %rdi
callq 0x21d06
leaq 0x98(%rsp), %rdi
callq 0x16a02
movq %r14, %rdi
callq 0x5680
movq %rax, %rdi
callq 0xb51f
nop