// File: /workspace/github_cpp_makefile_star2_O3/sjtuwrk[P]SunwayMR/tools/SunwayMRHelper.hpp
// Function: SunwayMRHelper::runApplication(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool)
void SunwayMRHelper::runApplication(string filePath, bool localMode) {
	// run user application
	string targetHostsFileName = allHostsFileName;
	if (localMode) targetHostsFileName = localHostFileName;

	long appUID = getCurrentTime();
	int fileUID1 = appUID;
	int fileUID2 = appUID + 1;

	string appFileName = fileNameFromPath(filePath);
	string hostsFileName = "hostsFile.lst";

	stringstream filePath2;
	filePath2 << fileSaveDir << targetHostsFileName;

	stringstream fileInfo1, fileInfo2;
	fileInfo1 << fileUID1 << " " << appUID << " " << appFileName;
	fileInfo2 << fileUID2 << " " << appUID << " " << hostsFileName;

	string fileContent1, fileContent2;
	bool rd1 = readFile(filePath, fileContent1);
	if (!rd1) {
		stringstream error1;
		error1 << "SunwayMRHelper: unable to read file: " << filePath;
		Logging::logError(error1.str());
	}
	bool rd2 = readFile(filePath2.str(), fileContent2);
	if (!rd2) {
		stringstream error2;
		error2 << "SunwayMRHelper: unable to read file: " << filePath2.str();
		Logging::logError(error2.str());
	}


	if (!rd1 || !rd2) {
		exit(1);
	}

	// for all hosts in fileContent2
	stringstream ss(fileContent2);
	string line;
	vector<HostResource> tmp;

	bool sendWithFailure = false;
	while(std::getline(ss,line,'\n')){
		vector<string> v = splitString(line, ' ');
		if (v.size() >= 4) {
			string host = v[0];
			int threads = atoi(v[1].c_str());
			int memory = atoi(v[2].c_str());
			int port = atoi(v[3].c_str());
			HostResource hr = {
					host,
					threads,
					memory,
					port
			};
			tmp.push_back(hr);

			string msg1 = fileInfo1.str();
			string reply;
			// send file info 1
			bool sr = sendMessageForReply(host, port, FILE_INFO, msg1, reply);
			if(!sr) {
				sendWithFailure = true;
				stringstream err;
				err << "SunwayMRHelper: failed to send file info[1] to host: " << host << ", " << port << "; info:" << fileInfo1.str();
				Logging::logError(err.str());
			}

			string msg2 = fileInfo2.str();
			// send file info 2
			sr = sendMessageForReply(host, port, FILE_INFO, msg2, reply);
			if(!sr) {
				sendWithFailure = true;
				stringstream err;
				err << "SunwayMRHelper: failed to send file info[2] to host: " << host << ", " << port << "; info:" << fileInfo2.str();
				Logging::logError(err.str());
			}

			// send file content 1
			sr = sendMessageForReply(host, port, fileUID1, fileContent1, reply);
			if(!sr) {
				sendWithFailure = true;
				stringstream err;
				err << "SunwayMRHelper: failed to send file content[1] to host: " << host << ", " << port;
				Logging::logError(err.str());
			}

			// send file content 2
			sr = sendMessageForReply(host, port, fileUID2, fileContent2, reply);
			if(!sr) {
				sendWithFailure = true;
				stringstream err;
				err << "SunwayMRHelper: failed to send file content[2] to host: " << host << ", " << port;
				Logging::logError(err.str());
			}
		}
	}

	if(sendWithFailure) exit(1);

	Logging::logInfo("SunwayMRHelper: sending files succeeded.");
	Logging::logInfo("SunwayMRHelper: starting...");

	string appExecutableName = splitString(appFileName, '.')[0];

	string masterValue = masterAddr;
	if (localMode) masterValue = localAddr;
	stringstream masterInfo;
	masterInfo << "SunwayMRHelper: master is on: " << masterValue;
	Logging::logInfo(masterInfo.str());

	int appListenPort = randomValue(30001, 39999);

	stringstream appDirStream;
	appDirStream << fileSaveDir << appUID << "/";
	string appDir = appDirStream.str();
	stringstream startAppCmd;
	startAppCmd << CXX << " -O2 -g -Wall -fmessage-length=0 "
			<< appDir << appFileName
			<< " -o " << appDir << appExecutableName
			<< " -Itools -Iinclude -Iheaders -pthread -lstdc++ -lm " << endl;
	startAppCmd << appDir <<  appExecutableName << " "
			<< appDir << hostsFileName << " "
			<< masterValue << " " << appListenPort << endl;

	for(unsigned int i=0; i<tmp.size(); i++) {
		string msg = startAppCmd.str();
		sendMessage(tmp[i].host, tmp[i].listenPort, SHELL_COMMAND, msg);
	}

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd38, %rsp            # imm = 0xD38
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, 0x120(%rsp)
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0xaa76(%rip), %rsi      # 0x13438
movq 0xaa77(%rip), %rdx      # 0x13440
addq %rsi, %rdx
movq %rsp, %rdi
callq 0xc556
movl %ebp, 0xf8(%rsp)
testl %ebp, %ebp
je 0x89ee
leaq 0xaa32(%rip), %rsi      # 0x13418
movq %rsp, %rdi
callq 0x31e0
leaq 0xbb0(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x35c0
imulq $0x3e8, (%r14), %r15    # imm = 0x3E8
movabsq $0x20c49ba5e353f7cf, %rax # imm = 0x20C49BA5E353F7CF
imulq 0x8(%r14)
movq %rdx, %r12
leaq 0x5631(%rip), %rsi      # 0xe050
movl $0x2, %ecx
movq %rbx, %rdi
movq $-0x1, %rdx
callq 0x36e0
leaq 0x1(%rax), %rdx
leaq 0x188(%rsp), %rdi
movq %rbx, %rsi
movq $-0x1, %rcx
callq 0x33b0
leaq 0x30(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x5af5(%rip), %rsi      # 0xe553
leaq 0x5afb(%rip), %rdx      # 0xe560
leaq 0x20(%rsp), %rdi
callq 0xc5ec
leaq 0xbb0(%rsp), %rdi
callq 0x3240
leaq 0xbc0(%rsp), %rdi
movq 0xa96d(%rip), %rsi      # 0x133f8
movq 0xa96e(%rip), %rdx      # 0x13400
callq 0x3400
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rax, %rdi
callq 0x3400
leaq 0xa28(%rsp), %rdi
callq 0x3240
leaq 0x8a0(%rsp), %rdi
callq 0x3240
movq %r12, %rax
shrq $0x3f, %rax
sarq $0x7, %r12
addq %rax, %r12
addq %r15, %r12
leaq 0xa38(%rsp), %rdi
movq %r12, 0xa8(%rsp)
movl %r12d, %esi
callq 0x3600
movq %rax, %r14
leaq 0x5ac9(%rip), %rsi      # 0xe5be
movl $0x1, %edx
movq %rax, %rdi
callq 0x3400
movq %r14, %rdi
movq 0xa8(%rsp), %rsi
callq 0x3340
movq %rax, %r14
leaq 0x5aa2(%rip), %rsi      # 0xe5be
movl $0x1, %edx
movq %rax, %rdi
callq 0x3400
movq 0x188(%rsp), %rsi
movq 0x190(%rsp), %rdx
movq %r14, %rdi
callq 0x3400
movq 0xa8(%rsp), %rax
leal 0x1(%rax), %esi
leaq 0x8b0(%rsp), %rdi
movl %esi, 0xfc(%rsp)
callq 0x3600
movq %rax, %r14
leaq 0x5a54(%rip), %rsi      # 0xe5be
movl $0x1, %edx
movq %rax, %rdi
callq 0x3400
movq %r14, %rdi
movq 0xa8(%rsp), %rsi
callq 0x3340
movq %rax, %r14
leaq 0x5a2d(%rip), %rsi      # 0xe5be
movl $0x1, %edx
movq %rax, %rdi
callq 0x3400
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %r14, %rdi
callq 0x3400
leaq 0x1b8(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0xe8(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x250(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x240(%rsp), %rdi
callq 0xc556
leaq 0x240(%rsp), %rdi
leaq 0x1a8(%rsp), %rsi
callq 0x46c8
movl %eax, %ebp
movq 0x240(%rsp), %rdi
cmpq %r14, %rdi
je 0x8c2d
movq 0x250(%rsp), %rsi
incq %rsi
callq 0x3390
testb %bpl, %bpl
jne 0x8cd2
leaq 0x718(%rsp), %rdi
callq 0x3240
leaq 0x728(%rsp), %r14
leaq 0x590f(%rip), %rsi      # 0xe561
movl $0x25, %edx
movq %r14, %rdi
callq 0x3400
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x3400
leaq 0x730(%rsp), %rsi
leaq 0x280(%rsp), %rdi
callq 0x3580
leaq 0x280(%rsp), %rdi
callq 0x58ec
leaq 0x290(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8cb1
movq 0x290(%rsp), %rsi
incq %rsi
callq 0x3390
movq 0xa2f8(%rip), %rsi      # 0x12fb0
leaq 0x718(%rsp), %rdi
callq 0x3260
leaq 0x798(%rsp), %rdi
callq 0x3150
leaq 0xbc8(%rsp), %rbx
leaq 0x260(%rsp), %rdi
movq %rbx, %rsi
callq 0x3580
leaq 0x260(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x46c8
movl %eax, %r14d
leaq 0x270(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8d23
movq 0x270(%rsp), %rsi
incq %rsi
callq 0x3390
testb %r14b, %r14b
je 0x9cc8
testb %bpl, %bpl
je 0x9d9a
leaq 0x718(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
movl $0x18, %edx
callq 0x3590
leaq 0x1f0(%rsp), %rax
movq %rax, -0x10(%rax)
xorl %ecx, %ecx
movq %rcx, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x100(%rsp), %rax
movq $0x0, 0xb0(%rsp)
movq %rcx, 0x10(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
leaq 0x230(%rsp), %r12
leaq 0x280(%rsp), %rax
addq $0x80, %rax
movq %rax, 0x80(%rsp)
leaq 0x1e0(%rsp), %rbp
leaq 0x718(%rsp), %rdi
movq %rbp, %rsi
movl $0xa, %edx
callq 0x3690
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x9586
leaq 0x1c8(%rsp), %rdi
movq %rbp, %rsi
movl $0x20, %edx
callq 0x3b95
movq 0x1c8(%rsp), %rax
movq 0x1d0(%rsp), %rcx
subq %rax, %rcx
cmpq $0x61, %rcx
jb 0x9574
leaq 0x418(%rsp), %rcx
movq %rcx, 0x408(%rsp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x408(%rsp), %rdi
callq 0xc556
movq 0x1c8(%rsp), %r13
movq 0x20(%r13), %rdi
callq 0x3570
movl %eax, %ebx
movq 0x40(%r13), %rdi
callq 0x3570
movl %eax, %r15d
movq 0x60(%r13), %rdi
callq 0x3570
movl %eax, %r13d
leaq 0x5a0(%rsp), %rax
movq %rax, 0x590(%rsp)
movq 0x408(%rsp), %rsi
movq 0x410(%rsp), %rdx
addq %rsi, %rdx
leaq 0x590(%rsp), %r14
movq %r14, %rdi
callq 0xc556
movl %ebx, 0x5b0(%rsp)
movl %r15d, 0x5b4(%rsp)
movl %r13d, 0x5b8(%rsp)
leaq 0x100(%rsp), %rdi
movq %r14, %rsi
callq 0xc1c2
leaq 0xb8(%rsp), %rdi
leaq 0xa40(%rsp), %rsi
callq 0x3580
leaq 0x98(%rsp), %rax
movq %rax, 0x88(%rsp)
movq $0x0, 0x90(%rsp)
movb $0x0, 0x98(%rsp)
movq %r12, 0x220(%rsp)
movq 0x408(%rsp), %rsi
movq 0x410(%rsp), %rdx
addq %rsi, %rdx
leaq 0x220(%rsp), %rbx
movq %rbx, %rdi
callq 0xc556
movq %rbx, %rsi
movl %r13d, %edx
movl $0x1, %ecx
leaq 0xb8(%rsp), %r8
leaq 0x88(%rsp), %r9
callq 0x606e
movl %eax, %ebx
movq 0x220(%rsp), %rdi
cmpq %r12, %rdi
je 0x8f50
movq 0x230(%rsp), %rsi
incq %rsi
callq 0x3390
testb %bl, %bl
jne 0x9078
leaq 0x280(%rsp), %rdi
callq 0x3240
movl $0x35, %edx
leaq 0x290(%rsp), %rdi
leaq 0x560e(%rip), %rsi      # 0xe587
callq 0x3400
movq 0x408(%rsp), %rsi
movq 0x410(%rsp), %rdx
leaq 0x290(%rsp), %rdi
callq 0x3400
movq %rax, %rbx
movl $0x2, %edx
movq %rax, %rdi
leaq 0x5610(%rip), %rsi      # 0xe5bd
callq 0x3400
movq %rbx, %rdi
movl %r13d, %esi
callq 0x3600
movq %rax, %rbx
movl $0x7, %edx
movq %rax, %rdi
leaq 0x55f1(%rip), %rsi      # 0xe5c0
callq 0x3400
leaq 0x40(%rsp), %rdi
leaq 0xa40(%rsp), %rsi
callq 0x3580
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq %rbx, %rdi
callq 0x3400
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x9014
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3390
leaq 0x40(%rsp), %rbx
movq %rbx, %rdi
leaq 0x298(%rsp), %rsi
callq 0x3580
movq %rbx, %rdi
callq 0x58ec
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x904d
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3390
leaq 0x280(%rsp), %rdi
movq 0x9f54(%rip), %rsi      # 0x12fb0
callq 0x3260
movq 0x80(%rsp), %rdi
callq 0x3150
movb $0x1, %al
movq %rax, 0xb0(%rsp)
leaq 0x40(%rsp), %rdi
leaq 0x8b8(%rsp), %rsi
callq 0x3580
leaq 0x178(%rsp), %rax
movq %rax, 0x168(%rsp)
movq 0x408(%rsp), %rsi
movq 0x410(%rsp), %rdx
addq %rsi, %rdx
leaq 0x168(%rsp), %rdi
callq 0xc556
leaq 0x168(%rsp), %rsi
movl %r13d, %edx
movl $0x1, %ecx
leaq 0x40(%rsp), %r8
leaq 0x88(%rsp), %r9
callq 0x606e
movl %eax, %ebx
movq 0x168(%rsp), %rdi
leaq 0x178(%rsp), %rax
cmpq %rax, %rdi
je 0x9103
movq 0x178(%rsp), %rsi
incq %rsi
callq 0x3390
testb %bl, %bl
jne 0x9229
leaq 0x280(%rsp), %rdi
callq 0x3240
movl $0x35, %edx
leaq 0x290(%rsp), %rbx
movq %rbx, %rdi
leaq 0x5499(%rip), %rsi      # 0xe5c8
callq 0x3400
movq 0x408(%rsp), %rsi
movq 0x410(%rsp), %rdx
movq %rbx, %rdi
callq 0x3400
movq %rax, %rbx
movl $0x2, %edx
movq %rax, %rdi
leaq 0x545f(%rip), %rsi      # 0xe5bd
callq 0x3400
movq %rbx, %rdi
movl %r13d, %esi
callq 0x3600
movq %rax, %rbx
movl $0x7, %edx
movq %rax, %rdi
leaq 0x5440(%rip), %rsi      # 0xe5c0
callq 0x3400
leaq 0x60(%rsp), %rdi
leaq 0x8b8(%rsp), %rsi
callq 0x3580
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq %rbx, %rdi
callq 0x3400
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x91c5
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3390
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
leaq 0x298(%rsp), %rsi
callq 0x3580
movq %rbx, %rdi
callq 0x58ec
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x91fe
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3390
leaq 0x280(%rsp), %rdi
movq 0x9da3(%rip), %rsi      # 0x12fb0
callq 0x3260
movq 0x80(%rsp), %rdi
callq 0x3150
movb $0x1, %al
movq %rax, 0xb0(%rsp)
leaq 0x158(%rsp), %rax
movq %rax, 0x148(%rsp)
movq 0x408(%rsp), %rsi
movq 0x410(%rsp), %rdx
addq %rsi, %rdx
leaq 0x148(%rsp), %rdi
callq 0xc556
leaq 0x148(%rsp), %rsi
movl %r13d, %edx
movq 0xa8(%rsp), %rcx
leaq 0x1a8(%rsp), %r8
leaq 0x88(%rsp), %r9
callq 0x606e
movl %eax, %ebx
movq 0x148(%rsp), %rdi
leaq 0x158(%rsp), %rax
cmpq %rax, %rdi
je 0x92a8
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x3390
testb %bl, %bl
jne 0x9377
leaq 0x280(%rsp), %rdi
callq 0x3240
movl $0x38, %edx
leaq 0x290(%rsp), %rbx
movq %rbx, %rdi
leaq 0x532a(%rip), %rsi      # 0xe5fe
callq 0x3400
movq 0x408(%rsp), %rsi
movq 0x410(%rsp), %rdx
movq %rbx, %rdi
callq 0x3400
movq %rax, %rbx
movl $0x2, %edx
movq %rax, %rdi
leaq 0x52ba(%rip), %rsi      # 0xe5bd
callq 0x3400
movq %rbx, %rdi
movl %r13d, %esi
callq 0x3600
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
leaq 0x298(%rsp), %rsi
callq 0x3580
movq %rbx, %rdi
callq 0x58ec
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x934c
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3390
leaq 0x280(%rsp), %rdi
movq 0x9c55(%rip), %rsi      # 0x12fb0
callq 0x3260
movq 0x80(%rsp), %rdi
callq 0x3150
movb $0x1, %al
movq %rax, 0xb0(%rsp)
leaq 0x138(%rsp), %rax
movq %rax, 0x128(%rsp)
movq 0x408(%rsp), %rsi
movq 0x410(%rsp), %rdx
addq %rsi, %rdx
leaq 0x128(%rsp), %rdi
callq 0xc556
leaq 0x128(%rsp), %rsi
movl %r13d, %edx
movl 0xfc(%rsp), %ecx
leaq 0xd8(%rsp), %r8
leaq 0x88(%rsp), %r9
callq 0x606e
movl %eax, %ebx
movq 0x128(%rsp), %rdi
leaq 0x138(%rsp), %rax
cmpq %rax, %rdi
je 0x93f5
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x3390
testb %bl, %bl
jne 0x94c4
leaq 0x280(%rsp), %rdi
callq 0x3240
movl $0x38, %edx
leaq 0x290(%rsp), %rbx
movq %rbx, %rdi
leaq 0x5216(%rip), %rsi      # 0xe637
callq 0x3400
movq 0x408(%rsp), %rsi
movq 0x410(%rsp), %rdx
movq %rbx, %rdi
callq 0x3400
movq %rax, %rbx
movl $0x2, %edx
movq %rax, %rdi
leaq 0x516d(%rip), %rsi      # 0xe5bd
callq 0x3400
movq %rbx, %rdi
movl %r13d, %esi
callq 0x3600
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
leaq 0x298(%rsp), %rsi
callq 0x3580
movq %rbx, %rdi
callq 0x58ec
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x9499
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3390
leaq 0x280(%rsp), %rdi
movq 0x9b08(%rip), %rsi      # 0x12fb0
callq 0x3260
movq 0x80(%rsp), %rdi
callq 0x3150
movb $0x1, %al
movq %rax, 0xb0(%rsp)
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x94e0
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3390
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x9505
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x3390
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x952a
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x3390
movq 0x590(%rsp), %rdi
leaq 0x5a0(%rsp), %rax
cmpq %rax, %rdi
je 0x954f
movq 0x5a0(%rsp), %rsi
incq %rsi
callq 0x3390
movq 0x408(%rsp), %rdi
leaq 0x418(%rsp), %rax
cmpq %rax, %rdi
je 0x9574
movq 0x418(%rsp), %rsi
incq %rsi
callq 0x3390
leaq 0x1c8(%rsp), %rdi
callq 0xbc26
jmp 0x8da8
testb $0x1, 0xb0(%rsp)
jne 0x9d9a
leaq 0x280(%rsp), %rdi
leaq 0x290(%rsp), %rbx
movq %rbx, (%rdi)
leaq 0x50c2(%rip), %rsi      # 0xe670
leaq 0x50e3(%rip), %rdx      # 0xe698
callq 0xc5ec
leaq 0x280(%rsp), %rdi
callq 0x56e8
movq 0x280(%rsp), %rdi
cmpq %rbx, %rdi
je 0x95e4
movq 0x290(%rsp), %rsi
incq %rsi
callq 0x3390
leaq 0x280(%rsp), %rdi
movq %rbx, (%rdi)
leaq 0x50a3(%rip), %rsi      # 0xe699
leaq 0x50b7(%rip), %rdx      # 0xe6b4
callq 0xc5ec
leaq 0x280(%rsp), %rdi
callq 0x56e8
movq 0x280(%rsp), %rdi
cmpq %rbx, %rdi
je 0x962c
movq 0x290(%rsp), %rsi
incq %rsi
callq 0x3390
leaq 0x280(%rsp), %rdi
leaq 0x188(%rsp), %rsi
movl $0x2e, %edx
callq 0x3b95
movq 0x280(%rsp), %rax
leaq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rcx
movq %rcx, (%rdi)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
callq 0xc556
leaq 0x280(%rsp), %rdi
callq 0xbc26
leaq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
movq %rax, (%rdi)
movq 0x120(%rsp), %rax
movq 0xf0(%rax), %rsi
movq 0xf8(%rax), %rdx
addq %rsi, %rdx
callq 0xc556
cmpb $0x0, 0xf8(%rsp)
je 0x96d4
movq 0x120(%rsp), %rsi
addq $0x110, %rsi            # imm = 0x110
leaq 0x88(%rsp), %rdi
callq 0x31e0
leaq 0x280(%rsp), %rdi
callq 0x3240
leaq 0x290(%rsp), %r14
leaq 0x4fc5(%rip), %rsi      # 0xe6b5
movl $0x1e, %edx
movq %r14, %rdi
callq 0x3400
movq 0x88(%rsp), %rsi
movq 0x90(%rsp), %rdx
movq %r14, %rdi
callq 0x3400
leaq 0x298(%rsp), %rsi
leaq 0x590(%rsp), %rdi
callq 0x3580
leaq 0x590(%rsp), %rdi
callq 0x56e8
movq 0x590(%rsp), %rdi
leaq 0x5a0(%rsp), %rax
cmpq %rax, %rdi
je 0x975c
movq 0x5a0(%rsp), %rsi
incq %rsi
callq 0x3390
movl $0x7531, %edi           # imm = 0x7531
movl $0x9c3f, %esi           # imm = 0x9C3F
callq 0x42ec
movl %eax, %ebp
leaq 0x590(%rsp), %rdi
callq 0x3240
leaq 0x5a0(%rsp), %rdi
movq 0x9c6f(%rip), %rsi      # 0x133f8
movq 0x9c70(%rip), %rdx      # 0x13400
callq 0x3400
movq %rax, %rdi
movq 0xa8(%rsp), %rsi
callq 0x3340
leaq 0x4bb2(%rip), %rsi      # 0xe35e
movl $0x1, %edx
movq %rax, %rdi
callq 0x3400
leaq 0x5a8(%rsp), %rsi
leaq 0x40(%rsp), %rdi
callq 0x3580
leaq 0x408(%rsp), %rdi
callq 0x3240
leaq 0x418(%rsp), %r15
movq 0x9c71(%rip), %rsi      # 0x13458
movq 0x9c72(%rip), %rdx      # 0x13460
movq %r15, %rdi
callq 0x3400
movq %rax, %r12
leaq 0x4ed4(%rip), %rsi      # 0xe6d4
movl $0x21, %edx
movq %rax, %rdi
callq 0x3400
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq %r12, %rdi
callq 0x3400
movq 0x188(%rsp), %rsi
movq 0x190(%rsp), %rdx
movq %rax, %rdi
callq 0x3400
movq %rax, %r12
leaq 0x4eb5(%rip), %rsi      # 0xe6f6
movl $0x4, %edx
movq %rax, %rdi
callq 0x3400
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq %r12, %rdi
callq 0x3400
movq 0xb8(%rsp), %rsi
movq 0xc0(%rsp), %rdx
movq %rax, %rdi
callq 0x3400
movq %rax, %r12
leaq 0x4e79(%rip), %rsi      # 0xe6fb
movl $0x33, %edx
movq %rax, %rdi
callq 0x3400
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x3360
movsbl %al, %esi
movq %r12, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3220
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq %r15, %rdi
callq 0x3400
movq 0xb8(%rsp), %rsi
movq 0xc0(%rsp), %rdx
movq %rax, %rdi
callq 0x3400
movq %rax, %r15
leaq 0x4cd3(%rip), %rsi      # 0xe5be
movl $0x1, %edx
movq %rax, %rdi
callq 0x3400
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq %r15, %rdi
callq 0x3400
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %rax, %rdi
callq 0x3400
movq %rax, %r15
leaq 0x4c98(%rip), %rsi      # 0xe5be
movl $0x1, %edx
movq %rax, %rdi
callq 0x3400
movq 0x88(%rsp), %rsi
movq 0x90(%rsp), %rdx
movq %r15, %rdi
callq 0x3400
movq %rax, %r15
leaq 0x4c69(%rip), %rsi      # 0xe5be
movl $0x1, %edx
movq %rax, %rdi
callq 0x3400
movq %r15, %rdi
movl %ebp, %esi
callq 0x3600
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3360
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3220
movq 0x108(%rsp), %rax
cmpq 0x100(%rsp), %rax
je 0x9a8b
leaq 0x210(%rsp), %rbp
movl $0x1, %ebx
xorl %r15d, %r15d
leaq 0x60(%rsp), %r12
leaq 0x200(%rsp), %r13
movabsq $-0x5555555555555555, %r14 # imm = 0xAAAAAAAAAAAAAAAB
movq %r12, %rdi
leaq 0x420(%rsp), %rsi
callq 0x3580
movq 0x100(%rsp), %rax
leaq (%r15,%r15,2), %r15
shlq $0x4, %r15
movq %rbp, 0x200(%rsp)
movq (%rax,%r15), %rsi
movq 0x8(%rax,%r15), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0xc556
movq 0x100(%rsp), %rax
movl 0x28(%rax,%r15), %edx
movq %r13, %rsi
movl $0x2, %ecx
movq %r12, %r8
callq 0x62d0
movq 0x200(%rsp), %rdi
cmpq %rbp, %rdi
je 0x9a49
movq 0x210(%rsp), %rsi
incq %rsi
callq 0x3390
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x9a65
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3390
movl %ebx, %r15d
movq 0x108(%rsp), %rax
subq 0x100(%rsp), %rax
sarq $0x4, %rax
imulq %r14, %rax
incl %ebx
cmpq %r15, %rax
ja 0x99d3
movq 0x951e(%rip), %rsi      # 0x12fb0
leaq 0x408(%rsp), %rdi
callq 0x3260
leaq 0x488(%rsp), %rdi
callq 0x3150
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x9ac8
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3390
movq 0x94e1(%rip), %r15      # 0x12fb0
leaq 0x590(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x3260
movl $0x80, %ebx
addq %rbx, %r14
movq %r14, %rdi
callq 0x3150
leaq 0x280(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x3260
addq %rbx, %r14
movq %r14, %rdi
callq 0x3150
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x9b35
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x3390
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x9b5a
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x3390
leaq 0x100(%rsp), %rdi
callq 0xc164
movq 0x1e0(%rsp), %rdi
leaq 0x1f0(%rsp), %rax
cmpq %rax, %rdi
je 0x9b8c
movq 0x1f0(%rsp), %rsi
incq %rsi
callq 0x3390
movq 0x941d(%rip), %rsi      # 0x12fb0
leaq 0x718(%rsp), %rdi
callq 0x3260
leaq 0x798(%rsp), %rdi
callq 0x3150
movq 0xd8(%rsp), %rdi
leaq 0xe8(%rsp), %rax
cmpq %rax, %rdi
je 0x9bd2
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x3390
movq 0x1a8(%rsp), %rdi
leaq 0x1b8(%rsp), %rax
cmpq %rax, %rdi
je 0x9bf7
movq 0x1b8(%rsp), %rsi
incq %rsi
callq 0x3390
movq 0x93b2(%rip), %rbx      # 0x12fb0
leaq 0x8a0(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x3260
movl $0x80, %r14d
addq %r14, %r15
movq %r15, %rdi
callq 0x3150
leaq 0xa28(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x3260
addq %r14, %r15
movq %r15, %rdi
callq 0x3150
leaq 0xbb0(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x3260
addq %r14, %r15
movq %r15, %rdi
callq 0x3150
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x9c7a
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3390
leaq 0x198(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
leaq 0x10(%rsp), %rbx
je 0x9ca0
movq 0x198(%rsp), %rsi
incq %rsi
callq 0x3390
movq (%rsp), %rdi
cmpq %rbx, %rdi
je 0x9cb6
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3390
addq $0xd38, %rsp            # imm = 0xD38
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x718(%rsp), %rdi
callq 0x3240
leaq 0x728(%rsp), %r14
leaq 0x487d(%rip), %rsi      # 0xe561
movl $0x25, %edx
movq %r14, %rdi
callq 0x3400
leaq 0x280(%rsp), %rdi
movq %rbx, %rsi
callq 0x3580
movq 0x280(%rsp), %rsi
movq 0x288(%rsp), %rdx
movq %r14, %rdi
callq 0x3400
leaq 0x290(%rsp), %rbx
movq -0x10(%rbx), %rdi
cmpq %rbx, %rdi
je 0x9d3a
movq 0x290(%rsp), %rsi
incq %rsi
callq 0x3390
leaq 0x730(%rsp), %rsi
leaq 0x280(%rsp), %rdi
callq 0x3580
leaq 0x280(%rsp), %rdi
callq 0x58ec
movq 0x280(%rsp), %rdi
cmpq %rbx, %rdi
je 0x9d79
movq 0x290(%rsp), %rsi
incq %rsi
callq 0x3390
movq 0x9230(%rip), %rsi      # 0x12fb0
leaq 0x718(%rsp), %rdi
callq 0x3260
leaq 0x798(%rsp), %rdi
callq 0x3150
movl $0x1, %edi
callq 0x3440
movq %rax, %r15
movq 0x280(%rsp), %rdi
cmpq %rbx, %rdi
jne 0x9dec
jmp 0x9ed4
jmp 0x9ed1
jmp 0x9dd4
jmp 0x9ed1
jmp 0x9ed1
jmp 0x9e58
jmp 0x9f19
movq %rax, %r15
leaq 0x290(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9ed4
movq 0x290(%rsp), %rsi
incq %rsi
callq 0x3390
jmp 0x9ed4
jmp 0x9ed1
jmp 0x9f19
jmp 0x9f59
movq %rax, %r15
jmp 0xa176
jmp 0x9f7b
jmp 0x9f66
movq %rax, %r15
movq 0x590(%rsp), %rdi
leaq 0x5a0(%rsp), %rax
cmpq %rax, %rdi
je 0xa1b3
movq 0x5a0(%rsp), %rsi
incq %rsi
callq 0x3390
jmp 0xa1b3
jmp 0x9f66
movq %rax, %r15
jmp 0xa1d4
movq %rax, %r15
jmp 0xa1f9
movq %rax, %r15
leaq 0x280(%rsp), %rdi
callq 0xbc26
jmp 0xa229
jmp 0xa226
jmp 0x9e89
jmp 0xa226
movq %rax, %r15
movq 0x280(%rsp), %rdi
cmpq %rbx, %rdi
je 0xa229
movq 0x290(%rsp), %rsi
jmp 0xa216
jmp 0xa226
jmp 0x9f19
movq %rax, %r15
leaq 0x270(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9f1c
movq 0x270(%rsp), %rsi
jmp 0x9f0f
jmp 0x9f19
movq %rax, %r15
movq 0x90d5(%rip), %rsi      # 0x12fb0
leaq 0x718(%rsp), %rdi
callq 0x3260
leaq 0x798(%rsp), %rdi
callq 0x3150
jmp 0x9f1c
movq %rax, %r15
movq 0x240(%rsp), %rdi
cmpq %r14, %rdi
je 0x9f1c
movq 0x250(%rsp), %rsi
incq %rsi
callq 0x3390
jmp 0x9f1c
movq %rax, %r15
leaq 0x10(%rsp), %rbx
leaq 0x30(%rsp), %r14
jmp 0xa3ab
movq %rax, %r15
leaq 0x10(%rsp), %rbx
leaq 0x30(%rsp), %r14
jmp 0xa416
jmp 0x9f6e
movq %rax, %r15
leaq 0x10(%rsp), %rbx
jmp 0xa458
movq %rax, %r15
leaq 0x10(%rsp), %rbx
jmp 0xa46f
movq %rax, %r15
leaq 0x10(%rsp), %rbx
jmp 0xa490
movq %rax, %r15
jmp 0xa1b3
movq %rax, %r15
leaq 0x10(%rsp), %rbx
jmp 0xa437
movq %rax, %r15
jmp 0xa192
jmp 0xa0f3
jmp 0xa28e
jmp 0xa28e
jmp 0xa238
jmp 0x9fae
jmp 0xa238
jmp 0x9fae
jmp 0xa238
jmp 0x9fae
jmp 0xa28e
jmp 0x9fdb
movq %rax, %r15
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0xa23b
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3390
jmp 0xa23b
jmp 0xa238
movq %rax, %r15
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xa261
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3390
jmp 0xa261
jmp 0xa25e
jmp 0xa25e
movq %rax, %r15
leaq 0x10(%rsp), %rbx
leaq 0x30(%rsp), %r14
jmp 0xa3f5
jmp 0xa0f3
movq %rax, %r15
movq 0x148(%rsp), %rdi
leaq 0x158(%rsp), %rax
cmpq %rax, %rdi
je 0xa291
movq 0x158(%rsp), %rsi
jmp 0xa0e6
movq %rax, %r15
movq 0x128(%rsp), %rdi
leaq 0x138(%rsp), %rax
cmpq %rax, %rdi
je 0xa291
movq 0x138(%rsp), %rsi
jmp 0xa0e6
movq %rax, %r15
movq 0x220(%rsp), %rdi
cmpq %r12, %rdi
je 0xa282
movq 0x230(%rsp), %rsi
incq %rsi
callq 0x3390
jmp 0xa282
jmp 0xa09e
movq %rax, %r15
leaq 0x10(%rsp), %rbx
leaq 0x30(%rsp), %r14
jmp 0xa301
movq %rax, %r15
leaq 0x10(%rsp), %rbx
leaq 0x30(%rsp), %r14
jmp 0xa326
movq %rax, %r15
movq 0x168(%rsp), %rdi
leaq 0x178(%rsp), %rax
cmpq %rax, %rdi
je 0xa291
movq 0x178(%rsp), %rsi
incq %rsi
callq 0x3390
jmp 0xa291
movq %rax, %r15
jmp 0xa282
movq %rax, %r15
leaq 0x10(%rsp), %rbx
leaq 0x30(%rsp), %r14
jmp 0xa34b
jmp 0xa152
movq %rax, %r15
jmp 0xa134
movq %rax, %r15
movq 0x200(%rsp), %rdi
cmpq %rbp, %rdi
je 0xa134
movq 0x210(%rsp), %rsi
incq %rsi
callq 0x3390
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0xa155
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3390
jmp 0xa155
movq %rax, %r15
movq 0x8e54(%rip), %rsi      # 0x12fb0
leaq 0x408(%rsp), %rdi
callq 0x3260
leaq 0x488(%rsp), %rdi
callq 0x3150
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xa192
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3390
movq 0x8e17(%rip), %rsi      # 0x12fb0
leaq 0x590(%rsp), %rdi
callq 0x3260
leaq 0x610(%rsp), %rdi
callq 0x3150
movq 0x8df6(%rip), %rsi      # 0x12fb0
leaq 0x280(%rsp), %rdi
callq 0x3260
leaq 0x300(%rsp), %rdi
callq 0x3150
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0xa1f9
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x3390
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0xa229
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x3390
jmp 0xa229
jmp 0xa238
jmp 0xa238
jmp 0xa226
movq %rax, %r15
leaq 0x10(%rsp), %rbx
leaq 0x30(%rsp), %r14
jmp 0xa358
movq %rax, %r15
movq 0x8d6e(%rip), %rsi      # 0x12fb0
leaq 0x280(%rsp), %rdi
callq 0x3260
movq 0x80(%rsp), %rdi
callq 0x3150
jmp 0xa291
movq %rax, %r15
movq 0x8d48(%rip), %rsi      # 0x12fb0
leaq 0x280(%rsp), %rdi
callq 0x3260
movq 0x80(%rsp), %rdi
callq 0x3150
leaq 0x10(%rsp), %rbx
leaq 0x30(%rsp), %r14
jmp 0xa2b7
movq %rax, %r15
leaq 0x10(%rsp), %rbx
leaq 0x30(%rsp), %r14
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xa2b7
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3390
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0xa2dc
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x3390
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0xa301
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x3390
movq 0x590(%rsp), %rdi
leaq 0x5a0(%rsp), %rax
cmpq %rax, %rdi
je 0xa326
movq 0x5a0(%rsp), %rsi
incq %rsi
callq 0x3390
movq 0x408(%rsp), %rdi
leaq 0x418(%rsp), %rax
cmpq %rax, %rdi
je 0xa34b
movq 0x418(%rsp), %rsi
incq %rsi
callq 0x3390
leaq 0x1c8(%rsp), %rdi
callq 0xbc26
leaq 0x100(%rsp), %rdi
callq 0xc164
movq 0x1e0(%rsp), %rdi
leaq 0x1f0(%rsp), %rax
cmpq %rax, %rdi
je 0xa38a
movq 0x1f0(%rsp), %rsi
incq %rsi
callq 0x3390
movq 0x8c1f(%rip), %rsi      # 0x12fb0
leaq 0x718(%rsp), %rdi
callq 0x3260
leaq 0x798(%rsp), %rdi
callq 0x3150
leaq 0xe8(%rsp), %rax
movq 0xd8(%rsp), %rdi
cmpq %rax, %rdi
je 0xa3d0
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x3390
movq 0x1a8(%rsp), %rdi
leaq 0x1b8(%rsp), %rax
cmpq %rax, %rdi
je 0xa3f5
movq 0x1b8(%rsp), %rsi
incq %rsi
callq 0x3390
movq 0x8bb4(%rip), %rsi      # 0x12fb0
leaq 0x8a0(%rsp), %rdi
callq 0x3260
leaq 0x920(%rsp), %rdi
callq 0x3150
movq 0x8b93(%rip), %rsi      # 0x12fb0
leaq 0xa28(%rsp), %rdi
callq 0x3260
leaq 0xaa8(%rsp), %rdi
callq 0x3150
movq 0x8b72(%rip), %rsi      # 0x12fb0
leaq 0xbb0(%rsp), %rdi
callq 0x3260
leaq 0xc30(%rsp), %rdi
callq 0x3150
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0xa46f
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3390
leaq 0x198(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa490
movq 0x198(%rsp), %rsi
incq %rsi
callq 0x3390
movq (%rsp), %rdi
cmpq %rbx, %rdi
je 0xa4a6
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3390
movq %r15, %rdi
callq 0x3640