// File: tonymugen[P]sampleSNPs/varfiles.cpp
// Function: sampFiles::BedFileI::sample(sampFiles::BedFileO&, unsigned long const&)
void BedFileI::sample(BedFileO &out, const uint64_t &n){

	if (n == 0) {
		cerr << "WARNING: zero SNPs requested. Nothing to be done." << endl;
		return;
	}
	// start by figuring out the number of SNPs in the .bed file
	if (out._varFile.is_open()) {
		out.close();
	}
	// First have to know the number of lines
	string outFam  = out._fileStub + ".fam";
	string famName = _fileStub + ".fam";

	try {
		_famFile.open(famName.c_str(), ios::in);
		if (!_famFile.is_open()) {
			cerr << "ERROR: failed to open .fam file " << famName << " for input" << endl;
			exit(2);
		}

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

	try {
		out._famFile.open(outFam.c_str(), ios::out | ios::trunc);
		if (!out._famFile.is_open()) {
			cerr << "ERROR: failed to open .fam file " << outFam << " for output" << endl;
			exit(2);
		}

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

	_nCols        = _famLines(out._famFile); // copying the .fam file
    uint64_t N    = _numLines(); // number of SNPs in the .bed file
    uint64_t Nbed = (_nCols/4UL) + static_cast<uint64_t>( (_nCols%4UL) > 0UL );
	_varFile.close();

	// Test for potential problems
	string inBim  = _fileStub + ".bim";
	string outBim = out._fileStub + ".bim";
	if (N < n) {
		cerr << "ERROR: requested a sample of " << n << " SNPs that is greater than the number of SNPs (" << N << ") in the input file." << endl;
		return;
	} else if (N == n) {
		cerr << "WARNING: sample size (" << n << ") the same as the number of SNPs (" << N << ") in the input file. Simply copying the files." << endl;
		char *buf;
		const size_t bufSize = BUF_SIZE;
		try {
			buf = new char[bufSize];
		} catch (bad_alloc&) {
			cerr << "ERROR: failed to allocate buffer" << endl;
			exit(4);
		}

		// Copy .bed
		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);
		}
		try {
			out._varFile.open(out._fileName.c_str(), ios::out);
			if (!out._varFile.is_open()) {
				cerr << "ERROR: failed to open .bed file " << out._fileName << " for output" << endl;
				exit(2);
			}

		} catch (system_error &error) {
			cerr << "ERROR: cannot open .bed file " << out._fileName << " for output: " << error.code().message() << flush;
			perror(" ");
			exit(1);
		}
		while (_varFile) {
			_varFile.read(buf, bufSize);
			out._varFile.write(buf, _varFile.gcount()); // must be gcount() in case we got to the end of the file
		}
		_varFile.close();
		out._varFile.close();

		// Copy .bim
		try {
			_bimFile.open(inBim.c_str(), ios::in);
			if (!_bimFile.is_open()) {
				cerr << "ERROR: failed to open .bim file " << inBim << " for input" << endl;
				exit(2);
			}

		} catch (system_error &error) {
			cerr << "ERROR: cannot open .bim file " << inBim << " for input: " << error.code().message() << flush;
			perror(" ");
			exit(1);
		}
		try {
			out._bimFile.open(outBim.c_str(), ios::out);
			if (!out._bimFile.is_open()) {
				cerr << "ERROR: failed to open .bim file " << outBim << " for output" << endl;
				exit(2);
			}

		} catch (system_error &error) {
			cerr << "ERROR: cannot open .bim file " << outBim << " for output: " << error.code().message() << flush;
			perror(" ");
			exit(1);
		}
		while (_bimFile) {
			_bimFile.read(buf, bufSize);
			out._bimFile.write(buf, _bimFile.gcount());
		}
		_bimFile.close();
		out._bimFile.close();
		delete [] buf;
		return;
	}

	// Passed all the tests, proceed to sampling
	char *SNPbuf;
	try {
		SNPbuf = new char[Nbed]; // .read() does not append a null-character
	} catch (bad_alloc &) {
		cerr << "ERROR: failed to allocate the SNP buffer" << endl;
		exit(4);

	}
	string bimLine;

	try {
		_bimFile.open(inBim.c_str(), ios::in);
		if (!_bimFile.is_open()) {
			cerr << "ERROR: failed to open .bim file " << inBim << " for input" << endl;
			exit(2);
		}

	} catch (system_error &error) {
		cerr << "ERROR: cannot open .bim file " << inBim << " for input: " << error.code().message() << flush;
		perror(" ");
		exit(1);
	}
	try {
		out._bimFile.open(outBim.c_str(), ios::out);
		if (!out._bimFile.is_open()) {
			cerr << "ERROR: failed to open .bim file " << outBim << " for output" << endl;
			exit(2);
		}


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

	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);
	}
	try {
		out._varFile.open(out._fileName.c_str(), ios::out | ios::binary | ios::trunc);
		if (!out._varFile.is_open()) {
			cerr << "ERROR: failed to open .bed file " << out._fileName << " for output" << endl;
			exit(2);
		}

		// write the magic bytes and the SNP-major status byte
		char magic[3] = {static_cast<char>(0x6C), static_cast<char>(0x1B), static_cast<char>(0x01)};
		out._varFile.write(magic, 3);

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

	uint64_t nloc = n; // local copy of n
	uint64_t S;
	uint64_t cumS = 0; // cumulative position in the file
	RanDraw *snpSamp;  // so that I can catch RanDraw constructor exceptions
	try {
		snpSamp = new RanDraw();
	} catch (string error) {
		cerr << "ERROR: " << error << endl;
		exit(5);
	}
	while (nloc) {
		try {
			S = snpSamp->vitter(nloc, 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(SNPbuf, Nbed);
		cumS++;                        // step up cumS because seekg() will not change it (unlike the getline() that automatially advances)
		out._varFile.write(SNPbuf, Nbed);
		while (S) { // skipping S lines in the bim file
			_bimFile.ignore(numeric_limits<streamsize>::max(), '\n');
			S--;
		}
		getline(_bimFile, bimLine);
		out._bimFile << bimLine << endl;
		nloc--;

	}
	_varFile.close();
	out._varFile.close();
	_bimFile.close();
	out._bimFile.close();
	delete [] SNPbuf;
	delete snpSamp;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x7e0, %rsp            # imm = 0x7E0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x338(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
jne 0xff23
movq 0x1c0ed(%rip), %rdi     # 0x2bff0
leaq 0x136a2(%rip), %rsi     # 0x235ac
callq 0x4310
movq %rax, %rdi
movq 0x1c097(%rip), %rsi     # 0x2bfb0
callq 0x4350
jmp 0x12136
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0x45e0
testb $0x1, %al
jne 0xff36
jmp 0xff40
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq -0x10(%rbp), %rsi
addq $0x668, %rsi            # imm = 0x668
leaq 0x1382b(%rip), %rdx     # 0x2377d
movq %rdx, -0x340(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x7920
movq -0x338(%rbp), %rsi
movq -0x340(%rbp), %rdx
addq $0x668, %rsi            # imm = 0x668
leaq -0x58(%rbp), %rdi
callq 0x7920
jmp 0xff82
movq -0x338(%rbp), %rax
addq $0x248, %rax            # imm = 0x248
movq %rax, -0x348(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x4140
movq -0x348(%rbp), %rdi
movq %rax, %rsi
movl $0x8, %edx
callq 0x42f0
jmp 0xffb5
movq -0x338(%rbp), %rdi
addq $0x248, %rdi            # imm = 0x248
callq 0x45e0
movb %al, -0x349(%rbp)
jmp 0xffd0
movb -0x349(%rbp), %al
testb $0x1, %al
jne 0x10154
jmp 0xffe0
movq 0x1c009(%rip), %rdi     # 0x2bff0
leaq 0x13794(%rip), %rsi     # 0x23782
callq 0x4310
movq %rax, -0x358(%rbp)
jmp 0xfffc
movq -0x358(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x42e0
movq %rax, -0x360(%rbp)
jmp 0x10015
movq -0x360(%rbp), %rdi
leaq 0x13531(%rip), %rsi     # 0x23554
callq 0x4310
movq %rax, -0x368(%rbp)
jmp 0x10031
movq -0x368(%rbp), %rdi
movq 0x1bf71(%rip), %rsi     # 0x2bfb0
callq 0x4350
jmp 0x10046
movl $0x2, %edi
callq 0x4400
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x1216c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x12163
movq -0x60(%rbp), %rdi
callq 0x4130
movq %rax, -0x70(%rbp)
movq 0x1bf5f(%rip), %rdi     # 0x2bff0
leaq 0x1370b(%rip), %rsi     # 0x237a3
callq 0x4310
movq %rax, -0x370(%rbp)
jmp 0x100a6
movq -0x370(%rbp), %rdi
movq -0x338(%rbp), %rsi
addq $0x218, %rsi            # imm = 0x218
callq 0x42e0
movq %rax, -0x378(%rbp)
jmp 0x100c9
movq -0x378(%rbp), %rdi
leaq 0x1390e(%rip), %rsi     # 0x239e5
callq 0x4310
movq %rax, -0x380(%rbp)
jmp 0x100e5
movq -0x70(%rbp), %rdi
callq 0x1ee90
movq %rax, %rsi
leaq -0x90(%rbp), %rdi
callq 0x1eeb0
jmp 0x100ff
movq -0x380(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x42e0
movq %rax, -0x388(%rbp)
jmp 0x1011b
movq -0x388(%rbp), %rdi
movq 0x1be9f(%rip), %rsi     # 0x2bfc8
callq 0x4350
jmp 0x10130
leaq -0x90(%rbp), %rdi
callq 0x46d8
leaq 0x136b7(%rip), %rdi     # 0x237fa
callq 0x42a0
jmp 0x1014a
movl $0x1, %edi
callq 0x4400
jmp 0x10188
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x1017c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x46d8
callq 0x4580
jmp 0x10183
jmp 0x12163
movq -0x10(%rbp), %rax
addq $0x248, %rax            # imm = 0x248
movq %rax, -0x3a0(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x4140
movq %rax, -0x398(%rbp)
movl $0x10, %edi
movl $0x20, %esi
callq 0x1ee70
movl %eax, -0x38c(%rbp)
jmp 0x101c0
movl -0x38c(%rbp), %edx
movq -0x398(%rbp), %rsi
movq -0x3a0(%rbp), %rdi
callq 0x42f0
jmp 0x101db
movq -0x10(%rbp), %rdi
addq $0x248, %rdi            # imm = 0x248
callq 0x45e0
movb %al, -0x3a1(%rbp)
jmp 0x101f3
movb -0x3a1(%rbp), %al
testb $0x1, %al
jne 0x10369
jmp 0x10203
movq 0x1bde6(%rip), %rdi     # 0x2bff0
leaq 0x13571(%rip), %rsi     # 0x23782
callq 0x4310
movq %rax, -0x3b0(%rbp)
jmp 0x1021f
movq -0x3b0(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x42e0
movq %rax, -0x3b8(%rbp)
jmp 0x10238
movq -0x3b8(%rbp), %rdi
leaq 0x13484(%rip), %rsi     # 0x236ca
callq 0x4310
movq %rax, -0x3c0(%rbp)
jmp 0x10254
movq -0x3c0(%rbp), %rdi
movq 0x1bd4e(%rip), %rsi     # 0x2bfb0
callq 0x4350
jmp 0x10269
movl $0x2, %edi
callq 0x4400
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x12163
movq -0x60(%rbp), %rdi
callq 0x4130
movq %rax, -0x98(%rbp)
movq 0x1bd4a(%rip), %rdi     # 0x2bff0
leaq 0x134f6(%rip), %rsi     # 0x237a3
callq 0x4310
movq %rax, -0x3c8(%rbp)
jmp 0x102bb
movq -0x3c8(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x218, %rsi            # imm = 0x218
callq 0x42e0
movq %rax, -0x3d0(%rbp)
jmp 0x102db
movq -0x3d0(%rbp), %rdi
leaq 0x133ed(%rip), %rsi     # 0x236d6
callq 0x4310
movq %rax, -0x3d8(%rbp)
jmp 0x102f7
movq -0x98(%rbp), %rdi
callq 0x1ee90
movq %rax, %rsi
leaq -0xb8(%rbp), %rdi
callq 0x1eeb0
jmp 0x10314
movq -0x3d8(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x42e0
movq %rax, -0x3e0(%rbp)
jmp 0x10330
movq -0x3e0(%rbp), %rdi
movq 0x1bc8a(%rip), %rsi     # 0x2bfc8
callq 0x4350
jmp 0x10345
leaq -0xb8(%rbp), %rdi
callq 0x46d8
leaq 0x134a2(%rip), %rdi     # 0x237fa
callq 0x42a0
jmp 0x1035f
movl $0x1, %edi
callq 0x4400
jmp 0x1039d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x10391
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x46d8
callq 0x4580
jmp 0x10398
jmp 0x12163
movq -0x338(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x248, %rsi            # imm = 0x248
callq 0xc1c0
movq %rax, -0x3e8(%rbp)
jmp 0x103bd
movq -0x338(%rbp), %rdi
movq -0x3e8(%rbp), %rax
movq %rax, 0x238(%rdi)
callq 0xb9e0
movq %rax, -0x3f0(%rbp)
jmp 0x103e0
movq -0x338(%rbp), %rdi
movq -0x3f0(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq 0x238(%rdi), %rcx
movq %rcx, %rax
shrq $0x2, %rax
andl $0x3, %ecx
subq $0x1, %rcx
sbbq $-0x1, %rax
movq %rax, -0xc8(%rbp)
addq $0x8, %rdi
callq 0x4060
jmp 0x10420
movq -0x338(%rbp), %rsi
addq $0x668, %rsi            # imm = 0x668
leaq 0x133e7(%rip), %rdx     # 0x2381c
leaq -0xe8(%rbp), %rdi
callq 0x7920
jmp 0x10443
movq -0x10(%rbp), %rsi
addq $0x668, %rsi            # imm = 0x668
leaq 0x133c7(%rip), %rdx     # 0x2381c
leaq -0x108(%rbp), %rdi
callq 0x7920
jmp 0x10463
movq -0xc0(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x1055a
movq 0x1bb72(%rip), %rdi     # 0x2bff0
leaq 0x13159(%rip), %rsi     # 0x235de
callq 0x4310
movq %rax, -0x3f8(%rbp)
jmp 0x10493
movq -0x3f8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
callq 0x40d0
movq %rax, -0x400(%rbp)
jmp 0x104af
movq -0x400(%rbp), %rdi
leaq 0x13423(%rip), %rsi     # 0x238e0
callq 0x4310
movq %rax, -0x408(%rbp)
jmp 0x104cb
movq -0x408(%rbp), %rdi
movq -0xc0(%rbp), %rsi
callq 0x40d0
movq %rax, -0x410(%rbp)
jmp 0x104e7
movq -0x410(%rbp), %rdi
leaq 0x13137(%rip), %rsi     # 0x2362c
callq 0x4310
movq %rax, -0x418(%rbp)
jmp 0x10503
movq -0x418(%rbp), %rdi
movq 0x1ba9f(%rip), %rsi     # 0x2bfb0
callq 0x4350
jmp 0x10518
movl $0x1, -0x10c(%rbp)
jmp 0x1210c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x12163
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x12157
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x1214b
movq -0xc0(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq (%rcx), %rax
jne 0x111d2
movq 0x1ba7b(%rip), %rdi     # 0x2bff0
leaq 0x130c5(%rip), %rsi     # 0x23641
callq 0x4310
movq %rax, -0x420(%rbp)
jmp 0x1058a
movq -0x420(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
callq 0x40d0
movq %rax, -0x428(%rbp)
jmp 0x105a6
movq -0x428(%rbp), %rdi
leaq 0x1335c(%rip), %rsi     # 0x23910
callq 0x4310
movq %rax, -0x430(%rbp)
jmp 0x105c2
movq -0x430(%rbp), %rdi
movq -0xc0(%rbp), %rsi
callq 0x40d0
movq %rax, -0x438(%rbp)
jmp 0x105de
movq -0x438(%rbp), %rdi
leaq 0x13347(%rip), %rsi     # 0x23933
callq 0x4310
movq %rax, -0x440(%rbp)
jmp 0x105fa
movq -0x440(%rbp), %rdi
movq 0x1b9a8(%rip), %rsi     # 0x2bfb0
callq 0x4350
jmp 0x1060f
movq $0xa00000, -0x120(%rbp) # imm = 0xA00000
movl $0xa00000, %edi         # imm = 0xA00000
callq 0x4030
movq %rax, -0x448(%rbp)
jmp 0x1062d
movq -0x448(%rbp), %rax
movq %rax, -0x118(%rbp)
jmp 0x106bc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movl $0x2, %ecx
cmpl %ecx, %eax
jne 0x1214b
movq -0x60(%rbp), %rdi
callq 0x4130
movq %rax, -0x128(%rbp)
movq 0x1b980(%rip), %rdi     # 0x2bff0
leaq 0x13032(%rip), %rsi     # 0x236a9
callq 0x4310
movq %rax, -0x450(%rbp)
jmp 0x10685
movq -0x450(%rbp), %rdi
movq 0x1b91d(%rip), %rsi     # 0x2bfb0
callq 0x4350
jmp 0x1069a
movl $0x4, %edi
callq 0x4400
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
callq 0x4580
jmp 0x106b7
jmp 0x1214b
movq -0x338(%rbp), %rdi
movq %rdi, %rax
addq $0x8, %rax
movq %rax, -0x468(%rbp)
addq $0x218, %rdi            # imm = 0x218
callq 0x4140
movq %rax, -0x460(%rbp)
movl $0x8, %edi
movl $0x4, %esi
callq 0x1ee70
movl %eax, -0x454(%rbp)
jmp 0x106fb
movl -0x454(%rbp), %edx
movq -0x460(%rbp), %rsi
movq -0x468(%rbp), %rdi
callq 0x42f0
jmp 0x10716
movq -0x338(%rbp), %rdi
addq $0x8, %rdi
callq 0x45e0
movb %al, -0x469(%rbp)
jmp 0x1072e
movb -0x469(%rbp), %al
testb $0x1, %al
jne 0x108b1
jmp 0x1073e
movq 0x1b8ab(%rip), %rdi     # 0x2bff0
leaq 0x13216(%rip), %rsi     # 0x23962
callq 0x4310
movq %rax, -0x478(%rbp)
jmp 0x1075a
movq -0x478(%rbp), %rdi
movq -0x338(%rbp), %rsi
addq $0x218, %rsi            # imm = 0x218
callq 0x42e0
movq %rax, -0x480(%rbp)
jmp 0x1077d
movq -0x480(%rbp), %rdi
leaq 0x12dc9(%rip), %rsi     # 0x23554
callq 0x4310
movq %rax, -0x488(%rbp)
jmp 0x10799
movq -0x488(%rbp), %rdi
movq 0x1b809(%rip), %rsi     # 0x2bfb0
callq 0x4350
jmp 0x107ae
movl $0x2, %edi
callq 0x4400
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1214b
movq -0x60(%rbp), %rdi
callq 0x4130
movq %rax, -0x138(%rbp)
movq 0x1b805(%rip), %rdi     # 0x2bff0
leaq 0x13191(%rip), %rsi     # 0x23983
callq 0x4310
movq %rax, -0x490(%rbp)
jmp 0x10800
movq -0x490(%rbp), %rdi
movq -0x338(%rbp), %rsi
addq $0x218, %rsi            # imm = 0x218
callq 0x42e0
movq %rax, -0x498(%rbp)
jmp 0x10823
movq -0x498(%rbp), %rdi
leaq 0x131b4(%rip), %rsi     # 0x239e5
callq 0x4310
movq %rax, -0x4a0(%rbp)
jmp 0x1083f
movq -0x138(%rbp), %rdi
callq 0x1ee90
movq %rax, %rsi
leaq -0x158(%rbp), %rdi
callq 0x1eeb0
jmp 0x1085c
movq -0x4a0(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0x42e0
movq %rax, -0x4a8(%rbp)
jmp 0x10878
movq -0x4a8(%rbp), %rdi
movq 0x1b742(%rip), %rsi     # 0x2bfc8
callq 0x4350
jmp 0x1088d
leaq -0x158(%rbp), %rdi
callq 0x46d8
leaq 0x12f5a(%rip), %rdi     # 0x237fa
callq 0x42a0
jmp 0x108a7
movl $0x1, %edi
callq 0x4400
movq -0x338(%rbp), %rdi
addq $0x8, %rdi
leaq -0x12b(%rbp), %rsi
movl $0x3, %edx
callq 0x4450
jmp 0x108cf
movsbl -0x12b(%rbp), %eax
cmpl $0x6c, %eax
jne 0x108e7
movsbl -0x12a(%rbp), %eax
cmpl $0x1b, %eax
je 0x10961
movq 0x1b702(%rip), %rdi     # 0x2bff0
leaq 0x12f49(%rip), %rsi     # 0x2383e
callq 0x4310
movq %rax, -0x4b0(%rbp)
jmp 0x10903
movq -0x4b0(%rbp), %rdi
movq -0x338(%rbp), %rsi
addq $0x218, %rsi            # imm = 0x218
callq 0x42e0
movq %rax, -0x4b8(%rbp)
jmp 0x10926
movq -0x4b8(%rbp), %rdi
leaq 0x12f1e(%rip), %rsi     # 0x23852
callq 0x4310
movq %rax, -0x4c0(%rbp)
jmp 0x10942
movq -0x4c0(%rbp), %rdi
movq 0x1b660(%rip), %rsi     # 0x2bfb0
callq 0x4350
jmp 0x10957
movl $0x2, %edi
callq 0x4400
movsbl -0x129(%rbp), %eax
cmpl $0x1, %eax
je 0x109e7
movq 0x1b67c(%rip), %rdi     # 0x2bff0
leaq 0x12ec3(%rip), %rsi     # 0x2383e
callq 0x4310
movq %rax, -0x4c8(%rbp)
jmp 0x10989
movq -0x4c8(%rbp), %rdi
movq -0x338(%rbp), %rsi
addq $0x218, %rsi            # imm = 0x218
callq 0x42e0
movq %rax, -0x4d0(%rbp)
jmp 0x109ac
movq -0x4d0(%rbp), %rdi
leaq 0x12eaf(%rip), %rsi     # 0x23869
callq 0x4310
movq %rax, -0x4d8(%rbp)
jmp 0x109c8
movq -0x4d8(%rbp), %rdi
movq 0x1b5da(%rip), %rsi     # 0x2bfb0
callq 0x4350
jmp 0x109dd
movl $0x3, %edi
callq 0x4400
jmp 0x109e9
jmp 0x10a1d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x10a11
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x46d8
callq 0x4580
jmp 0x10a18
jmp 0x1214b
movq -0x10(%rbp), %rdi
movq %rdi, %rax
addq $0x8, %rax
movq %rax, -0x4e0(%rbp)
addq $0x218, %rdi            # imm = 0x218
callq 0x4140
movq -0x4e0(%rbp), %rdi
movq %rax, %rsi
movl $0x10, %edx
callq 0x42f0
jmp 0x10a51
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0x45e0
movb %al, -0x4e1(%rbp)
jmp 0x10a66
movb -0x4e1(%rbp), %al
testb $0x1, %al
jne 0x10be3
jmp 0x10a76
movq 0x1b573(%rip), %rdi     # 0x2bff0
leaq 0x12ede(%rip), %rsi     # 0x23962
callq 0x4310
movq %rax, -0x4f0(%rbp)
jmp 0x10a92
movq -0x4f0(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x218, %rsi            # imm = 0x218
callq 0x42e0
movq %rax, -0x4f8(%rbp)
jmp 0x10ab2
movq -0x4f8(%rbp), %rdi
leaq 0x12c0a(%rip), %rsi     # 0x236ca
callq 0x4310
movq %rax, -0x500(%rbp)
jmp 0x10ace
movq -0x500(%rbp), %rdi
movq 0x1b4d4(%rip), %rsi     # 0x2bfb0
callq 0x4350
jmp 0x10ae3
movl $0x2, %edi
callq 0x4400
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1214b
movq -0x60(%rbp), %rdi
callq 0x4130
movq %rax, -0x160(%rbp)
movq 0x1b4d0(%rip), %rdi     # 0x2bff0
leaq 0x12e5c(%rip), %rsi     # 0x23983
callq 0x4310
movq %rax, -0x508(%rbp)
jmp 0x10b35
movq -0x508(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x218, %rsi            # imm = 0x218
callq 0x42e0
movq %rax, -0x510(%rbp)
jmp 0x10b55
movq -0x510(%rbp), %rdi
leaq 0x12b73(%rip), %rsi     # 0x236d6
callq 0x4310
movq %rax, -0x518(%rbp)
jmp 0x10b71
movq -0x160(%rbp), %rdi
callq 0x1ee90
movq %rax, %rsi
leaq -0x180(%rbp), %rdi
callq 0x1eeb0
jmp 0x10b8e
movq -0x518(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x42e0
movq %rax, -0x520(%rbp)
jmp 0x10baa
movq -0x520(%rbp), %rdi
movq 0x1b410(%rip), %rsi     # 0x2bfc8
callq 0x4350
jmp 0x10bbf
leaq -0x180(%rbp), %rdi
callq 0x46d8
leaq 0x12c28(%rip), %rdi     # 0x237fa
callq 0x42a0
jmp 0x10bd9
movl $0x1, %edi
callq 0x4400
jmp 0x10c17
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x10c0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x46d8
callq 0x4580
jmp 0x10c12
jmp 0x1214b
jmp 0x10c19
movq -0x338(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x18(%rcx), %rcx
leaq 0x8(%rax,%rcx), %rdi
callq 0x4440
movb %al, -0x521(%rbp)
jmp 0x10c3a
movb -0x521(%rbp), %al
testb $0x1, %al
jne 0x10c46
jmp 0x10cbb
movq -0x338(%rbp), %rdi
addq $0x8, %rdi
movq -0x118(%rbp), %rsi
movl $0xa00000, %edx         # imm = 0xA00000
callq 0x4450
jmp 0x10c64
movq -0x338(%rbp), %rdi
movq -0x10(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x540(%rbp)
movq -0x118(%rbp), %rax
movq %rax, -0x538(%rbp)
addq $0x8, %rdi
callq 0x46c0
movq %rax, -0x530(%rbp)
jmp 0x10c9a
movq -0x530(%rbp), %rdx
movq -0x538(%rbp), %rsi
movq -0x540(%rbp), %rdi
callq 0x44a0
jmp 0x10cb6
jmp 0x10c19
movq -0x338(%rbp), %rdi
addq $0x8, %rdi
callq 0x4060
jmp 0x10ccd
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0x4060
jmp 0x10cdc
movq -0x338(%rbp), %rax
addq $0x458, %rax            # imm = 0x458
movq %rax, -0x548(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x4140
movq -0x548(%rbp), %rdi
movq %rax, %rsi
movl $0x8, %edx
callq 0x42f0
jmp 0x10d12
movq -0x338(%rbp), %rdi
addq $0x458, %rdi            # imm = 0x458
callq 0x45e0
movb %al, -0x549(%rbp)
jmp 0x10d2d
movb -0x549(%rbp), %al
testb $0x1, %al
jne 0x10ea2
jmp 0x10d3d
movq 0x1b2ac(%rip), %rdi     # 0x2bff0
leaq 0x12b56(%rip), %rsi     # 0x238a1
callq 0x4310
movq %rax, -0x558(%rbp)
jmp 0x10d59
movq -0x558(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x42e0
movq %rax, -0x560(%rbp)
jmp 0x10d75
movq -0x560(%rbp), %rdi
leaq 0x127d1(%rip), %rsi     # 0x23554
callq 0x4310
movq %rax, -0x568(%rbp)
jmp 0x10d91
movq -0x568(%rbp), %rdi
movq 0x1b211(%rip), %rsi     # 0x2bfb0
callq 0x4350
jmp 0x10da6
movl $0x2, %edi
callq 0x4400
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1214b
movq -0x60(%rbp), %rdi
callq 0x4130
movq %rax, -0x188(%rbp)
movq 0x1b20d(%rip), %rdi     # 0x2bff0
leaq 0x12ad8(%rip), %rsi     # 0x238c2
callq 0x4310
movq %rax, -0x570(%rbp)
jmp 0x10df8
movq -0x570(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x42e0
movq %rax, -0x578(%rbp)
jmp 0x10e14
movq -0x578(%rbp), %rdi
leaq 0x12bc3(%rip), %rsi     # 0x239e5
callq 0x4310
movq %rax, -0x580(%rbp)
jmp 0x10e30
movq -0x188(%rbp), %rdi
callq 0x1ee90
movq %rax, %rsi
leaq -0x1a8(%rbp), %rdi
callq 0x1eeb0
jmp 0x10e4d
movq -0x580(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
callq 0x42e0
movq %rax, -0x588(%rbp)
jmp 0x10e69
movq -0x588(%rbp), %rdi
movq 0x1b151(%rip), %rsi     # 0x2bfc8
callq 0x4350
jmp 0x10e7e
leaq -0x1a8(%rbp), %rdi
callq 0x46d8
leaq 0x12969(%rip), %rdi     # 0x237fa
callq 0x42a0
jmp 0x10e98
movl $0x1, %edi
callq 0x4400
jmp 0x10ed6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x10eca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x1a8(%rbp), %rdi
callq 0x46d8
callq 0x4580
jmp 0x10ed1
jmp 0x1214b
movq -0x10(%rbp), %rax
addq $0x458, %rax            # imm = 0x458
movq %rax, -0x590(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x4140
movq -0x590(%rbp), %rdi
movq %rax, %rsi
movl $0x10, %edx
callq 0x42f0
jmp 0x10f09
movq -0x10(%rbp), %rdi
addq $0x458, %rdi            # imm = 0x458
callq 0x45e0
movb %al, -0x591(%rbp)
jmp 0x10f21
movb -0x591(%rbp), %al
testb $0x1, %al
jne 0x11096
jmp 0x10f31
movq 0x1b0b8(%rip), %rdi     # 0x2bff0
leaq 0x12962(%rip), %rsi     # 0x238a1
callq 0x4310
movq %rax, -0x5a0(%rbp)
jmp 0x10f4d
movq -0x5a0(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x42e0
movq %rax, -0x5a8(%rbp)
jmp 0x10f69
movq -0x5a8(%rbp), %rdi
leaq 0x12753(%rip), %rsi     # 0x236ca
callq 0x4310
movq %rax, -0x5b0(%rbp)
jmp 0x10f85
movq -0x5b0(%rbp), %rdi
movq 0x1b01d(%rip), %rsi     # 0x2bfb0
callq 0x4350
jmp 0x10f9a
movl $0x2, %edi
callq 0x4400
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1214b
movq -0x60(%rbp), %rdi
callq 0x4130
movq %rax, -0x1b0(%rbp)
movq 0x1b019(%rip), %rdi     # 0x2bff0
leaq 0x128e4(%rip), %rsi     # 0x238c2
callq 0x4310
movq %rax, -0x5b8(%rbp)
jmp 0x10fec
movq -0x5b8(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x42e0
movq %rax, -0x5c0(%rbp)
jmp 0x11008
movq -0x5c0(%rbp), %rdi
leaq 0x126c0(%rip), %rsi     # 0x236d6
callq 0x4310
movq %rax, -0x5c8(%rbp)
jmp 0x11024
movq -0x1b0(%rbp), %rdi
callq 0x1ee90
movq %rax, %rsi
leaq -0x1d0(%rbp), %rdi
callq 0x1eeb0
jmp 0x11041
movq -0x5c8(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
callq 0x42e0
movq %rax, -0x5d0(%rbp)
jmp 0x1105d
movq -0x5d0(%rbp), %rdi
movq 0x1af5d(%rip), %rsi     # 0x2bfc8
callq 0x4350
jmp 0x11072
leaq -0x1d0(%rbp), %rdi
callq 0x46d8
leaq 0x12775(%rip), %rdi     # 0x237fa
callq 0x42a0
jmp 0x1108c
movl $0x1, %edi
callq 0x4400
jmp 0x110ca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x110be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x46d8
callq 0x4580
jmp 0x110c5
jmp 0x1214b
jmp 0x110cc
movq -0x338(%rbp), %rax
movq 0x458(%rax), %rcx
movq -0x18(%rcx), %rcx
leaq 0x458(%rax,%rcx), %rdi
callq 0x4440
movb %al, -0x5d1(%rbp)
jmp 0x110f3
movb -0x5d1(%rbp), %al
testb $0x1, %al
jne 0x110ff
jmp 0x1117c
movq -0x338(%rbp), %rdi
addq $0x458, %rdi            # imm = 0x458
movq -0x118(%rbp), %rsi
movl $0xa00000, %edx         # imm = 0xA00000
callq 0x4450
jmp 0x11120
movq -0x338(%rbp), %rdi
movq -0x10(%rbp), %rax
addq $0x468, %rax            # imm = 0x468
movq %rax, -0x5f0(%rbp)
movq -0x118(%rbp), %rax
movq %rax, -0x5e8(%rbp)
addq $0x458, %rdi            # imm = 0x458
callq 0x46c0
movq %rax, -0x5e0(%rbp)
jmp 0x1115b
movq -0x5e0(%rbp), %rdx
movq -0x5e8(%rbp), %rsi
movq -0x5f0(%rbp), %rdi
callq 0x44a0
jmp 0x11177
jmp 0x110cc
movq -0x338(%rbp), %rdi
addq $0x458, %rdi            # imm = 0x458
callq 0x4060
jmp 0x11191
movq -0x10(%rbp), %rdi
addq $0x458, %rdi            # imm = 0x458
callq 0x4060
jmp 0x111a3
movq -0x118(%rbp), %rax
movq %rax, -0x5f8(%rbp)
cmpq $0x0, %rax
je 0x111c3
movq -0x5f8(%rbp), %rdi
callq 0x4480
movl $0x1, -0x10c(%rbp)
jmp 0x1210c
jmp 0x111d4
movq -0xc8(%rbp), %rdi
callq 0x4030
movq %rax, -0x600(%rbp)
jmp 0x111e9
movq -0x600(%rbp), %rax
movq %rax, -0x1d8(%rbp)
jmp 0x11278
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movl $0x2, %ecx
cmpl %ecx, %eax
jne 0x1214b
movq -0x60(%rbp), %rdi
callq 0x4130
movq %rax, -0x1e0(%rbp)
movq 0x1adc4(%rip), %rdi     # 0x2bff0
leaq 0x1276e(%rip), %rsi     # 0x239a1
callq 0x4310
movq %rax, -0x608(%rbp)
jmp 0x11241
movq -0x608(%rbp), %rdi
movq 0x1ad61(%rip), %rsi     # 0x2bfb0
callq 0x4350
jmp 0x11256
movl $0x4, %edi
callq 0x4400
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
callq 0x4580
jmp 0x11273
jmp 0x1214b
leaq -0x200(%rbp), %rdi
callq 0x44d0
movq -0x338(%rbp), %rax
addq $0x458, %rax            # imm = 0x458
movq %rax, -0x610(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x4140
movq -0x610(%rbp), %rdi
movq %rax, %rsi
movl $0x8, %edx
callq 0x42f0
jmp 0x112ba
movq -0x338(%rbp), %rdi
addq $0x458, %rdi            # imm = 0x458
callq 0x45e0
movb %al, -0x611(%rbp)
jmp 0x112d5
movb -0x611(%rbp), %al
testb $0x1, %al
jne 0x1144a
jmp 0x112e5
movq 0x1ad04(%rip), %rdi     # 0x2bff0
leaq 0x125ae(%rip), %rsi     # 0x238a1
callq 0x4310
movq %rax, -0x620(%rbp)
jmp 0x11301
movq -0x620(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x42e0
movq %rax, -0x628(%rbp)
jmp 0x1131d
movq -0x628(%rbp), %rdi
leaq 0x12229(%rip), %rsi     # 0x23554
callq 0x4310
movq %rax, -0x630(%rbp)
jmp 0x11339
movq -0x630(%rbp), %rdi
movq 0x1ac69(%rip), %rsi     # 0x2bfb0
callq 0x4350
jmp 0x1134e
movl $0x2, %edi
callq 0x4400
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1213f
movq -0x60(%rbp), %rdi
callq 0x4130
movq %rax, -0x208(%rbp)
movq 0x1ac65(%rip), %rdi     # 0x2bff0
leaq 0x12530(%rip), %rsi     # 0x238c2
callq 0x4310
movq %rax, -0x638(%rbp)
jmp 0x113a0
movq -0x638(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x42e0
movq %rax, -0x640(%rbp)
jmp 0x113bc
movq -0x640(%rbp), %rdi
leaq 0x1261b(%rip), %rsi     # 0x239e5
callq 0x4310
movq %rax, -0x648(%rbp)
jmp 0x113d8
movq -0x208(%rbp), %rdi
callq 0x1ee90
movq %rax, %rsi
leaq -0x228(%rbp), %rdi
callq 0x1eeb0
jmp 0x113f5
movq -0x648(%rbp), %rdi
leaq -0x228(%rbp), %rsi
callq 0x42e0
movq %rax, -0x650(%rbp)
jmp 0x11411
movq -0x650(%rbp), %rdi
movq 0x1aba9(%rip), %rsi     # 0x2bfc8
callq 0x4350
jmp 0x11426
leaq -0x228(%rbp), %rdi
callq 0x46d8
leaq 0x123c1(%rip), %rdi     # 0x237fa
callq 0x42a0
jmp 0x11440
movl $0x1, %edi
callq 0x4400
jmp 0x1147e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x11472
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x46d8
callq 0x4580
jmp 0x11479
jmp 0x1213f
movq -0x10(%rbp), %rax
addq $0x458, %rax            # imm = 0x458
movq %rax, -0x658(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x4140
movq -0x658(%rbp), %rdi
movq %rax, %rsi
movl $0x10, %edx
callq 0x42f0
jmp 0x114b1
movq -0x10(%rbp), %rdi
addq $0x458, %rdi            # imm = 0x458
callq 0x45e0
movb %al, -0x659(%rbp)
jmp 0x114c9
movb -0x659(%rbp), %al
testb $0x1, %al
jne 0x1163e
jmp 0x114d9
movq 0x1ab10(%rip), %rdi     # 0x2bff0
leaq 0x123ba(%rip), %rsi     # 0x238a1
callq 0x4310
movq %rax, -0x668(%rbp)
jmp 0x114f5
movq -0x668(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x42e0
movq %rax, -0x670(%rbp)
jmp 0x11511
movq -0x670(%rbp), %rdi
leaq 0x121ab(%rip), %rsi     # 0x236ca
callq 0x4310
movq %rax, -0x678(%rbp)
jmp 0x1152d
movq -0x678(%rbp), %rdi
movq 0x1aa75(%rip), %rsi     # 0x2bfb0
callq 0x4350
jmp 0x11542
movl $0x2, %edi
callq 0x4400
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1213f
movq -0x60(%rbp), %rdi
callq 0x4130
movq %rax, -0x230(%rbp)
movq 0x1aa71(%rip), %rdi     # 0x2bff0
leaq 0x1233c(%rip), %rsi     # 0x238c2
callq 0x4310
movq %rax, -0x680(%rbp)
jmp 0x11594
movq -0x680(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x42e0
movq %rax, -0x688(%rbp)
jmp 0x115b0
movq -0x688(%rbp), %rdi
leaq 0x12118(%rip), %rsi     # 0x236d6
callq 0x4310
movq %rax, -0x690(%rbp)
jmp 0x115cc
movq -0x230(%rbp), %rdi
callq 0x1ee90
movq %rax, %rsi
leaq -0x250(%rbp), %rdi
callq 0x1eeb0
jmp 0x115e9
movq -0x690(%rbp), %rdi
leaq -0x250(%rbp), %rsi
callq 0x42e0
movq %rax, -0x698(%rbp)
jmp 0x11605
movq -0x698(%rbp), %rdi
movq 0x1a9b5(%rip), %rsi     # 0x2bfc8
callq 0x4350
jmp 0x1161a
leaq -0x250(%rbp), %rdi
callq 0x46d8
leaq 0x121cd(%rip), %rdi     # 0x237fa
callq 0x42a0
jmp 0x11634
movl $0x1, %edi
callq 0x4400
jmp 0x11672
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x11666
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x46d8
callq 0x4580
jmp 0x1166d
jmp 0x1213f
movq -0x338(%rbp), %rdi
movq %rdi, %rax
addq $0x8, %rax
movq %rax, -0x6b0(%rbp)
addq $0x218, %rdi            # imm = 0x218
callq 0x4140
movq %rax, -0x6a8(%rbp)
movl $0x8, %edi
movl $0x4, %esi
callq 0x1ee70
movl %eax, -0x69c(%rbp)
jmp 0x116b1
movl -0x69c(%rbp), %edx
movq -0x6a8(%rbp), %rsi
movq -0x6b0(%rbp), %rdi
callq 0x42f0
jmp 0x116cc
movq -0x338(%rbp), %rdi
addq $0x8, %rdi
callq 0x45e0
movb %al, -0x6b1(%rbp)
jmp 0x116e4
movb -0x6b1(%rbp), %al
testb $0x1, %al
jne 0x11867
jmp 0x116f4
movq 0x1a8f5(%rip), %rdi     # 0x2bff0
leaq 0x12260(%rip), %rsi     # 0x23962
callq 0x4310
movq %rax, -0x6c0(%rbp)
jmp 0x11710
movq -0x6c0(%rbp), %rdi
movq -0x338(%rbp), %rsi
addq $0x218, %rsi            # imm = 0x218
callq 0x42e0
movq %rax, -0x6c8(%rbp)
jmp 0x11733
movq -0x6c8(%rbp), %rdi
leaq 0x11e13(%rip), %rsi     # 0x23554
callq 0x4310
movq %rax, -0x6d0(%rbp)
jmp 0x1174f
movq -0x6d0(%rbp), %rdi
movq 0x1a853(%rip), %rsi     # 0x2bfb0
callq 0x4350
jmp 0x11764
movl $0x2, %edi
callq 0x4400
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1213f
movq -0x60(%rbp), %rdi
callq 0x4130
movq %rax, -0x260(%rbp)
movq 0x1a84f(%rip), %rdi     # 0x2bff0
leaq 0x121db(%rip), %rsi     # 0x23983
callq 0x4310
movq %rax, -0x6d8(%rbp)
jmp 0x117b6
movq -0x6d8(%rbp), %rdi
movq -0x338(%rbp), %rsi
addq $0x218, %rsi            # imm = 0x218
callq 0x42e0
movq %rax, -0x6e0(%rbp)
jmp 0x117d9
movq -0x6e0(%rbp), %rdi
leaq 0x121fe(%rip), %rsi     # 0x239e5
callq 0x4310
movq %rax, -0x6e8(%rbp)
jmp 0x117f5
movq -0x260(%rbp), %rdi
callq 0x1ee90
movq %rax, %rsi
leaq -0x280(%rbp), %rdi
callq 0x1eeb0
jmp 0x11812
movq -0x6e8(%rbp), %rdi
leaq -0x280(%rbp), %rsi
callq 0x42e0
movq %rax, -0x6f0(%rbp)
jmp 0x1182e
movq -0x6f0(%rbp), %rdi
movq 0x1a78c(%rip), %rsi     # 0x2bfc8
callq 0x4350
jmp 0x11843
leaq -0x280(%rbp), %rdi
callq 0x46d8
leaq 0x11fa4(%rip), %rdi     # 0x237fa
callq 0x42a0
jmp 0x1185d
movl $0x1, %edi
callq 0x4400
movq -0x338(%rbp), %rdi
addq $0x8, %rdi
leaq -0x253(%rbp), %rsi
movl $0x3, %edx
callq 0x4450
jmp 0x11885
movsbl -0x253(%rbp), %eax
cmpl $0x6c, %eax
jne 0x1189d
movsbl -0x252(%rbp), %eax
cmpl $0x1b, %eax
je 0x11917
movq 0x1a74c(%rip), %rdi     # 0x2bff0
leaq 0x11f93(%rip), %rsi     # 0x2383e
callq 0x4310
movq %rax, -0x6f8(%rbp)
jmp 0x118b9
movq -0x6f8(%rbp), %rdi
movq -0x338(%rbp), %rsi
addq $0x218, %rsi            # imm = 0x218
callq 0x42e0
movq %rax, -0x700(%rbp)
jmp 0x118dc
movq -0x700(%rbp), %rdi
leaq 0x11f68(%rip), %rsi     # 0x23852
callq 0x4310
movq %rax, -0x708(%rbp)
jmp 0x118f8
movq -0x708(%rbp), %rdi
movq 0x1a6aa(%rip), %rsi     # 0x2bfb0
callq 0x4350
jmp 0x1190d
movl $0x2, %edi
callq 0x4400
movsbl -0x251(%rbp), %eax
cmpl $0x1, %eax
je 0x1199d
movq 0x1a6c6(%rip), %rdi     # 0x2bff0
leaq 0x11f0d(%rip), %rsi     # 0x2383e
callq 0x4310
movq %rax, -0x710(%rbp)
jmp 0x1193f
movq -0x710(%rbp), %rdi
movq -0x338(%rbp), %rsi
addq $0x218, %rsi            # imm = 0x218
callq 0x42e0
movq %rax, -0x718(%rbp)
jmp 0x11962
movq -0x718(%rbp), %rdi
leaq 0x11ef9(%rip), %rsi     # 0x23869
callq 0x4310
movq %rax, -0x720(%rbp)
jmp 0x1197e
movq -0x720(%rbp), %rdi
movq 0x1a624(%rip), %rsi     # 0x2bfb0
callq 0x4350
jmp 0x11993
movl $0x3, %edi
callq 0x4400
jmp 0x1199f
jmp 0x119d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x119c7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x280(%rbp), %rdi
callq 0x46d8
callq 0x4580
jmp 0x119ce
jmp 0x1213f
movq -0x10(%rbp), %rdi
movq %rdi, %rax
addq $0x8, %rax
movq %rax, -0x738(%rbp)
addq $0x218, %rdi            # imm = 0x218
callq 0x4140
movq %rax, -0x730(%rbp)
movl $0x10, %edi
movl $0x4, %esi
callq 0x1ee70
movl %eax, -0x724(%rbp)
jmp 0x11a0f
movl -0x724(%rbp), %edi
movl $0x20, %esi
callq 0x1ee70
movl %eax, -0x73c(%rbp)
jmp 0x11a27
movl -0x73c(%rbp), %edx
movq -0x730(%rbp), %rsi
movq -0x738(%rbp), %rdi
callq 0x42f0
jmp 0x11a42
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0x45e0
movb %al, -0x73d(%rbp)
jmp 0x11a57
movb -0x73d(%rbp), %al
testb $0x1, %al
jne 0x11bd4
jmp 0x11a67
movq 0x1a582(%rip), %rdi     # 0x2bff0
leaq 0x11eed(%rip), %rsi     # 0x23962
callq 0x4310
movq %rax, -0x748(%rbp)
jmp 0x11a83
movq -0x748(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x218, %rsi            # imm = 0x218
callq 0x42e0
movq %rax, -0x750(%rbp)
jmp 0x11aa3
movq -0x750(%rbp), %rdi
leaq 0x11c19(%rip), %rsi     # 0x236ca
callq 0x4310
movq %rax, -0x758(%rbp)
jmp 0x11abf
movq -0x758(%rbp), %rdi
movq 0x1a4e3(%rip), %rsi     # 0x2bfb0
callq 0x4350
jmp 0x11ad4
movl $0x2, %edi
callq 0x4400
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1213f
movq -0x60(%rbp), %rdi
callq 0x4130
movq %rax, -0x290(%rbp)
movq 0x1a4df(%rip), %rdi     # 0x2bff0
leaq 0x11e6b(%rip), %rsi     # 0x23983
callq 0x4310
movq %rax, -0x760(%rbp)
jmp 0x11b26
movq -0x760(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x218, %rsi            # imm = 0x218
callq 0x42e0
movq %rax, -0x768(%rbp)
jmp 0x11b46
movq -0x768(%rbp), %rdi
leaq 0x11b82(%rip), %rsi     # 0x236d6
callq 0x4310
movq %rax, -0x770(%rbp)
jmp 0x11b62
movq -0x290(%rbp), %rdi
callq 0x1ee90
movq %rax, %rsi
leaq -0x2b0(%rbp), %rdi
callq 0x1eeb0
jmp 0x11b7f
movq -0x770(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
callq 0x42e0
movq %rax, -0x778(%rbp)
jmp 0x11b9b
movq -0x778(%rbp), %rdi
movq 0x1a41f(%rip), %rsi     # 0x2bfc8
callq 0x4350
jmp 0x11bb0
leaq -0x2b0(%rbp), %rdi
callq 0x46d8
leaq 0x11c37(%rip), %rdi     # 0x237fa
callq 0x42a0
jmp 0x11bca
movl $0x1, %edi
callq 0x4400
movb $0x1, -0x282(%rbp)
movw $0x1b6c, -0x284(%rbp)   # imm = 0x1B6C
movq -0x10(%rbp), %rdi
addq $0x18, %rdi
leaq -0x284(%rbp), %rsi
movl $0x3, %edx
callq 0x44a0
jmp 0x11bff
jmp 0x11c33
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x11c27
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x2b0(%rbp), %rdi
callq 0x46d8
callq 0x4580
jmp 0x11c2e
jmp 0x1213f
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x2b8(%rbp)
movq $0x0, -0x2c8(%rbp)
movl $0x8, %edi
callq 0x4330
movq %rax, -0x780(%rbp)
jmp 0x11c5f
movq -0x780(%rbp), %rdi
callq 0x22380
jmp 0x11c6d
movq -0x780(%rbp), %rax
movq %rax, -0x2d0(%rbp)
jmp 0x11d63
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x11cab
movq -0x780(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
movl $0x8, %esi
callq 0x4340
movl -0x64(%rbp), %eax
movl $0x3, %ecx
cmpl %ecx, %eax
jne 0x1213f
movq -0x60(%rbp), %rdi
movq %rdi, -0x788(%rbp)
callq 0x4430
movq %rax, %rsi
leaq -0x2f0(%rbp), %rdi
callq 0x4150
jmp 0x11cdc
movq -0x788(%rbp), %rdi
callq 0x4130
movq 0x1a301(%rip), %rdi     # 0x2bff0
leaq 0x11a17(%rip), %rsi     # 0x2370d
callq 0x4310
movq %rax, -0x790(%rbp)
jmp 0x11d04
movq -0x790(%rbp), %rdi
leaq -0x2f0(%rbp), %rsi
callq 0x42e0
movq %rax, -0x798(%rbp)
jmp 0x11d20
movq -0x798(%rbp), %rdi
movq 0x1a282(%rip), %rsi     # 0x2bfb0
callq 0x4350
jmp 0x11d35
movl $0x5, %edi
callq 0x4400
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x2f0(%rbp), %rdi
callq 0x46d8
callq 0x4580
jmp 0x11d5e
jmp 0x1213f
jmp 0x11d65
cmpq $0x0, -0x2b8(%rbp)
je 0x1205d
movq -0x2d0(%rbp), %rdi
movq -0x2b8(%rbp), %xmm0
movaps 0x11717(%rip), %xmm2    # 0x234a0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x1171b(%rip), %xmm1    # 0x234b0
subpd %xmm1, %xmm0
movaps %xmm0, %xmm3
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm3, %xmm0
movsd %xmm0, -0x2f8(%rbp)
movq -0xc0(%rbp), %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd %xmm0, -0x300(%rbp)
leaq -0x2f8(%rbp), %rsi
leaq -0x300(%rbp), %rdx
callq 0x227a0
movq %rax, -0x7a0(%rbp)
jmp 0x11deb
movq -0x7a0(%rbp), %rax
movq %rax, -0x2c0(%rbp)
jmp 0x11ec2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movl $0x3, %ecx
cmpl %ecx, %eax
jne 0x1213f
movq -0x60(%rbp), %rdi
movq %rdi, -0x7a8(%rbp)
callq 0x4430
movq %rax, %rsi
leaq -0x320(%rbp), %rdi
callq 0x4150
jmp 0x11e3b
movq -0x7a8(%rbp), %rdi
callq 0x4130
movq 0x1a1a2(%rip), %rdi     # 0x2bff0
leaq 0x118b8(%rip), %rsi     # 0x2370d
callq 0x4310
movq %rax, -0x7b0(%rbp)
jmp 0x11e63
movq -0x7b0(%rbp), %rdi
leaq -0x320(%rbp), %rsi
callq 0x42e0
movq %rax, -0x7b8(%rbp)
jmp 0x11e7f
movq -0x7b8(%rbp), %rdi
movq 0x1a123(%rip), %rsi     # 0x2bfb0
callq 0x4350
jmp 0x11e94
movl $0x5, %edi
callq 0x4400
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x320(%rbp), %rdi
callq 0x46d8
callq 0x4580
jmp 0x11ebd
jmp 0x1213f
movq -0x338(%rbp), %rax
movq -0x2c0(%rbp), %rdx
movq -0x2c8(%rbp), %rcx
addq %rdx, %rcx
movq %rcx, -0x2c8(%rbp)
movq -0x2c0(%rbp), %rcx
movq -0xc0(%rbp), %rdx
notq %rcx
addq %rdx, %rcx
movq %rcx, -0xc0(%rbp)
addq $0x8, %rax
movq %rax, -0x7c0(%rbp)
movq -0x2c8(%rbp), %rsi
movq -0xc8(%rbp), %rax
imulq %rax, %rsi
addq $0x3, %rsi
leaq -0x330(%rbp), %rdi
callq 0x1ef20
jmp 0x11f2b
movq -0x7c0(%rbp), %rdi
movq -0x330(%rbp), %rsi
movq -0x328(%rbp), %rdx
callq 0x4460
jmp 0x11f47
movq -0x338(%rbp), %rdi
addq $0x8, %rdi
movq -0x1d8(%rbp), %rsi
movq -0xc8(%rbp), %rdx
callq 0x4450
jmp 0x11f67
movq -0x2c8(%rbp), %rax
incq %rax
movq %rax, -0x2c8(%rbp)
movq -0x10(%rbp), %rdi
addq $0x18, %rdi
movq -0x1d8(%rbp), %rsi
movq -0xc8(%rbp), %rdx
callq 0x44a0
jmp 0x11f95
jmp 0x11f97
cmpq $0x0, -0x2c0(%rbp)
je 0x11ff5
movq -0x338(%rbp), %rax
addq $0x458, %rax            # imm = 0x458
movq %rax, -0x7c8(%rbp)
callq 0x1f390
movq -0x7c8(%rbp), %rdi
movq %rax, %rsi
movl $0xa, %edx
callq 0x41f0
jmp 0x11fd0
movq -0x2c0(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x2c0(%rbp)
jmp 0x11f97
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x1213f
movq -0x338(%rbp), %rdi
addq $0x458, %rdi            # imm = 0x458
leaq -0x200(%rbp), %rsi
callq 0x4080
jmp 0x12011
movq -0x10(%rbp), %rdi
addq $0x468, %rdi            # imm = 0x468
leaq -0x200(%rbp), %rsi
callq 0x42e0
movq %rax, -0x7d0(%rbp)
jmp 0x12031
movq -0x7d0(%rbp), %rdi
movq 0x19f71(%rip), %rsi     # 0x2bfb0
callq 0x4350
jmp 0x12046
movq -0x2b8(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x2b8(%rbp)
jmp 0x11d65
movq -0x338(%rbp), %rdi
addq $0x8, %rdi
callq 0x4060
jmp 0x1206f
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0x4060
jmp 0x1207e
movq -0x338(%rbp), %rdi
addq $0x458, %rdi            # imm = 0x458
callq 0x4060
jmp 0x12093
movq -0x10(%rbp), %rdi
addq $0x458, %rdi            # imm = 0x458
callq 0x4060
jmp 0x120a5
movq -0x1d8(%rbp), %rax
movq %rax, -0x7d8(%rbp)
cmpq $0x0, %rax
je 0x120c5
movq -0x7d8(%rbp), %rdi
callq 0x4480
movq -0x2d0(%rbp), %rax
movq %rax, -0x7e0(%rbp)
cmpq $0x0, %rax
je 0x120f6
movq -0x7e0(%rbp), %rdi
callq 0x1ef60
movq -0x7e0(%rbp), %rdi
movl $0x8, %esi
callq 0x4340
leaq -0x200(%rbp), %rdi
callq 0x46d8
movl $0x0, -0x10c(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x46d8
leaq -0xe8(%rbp), %rdi
callq 0x46d8
leaq -0x58(%rbp), %rdi
callq 0x46d8
leaq -0x38(%rbp), %rdi
callq 0x46d8
addq $0x7e0, %rsp            # imm = 0x7E0
popq %rbp
retq
leaq -0x200(%rbp), %rdi
callq 0x46d8
leaq -0x108(%rbp), %rdi
callq 0x46d8
leaq -0xe8(%rbp), %rdi
callq 0x46d8
leaq -0x58(%rbp), %rdi
callq 0x46d8
leaq -0x38(%rbp), %rdi
callq 0x46d8
movq -0x60(%rbp), %rdi
callq 0x4610
movq %rax, %rdi
callq 0x82c0
nopw %cs:(%rax,%rax)