// File: /workspace/github_cpp_makefile_star2_O3/tonymugen[P]sampleSNPs/varfiles.cpp
// Function: sampFiles::BedFileI::sampleLD(sampFiles::PopIndex const&, unsigned long const&)
void BedFileI::sampleLD(const PopIndex &popID, const uint64_t &n){
	if (n == 0) {
		cerr << "WARNING: zero SNPs requested. Nothing to be done." << endl;
		return;
	}
    if (_varFile.is_open()) {
        _varFile.close();
    }
	if (!_bimFile.is_open()) {
		try {
			string bimName = _fileStub + ".bim";
			_bimFile.open(bimName.c_str(), ios::in);
			if (!_bimFile.is_open()) {
				cerr << "ERROR: failed to open .bim file " << bimName << " for input" << endl;
				exit(2);
			}

		} catch (system_error &error) {
			cerr << "ERROR: cannot open BIM file for input: " << error.code().message() << flush;
			perror(" ");
			exit(1);
		}
	}

	uint64_t N = _numLines(); // have to do this first to set _nCols properly
	if (_nCols != popID.size()) {
		cerr << "Sample size the population index (" << popID.size() << ") not equal to sample size (" << _nCols << ") in the .fam file" << endl;
		exit(5);
	}
	const uint64_t Nbed = (_nCols/4UL) + static_cast<uint64_t>( (_nCols%4UL) > 0UL ); // 4 SNPs/byte plus padding in BED
    uint64_t nSamp      = 2 * n; // n is the number of pairs

    try { // has to be here, because _numLines() closes the file
        _varFile.open(_fileName.c_str(), ios::in | ios::binary);
		if (!_varFile.is_open()) {
			cerr << "ERROR: failed to open .bed file " << _fileName << " for input" << endl;
			exit(2);
		}

        // check the magic bytes and SNP-major status
        char magic[3];
        _varFile.read(magic, 3);
        if ( (magic[0] != static_cast<char>(0x6C)) || (magic[1] != static_cast<char>(0x1B)) ) {
            cerr << "ERROR: binary file " << _fileName << " not recognized as BED" << endl;
            exit(2);
        } else if (magic[2] != static_cast<char>(0x01)){
            cerr << "ERROR: binary file " << _fileName << " not SNP-major. Run a newer version of plink to fix it." << endl;
            exit(3);
        }
    } catch (system_error &error) {
        cerr << "ERROR: cannot open BED file " << _fileName << ": " << error.code().message() << flush;
        perror(" ");
        exit(1);
    }

	const string outName = _fileStub + "_LD.tsv";
	if (nSamp > N) {
		cerr << "ERROR: requested a sample of " << nSamp << " SNPs that is greater than the number of SNPs (" << N << ") in the input file." << endl;
		return;
	} else if (nSamp == N) {
		cerr << "WARNING: the number of sampled SNPs the same as the total number of SNPs in the file. LD will be between neighboring loci." << endl;
		// use neighboring loci
		char *locus1  = new char[Nbed];
		char *locus2  = new char[Nbed];
		uint64_t cumS = 0; // cumulative position in the file
		vector<double> rSq(popID.popNumber());
		vector<double> Dprime(popID.popNumber());
		vector<double> cnt1(popID.popNumber());
		vector<double> cnt2(popID.popNumber());
		string chrID;   // chromosome ID
		uint64_t pos1;  // position of locus1
		uint64_t pos2;  // position of locus2
		string bimLine; // line in the .bim file
		string field;   // single field in the .bim file
		stringstream lineStream;

		ofstream outFile(outName);
		outFile << "ChrID\tpos1\tpos2\tDistance"  << flush;
		for (unsigned short iPop = 1; iPop <= popID.popNumber(); iPop++) {
			outFile << "\trSq_" << iPop << "\tDprime_" << iPop << "\tn1_" << iPop << "\tn2_" << iPop << flush;
		}
		outFile << endl;

		while (nSamp) {
			// first locus in the pair
			_varFile.seekg(cumS*Nbed + 3); // seekg() index is base-0
			_varFile.read(locus1, Nbed);
			getline(_bimFile, bimLine);
			cumS++;
			nSamp--;

			lineStream.str(bimLine); // replaces whatever was there from before
			lineStream >> field;
			chrID = field;
			lineStream >> field >> field >> field;
			pos1 = atoi(field.c_str());

			// second locus
			_varFile.seekg(cumS*Nbed + 3);
			_varFile.read(locus2, Nbed);
			getline(_bimFile, bimLine);
			cumS++;
			nSamp--;

			lineStream.str(bimLine);
			lineStream >> field;
			if (chrID != field) { // if the chromosome number changes, we discard this pair and continue
				continue;
			}
			lineStream >> field >> field >> field;
			pos2 = atoi(field.c_str());
			if (pos2 <= pos1) {
				cerr << "WARNING: second SNP position (" << pos2 << ") no larger than the first (" << pos1 << ") on chromosome " << chrID << ". Skipping this pair without re-trying." << endl;
				continue;
			}
			_ld(locus1, locus2, popID, rSq, Dprime, cnt1, cnt2);
			outFile << chrID << "\t" << pos1 << "\t" << pos2 << "\t" << pos2 - pos1 << flush;
			for (size_t iPop = 0; iPop < popID.popNumber(); iPop++) {
				outFile <<  "\t" << rSq[iPop] << "\t" << Dprime[iPop] << "\t" << cnt1[iPop] << "\t" << cnt2[iPop] << flush;
			}
			outFile << endl;
		}

		delete [] locus1;
		delete [] locus2;
		_varFile.close();
		_bimFile.close();
		outFile.close();
        return;
	}
	// sample loci and calculate LD
	char *locus1  = new char[Nbed];
	char *locus2  = new char[Nbed];
	uint64_t cumS = 0; // cumulative position in the file
	uint64_t S;
	vector<double> rSq(popID.popNumber());
	vector<double> Dprime(popID.popNumber());
	vector<double> cnt1(popID.popNumber());
	vector<double> cnt2(popID.popNumber());
	string chrID;   // chromosome ID
	uint64_t pos1;  // position of locus1
	uint64_t pos2;  // position of locus2
	string bimLine; // line in the .bim file
	string field;   // single field in the .bim file
	stringstream lineStream;

	ofstream outFile(outName);
	outFile << "ChrID\tpos1\tpos2\tDistance"  << flush;
	for (unsigned short iPop = 1; iPop <= popID.popNumber(); iPop++) {
		outFile << "\trSq_" << iPop << "\tDprime_" << iPop << "\tn1_" << iPop << "\tn2_" << iPop << flush;
	}
	outFile << endl;

	RanDraw *snpSamp;  // so that I can catch RanDraw constructor exceptions
	try {
		snpSamp = new RanDraw();
	} catch (string error) {
		cerr << "ERROR: " << error << endl;
		exit(5);
	}

	while (nSamp) {
		// first locus in the pair
		try {
			S = snpSamp->vitter(nSamp, N); // sample the number of SNPs to skip; keep track of the running total
		} catch (string error) {
			cerr << "ERROR: " << error << endl;
			exit(5);
		}
		cumS += S;
		N    -= S + 1;
		_varFile.seekg(cumS*Nbed + 3); // seekg() index is base-0
		_varFile.read(locus1, Nbed);
		cumS++;                        // step up cumS because seekg() will not change it (unlike the getline() that automatially advances)
		while (S) { // skipping S lines in the bim file
			_bimFile.ignore(numeric_limits<streamsize>::max(), '\n');
 			S--;
		}
		getline(_bimFile, bimLine);
		lineStream.str(bimLine); // replaces whatever was there from before
		lineStream >> field;
		chrID = field;
		lineStream >> field >> field >> field;
		pos1 = atoi(field.c_str());
		nSamp--;

		// second locus
		try {
			S = snpSamp->vitter(nSamp, N);
		} catch (string error) {
			cerr << "ERROR: " << error << endl;
			exit(5);
		}
		cumS += S;
		N    -= S + 1;
		_varFile.seekg(cumS*Nbed + 3);
		_varFile.read(locus2, Nbed);
		cumS++;
		while (S) {
			_bimFile.ignore(numeric_limits<streamsize>::max(), '\n');
			S--;
		}
		getline(_bimFile, bimLine);

		lineStream.str(bimLine);
		lineStream >> field;
		if (chrID != field) { // if the chromosome number changes, we discard this pair and start over
			nSamp++;          // back up so that we end up with the correct number of pairs regardless of how many chromosome boundaries we cross
			continue;
		}
		lineStream >> field >> field >> field;
		pos2 = atoi(field.c_str());
		if (pos2 <= pos1) {
			cerr << "WARNING: second SNP position (" << pos2 << ") no larger than the first (" << pos1 << ") on chromosome " << chrID << ". Skipping this pair without re-trying." << endl;
			nSamp--; // will not re-try in this case
			continue;
		}
		_ld(locus1, locus2, popID, rSq, Dprime, cnt1, cnt2);
		outFile << chrID << "\t" << pos1 << "\t" << pos2 << "\t" << pos2 - pos1 << flush;
		for (size_t iPop = 0; iPop < popID.popNumber(); iPop++) {
			outFile <<  "\t" << rSq[iPop] << "\t" << Dprime[iPop] << "\t" << cnt1[iPop] << "\t" << cnt2[iPop] << flush;
		}
		outFile << endl;
		nSamp--;
	}

	delete [] locus1;
	delete [] locus2;
	_varFile.close();
	_bimFile.close();
	outFile.close();

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4f8, %rsp            # imm = 0x4F8
cmpq $0x0, (%rdx)
je 0xebdd
movq %rdx, %r13
movq %rdi, %r15
movq %rsi, 0x140(%rsp)
leaq 0x8(%rdi), %rax
movq %rax, (%rsp)
leaq 0x88(%rdi), %rbx
movq %rbx, %rdi
callq 0x40a0
testb %al, %al
je 0xe9b3
movq (%rsp), %rdi
callq 0x4060
leaq 0x458(%r15), %r14
leaq 0x4d8(%r15), %r12
movq %r12, %rdi
callq 0x40a0
testb %al, %al
jne 0xea51
leaq 0x170(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq 0x668(%r15), %rsi
movq 0x670(%r15), %rdx
addq %rsi, %rdx
leaq 0x160(%rsp), %rdi
callq 0x76e4
leaq 0x9e32(%rip), %rsi      # 0x18834
leaq 0x160(%rsp), %rdi
callq 0x4530
movq 0x160(%rsp), %rsi
movq %r14, %rdi
movl $0x8, %edx
callq 0x4270
movq %r12, %rdi
callq 0x40a0
testb %al, %al
je 0xffe6
movq 0x160(%rsp), %rdi
cmpq %rbp, %rdi
je 0xea51
movq 0x170(%rsp), %rsi
incq %rsi
callq 0x42d0
movq %r15, %rdi
callq 0x8ece
movq %rax, 0x30(%rsp)
movq 0x238(%r15), %rax
movq 0x140(%rsp), %r12
cmpq 0x18(%r12), %rax
jne 0xfe85
movq %rax, %rcx
shrq $0x2, %rcx
andl $0x3, %eax
cmpq $0x1, %rax
sbbq $-0x1, %rcx
movq %rcx, 0x8(%rsp)
movq (%r13), %r13
movq 0x218(%r15), %rsi
movq (%rsp), %rdi
movl $0xc, %edx
callq 0x4270
movq %rbx, %rdi
callq 0x40a0
testb %al, %al
je 0xfedf
leaq 0x160(%rsp), %rsi
movl $0x3, %edx
movq (%rsp), %rdi
callq 0x4350
cmpb $0x6c, 0x160(%rsp)
jne 0xff35
cmpb $0x1b, 0x161(%rsp)
jne 0xff35
cmpb $0x1, 0x162(%rsp)
jne 0xff8b
leaq 0x130(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x668(%r15), %rsi
movq 0x670(%r15), %rdx
addq %rsi, %rdx
leaq 0x120(%rsp), %rbx
movq %rbx, %rdi
callq 0x76e4
leaq 0x9ede(%rip), %rsi      # 0x18a0a
movq %rbx, %rdi
callq 0x4530
addq %r13, %r13
movq %r13, 0xb8(%rsp)
cmpq 0x30(%rsp), %r13
jbe 0xec30
movq 0x1149f(%rip), %rdi     # 0x1fff0
leaq 0x9a9e(%rip), %rsi      # 0x185f6
movl $0x1d, %edx
callq 0x42f0
movq 0x11487(%rip), %rdi     # 0x1fff0
movq 0xb8(%rsp), %rsi
callq 0x41a0
movq %rax, %rbx
leaq 0x9d78(%rip), %rsi      # 0x188f8
movl $0x2f, %edx
movq %rax, %rdi
callq 0x42f0
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
callq 0x41a0
movq %rax, %rbx
leaq 0x9aa0(%rip), %rsi      # 0x18644
movl $0x14, %edx
movq %rax, %rdi
callq 0x42f0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4290
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41b0
jmp 0xfe4e
movq 0x1140c(%rip), %rbx     # 0x1fff0
leaq 0x99d9(%rip), %rsi      # 0x185c4
movl $0x31, %edx
movq %rbx, %rdi
callq 0x42f0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4290
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
addq $0x4f8, %rsp            # imm = 0x4F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x41b0
jne 0xf485
movq 0x113b3(%rip), %rbx     # 0x1fff0
leaq 0x9dce(%rip), %rsi      # 0x18a12
movl $0x7a, %edx
movq %rbx, %rdi
callq 0x42f0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x4290
movsbl %al, %esi
movq 0x11381(%rip), %rdi     # 0x1fff0
callq 0x4040
movq %rax, %rdi
callq 0x41b0
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x4030
movq %rax, 0x38(%rsp)
movq %rbx, %rdi
callq 0x4030
movq %rax, 0xa0(%rsp)
movq 0x8(%r12), %rsi
subq (%r12), %rsi
sarq $0x3, %rsi
movabsq $-0x5555555555555555, %rbx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rbx, %rsi
leaq 0x40(%rsp), %rdi
leaq 0x160(%rsp), %rdx
callq 0x1684e
movq 0x8(%r12), %rsi
subq (%r12), %rsi
sarq $0x3, %rsi
imulq %rbx, %rsi
leaq 0xf0(%rsp), %rdi
leaq 0x160(%rsp), %rdx
callq 0x1684e
movq 0x8(%r12), %rsi
subq (%r12), %rsi
sarq $0x3, %rsi
imulq %rbx, %rsi
leaq 0xd8(%rsp), %rdi
leaq 0x160(%rsp), %rdx
callq 0x1684e
movq 0x8(%r12), %rsi
subq (%r12), %rsi
sarq $0x3, %rsi
imulq %rbx, %rsi
leaq 0xc0(%rsp), %rdi
leaq 0x160(%rsp), %rdx
callq 0x1684e
leaq 0x70(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x90(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x20(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x370(%rsp), %rdi
callq 0x41c0
leaq 0x160(%rsp), %rdi
leaq 0x120(%rsp), %rsi
movl $0x10, %edx
callq 0x4540
leaq 0x9de4(%rip), %rsi      # 0x18b81
leaq 0x160(%rsp), %rdi
movl $0x18, %edx
callq 0x42f0
leaq 0x160(%rsp), %rdi
callq 0x41b0
movq 0x8(%r12), %rax
cmpq (%r12), %rax
je 0xee95
movl $0x1, %ebp
movw $0x2, %r15w
leaq 0x160(%rsp), %r13
movl $0x5, %edx
movq %r13, %rdi
leaq 0x9dae(%rip), %rsi      # 0x18b9a
callq 0x42f0
movq %r13, %rdi
movq %rbp, %rsi
callq 0x41a0
movq %rax, %rbx
movl $0x8, %edx
movq %rax, %rdi
leaq 0x9d92(%rip), %rsi      # 0x18ba0
callq 0x42f0
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x41a0
movq %rax, %rbx
movl $0x4, %edx
movq %rax, %rdi
leaq 0x9d79(%rip), %rsi      # 0x18ba9
callq 0x42f0
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x41a0
movq %rax, %rbx
movl $0x4, %edx
movq %rax, %rdi
leaq 0x9d5c(%rip), %rsi      # 0x18bae
callq 0x42f0
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x41a0
movq %rax, %rdi
callq 0x41b0
movzwl %r15w, %ebp
movq 0x8(%r12), %rax
subq (%r12), %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
incl %r15d
cmpq %rbp, %rax
jae 0xeddd
movq 0x160(%rsp), %rax
leaq 0x160(%rsp), %rdi
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x4290
movsbl %al, %esi
leaq 0x160(%rsp), %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41b0
cmpq $0x0, 0x30(%rsp)
je 0xf32b
xorl %ebp, %ebp
movq %rbp, %rsi
imulq 0x8(%rsp), %rsi
addq $0x3, %rsi
movq (%rsp), %rdi
xorl %edx, %edx
callq 0x4360
movq (%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x4350
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4290
movsbl %al, %edx
movq %r14, %rdi
leaq 0x80(%rsp), %rsi
callq 0x4500
leaq 0x388(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x4410
leaq 0x370(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x4370
leaq 0x60(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x4160
leaq 0x370(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x4370
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x4370
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x4370
movq %rbp, %rbx
orq $0x1, %rbx
movq 0x10(%rsp), %rdi
callq 0x4440
movl %eax, %r15d
imulq 0x8(%rsp), %rbx
addq $0x3, %rbx
movq (%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x4360
movq (%rsp), %rdi
movq 0xa0(%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x4350
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4290
movsbl %al, %edx
movq %r14, %rdi
leaq 0x80(%rsp), %rsi
callq 0x4500
leaq 0x388(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x4410
leaq 0x370(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x4370
movq 0x68(%rsp), %rdx
cmpq 0x18(%rsp), %rdx
jne 0xf31b
testq %rdx, %rdx
je 0xf049
movq 0x10(%rsp), %rsi
movq 0x60(%rsp), %rdi
callq 0x42e0
testl %eax, %eax
jne 0xf31b
leaq 0x370(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x4370
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x4370
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x4370
movslq %r15d, %r15
movq 0x10(%rsp), %rdi
callq 0x4440
movslq %eax, %rbx
cmpl %r15d, %ebx
jbe 0xf26b
movq 0x38(%rsp), %rsi
movq 0xa0(%rsp), %rdx
movq %r12, %rcx
leaq 0x40(%rsp), %r8
leaq 0xf0(%rsp), %r9
leaq 0xc0(%rsp), %rax
pushq %rax
leaq 0xe0(%rsp), %rax
pushq %rax
callq 0xa5d8
addq $0x10, %rsp
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
leaq 0x160(%rsp), %rdi
callq 0x42f0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
leaq 0x9a3d(%rip), %rsi      # 0x18b2c
callq 0x42f0
movq %r13, %rdi
movq %r15, %rsi
callq 0x41a0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
leaq 0x9a1b(%rip), %rsi      # 0x18b2c
callq 0x42f0
movq %r13, %rdi
movq %rbx, %rsi
callq 0x41a0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
leaq 0x99f9(%rip), %rsi      # 0x18b2c
callq 0x42f0
subq %r15, %rbx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x41a0
movq %rax, %rdi
callq 0x41b0
movq 0x8(%r12), %rax
cmpq (%r12), %rax
leaq 0x160(%rsp), %r13
je 0xf245
xorl %r15d, %r15d
movl $0x1, %edx
movq %r13, %rdi
leaq 0x99b5(%rip), %rsi      # 0x18b2c
callq 0x42f0
movq 0x40(%rsp), %rax
movsd (%rax,%r15,8), %xmm0
movq %r13, %rdi
callq 0x4470
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
leaq 0x998b(%rip), %rsi      # 0x18b2c
callq 0x42f0
movq 0xf0(%rsp), %rax
movsd (%rax,%r15,8), %xmm0
movq %rbx, %rdi
callq 0x4470
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
leaq 0x995e(%rip), %rsi      # 0x18b2c
callq 0x42f0
movq 0xd8(%rsp), %rax
movsd (%rax,%r15,8), %xmm0
movq %rbx, %rdi
callq 0x4470
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
leaq 0x9931(%rip), %rsi      # 0x18b2c
callq 0x42f0
movq 0xc0(%rsp), %rax
movsd (%rax,%r15,8), %xmm0
movq %rbx, %rdi
callq 0x4470
movq %rax, %rdi
callq 0x41b0
movq 0x8(%r12), %rax
subq (%r12), %rax
incq %r15
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
cmpq %rax, %r15
jb 0xf168
movq 0x160(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x4290
leaq 0x160(%rsp), %rbx
jmp 0xf308
movl $0x1e, %edx
movq 0x10d79(%rip), %rdi     # 0x1fff0
leaq 0x9839(%rip), %rsi      # 0x18ab7
callq 0x42f0
movq 0x10d66(%rip), %rdi     # 0x1fff0
movq %rbx, %rsi
callq 0x41a0
movq %rax, %rbx
movl $0x1c, %edx
movq %rax, %rdi
leaq 0x9832(%rip), %rsi      # 0x18ad6
callq 0x42f0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x41a0
movq %rax, %rbx
movl $0x10, %edx
movq %rax, %rdi
leaq 0x982d(%rip), %rsi      # 0x18af3
callq 0x42f0
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq %rbx, %rdi
callq 0x42f0
movq %rax, %rbx
movl $0x27, %edx
movq %rax, %rdi
leaq 0x9815(%rip), %rsi      # 0x18b04
callq 0x42f0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4290
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41b0
addq $0x2, %rbp
addq $-0x2, 0x30(%rsp)
jne 0xeed9
movq 0x38(%rsp), %rdi
callq 0x4380
movq 0xa0(%rsp), %rdi
callq 0x4380
movq (%rsp), %rdi
callq 0x4060
movq %r14, %rdi
callq 0x4060
leaq 0x160(%rsp), %rdi
callq 0x43d0
movq 0x10c69(%rip), %rax     # 0x1ffd0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x168(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x160(%rsp,%rcx)
callq 0x4250
leaq 0x258(%rsp), %rdi
callq 0x40f0
movq 0x10c11(%rip), %rsi     # 0x1ffb0
leaq 0x370(%rsp), %rdi
callq 0x4200
leaq 0x3f0(%rsp), %rdi
callq 0x40f0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0xf3d5
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0xf3fa
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0xf416
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0xf433
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x42d0
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0xf450
movq 0xe8(%rsp), %rsi
subq %rdi, %rsi
callq 0x42d0
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0xf46d
movq 0x100(%rsp), %rsi
subq %rdi, %rsi
callq 0x42d0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0xfe4e
movq 0x50(%rsp), %rsi
jmp 0xfe46
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x4030
movq %rax, 0x110(%rsp)
movq %rbx, %rdi
callq 0x4030
movq %rax, 0x108(%rsp)
movq 0x8(%r12), %rsi
subq (%r12), %rsi
sarq $0x3, %rsi
movabsq $-0x5555555555555555, %rbx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rbx, %rsi
leaq 0xf0(%rsp), %rdi
leaq 0x160(%rsp), %rdx
callq 0x1684e
movq 0x8(%r12), %rsi
subq (%r12), %rsi
sarq $0x3, %rsi
imulq %rbx, %rsi
leaq 0xd8(%rsp), %rdi
leaq 0x160(%rsp), %rdx
callq 0x1684e
movq 0x8(%r12), %rsi
subq (%r12), %rsi
sarq $0x3, %rsi
imulq %rbx, %rsi
leaq 0xc0(%rsp), %rdi
leaq 0x160(%rsp), %rdx
callq 0x1684e
movq 0x8(%r12), %rsi
subq (%r12), %rsi
sarq $0x3, %rsi
imulq %rbx, %rsi
leaq 0x148(%rsp), %rdi
leaq 0x160(%rsp), %rdx
callq 0x1684e
leaq 0x70(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x90(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x20(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x370(%rsp), %rdi
callq 0x41c0
leaq 0x160(%rsp), %rdi
leaq 0x120(%rsp), %rsi
movl $0x10, %edx
callq 0x4540
leaq 0x95d5(%rip), %rsi      # 0x18b81
leaq 0x160(%rsp), %rdi
movl $0x18, %edx
callq 0x42f0
leaq 0x160(%rsp), %rdi
callq 0x41b0
movq 0x8(%r12), %rax
cmpq (%r12), %rax
je 0xf6a4
movl $0x1, %ebp
movw $0x2, %r15w
leaq 0x160(%rsp), %r13
movl $0x5, %edx
movq %r13, %rdi
leaq 0x959f(%rip), %rsi      # 0x18b9a
callq 0x42f0
movq %r13, %rdi
movq %rbp, %rsi
callq 0x41a0
movq %rax, %rbx
movl $0x8, %edx
movq %rax, %rdi
leaq 0x9583(%rip), %rsi      # 0x18ba0
callq 0x42f0
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x41a0
movq %rax, %rbx
movl $0x4, %edx
movq %rax, %rdi
leaq 0x956a(%rip), %rsi      # 0x18ba9
callq 0x42f0
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x41a0
movq %rax, %rbx
movl $0x4, %edx
movq %rax, %rdi
leaq 0x954d(%rip), %rsi      # 0x18bae
callq 0x42f0
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x41a0
movq %rax, %rdi
callq 0x41b0
movzwl %r15w, %ebp
movq 0x8(%r12), %rax
subq (%r12), %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
incl %r15d
cmpq %rbp, %rax
jae 0xf5ec
movq 0x160(%rsp), %rax
leaq 0x160(%rsp), %rdi
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x4290
movsbl %al, %esi
leaq 0x160(%rsp), %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41b0
movl $0x8, %edi
callq 0x42c0
movq %rax, 0x38(%rsp)
movq %rax, %rdi
callq 0x172de
movq 0xb8(%rsp), %rax
testq %rax, %rax
je 0xfcec
xorl %r13d, %r13d
movabsq $0x7fffffffffffffff, %rbx # imm = 0x7FFFFFFFFFFFFFFF
movq %rax, %xmm0
movq 0x8d84(%rip), %xmm1     # 0x184a0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x8d88(%rip), %xmm2     # 0x184b0
subpd %xmm2, %xmm0
movapd %xmm0, %xmm3
unpckhpd %xmm0, %xmm3            # xmm3 = xmm3[1],xmm0[1]
addsd %xmm0, %xmm3
movapd %xmm3, 0xa0(%rsp)
movq %rax, 0xb8(%rsp)
decq %rax
movq %rax, %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
subpd %xmm2, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0x360(%rsp)
movaps 0xa0(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
movsd 0x30(%rsp), %xmm0
unpcklps 0x8d17(%rip), %xmm0     # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x8d1f(%rip), %xmm0     # 0x184b0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd %xmm1, 0x118(%rsp)
movq 0x38(%rsp), %rdi
leaq 0x40(%rsp), %rsi
leaq 0x118(%rsp), %rdx
callq 0x175fe
movq %rax, %rbp
addq %rax, %r13
movq %r13, %rsi
imulq 0x8(%rsp), %rsi
addq $0x3, %rsi
movq (%rsp), %rdi
xorl %edx, %edx
callq 0x4360
movq (%rsp), %rdi
movq 0x110(%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x4350
testq %rbp, %rbp
je 0xf80e
movq %rbp, %r15
movq %r14, %rdi
movq %rbx, %rsi
movl $0xa, %edx
callq 0x4190
decq %r15
jne 0xf7f9
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4290
movsbl %al, %edx
movq %r14, %rdi
leaq 0x80(%rsp), %rsi
callq 0x4500
leaq 0x388(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x4410
leaq 0x370(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x4370
leaq 0x60(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x4160
leaq 0x370(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x4370
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x4370
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x4370
notq %rbp
movq 0x30(%rsp), %r15
addq %rbp, %r15
movq 0x10(%rsp), %rdi
callq 0x4440
movl %eax, %ebp
movaps 0x360(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
movq %r15, 0x30(%rsp)
movq %r15, %xmm0
punpckldq 0x8bd2(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x8bda(%rip), %xmm0     # 0x184b0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd %xmm1, 0x118(%rsp)
movq 0x38(%rsp), %rdi
leaq 0x40(%rsp), %rsi
leaq 0x118(%rsp), %rdx
callq 0x175fe
movq %rax, %r12
incq %r13
addq %rax, %r13
movq %r13, %rsi
imulq 0x8(%rsp), %rsi
addq $0x3, %rsi
movq (%rsp), %rdi
xorl %edx, %edx
callq 0x4360
movq (%rsp), %rdi
movq 0x108(%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x4350
testq %r12, %r12
je 0xf956
movq %r12, %r15
movq %r14, %rdi
movq %rbx, %rsi
movl $0xa, %edx
callq 0x4190
decq %r15
jne 0xf941
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4290
movsbl %al, %edx
movq %r14, %rdi
leaq 0x80(%rsp), %rsi
callq 0x4500
leaq 0x388(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x4410
leaq 0x370(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x4370
notq %r12
addq %r12, 0x30(%rsp)
incq %r13
movq 0x68(%rsp), %rdx
cmpq 0x18(%rsp), %rdx
jne 0xf76e
testq %rdx, %rdx
je 0xf9db
movq 0x10(%rsp), %rsi
movq 0x60(%rsp), %rdi
callq 0x42e0
testl %eax, %eax
jne 0xf76e
leaq 0x370(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x4370
movq 0x140(%rsp), %r12
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x4370
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x4370
movslq %ebp, %r15
movq 0x10(%rsp), %rdi
callq 0x4440
movslq %eax, %rbp
movq %r15, 0xa0(%rsp)
cmpl %r15d, %ebp
jbe 0xfc25
movq 0x110(%rsp), %rsi
movq 0x108(%rsp), %rdx
movq %r12, %rcx
leaq 0xf0(%rsp), %r8
leaq 0xd8(%rsp), %r9
leaq 0x148(%rsp), %rax
pushq %rax
leaq 0xc8(%rsp), %rax
pushq %rax
callq 0xa5d8
addq $0x10, %rsp
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
leaq 0x160(%rsp), %rdi
callq 0x42f0
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x9095(%rip), %rsi      # 0x18b2c
callq 0x42f0
movq %r15, %rdi
movq 0xa0(%rsp), %rsi
callq 0x41a0
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x906e(%rip), %rsi      # 0x18b2c
callq 0x42f0
movq %r15, %rdi
movq %rbp, %rsi
callq 0x41a0
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x904c(%rip), %rsi      # 0x18b2c
callq 0x42f0
subq 0xa0(%rsp), %rbp
movq %r15, %rdi
movq %rbp, %rsi
callq 0x41a0
movq %rax, %rdi
callq 0x41b0
movq 0x8(%r12), %rax
cmpq (%r12), %rax
je 0xfbf7
xorl %ebp, %ebp
movl $0x1, %edx
leaq 0x160(%rsp), %rdi
leaq 0x9007(%rip), %rsi      # 0x18b2c
callq 0x42f0
movq 0xf0(%rsp), %rax
movsd (%rax,%rbp,8), %xmm0
leaq 0x160(%rsp), %rdi
callq 0x4470
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x8fd6(%rip), %rsi      # 0x18b2c
callq 0x42f0
movq 0xd8(%rsp), %rax
movsd (%rax,%rbp,8), %xmm0
movq %r15, %rdi
callq 0x4470
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x8faa(%rip), %rsi      # 0x18b2c
callq 0x42f0
movq 0xc0(%rsp), %rax
movsd (%rax,%rbp,8), %xmm0
movq %r15, %rdi
callq 0x4470
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x8f7e(%rip), %rsi      # 0x18b2c
callq 0x42f0
movq 0x148(%rsp), %rax
movsd (%rax,%rbp,8), %xmm0
movq %r15, %rdi
callq 0x4470
movq %rax, %rdi
callq 0x41b0
movq 0x8(%r12), %rax
subq (%r12), %rax
incq %rbp
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
cmpq %rax, %rbp
jb 0xfb11
movq 0x160(%rsp), %rax
movq -0x18(%rax), %rdi
leaq 0x160(%rsp), %rax
addq %rax, %rdi
movl $0xa, %esi
callq 0x4290
leaq 0x160(%rsp), %r15
jmp 0xfcc7
movl $0x1e, %edx
movq 0x103bf(%rip), %rdi     # 0x1fff0
leaq 0x8e7f(%rip), %rsi      # 0x18ab7
callq 0x42f0
movq 0x103ac(%rip), %rdi     # 0x1fff0
movq %rbp, %rsi
callq 0x41a0
movq %rax, %r15
movl $0x1c, %edx
movq %rax, %rdi
leaq 0x8e78(%rip), %rsi      # 0x18ad6
callq 0x42f0
movq %r15, %rdi
movq 0xa0(%rsp), %rsi
callq 0x41a0
movq %rax, %r15
movl $0x10, %edx
movq %rax, %rdi
leaq 0x8e6e(%rip), %rsi      # 0x18af3
callq 0x42f0
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq %r15, %rdi
callq 0x42f0
movq %rax, %r15
movl $0x27, %edx
movq %rax, %rdi
leaq 0x8e56(%rip), %rsi      # 0x18b04
callq 0x42f0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4290
movsbl %al, %esi
movq %r15, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41b0
movq 0xb8(%rsp), %rax
addq $-0x2, %rax
jne 0xf70f
movq 0x110(%rsp), %rdi
callq 0x4380
movq 0x108(%rsp), %rdi
callq 0x4380
movq (%rsp), %rdi
callq 0x4060
movq %r14, %rdi
callq 0x4060
leaq 0x160(%rsp), %rdi
callq 0x43d0
movq 0x102a5(%rip), %rax     # 0x1ffd0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x168(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x160(%rsp,%rcx)
callq 0x4250
leaq 0x258(%rsp), %rdi
callq 0x40f0
movq 0x1024d(%rip), %rsi     # 0x1ffb0
leaq 0x370(%rsp), %rdi
callq 0x4200
leaq 0x3f0(%rsp), %rdi
callq 0x40f0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0xfd99
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0xfdbe
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0xfdda
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x148(%rsp), %rdi
testq %rdi, %rdi
je 0xfdf7
movq 0x158(%rsp), %rsi
subq %rdi, %rsi
callq 0x42d0
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0xfe14
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x42d0
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0xfe31
movq 0xe8(%rsp), %rsi
subq %rdi, %rsi
callq 0x42d0
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0xfe4e
movq 0x100(%rsp), %rsi
subq %rdi, %rsi
callq 0x42d0
movq 0x120(%rsp), %rdi
leaq 0x130(%rsp), %rax
cmpq %rax, %rdi
je 0xfe73
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x42d0
addq $0x4f8, %rsp            # imm = 0x4F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10164(%rip), %rdi     # 0x1fff0
leaq 0x8c9b(%rip), %rsi      # 0x18b2e
callq 0x42a0
movq 0x18(%r12), %rsi
movq %rax, %rdi
callq 0x40b0
leaq 0x8ca5(%rip), %rsi      # 0x18b51
movq %rax, %rdi
callq 0x42a0
movq 0x238(%r15), %rsi
movq %rax, %rdi
callq 0x40b0
leaq 0x8ca4(%rip), %rsi      # 0x18b6e
movq %rax, %rdi
callq 0x42a0
movq %rax, %rdi
callq 0x4130
jmp 0x1053c
movq 0x1010a(%rip), %rdi     # 0x1fff0
leaq 0x8a8d(%rip), %rsi      # 0x1897a
movl $0x20, %edx
callq 0x42f0
movq 0x218(%r15), %rsi
movq 0x220(%r15), %rdx
movq 0x100e4(%rip), %rdi     # 0x1fff0
callq 0x42f0
movq %rax, %rbx
leaq 0x8651(%rip), %rsi      # 0x1856c
movl $0xa, %edx
movq %rax, %rdi
callq 0x42f0
movq %rbx, %rdi
callq 0x4130
jmp 0x10039
movq 0x100b4(%rip), %rdi     # 0x1fff0
leaq 0x8913(%rip), %rsi      # 0x18856
movl $0x13, %edx
callq 0x42f0
movq 0x218(%r15), %rsi
movq 0x220(%r15), %rdx
movq 0x1008e(%rip), %rdi     # 0x1fff0
callq 0x42f0
movq %rax, %rbx
leaq 0x88f9(%rip), %rsi      # 0x1886a
movl $0x16, %edx
movq %rax, %rdi
callq 0x42f0
movq %rbx, %rdi
callq 0x4130
jmp 0x10039
movq 0x1005e(%rip), %rdi     # 0x1fff0
leaq 0x88bd(%rip), %rsi      # 0x18856
movl $0x13, %edx
callq 0x42f0
movq 0x218(%r15), %rsi
movq 0x220(%r15), %rdx
movq 0x10038(%rip), %rdi     # 0x1fff0
callq 0x42f0
movq %rax, %rbx
leaq 0x88ba(%rip), %rsi      # 0x18881
movl $0x37, %edx
movq %rax, %rdi
callq 0x42f0
movq %rbx, %rdi
callq 0x4130
movl $0x3, %edi
callq 0x4320
movq 0x10003(%rip), %rdi     # 0x1fff0
leaq 0x88c5(%rip), %rsi      # 0x188b9
movl $0x20, %edx
callq 0x42f0
movq 0x160(%rsp), %rsi
movq 0x168(%rsp), %rdx
movq 0xffdb(%rip), %rdi      # 0x1fff0
callq 0x42f0
movq %rax, %rbx
leaq 0x8548(%rip), %rsi      # 0x1856c
movl $0xa, %edx
movq %rax, %rdi
callq 0x42f0
movq %rbx, %rdi
callq 0x4130
movl $0x2, %edi
callq 0x4320
movq %rdx, %r14
movq %rax, %rbx
movl $0x8, %esi
movq 0x38(%rsp), %rdi
callq 0x42d0
jmp 0x10060
movq %rdx, %r14
movq %rax, %rbx
cmpl $0x2, %r14d
jne 0x10578
movq %rbx, %rdi
callq 0x4340
leaq 0x50(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x40(%rsp), %rdi
callq 0x76e4
movq %rbx, %rdi
callq 0x4110
movq 0xff52(%rip), %rdi      # 0x1fff0
leaq 0x8680(%rip), %rsi      # 0x18725
movl $0x7, %edx
callq 0x42f0
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq 0xff30(%rip), %rdi      # 0x1fff0
callq 0x42f0
movq %rax, %rdi
callq 0x4130
jmp 0x1053c
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r14, %rdi
je 0x100ec
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x42d0
callq 0x4480
jmp 0x10578
movq %rax, %rbx
jmp 0x10348
movq %rax, %rbx
jmp 0x10369
movq %rax, %rbx
jmp 0x103e3
movq %rax, %rbx
jmp 0x10400
movq %rax, %rbx
jmp 0x10585
movq %rax, %rbx
jmp 0x1041d
movq %rax, %rbx
jmp 0x105a6
jmp 0x10322
movq %rax, %rbx
jmp 0x10620
jmp 0x10322
movq %rax, %rbx
jmp 0x1063d
jmp 0x10322
movq %rax, %rbx
jmp 0x1065a
jmp 0x10322
jmp 0x10322
jmp 0x10322
jmp 0x10173
movq %rdx, %r14
movq %rax, %rbx
jmp 0x10196
jmp 0x10575
movq %rdx, %r14
movq %rax, %rbx
movq 0x160(%rsp), %rdi
cmpq %rbp, %rdi
je 0x10196
movq 0x170(%rsp), %rsi
incq %rsi
callq 0x42d0
cmpl $0x1, %r14d
jne 0x1069c
movq %rbx, %rdi
callq 0x4110
movq %rax, %rbx
movq 0xfe3e(%rip), %rdi      # 0x1fff0
leaq 0x8829(%rip), %rsi      # 0x189e2
movl $0x27, %edx
callq 0x42f0
movq 0x18(%rbx), %rsi
movl 0x10(%rbx), %edx
movq (%rsi), %rax
leaq 0x160(%rsp), %rdi
callq *0x20(%rax)
movq 0x160(%rsp), %rsi
movq 0x168(%rsp), %rdx
movq 0xfe01(%rip), %rdi      # 0x1fff0
callq 0x42f0
movq %rax, %rdi
callq 0x41b0
leaq 0x160(%rsp), %rdi
callq 0x4815
movq %rax, %rbx
movq 0x160(%rsp), %rdi
cmpq %rbp, %rdi
je 0x10230
movq 0x170(%rsp), %rsi
incq %rsi
callq 0x42d0
jmp 0x10230
jmp 0x1022d
movq %rax, %rbx
callq 0x4480
jmp 0x1069c
jmp 0x10322
jmp 0x10575
jmp 0x1024b
jmp 0x10338
movq %rax, %rbx
cmpl $0x1, %edx
jne 0x1069c
movq %rbx, %rdi
callq 0x4110
movq %rax, %rbx
movq 0xfd87(%rip), %rdi      # 0x1fff0
leaq 0x85c9(%rip), %rsi      # 0x18839
movl $0x1c, %edx
callq 0x42f0
movq 0x218(%r15), %rsi
movq 0x220(%r15), %rdx
movq 0xfd61(%rip), %rdi      # 0x1fff0
callq 0x42f0
movq %rax, %r14
leaq 0x8573(%rip), %rsi      # 0x18811
movl $0x2, %edx
movq %rax, %rdi
callq 0x42f0
movq 0x18(%rbx), %rsi
movl 0x10(%rbx), %edx
movq (%rsi), %rax
leaq 0x160(%rsp), %rdi
callq *0x20(%rax)
movq 0x160(%rsp), %rsi
movq 0x168(%rsp), %rdx
movq %r14, %rdi
callq 0x42f0
movq %rax, %rdi
callq 0x41b0
leaq 0x160(%rsp), %rdi
callq 0x482f
movq %rax, %rbx
leaq 0x170(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x10318
movq 0x170(%rsp), %rsi
incq %rsi
callq 0x42d0
jmp 0x10318
jmp 0x10315
movq %rax, %rbx
callq 0x4480
jmp 0x1069c
movq %rax, %rbx
jmp 0x10677
jmp 0x10338
jmp 0x10575
jmp 0x10575
jmp 0x10338
movq %rax, %rbx
leaq 0x160(%rsp), %rdi
callq 0x4400
movq 0xfc61(%rip), %rsi      # 0x1ffb0
leaq 0x370(%rsp), %rdi
callq 0x4200
leaq 0x3f0(%rsp), %rdi
callq 0x40f0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x10385
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x103aa
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x103c6
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x103e3
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x42d0
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x10400
movq 0xe8(%rsp), %rsi
subq %rdi, %rsi
callq 0x42d0
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x1041d
movq 0x100(%rsp), %rsi
subq %rdi, %rsi
callq 0x42d0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x10677
movq 0x50(%rsp), %rsi
jmp 0x1066f
movq %rax, %rbx
cmpl $0x2, %edx
jne 0x10578
movq %rbx, %rdi
callq 0x4340
leaq 0x50(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x40(%rsp), %rdi
callq 0x76e4
movq %rbx, %rdi
callq 0x4110
movq 0xfb7b(%rip), %rdi      # 0x1fff0
leaq 0x82a9(%rip), %rsi      # 0x18725
movl $0x7, %edx
callq 0x42f0
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq 0xfb59(%rip), %rdi      # 0x1fff0
callq 0x42f0
movq %rax, %rdi
callq 0x4130
jmp 0x1053c
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r14, %rdi
je 0x104c3
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x42d0
callq 0x4480
jmp 0x10578
movq %rax, %rbx
cmpl $0x2, %edx
jne 0x10578
movq %rbx, %rdi
callq 0x4340
leaq 0x50(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x40(%rsp), %rdi
callq 0x76e4
movq %rbx, %rdi
callq 0x4110
movq 0xfae3(%rip), %rdi      # 0x1fff0
leaq 0x8211(%rip), %rsi      # 0x18725
movl $0x7, %edx
callq 0x42f0
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq 0xfac1(%rip), %rdi      # 0x1fff0
callq 0x42f0
movq %rax, %rdi
callq 0x4130
movl $0x5, %edi
callq 0x4320
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r14, %rdi
je 0x10560
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x42d0
callq 0x4480
jmp 0x10578
movq %rax, %rdi
callq 0x76d8
jmp 0x10575
jmp 0x10575
jmp 0x10575
movq %rax, %rbx
leaq 0x160(%rsp), %rdi
callq 0x4400
movq 0xfa24(%rip), %rsi      # 0x1ffb0
leaq 0x370(%rsp), %rdi
callq 0x4200
leaq 0x3f0(%rsp), %rdi
callq 0x40f0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x105c2
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x105e7
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x10603
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x148(%rsp), %rdi
testq %rdi, %rdi
je 0x10620
movq 0x158(%rsp), %rsi
subq %rdi, %rsi
callq 0x42d0
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x1063d
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x42d0
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x1065a
movq 0xe8(%rsp), %rsi
subq %rdi, %rsi
callq 0x42d0
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x10677
movq 0x100(%rsp), %rsi
subq %rdi, %rsi
callq 0x42d0
movq 0x120(%rsp), %rdi
leaq 0x130(%rsp), %rax
cmpq %rax, %rdi
je 0x1069c
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x42d0
movq %rbx, %rdi
callq 0x44e0