// File: /workspace/github_cpp_makefile_star2_O1/tonymugen[P]sampleSNPs/varfiles.cpp
// Function: sampFiles::BedFileI::sampleLD(unsigned long const&)
void BedFileI::sampleLD(const uint64_t &n){
	if (n == 0) {
		cerr << "WARNING: zero SNPs requested. Nothing to be done." << endl;
		return;
	}

    if (_bimFile.is_open()) {
        _bimFile.close();
    }
    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 nSamp = 2UL * n; // n is the number of pairs
	uint64_t N           = _numLines(); // also sets _nCols correctly
    const uint16_t Npad  = _nCols % 4UL;
    const uint64_t Nbed  = (_nCols/4UL) + static_cast<uint64_t>(Npad > 0UL);
	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
		double rSq;
		double Dprime;
		double cnt1;
		double cnt2;
		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\trSq\tDprime\tn1\tn2"  << endl;

        try {
            _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 << " for input: " << error.code().message() << flush;
            perror(" ");
            exit(1);
        }
		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, Nbed, Npad, rSq, Dprime, cnt1, cnt2);
			outFile << chrID << "\t" << pos1 << "\t" << pos2 << "\t" << pos2 - pos1 << "\t" << rSq << "\t" << Dprime << "\t" << cnt1 << "\t" << cnt2 << endl;
		}

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

	}
	try {
		_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);
	}
	// 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;
	double rSq;
	double Dprime;
	double cnt1;
	double cnt2;
	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\trSq\tDprime\tn1\tn2"  << 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, Nbed, Npad, rSq, Dprime, cnt1, cnt2);
		outFile << chrID << "\t" << pos1 << "\t" << pos2 << "\t" << pos2 - pos1 << "\t" << rSq << "\t" << Dprime << "\t" << cnt1 << "\t" << cnt2 << 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 $0x4c8, %rsp            # imm = 0x4C8
cmpq $0x0, (%rsi)
je 0xd2c5
movq %rsi, %r14
leaq 0x458(%rdi), %rbx
movq %rdi, 0xb0(%rsp)
leaq 0x4d8(%rdi), %r15
movq %r15, %rdi
callq 0x40a0
testb %al, %al
je 0xd108
movq %rbx, %rdi
callq 0x4060
leaq 0x150(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0xb0(%rsp), %rax
movq 0x668(%rax), %rsi
movq 0x670(%rax), %rdx
addq %rsi, %rdx
leaq 0x140(%rsp), %rdi
callq 0x7720
leaq 0xb6f2(%rip), %rsi      # 0x18834
leaq 0x140(%rsp), %rdi
callq 0x4530
movq 0x140(%rsp), %rsi
movq %rbx, %rdi
movl $0x8, %edx
callq 0x4270
movq %r15, %rdi
callq 0x40a0
testb %al, %al
je 0xe1d4
movq 0x140(%rsp), %rdi
cmpq %r12, %rdi
je 0xd191
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x42d0
movq (%r14), %r13
movq 0xb0(%rsp), %r12
movq %r12, %rdi
callq 0x8f46
movq %rax, 0xd8(%rsp)
movq 0x238(%r12), %r15
movl %r15d, %eax
andl $0x3, %eax
movw %ax, 0x36(%rsp)
shrq $0x2, %r15
cmpq $0x1, %rax
sbbq $-0x1, %r15
movq %r15, 0xd0(%rsp)
leaq 0x120(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x668(%r12), %rsi
movq 0x670(%r12), %rdx
addq %rsi, %rdx
leaq 0x110(%rsp), %r12
movq %r12, %rdi
callq 0x7720
leaq 0xb801(%rip), %rsi      # 0x18a0a
movq %r12, %rdi
callq 0x4530
leaq (,%r13,2), %rcx
movq %rcx, 0xc0(%rsp)
cmpq 0xd8(%rsp), %rcx
jbe 0xd318
movq 0x12dba(%rip), %rdi     # 0x1fff0
leaq 0xb3b9(%rip), %rsi      # 0x185f6
movl $0x1d, %edx
callq 0x42f0
movq 0x12da2(%rip), %rdi     # 0x1fff0
movq 0xc0(%rsp), %rsi
callq 0x41a0
movq %rax, %rbx
leaq 0xb693(%rip), %rsi      # 0x188f8
movl $0x2f, %edx
movq %rax, %rdi
callq 0x42f0
movq %rbx, %rdi
movq 0xd8(%rsp), %rsi
callq 0x41a0
movq %rax, %rbx
leaq 0xb3b8(%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 0xe19d
movq 0x12d24(%rip), %rbx     # 0x1fff0
leaq 0xb2f1(%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 $0x4c8, %rsp            # imm = 0x4C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x41b0
jne 0xd9a4
movq %r13, %r14
movq 0x12cc8(%rip), %r12     # 0x1fff0
leaq 0xb6e3(%rip), %rsi      # 0x18a12
movl $0x7a, %edx
movq %r12, %rdi
callq 0x42f0
movq (%r12), %rax
addq -0x18(%rax), %r12
movq %r12, %rdi
movl $0xa, %esi
callq 0x4290
movsbl %al, %esi
movq 0x12c95(%rip), %rdi     # 0x1fff0
callq 0x4040
movq %rax, %rdi
callq 0x41b0
movq %r15, %rdi
callq 0x4030
movq %rax, 0x68(%rsp)
movq %r15, %rdi
callq 0x4030
movq %rax, 0x60(%rsp)
leaq 0x48(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0xa0(%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 0x340(%rsp), %rdi
callq 0x41c0
leaq 0x140(%rsp), %rdi
leaq 0x110(%rsp), %rsi
movl $0x10, %edx
callq 0x4540
leaq 0xb6ab(%rip), %rsi      # 0x18a8d
leaq 0x140(%rsp), %r15
movl $0x29, %edx
movq %r15, %rdi
callq 0x42f0
movq 0x140(%rsp), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x4290
movsbl %al, %esi
leaq 0x140(%rsp), %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41b0
movq 0xb0(%rsp), %r15
leaq 0x8(%r15), %rdi
movq 0x218(%r15), %rsi
movq %rdi, 0x8(%rsp)
movl $0xc, %edx
callq 0x4270
leaq 0x88(%r15), %rdi
callq 0x40a0
testb %al, %al
je 0xe346
leaq 0x70(%rsp), %rsi
movl $0x3, %edx
movq 0x8(%rsp), %rdi
callq 0x4350
cmpb $0x6c, 0x70(%rsp)
jne 0xe3a1
cmpb $0x1b, 0x71(%rsp)
jne 0xe3a1
cmpb $0x1, 0x72(%rsp)
jne 0xe404
cmpq $0x0, 0xc0(%rsp)
je 0xd8af
leaq 0xd0(%rsp), %rax
movq (%rax), %rax
addq %r14, %r14
negq %r14
movq %rax, 0x58(%rsp)
addq %rax, %rax
movq %rax, 0xc8(%rsp)
movl $0x3, %r12d
movq 0x8(%rsp), %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x4360
movq 0x8(%rsp), %rdi
movq 0x68(%rsp), %rsi
movq 0x58(%rsp), %rdx
callq 0x4350
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4290
movsbl %al, %edx
movq %rbx, %rdi
leaq 0x90(%rsp), %rsi
callq 0x4500
leaq 0x358(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x4410
leaq 0x340(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x4370
leaq 0x38(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x4160
leaq 0x340(%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 0x10(%rsp), %rdi
callq 0x4440
movl %eax, %r15d
movq 0x58(%rsp), %rax
leaq (%rax,%r12), %rsi
movq 0x8(%rsp), %rdi
xorl %edx, %edx
callq 0x4360
movq 0x8(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq 0x58(%rsp), %rdx
callq 0x4350
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4290
movsbl %al, %edx
movq %rbx, %rdi
leaq 0x90(%rsp), %rsi
callq 0x4500
leaq 0x358(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x4410
leaq 0x340(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x4370
movq 0x40(%rsp), %rdx
cmpq 0x18(%rsp), %rdx
jne 0xd89d
testq %rdx, %rdx
je 0xd625
movq 0x10(%rsp), %rsi
movq 0x38(%rsp), %rdi
callq 0x42e0
testl %eax, %eax
jne 0xd89d
leaq 0x340(%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, %r13
cmpl %r15d, %r13d
jbe 0xd7ed
subq $0x8, %rsp
movq 0x70(%rsp), %rsi
movq 0x68(%rsp), %rdx
leaq 0xd8(%rsp), %rcx
leaq 0x3e(%rsp), %r8
leaq 0x108(%rsp), %r9
leaq 0xf0(%rsp), %rax
pushq %rax
leaq 0x100(%rsp), %rax
pushq %rax
leaq 0x110(%rsp), %rax
pushq %rax
callq 0x97c0
addq $0x20, %rsp
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
leaq 0x140(%rsp), %rdi
callq 0x42f0
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
leaq 0xb452(%rip), %rsi      # 0x18b2c
callq 0x42f0
movq %rbp, %rdi
movq %r15, %rsi
callq 0x41a0
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
leaq 0xb430(%rip), %rsi      # 0x18b2c
callq 0x42f0
movq %rbp, %rdi
movq %r13, %rsi
callq 0x41a0
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
leaq 0xb40e(%rip), %rsi      # 0x18b2c
callq 0x42f0
subq %r15, %r13
movq %rbp, %rdi
movq %r13, %rsi
callq 0x41a0
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0xb3e9(%rip), %rsi      # 0x18b2c
callq 0x42f0
movsd 0x100(%rsp), %xmm0
movq %r15, %rdi
callq 0x4470
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0xb3c1(%rip), %rsi      # 0x18b2c
callq 0x42f0
movsd 0xf8(%rsp), %xmm0
movq %r15, %rdi
callq 0x4470
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0xb399(%rip), %rsi      # 0x18b2c
callq 0x42f0
movsd 0xf0(%rsp), %xmm0
movq %r15, %rdi
callq 0x4470
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0xb371(%rip), %rsi      # 0x18b2c
callq 0x42f0
movsd 0xe8(%rsp), %xmm0
movq %r15, %rdi
callq 0x4470
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4290
jmp 0xd88a
movl $0x1e, %edx
movq 0x127f7(%rip), %rdi     # 0x1fff0
leaq 0xb2b7(%rip), %rsi      # 0x18ab7
callq 0x42f0
movq 0x127e4(%rip), %rdi     # 0x1fff0
movq %r13, %rsi
callq 0x41a0
movq %rax, %r13
movl $0x1c, %edx
movq %rax, %rdi
leaq 0xb2b0(%rip), %rsi      # 0x18ad6
callq 0x42f0
movq %r13, %rdi
movq %r15, %rsi
callq 0x41a0
movq %rax, %r15
movl $0x10, %edx
movq %rax, %rdi
leaq 0xb2ab(%rip), %rsi      # 0x18af3
callq 0x42f0
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq %r15, %rdi
callq 0x42f0
movq %rax, %r15
movl $0x27, %edx
movq %rax, %rdi
leaq 0xb293(%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
addq 0xc8(%rsp), %r12
addq $0x2, %r14
jne 0xd4c9
movq 0x68(%rsp), %rdi
callq 0x4380
movq 0x60(%rsp), %rdi
callq 0x4380
movq 0x8(%rsp), %rdi
callq 0x4060
movq %rbx, %rdi
callq 0x4060
leaq 0x140(%rsp), %rdi
callq 0x43d0
movq 0x126e7(%rip), %rax     # 0x1ffd0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x148(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x140(%rsp,%rcx)
callq 0x4250
leaq 0x238(%rsp), %rdi
callq 0x40f0
movq 0x1268f(%rip), %rsi     # 0x1ffb0
leaq 0x340(%rsp), %rdi
callq 0x4200
leaq 0x3c0(%rsp), %rdi
callq 0x40f0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0xd957
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0xd97c
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0xd998
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x42d0
movq $0x0, 0xc0(%rsp)
movq 0xb0(%rsp), %r15
leaq 0x8(%r15), %rdi
movq 0x218(%r15), %rsi
movq %rdi, 0x8(%rsp)
movl $0xc, %edx
callq 0x4270
leaq 0x88(%r15), %rdi
callq 0x40a0
testb %al, %al
je 0xe22c
leaq 0x140(%rsp), %rsi
movl $0x3, %edx
movq 0x8(%rsp), %rdi
callq 0x4350
cmpb $0x6c, 0x140(%rsp)
jne 0xe28a
cmpb $0x1b, 0x141(%rsp)
jne 0xe28a
cmpb $0x1, 0x142(%rsp)
jne 0xe2e8
movq 0xd0(%rsp), %r15
movq %r15, %rdi
callq 0x4030
movq %rax, 0x60(%rsp)
movq %r15, %rdi
callq 0x4030
movq %rax, 0xc8(%rsp)
leaq 0x48(%rsp), %r12
movq %r12, -0x10(%r12)
xorl %eax, %eax
movq %rax, -0x8(%r12)
movb %al, (%r12)
leaq 0xa0(%rsp), %r13
movq %r13, -0x10(%r13)
movq %rax, -0x8(%r13)
movb %al, (%r13)
leaq 0x20(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq %rax, -0x8(%rbp)
movb %al, (%rbp)
leaq 0x340(%rsp), %rdi
callq 0x41c0
leaq 0x140(%rsp), %rdi
leaq 0x110(%rsp), %rsi
movl $0x10, %edx
callq 0x4540
leaq 0xafe6(%rip), %rsi      # 0x18a8d
leaq 0x140(%rsp), %r15
movl $0x29, %edx
movq %r15, %rdi
callq 0x42f0
movq 0x140(%rsp), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x4290
movsbl %al, %esi
leaq 0x140(%rsp), %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41b0
movl $0x8, %edi
callq 0x42c0
movq %rax, 0x68(%rsp)
movq %rax, %rdi
callq 0x174a0
cmpq $0x0, 0xc0(%rsp)
sete 0x7(%rsp)
je 0xe0b1
leaq 0xd0(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x58(%rsp)
xorl %r15d, %r15d
movabsq $0x7fffffffffffffff, %rbp # imm = 0x7FFFFFFFFFFFFFFF
movq 0xc0(%rsp), %rax
movq %rax, %xmm0
movq 0xa956(%rip), %xmm1     # 0x184a0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0xa95a(%rip), %xmm2     # 0x184b0
subpd %xmm2, %xmm0
movapd %xmm0, %xmm3
unpckhpd %xmm0, %xmm3            # xmm3 = xmm3[1],xmm0[1]
addsd %xmm0, %xmm3
movapd %xmm3, 0xb0(%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, 0x130(%rsp)
movaps 0xb0(%rsp), %xmm0
movsd %xmm0, 0x70(%rsp)
movq 0xd8(%rsp), %rax
movq %rax, %r14
movq %rax, %xmm0
punpckldq 0xa8e6(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0xa8ee(%rip), %xmm0     # 0x184b0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd %xmm1, 0xe0(%rsp)
movq 0x68(%rsp), %rdi
leaq 0x70(%rsp), %rsi
leaq 0xe0(%rsp), %rdx
callq 0x177c4
movq %rax, %r12
addq %rax, %r15
movq 0x58(%rsp), %rsi
imulq %r15, %rsi
addq $0x3, %rsi
movq 0x8(%rsp), %rdi
xorl %edx, %edx
callq 0x4360
movq 0x8(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq 0x58(%rsp), %rdx
callq 0x4350
testq %r12, %r12
je 0xdc3e
movq %r12, %r13
movq %rbx, %rdi
movq %rbp, %rsi
movl $0xa, %edx
callq 0x4190
decq %r13
jne 0xdc29
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4290
movsbl %al, %edx
movq %rbx, %rdi
leaq 0x90(%rsp), %rsi
callq 0x4500
leaq 0x358(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x4410
leaq 0x340(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x4370
leaq 0x38(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x4160
leaq 0x340(%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 %r12
addq %r12, %r14
movq 0x10(%rsp), %rdi
callq 0x4440
movl %eax, 0x10c(%rsp)
movaps 0x130(%rsp), %xmm0
movsd %xmm0, 0x70(%rsp)
movq %r14, %r12
movq %r14, %xmm0
punpckldq 0xa7a4(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0xa7ac(%rip), %xmm0     # 0x184b0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd %xmm1, 0xe0(%rsp)
movq 0x68(%rsp), %rdi
leaq 0x70(%rsp), %rsi
leaq 0xe0(%rsp), %rdx
callq 0x177c4
movq %rax, %r14
incq %r15
addq %rax, %r15
movq %r15, %rsi
imulq 0x58(%rsp), %rsi
addq $0x3, %rsi
movq 0x8(%rsp), %rdi
xorl %edx, %edx
callq 0x4360
movq 0x8(%rsp), %rdi
movq 0xc8(%rsp), %rsi
movq 0x58(%rsp), %rdx
callq 0x4350
testq %r14, %r14
je 0xdd86
movq %r14, %r13
movq %rbx, %rdi
movq %rbp, %rsi
movl $0xa, %edx
callq 0x4190
decq %r13
jne 0xdd71
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4290
movsbl %al, %edx
movq %rbx, %rdi
leaq 0x90(%rsp), %rsi
callq 0x4500
leaq 0x358(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x4410
leaq 0x340(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x4370
notq %r14
addq %r14, %r12
movq %r12, 0xd8(%rsp)
incq %r15
movq 0x40(%rsp), %rdx
cmpq 0x18(%rsp), %rdx
jne 0xde09
testq %rdx, %rdx
je 0xde19
movq 0x10(%rsp), %rsi
movq 0x38(%rsp), %rdi
callq 0x42e0
testl %eax, %eax
je 0xde19
testb $0x1, 0x7(%rsp)
je 0xdb94
jmp 0xe0b1
leaq 0x340(%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 0x10c(%rsp), %r13
movq 0x10(%rsp), %rdi
callq 0x4440
movslq %eax, %r12
movq %r13, %r14
cmpl %r13d, %r12d
jbe 0xdfec
subq $0x8, %rsp
movq 0x68(%rsp), %rsi
movq 0xd0(%rsp), %rdx
leaq 0xd8(%rsp), %rcx
leaq 0x3e(%rsp), %r8
leaq 0x108(%rsp), %r9
leaq 0xf0(%rsp), %rax
pushq %rax
leaq 0x100(%rsp), %rax
pushq %rax
leaq 0x110(%rsp), %rax
pushq %rax
callq 0x97c0
addq $0x20, %rsp
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
leaq 0x140(%rsp), %rdi
callq 0x42f0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
leaq 0xac53(%rip), %rsi      # 0x18b2c
callq 0x42f0
movq %r13, %rdi
movq %r14, %rsi
callq 0x41a0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
leaq 0xac31(%rip), %rsi      # 0x18b2c
callq 0x42f0
movq %r13, %rdi
movq %r12, %rsi
callq 0x41a0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
leaq 0xac0f(%rip), %rsi      # 0x18b2c
callq 0x42f0
subq %r14, %r12
movq %r13, %rdi
movq %r12, %rsi
callq 0x41a0
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
leaq 0xabea(%rip), %rsi      # 0x18b2c
callq 0x42f0
movsd 0x100(%rsp), %xmm0
movq %r12, %rdi
callq 0x4470
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
leaq 0xabc2(%rip), %rsi      # 0x18b2c
callq 0x42f0
movsd 0xf8(%rsp), %xmm0
movq %r12, %rdi
callq 0x4470
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
leaq 0xab9a(%rip), %rsi      # 0x18b2c
callq 0x42f0
movsd 0xf0(%rsp), %xmm0
movq %r12, %rdi
callq 0x4470
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
leaq 0xab72(%rip), %rsi      # 0x18b2c
callq 0x42f0
movsd 0xe8(%rsp), %xmm0
movq %r12, %rdi
callq 0x4470
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x4290
jmp 0xe08a
movl $0x1e, %edx
movq 0x11ff8(%rip), %rdi     # 0x1fff0
leaq 0xaab8(%rip), %rsi      # 0x18ab7
callq 0x42f0
movq 0x11fe5(%rip), %rdi     # 0x1fff0
movq %r12, %rsi
callq 0x41a0
movq %rax, %r12
movl $0x1c, %edx
movq %rax, %rdi
leaq 0xaab1(%rip), %rsi      # 0x18ad6
callq 0x42f0
movq %r12, %rdi
movq %r14, %rsi
callq 0x41a0
movq %rax, %r12
movl $0x10, %edx
movq %rax, %rdi
leaq 0xaaac(%rip), %rsi      # 0x18af3
callq 0x42f0
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq %r12, %rdi
callq 0x42f0
movq %rax, %r12
movl $0x27, %edx
movq %rax, %rdi
leaq 0xaa94(%rip), %rsi      # 0x18b04
callq 0x42f0
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x4290
movsbl %al, %esi
movq %r12, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41b0
addq $-0x2, 0xc0(%rsp)
sete 0x7(%rsp)
jne 0xdb35
movq 0x60(%rsp), %rdi
callq 0x4380
movq 0xc8(%rsp), %rdi
callq 0x4380
movq 0x8(%rsp), %rdi
callq 0x4060
movq %rbx, %rdi
callq 0x4060
leaq 0x140(%rsp), %rdi
callq 0x43d0
movq 0x11ee2(%rip), %rax     # 0x1ffd0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x148(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x140(%rsp,%rcx)
callq 0x4250
leaq 0x238(%rsp), %rdi
callq 0x40f0
movq 0x11e8a(%rip), %rsi     # 0x1ffb0
leaq 0x340(%rsp), %rdi
callq 0x4200
leaq 0x3c0(%rsp), %rdi
callq 0x40f0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
leaq 0x48(%rsp), %rbx
leaq 0xa0(%rsp), %r14
je 0xe169
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0xe186
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x38(%rsp), %rdi
cmpq %rbx, %rdi
je 0xe19d
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x110(%rsp), %rdi
leaq 0x120(%rsp), %rax
cmpq %rax, %rdi
je 0xe1c2
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x42d0
addq $0x4c8, %rsp            # imm = 0x4C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x11e15(%rip), %rdi     # 0x1fff0
leaq 0xa6d7(%rip), %rsi      # 0x188b9
movl $0x20, %edx
callq 0x42f0
movq 0x140(%rsp), %rsi
movq 0x148(%rsp), %rdx
movq 0x11ded(%rip), %rdi     # 0x1fff0
callq 0x42f0
movq %rax, %rbx
leaq 0xa35a(%rip), %rsi      # 0x1856c
movl $0xa, %edx
movq %rax, %rdi
callq 0x42f0
movq %rbx, %rdi
callq 0x4130
jmp 0xe3fa
movq 0x11dbd(%rip), %rdi     # 0x1fff0
leaq 0xa740(%rip), %rsi      # 0x1897a
movl $0x20, %edx
movq 0xb0(%rsp), %rbx
callq 0x42f0
movq 0x218(%rbx), %rsi
movq 0x220(%rbx), %rdx
movq 0x11d8f(%rip), %rdi     # 0x1fff0
callq 0x42f0
movq %rax, %rbx
leaq 0xa2fc(%rip), %rsi      # 0x1856c
movl $0xa, %edx
movq %rax, %rdi
callq 0x42f0
movq %rbx, %rdi
callq 0x4130
jmp 0xe3fa
movq 0x11d5f(%rip), %rdi     # 0x1fff0
leaq 0xa5be(%rip), %rsi      # 0x18856
movl $0x13, %edx
callq 0x42f0
movq 0xb0(%rsp), %rax
movq 0x218(%rax), %rsi
movq 0x220(%rax), %rdx
movq 0x11d31(%rip), %rdi     # 0x1fff0
callq 0x42f0
movq %rax, %rbx
leaq 0xa59c(%rip), %rsi      # 0x1886a
movl $0x16, %edx
movq %rax, %rdi
callq 0x42f0
movq %rbx, %rdi
callq 0x4130
jmp 0xe3fa
movq 0x11d01(%rip), %rdi     # 0x1fff0
leaq 0xa560(%rip), %rsi      # 0x18856
movl $0x13, %edx
callq 0x42f0
movq 0xb0(%rsp), %rax
movq 0x218(%rax), %rsi
movq 0x220(%rax), %rdx
movq 0x11cd3(%rip), %rdi     # 0x1fff0
callq 0x42f0
movq %rax, %rbx
leaq 0xa555(%rip), %rsi      # 0x18881
movl $0x37, %edx
movq %rax, %rdi
callq 0x42f0
movq %rbx, %rdi
callq 0x4130
jmp 0xe45d
movq 0x11ca3(%rip), %rdi     # 0x1fff0
leaq 0xa626(%rip), %rsi      # 0x1897a
movl $0x20, %edx
movq 0xb0(%rsp), %rbx
callq 0x42f0
movq 0x218(%rbx), %rsi
movq 0x220(%rbx), %rdx
movq 0x11c75(%rip), %rdi     # 0x1fff0
callq 0x42f0
movq %rax, %rbx
leaq 0xa1e2(%rip), %rsi      # 0x1856c
movl $0xa, %edx
movq %rax, %rdi
callq 0x42f0
movq %rbx, %rdi
callq 0x4130
jmp 0xe3fa
movq 0x11c48(%rip), %rdi     # 0x1fff0
leaq 0xa4a7(%rip), %rsi      # 0x18856
movl $0x13, %edx
callq 0x42f0
movq 0xb0(%rsp), %rax
movq 0x218(%rax), %rsi
movq 0x220(%rax), %rdx
movq 0x11c1a(%rip), %rdi     # 0x1fff0
callq 0x42f0
movq %rax, %rbx
leaq 0xa485(%rip), %rsi      # 0x1886a
movl $0x16, %edx
movq %rax, %rdi
callq 0x42f0
movq %rbx, %rdi
callq 0x4130
movl $0x2, %edi
callq 0x4320
movq 0x11be5(%rip), %rdi     # 0x1fff0
leaq 0xa444(%rip), %rsi      # 0x18856
movl $0x13, %edx
callq 0x42f0
movq 0xb0(%rsp), %rax
movq 0x218(%rax), %rsi
movq 0x220(%rax), %rdx
movq 0x11bb7(%rip), %rdi     # 0x1fff0
callq 0x42f0
movq %rax, %rbx
leaq 0xa439(%rip), %rsi      # 0x18881
movl $0x37, %edx
movq %rax, %rdi
callq 0x42f0
movq %rbx, %rdi
callq 0x4130
movl $0x3, %edi
callq 0x4320
movq %rax, %rbx
jmp 0xe96b
movq %rax, %rbx
jmp 0xe98c
jmp 0xe805
jmp 0xe805
jmp 0xe559
movq %rdx, %r14
movq %rax, %rbx
movl $0x8, %esi
movq 0x68(%rsp), %rdi
callq 0x42d0
jmp 0xe4a3
movq %rdx, %r14
movq %rax, %rbx
cmpl $0x2, %r14d
jne 0xe9ec
movq %rbx, %rdi
callq 0x4340
leaq 0x80(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x70(%rsp), %rdi
callq 0x7720
movq %rbx, %rdi
callq 0x4110
movq 0x11b0c(%rip), %rdi     # 0x1fff0
leaq 0xa23a(%rip), %rsi      # 0x18725
movl $0x7, %edx
callq 0x42f0
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
movq 0x11aea(%rip), %rdi     # 0x1fff0
callq 0x42f0
movq %rax, %rdi
callq 0x4130
jmp 0xe922
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0xe535
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x42d0
callq 0x4480
jmp 0xe9ec
movq %rax, %rbx
jmp 0xea0b
movq %rax, %rbx
jmp 0xea2c
jmp 0xe805
jmp 0xe805
movq %rax, %rbx
cmpl $0x1, %edx
jne 0xe95e
movq %rbx, %rdi
callq 0x4110
movq %rax, %rbx
movq 0x11a79(%rip), %rdi     # 0x1fff0
leaq 0xa41d(%rip), %rsi      # 0x1899b
movl $0x1d, %edx
callq 0x42f0
movq 0xb0(%rsp), %rax
movq 0x218(%rax), %rsi
movq 0x220(%rax), %rdx
movq 0x11a4b(%rip), %rdi     # 0x1fff0
callq 0x42f0
movq %rax, %r14
leaq 0xa449(%rip), %rsi      # 0x189fd
movl $0xc, %edx
movq %rax, %rdi
callq 0x42f0
movq 0x18(%rbx), %rsi
movl 0x10(%rbx), %edx
movq (%rsi), %rax
leaq 0x70(%rsp), %rdi
callq *0x20(%rax)
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
movq %r14, %rdi
callq 0x42f0
movq %rax, %rdi
callq 0x41b0
leaq 0x70(%rsp), %rdi
callq 0x47fb
movq %rax, %rbx
leaq 0x80(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xe622
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x42d0
jmp 0xe622
jmp 0xe61f
movq %rax, %rbx
callq 0x4480
jmp 0xe95e
jmp 0xe646
jmp 0xe805
jmp 0xe733
movq %r12, %r15
movq %rdx, %r14
movq %rax, %rbx
jmp 0xe759
movq %rax, %rbx
cmpl $0x1, %edx
jne 0xea77
movq %rbx, %rdi
callq 0x4110
movq %rax, %rbx
movq 0x1198c(%rip), %rdi     # 0x1fff0
leaq 0xa1ce(%rip), %rsi      # 0x18839
movl $0x1c, %edx
callq 0x42f0
movq 0xb0(%rsp), %rax
movq 0x218(%rax), %rsi
movq 0x220(%rax), %rdx
movq 0x1195e(%rip), %rdi     # 0x1fff0
callq 0x42f0
movq %rax, %r14
leaq 0xa170(%rip), %rsi      # 0x18811
movl $0x2, %edx
movq %rax, %rdi
callq 0x42f0
movq 0x18(%rbx), %rsi
movl 0x10(%rbx), %edx
movq (%rsi), %rax
leaq 0x140(%rsp), %rdi
callq *0x20(%rax)
movq 0x140(%rsp), %rsi
movq 0x148(%rsp), %rdx
movq %r14, %rdi
callq 0x42f0
movq %rax, %rdi
callq 0x41b0
leaq 0x140(%rsp), %rdi
callq 0x47e1
movq %rax, %rbx
movq 0x140(%rsp), %rdi
leaq 0x150(%rsp), %rax
cmpq %rax, %rdi
je 0xe71f
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x42d0
jmp 0xe71f
jmp 0xe71c
movq %rax, %rbx
callq 0x4480
jmp 0xea77
jmp 0xe9e9
jmp 0xe95b
movq %rdx, %r14
movq %rax, %rbx
movq 0x140(%rsp), %rdi
movq %r12, %r15
cmpq %r12, %rdi
je 0xe759
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x42d0
cmpl $0x1, %r14d
jne 0xea9c
movq %rbx, %rdi
callq 0x4110
movq %rax, %rbx
movq 0x1187b(%rip), %rdi     # 0x1fff0
leaq 0xa266(%rip), %rsi      # 0x189e2
movl $0x27, %edx
callq 0x42f0
movq 0x18(%rbx), %rsi
movl 0x10(%rbx), %edx
movq (%rsi), %rax
leaq 0x140(%rsp), %rdi
callq *0x20(%rax)
movq 0x140(%rsp), %rsi
movq 0x148(%rsp), %rdx
movq 0x1183e(%rip), %rdi     # 0x1fff0
callq 0x42f0
movq %rax, %rdi
callq 0x41b0
leaq 0x140(%rsp), %rdi
callq 0x47c7
movq %rax, %rbx
movq 0x140(%rsp), %rdi
cmpq %r15, %rdi
je 0xe7f3
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x42d0
jmp 0xe7f3
jmp 0xe7f0
movq %rax, %rbx
callq 0x4480
jmp 0xea9c
movq %rax, %rbx
jmp 0xe9fe
movq %rax, %rbx
jmp 0xea77
jmp 0xe9e9
movq %rax, %rbx
cmpl $0x2, %edx
jne 0xe9ec
movq %rbx, %rdi
callq 0x4340
leaq 0x80(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x70(%rsp), %rdi
callq 0x7720
movq %rbx, %rdi
callq 0x4110
movq 0x1179b(%rip), %rdi     # 0x1fff0
leaq 0x9ec9(%rip), %rsi      # 0x18725
movl $0x7, %edx
callq 0x42f0
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
movq 0x11779(%rip), %rdi     # 0x1fff0
callq 0x42f0
movq %rax, %rdi
callq 0x4130
jmp 0xe922
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0xe8a6
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x42d0
callq 0x4480
jmp 0xe9ec
movq %rax, %rbx
cmpl $0x2, %edx
jne 0xe9ec
movq %rbx, %rdi
callq 0x4340
leaq 0x80(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x70(%rsp), %rdi
callq 0x7720
movq %rbx, %rdi
callq 0x4110
movq 0x116fd(%rip), %rdi     # 0x1fff0
leaq 0x9e2b(%rip), %rsi      # 0x18725
movl $0x7, %edx
callq 0x42f0
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
movq 0x116db(%rip), %rdi     # 0x1fff0
callq 0x42f0
movq %rax, %rdi
callq 0x4130
movl $0x5, %edi
callq 0x4320
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0xe949
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x42d0
callq 0x4480
jmp 0xe9ec
movq %rax, %rdi
callq 0x7714
movq %rax, %rbx
leaq 0x140(%rsp), %rdi
callq 0x4400
movq 0x1163e(%rip), %rsi     # 0x1ffb0
leaq 0x340(%rsp), %rdi
callq 0x4200
leaq 0x3c0(%rsp), %rdi
callq 0x40f0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0xe9a8
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0xe9cd
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
jne 0xea6a
jmp 0xea77
jmp 0xe9e9
jmp 0xe9e9
movq %rax, %rbx
leaq 0x48(%rsp), %r12
leaq 0xa0(%rsp), %r13
leaq 0x20(%rsp), %rbp
leaq 0x140(%rsp), %rdi
callq 0x4400
movq 0x1159e(%rip), %rsi     # 0x1ffb0
leaq 0x340(%rsp), %rdi
callq 0x4200
leaq 0x3c0(%rsp), %rdi
callq 0x40f0
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0xea43
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x90(%rsp), %rdi
cmpq %r13, %rdi
je 0xea60
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x38(%rsp), %rdi
cmpq %r12, %rdi
je 0xea77
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x110(%rsp), %rdi
leaq 0x120(%rsp), %rax
cmpq %rax, %rdi
je 0xea9c
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x42d0
movq %rbx, %rdi
callq 0x44e0