// File: sjtuwrk[P]SunwayMR/include/Messaging.hpp
// Function: messageHandler(void*)
void* messageHandler(void *data)
{
	// parse data
	struct xyz_messaging_listen_thread_data_ *td = (struct xyz_messaging_listen_thread_data_ *)data;
	Messaging *m = td->mess;

	string msg;
	readSocket(td->client_sockfd, msg);

	string::size_type pos;
	pos=msg.find('$', 0);
	if (pos !=  string::npos) {
		string typeStr = msg.substr(0, pos);
		int msgType = atoi(typeStr.c_str());
		string msgContent=msg.substr(pos+1);

		if(msgType == FILE_BLOCK_REQUEST) { // reply file block
			vector<string> vs;
			splitString(msgContent, vs, FILE_BLOCK_REQUEST_DELIMITATION);
			if(vs.size() >= 4) {
				string ret;
				string path = vs[0];
				int offset = atoi(vs[1].c_str());
				int length = atoi(vs[2].c_str());
				FileSourceFormat format = static_cast<FileSourceFormat>(atoi(vs[3].c_str()));
				if (format == FILE_SOURCE_FORMAT_BYTE) {

					pthread_mutex_lock(&m->mutex_check_file_cache);
					if (m->file_cache_bytes.find(path) == m->file_cache_bytes.end()) { // check file cache
						string *file_content = new string();
						readFile(path, *file_content);
						m->file_cache_bytes[path] = file_content;
					} 
					pthread_mutex_unlock(&m->mutex_check_file_cache);

					ret = m->file_cache_bytes[path]->substr(offset, length);
				} else {
					pthread_mutex_lock(&m->mutex_check_file_cache);
					if (m->file_cache_lines.find(path) == m->file_cache_lines.end()) { // check file cache
						vector<string> *file_content = new vector<string>();
						readFileToLines(path, *file_content);
						m->file_cache_lines[path] = file_content;
					} 
					pthread_mutex_unlock(&m->mutex_check_file_cache);

					unsigned end_line = offset+length;
					for (unsigned int i=offset; i<end_line && i<m->file_cache_lines[path]->size(); i++) {
						ret += (*m->file_cache_lines[path])[i];
						ret += "\n";
					}
				}
				send(td->client_sockfd, ret);
				close(td->client_sockfd);
			}
		} else if(msgType == FETCH_REQUEST) {

			//cout << "CONTEXT ID: " << SUNWAYMR_CONTEXT_ID << endl;

			vector<string> paras;
			splitString(msgContent, paras, ",");
			if(paras.size() == 2)
			{
				long shuffleID = atol(paras[0].c_str());
				int partitionID = atoi(paras[1].c_str());

				// send back data
				string base_dir = "cache/shuffle/";
				string app_id = num2string(SUNWAYMR_CONTEXT_ID);
			    string shuffle_id = num2string(shuffleID);

			    string dir = app_id.append("/shuffle-") + shuffle_id.append("/");
			    dir = base_dir + dir;
			    vector<string> allFileNames;
				listAllFileNamesContain(dir, allFileNames, "shuffleTaskFile");

				pthread_mutex_lock(&m->mutex_check_file_cache);
				//map< long, vector< vector<string>* > > fetch_content_local; // !global shuffle cache data map(fetch_content) will cause segmentation fault!
				map< long, vector< vector<string>* > >::iterator it = m->fetch_content_local.find(shuffleID);
				if(it == m->fetch_content_local.end())
				{
					// this shuffle has not  been cached, read it
					vector< vector<string>* > vvs;
					for(unsigned int i=0; i<allFileNames.size(); i++)
					{
							string content;
							readFile(dir+allFileNames[i], content);
							vector<string> *lines = new vector<string>();
							splitString(content, *lines, SHUFFLETASK_PARTITION_DELIMITATION);
							vvs.push_back(lines);
					}
					m->fetch_content_local[shuffleID] = vvs;
				}
				pthread_mutex_unlock(&m->mutex_check_file_cache);

				//organize send message
				string senMsg;
				for(unsigned int i=0; i<m->fetch_content_local[shuffleID].size()-1; i++)
					senMsg += (*(m->fetch_content_local[shuffleID][i]))[partitionID] + string(SHUFFLETASK_KV_DELIMITATION);
				senMsg += (*(m->fetch_content_local[shuffleID].back()))[partitionID];

				send(td->client_sockfd, senMsg);
			}
			close(td->client_sockfd);
		} else if(msgType == FILE_INFO || msgType > 999999) { // sunwaymrhelper file sending
			m->messageReceived(td->local_port, td->ip, msgType, msgContent);
			string reply = "0";
			send(td->client_sockfd, reply);
			close(td->client_sockfd);
		} else {
			string reply = "";
			send(td->client_sockfd, reply);
			close(td->client_sockfd);

			m->messageReceived(td->local_port, td->ip, msgType, msgContent);
		}
	} else {
		string reply = "";
		send(td->client_sockfd, reply);
		close(td->client_sockfd);
	}

	pthread_exit(NULL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x630, %rsp            # imm = 0x630
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
leaq -0x38(%rbp), %rdi
movq %rdi, -0x4e8(%rbp)
callq 0x45c0
movq -0x4e8(%rbp), %rsi
movq -0x10(%rbp), %rax
movl 0x30(%rax), %edi
callq 0x7750
jmp 0x88a7
leaq -0x38(%rbp), %rdi
movl $0x24, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x4580
movq %rax, -0x50(%rbp)
cmpq $-0x1, -0x50(%rbp)
je 0x9ac9
movq -0x50(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x70(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x4420
jmp 0x88df
leaq -0x70(%rbp), %rdi
callq 0x4190
movq %rax, %rdi
callq 0x4690
movl %eax, -0x74(%rbp)
movq -0x50(%rbp), %rdx
incq %rdx
leaq -0x98(%rbp), %rdi
leaq -0x38(%rbp), %rsi
movq $-0x1, %rcx
callq 0x4420
jmp 0x8913
cmpl $0x5, -0x74(%rbp)
jne 0x8f33
leaq -0xb0(%rbp), %rdi
callq 0xe370
leaq -0xd1(%rbp), %rdi
movq %rdi, -0x4f0(%rbp)
callq 0x47a0
movq -0x4f0(%rbp), %rdx
leaq 0x119a2(%rip), %rsi     # 0x1a2ec
leaq -0xd0(%rbp), %rdi
callq 0xe8d0
jmp 0x8958
leaq -0x98(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
leaq -0xd0(%rbp), %rdx
callq 0x4bc0
jmp 0x8974
leaq -0xd0(%rbp), %rdi
callq 0x4878
leaq -0xd1(%rbp), %rdi
callq 0x4470
leaq -0xb0(%rbp), %rdi
callq 0xe3f0
cmpq $0x4, %rax
jb 0x8f11
leaq -0xf8(%rbp), %rdi
callq 0x45c0
xorl %eax, %eax
movl %eax, %esi
leaq -0xb0(%rbp), %rdi
callq 0xef40
movq %rax, %rsi
leaq -0x118(%rbp), %rdi
callq 0x41a0
jmp 0x89cf
leaq -0xb0(%rbp), %rdi
movl $0x1, %esi
callq 0xef40
movq %rax, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x4690
movl %eax, -0x11c(%rbp)
leaq -0xb0(%rbp), %rdi
movl $0x2, %esi
callq 0xef40
movq %rax, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x4690
movl %eax, -0x120(%rbp)
leaq -0xb0(%rbp), %rdi
movl $0x3, %esi
callq 0xef40
movq %rax, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x4690
movl %eax, -0x124(%rbp)
cmpl $0x0, -0x124(%rbp)
jne 0x8c69
movq -0x18(%rbp), %rdi
addq $0x30, %rdi
callq 0x4610
movq -0x18(%rbp), %rdi
addq $0x58, %rdi
leaq -0x118(%rbp), %rsi
callq 0xf020
movq %rax, -0x4f8(%rbp)
jmp 0x8a7b
movq -0x4f8(%rbp), %rax
movq %rax, -0x130(%rbp)
movq -0x18(%rbp), %rdi
addq $0x58, %rdi
callq 0xec00
movq %rax, -0x138(%rbp)
leaq -0x130(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0xeff0
testb $0x1, %al
jne 0x8ab9
jmp 0x8bf5
movl $0x20, %edi
callq 0x4400
movq %rax, -0x500(%rbp)
jmp 0x8acc
movq -0x500(%rbp), %rdi
callq 0x45c0
movq -0x500(%rbp), %rax
movq %rax, -0x140(%rbp)
leaq -0x160(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x41a0
jmp 0x8afb
movq -0x140(%rbp), %rsi
leaq -0x160(%rbp), %rdi
callq 0x5dc0
jmp 0x8b10
leaq -0x160(%rbp), %rdi
callq 0x4878
movq -0x140(%rbp), %rax
movq %rax, -0x510(%rbp)
movq -0x18(%rbp), %rdi
addq $0x58, %rdi
leaq -0x118(%rbp), %rsi
callq 0xf050
movq %rax, -0x508(%rbp)
jmp 0x8b47
movq -0x508(%rbp), %rax
movq -0x510(%rbp), %rcx
movq %rcx, (%rax)
jmp 0x8bf5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x9b74
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x9abb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x8ba5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x4878
leaq -0xd1(%rbp), %rdi
callq 0x4470
jmp 0x8f22
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x8f03
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x8ef7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x4878
jmp 0x8ef7
movq -0x18(%rbp), %rdi
addq $0x30, %rdi
callq 0x42d0
movq -0x18(%rbp), %rdi
addq $0x58, %rdi
leaq -0x118(%rbp), %rsi
callq 0xf050
movq %rax, -0x518(%rbp)
jmp 0x8c1f
movq -0x518(%rbp), %rax
movq (%rax), %rsi
movslq -0x11c(%rbp), %rdx
movslq -0x120(%rbp), %rcx
leaq -0x180(%rbp), %rdi
callq 0x4420
jmp 0x8c45
leaq -0xf8(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x44f0
leaq -0x180(%rbp), %rdi
callq 0x4878
jmp 0x8eba
movq -0x18(%rbp), %rdi
addq $0x30, %rdi
callq 0x4610
movq -0x18(%rbp), %rdi
addq $0x88, %rdi
leaq -0x118(%rbp), %rsi
callq 0xf160
movq %rax, -0x520(%rbp)
jmp 0x8c96
movq -0x520(%rbp), %rax
movq %rax, -0x188(%rbp)
movq -0x18(%rbp), %rdi
addq $0x88, %rdi
callq 0xed20
movq %rax, -0x190(%rbp)
leaq -0x188(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0xf130
testb $0x1, %al
jne 0x8cd7
jmp 0x8da6
movl $0x18, %edi
callq 0x4400
movq %rax, -0x528(%rbp)
jmp 0x8cea
movq -0x528(%rbp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
callq 0xe370
movq -0x528(%rbp), %rax
movq %rax, -0x198(%rbp)
leaq -0x1b8(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x41a0
jmp 0x8d27
movq -0x198(%rbp), %rsi
leaq -0x1b8(%rbp), %rdi
callq 0x6120
jmp 0x8d3c
leaq -0x1b8(%rbp), %rdi
callq 0x4878
movq -0x198(%rbp), %rax
movq %rax, -0x538(%rbp)
movq -0x18(%rbp), %rdi
addq $0x88, %rdi
leaq -0x118(%rbp), %rsi
callq 0xf190
movq %rax, -0x530(%rbp)
jmp 0x8d76
movq -0x530(%rbp), %rax
movq -0x538(%rbp), %rcx
movq %rcx, (%rax)
jmp 0x8da6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x4878
jmp 0x8ef7
movq -0x18(%rbp), %rdi
addq $0x30, %rdi
callq 0x42d0
movl -0x11c(%rbp), %eax
addl -0x120(%rbp), %eax
movl %eax, -0x1bc(%rbp)
movl -0x11c(%rbp), %eax
movl %eax, -0x1c0(%rbp)
movl -0x1c0(%rbp), %ecx
xorl %eax, %eax
cmpl -0x1bc(%rbp), %ecx
movb %al, -0x539(%rbp)
jae 0x8e39
movl -0x1c0(%rbp), %eax
movq %rax, -0x550(%rbp)
movq -0x18(%rbp), %rdi
addq $0x88, %rdi
leaq -0x118(%rbp), %rsi
callq 0xf190
movq %rax, -0x548(%rbp)
jmp 0x8e14
movq -0x548(%rbp), %rax
movq (%rax), %rdi
callq 0xe3f0
movq %rax, %rcx
movq -0x550(%rbp), %rax
cmpq %rcx, %rax
setb %al
movb %al, -0x539(%rbp)
movb -0x539(%rbp), %al
testb $0x1, %al
jne 0x8e45
jmp 0x8eb8
movq -0x18(%rbp), %rdi
addq $0x88, %rdi
leaq -0x118(%rbp), %rsi
callq 0xf190
movq %rax, -0x558(%rbp)
jmp 0x8e65
movq -0x558(%rbp), %rax
movq (%rax), %rdi
movl -0x1c0(%rbp), %eax
movl %eax, %esi
callq 0xef40
movq %rax, %rsi
leaq -0xf8(%rbp), %rdi
callq 0x4540
jmp 0x8e8d
leaq 0x1146d(%rip), %rsi     # 0x1a301
leaq -0xf8(%rbp), %rdi
callq 0x43c0
jmp 0x8ea2
jmp 0x8ea4
movl -0x1c0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c0(%rbp)
jmp 0x8dd1
jmp 0x8eba
movq -0x10(%rbp), %rax
movl 0x30(%rax), %edi
leaq -0xf8(%rbp), %rsi
callq 0x9bb0
jmp 0x8ecf
movq -0x10(%rbp), %rax
movl 0x30(%rax), %edi
callq 0x4840
jmp 0x8edd
leaq -0x118(%rbp), %rdi
callq 0x4878
leaq -0xf8(%rbp), %rdi
callq 0x4878
jmp 0x8f11
leaq -0x118(%rbp), %rdi
callq 0x4878
leaq -0xf8(%rbp), %rdi
callq 0x4878
jmp 0x8f22
leaq -0xb0(%rbp), %rdi
callq 0xe390
jmp 0x9a95
leaq -0xb0(%rbp), %rdi
callq 0xe390
jmp 0x9aaf
cmpl $0x6, -0x74(%rbp)
jne 0x982f
leaq -0x1d8(%rbp), %rdi
callq 0xe370
leaq -0x1f9(%rbp), %rdi
movq %rdi, -0x560(%rbp)
callq 0x47a0
movq -0x560(%rbp), %rdx
leaq 0x11399(%rip), %rsi     # 0x1a303
leaq -0x1f8(%rbp), %rdi
callq 0xe8d0
jmp 0x8f78
leaq -0x98(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
leaq -0x1f8(%rbp), %rdx
callq 0x4bc0
jmp 0x8f94
leaq -0x1f8(%rbp), %rdi
callq 0x4878
leaq -0x1f9(%rbp), %rdi
callq 0x4470
leaq -0x1d8(%rbp), %rdi
callq 0xe3f0
cmpq $0x2, %rax
jne 0x97f3
xorl %eax, %eax
movl %eax, %esi
leaq -0x1d8(%rbp), %rdi
movq %rdi, -0x570(%rbp)
callq 0xef40
movq %rax, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x44d0
movq -0x570(%rbp), %rdi
movq %rax, -0x208(%rbp)
movl $0x1, %esi
callq 0xef40
movq %rax, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x4690
movl %eax, -0x20c(%rbp)
leaq -0x231(%rbp), %rdi
movq %rdi, -0x568(%rbp)
callq 0x47a0
movq -0x568(%rbp), %rdx
leaq 0x112cd(%rip), %rsi     # 0x1a305
leaq -0x230(%rbp), %rdi
callq 0xe8d0
jmp 0x9046
leaq -0x231(%rbp), %rdi
callq 0x4470
movq 0x1c457(%rip), %rsi     # 0x254b0
leaq -0x258(%rbp), %rdi
callq 0x6830
jmp 0x9067
movq -0x208(%rbp), %rsi
leaq -0x278(%rbp), %rdi
callq 0x6830
jmp 0x907c
leaq 0x11291(%rip), %rsi     # 0x1a314
leaq -0x258(%rbp), %rdi
callq 0x4820
movq %rax, -0x578(%rbp)
jmp 0x9098
leaq 0x11273(%rip), %rsi     # 0x1a312
leaq -0x278(%rbp), %rdi
callq 0x4820
movq %rax, -0x580(%rbp)
jmp 0x90b4
movq -0x580(%rbp), %rdx
movq -0x578(%rbp), %rsi
leaq -0x298(%rbp), %rdi
callq 0xe980
jmp 0x90d0
leaq -0x2b8(%rbp), %rdi
leaq -0x230(%rbp), %rsi
leaq -0x298(%rbp), %rdx
callq 0xe980
jmp 0x90ec
leaq -0x298(%rbp), %rdi
movq %rdi, -0x588(%rbp)
leaq -0x2b8(%rbp), %rsi
movq %rsi, -0x590(%rbp)
callq 0x44f0
movq -0x590(%rbp), %rdi
callq 0x4878
leaq -0x2d0(%rbp), %rdi
callq 0xe370
movq -0x588(%rbp), %rsi
leaq -0x2f0(%rbp), %rdi
callq 0x41a0
jmp 0x913a
leaq -0x311(%rbp), %rdi
movq %rdi, -0x598(%rbp)
callq 0x47a0
movq -0x598(%rbp), %rdx
leaq 0x111c3(%rip), %rsi     # 0x1a31e
leaq -0x310(%rbp), %rdi
callq 0xe8d0
jmp 0x9169
leaq -0x2f0(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
leaq -0x310(%rbp), %rdx
callq 0x6d90
jmp 0x9185
leaq -0x310(%rbp), %rdi
callq 0x4878
leaq -0x311(%rbp), %rdi
callq 0x4470
leaq -0x2f0(%rbp), %rdi
callq 0x4878
movq -0x18(%rbp), %rdi
addq $0x30, %rdi
callq 0x4610
movq -0x18(%rbp), %rdi
addq $0xb8, %rdi
leaq -0x208(%rbp), %rsi
callq 0xf270
movq %rax, -0x5a0(%rbp)
jmp 0x91d6
movq -0x5a0(%rbp), %rax
movq %rax, -0x320(%rbp)
movq -0x18(%rbp), %rdi
addq $0xb8, %rdi
callq 0xee40
movq %rax, -0x328(%rbp)
leaq -0x320(%rbp), %rdi
leaq -0x328(%rbp), %rsi
callq 0xf2a0
testb $0x1, %al
jne 0x9217
jmp 0x9547
leaq -0x340(%rbp), %rdi
callq 0xf2d0
movl $0x0, -0x344(%rbp)
movl -0x344(%rbp), %eax
movq %rax, -0x5a8(%rbp)
leaq -0x2d0(%rbp), %rdi
callq 0xe3f0
movq %rax, %rcx
movq -0x5a8(%rbp), %rax
cmpq %rcx, %rax
jae 0x94e7
leaq -0x368(%rbp), %rdi
callq 0x45c0
movl -0x344(%rbp), %eax
movl %eax, %esi
leaq -0x2d0(%rbp), %rdi
callq 0xef40
movq %rax, %rdx
leaq -0x388(%rbp), %rdi
leaq -0x298(%rbp), %rsi
callq 0xe980
jmp 0x9291
leaq -0x388(%rbp), %rdi
leaq -0x368(%rbp), %rsi
callq 0x5dc0
jmp 0x92a6
leaq -0x388(%rbp), %rdi
callq 0x4878
movl $0x18, %edi
callq 0x4400
movq %rax, -0x5b0(%rbp)
jmp 0x92c5
movq -0x5b0(%rbp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
callq 0xe370
movq -0x5b0(%rbp), %rax
movq %rax, -0x390(%rbp)
movq -0x390(%rbp), %rax
movq %rax, -0x5c0(%rbp)
leaq -0x3b1(%rbp), %rdi
movq %rdi, -0x5b8(%rbp)
callq 0x47a0
movq -0x5b8(%rbp), %rdx
leaq 0x11012(%rip), %rsi     # 0x1a32e
leaq -0x3b0(%rbp), %rdi
callq 0xe8d0
jmp 0x932a
movq -0x5c0(%rbp), %rsi
leaq -0x368(%rbp), %rdi
leaq -0x3b0(%rbp), %rdx
callq 0x4bc0
jmp 0x9346
leaq -0x3b0(%rbp), %rdi
callq 0x4878
leaq -0x3b1(%rbp), %rdi
callq 0x4470
leaq -0x340(%rbp), %rdi
leaq -0x390(%rbp), %rsi
callq 0xf2f0
jmp 0x9373
leaq -0x368(%rbp), %rdi
callq 0x4878
movl -0x344(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x344(%rbp)
jmp 0x922d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x93b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x4878
leaq -0x1f9(%rbp), %rdi
callq 0x4470
jmp 0x981e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x231(%rbp), %rdi
callq 0x4470
jmp 0x981e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x97e5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x97d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x97cd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x97c1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x97b5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x9462
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x310(%rbp), %rdi
callq 0x4878
leaq -0x311(%rbp), %rdi
callq 0x4470
leaq -0x2f0(%rbp), %rdi
callq 0x4878
jmp 0x97b5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x94d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x388(%rbp), %rdi
callq 0x4878
jmp 0x94d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x94cd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x3b0(%rbp), %rdi
callq 0x4878
leaq -0x3b1(%rbp), %rdi
callq 0x4470
leaq -0x368(%rbp), %rdi
callq 0x4878
jmp 0x9536
movq -0x18(%rbp), %rdi
addq $0xb8, %rdi
leaq -0x208(%rbp), %rsi
callq 0xf360
movq %rax, -0x5c8(%rbp)
jmp 0x9507
movq -0x5c8(%rbp), %rdi
leaq -0x340(%rbp), %rsi
callq 0xf440
jmp 0x951c
leaq -0x340(%rbp), %rdi
callq 0xf690
jmp 0x9547
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x340(%rbp), %rdi
callq 0xf690
jmp 0x97b5
movq -0x18(%rbp), %rdi
addq $0x30, %rdi
callq 0x42d0
leaq -0x3d8(%rbp), %rdi
callq 0x45c0
movl $0x0, -0x3dc(%rbp)
movl -0x3dc(%rbp), %eax
movq %rax, -0x5d8(%rbp)
movq -0x18(%rbp), %rdi
addq $0xb8, %rdi
leaq -0x208(%rbp), %rsi
callq 0xf360
movq %rax, -0x5d0(%rbp)
jmp 0x9597
movq -0x5d0(%rbp), %rdi
callq 0xee90
movq %rax, %rcx
movq -0x5d8(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x96fe
movq -0x18(%rbp), %rdi
addq $0xb8, %rdi
leaq -0x208(%rbp), %rsi
callq 0xf360
movq %rax, -0x5e0(%rbp)
jmp 0x95da
movq -0x5e0(%rbp), %rdi
movl -0x3dc(%rbp), %eax
movl %eax, %esi
callq 0xeeb0
movq (%rax), %rdi
movslq -0x20c(%rbp), %rsi
callq 0xef40
movq %rax, -0x5f0(%rbp)
leaq -0x421(%rbp), %rdi
movq %rdi, -0x5e8(%rbp)
callq 0x47a0
movq -0x5e8(%rbp), %rdx
leaq 0x10d0e(%rip), %rsi     # 0x1a333
leaq -0x420(%rbp), %rdi
callq 0xe8d0
jmp 0x9633
movq -0x5f0(%rbp), %rsi
leaq -0x400(%rbp), %rdi
leaq -0x420(%rbp), %rdx
callq 0xf6f0
jmp 0x964f
leaq -0x3d8(%rbp), %rdi
leaq -0x400(%rbp), %rsi
callq 0x4540
jmp 0x9664
leaq -0x400(%rbp), %rdi
callq 0x4878
leaq -0x420(%rbp), %rdi
callq 0x4878
leaq -0x421(%rbp), %rdi
callq 0x4470
movl -0x3dc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3dc(%rbp)
jmp 0x956a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x97a9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x96ed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x96e1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x400(%rbp), %rdi
callq 0x4878
leaq -0x420(%rbp), %rdi
callq 0x4878
leaq -0x421(%rbp), %rdi
callq 0x4470
jmp 0x97a9
movq -0x18(%rbp), %rdi
addq $0xb8, %rdi
leaq -0x208(%rbp), %rsi
callq 0xf360
movq %rax, -0x5f8(%rbp)
jmp 0x971e
movq -0x5f8(%rbp), %rdi
callq 0xf740
movq (%rax), %rdi
movslq -0x20c(%rbp), %rsi
callq 0xef40
movq %rax, %rsi
leaq -0x3d8(%rbp), %rdi
callq 0x4540
jmp 0x974a
movq -0x10(%rbp), %rax
movl 0x30(%rax), %edi
leaq -0x3d8(%rbp), %rsi
callq 0x9bb0
jmp 0x975f
leaq -0x3d8(%rbp), %rdi
callq 0x4878
leaq -0x2d0(%rbp), %rdi
callq 0xe390
leaq -0x298(%rbp), %rdi
callq 0x4878
leaq -0x278(%rbp), %rdi
callq 0x4878
leaq -0x258(%rbp), %rdi
callq 0x4878
leaq -0x230(%rbp), %rdi
callq 0x4878
jmp 0x97f3
leaq -0x3d8(%rbp), %rdi
callq 0x4878
leaq -0x2d0(%rbp), %rdi
callq 0xe390
leaq -0x298(%rbp), %rdi
callq 0x4878
leaq -0x278(%rbp), %rdi
callq 0x4878
leaq -0x258(%rbp), %rdi
callq 0x4878
leaq -0x230(%rbp), %rdi
callq 0x4878
jmp 0x981e
movq -0x10(%rbp), %rax
movl 0x30(%rax), %edi
callq 0x4840
jmp 0x9801
leaq -0x1d8(%rbp), %rdi
callq 0xe390
jmp 0x9a93
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0xe390
jmp 0x9aaf
cmpl $0x1, -0x74(%rbp)
je 0x9842
cmpl $0xf423f, -0x74(%rbp)   # imm = 0xF423F
jle 0x9978
movq -0x18(%rbp), %rax
movq %rax, -0x608(%rbp)
movq -0x10(%rbp), %rsi
movl 0x8(%rsi), %eax
movl %eax, -0x5fc(%rbp)
addq $0x10, %rsi
leaq -0x448(%rbp), %rdi
callq 0x41a0
jmp 0x986c
movl -0x5fc(%rbp), %esi
movq -0x608(%rbp), %rdi
movl -0x74(%rbp), %ecx
movq (%rdi), %rax
movq 0x10(%rax), %rax
leaq -0x448(%rbp), %rdx
leaq -0x98(%rbp), %r8
callq *%rax
jmp 0x9895
leaq -0x448(%rbp), %rdi
callq 0x4878
leaq -0x469(%rbp), %rdi
movq %rdi, -0x610(%rbp)
callq 0x47a0
movq -0x610(%rbp), %rdx
leaq 0x10a77(%rip), %rsi     # 0x1a339
leaq -0x468(%rbp), %rdi
callq 0xe8d0
jmp 0x98d0
leaq -0x469(%rbp), %rdi
callq 0x4470
movq -0x10(%rbp), %rax
movl 0x30(%rax), %edi
leaq -0x468(%rbp), %rsi
callq 0x9bb0
jmp 0x98f1
movq -0x10(%rbp), %rax
movl 0x30(%rax), %edi
callq 0x4840
jmp 0x98ff
leaq -0x468(%rbp), %rdi
callq 0x4878
jmp 0x9a91
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x9aaf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x448(%rbp), %rdi
callq 0x4878
jmp 0x9aaf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x469(%rbp), %rdi
callq 0x4470
jmp 0x9aaf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x468(%rbp), %rdi
callq 0x4878
jmp 0x9aaf
leaq -0x491(%rbp), %rdi
movq %rdi, -0x618(%rbp)
callq 0x47a0
movq -0x618(%rbp), %rdx
leaq 0x106e6(%rip), %rsi     # 0x1a07f
leaq -0x490(%rbp), %rdi
callq 0xe8d0
jmp 0x99a7
leaq -0x491(%rbp), %rdi
callq 0x4470
movq -0x10(%rbp), %rax
movl 0x30(%rax), %edi
leaq -0x490(%rbp), %rsi
callq 0x9bb0
jmp 0x99c8
movq -0x10(%rbp), %rax
movl 0x30(%rax), %edi
callq 0x4840
jmp 0x99d6
movq -0x18(%rbp), %rax
movq %rax, -0x628(%rbp)
movq -0x10(%rbp), %rsi
movl 0x8(%rsi), %eax
movl %eax, -0x61c(%rbp)
addq $0x10, %rsi
leaq -0x4b8(%rbp), %rdi
callq 0x41a0
jmp 0x9a00
movl -0x61c(%rbp), %esi
movq -0x628(%rbp), %rdi
movl -0x74(%rbp), %ecx
movq (%rdi), %rax
movq 0x10(%rax), %rax
leaq -0x4b8(%rbp), %rdx
leaq -0x98(%rbp), %r8
callq *%rax
jmp 0x9a29
leaq -0x4b8(%rbp), %rdi
callq 0x4878
leaq -0x490(%rbp), %rdi
callq 0x4878
jmp 0x9a91
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x491(%rbp), %rdi
callq 0x4470
jmp 0x9aaf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x9a83
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x4b8(%rbp), %rdi
callq 0x4878
leaq -0x490(%rbp), %rdi
callq 0x4878
jmp 0x9aaf
jmp 0x9a93
jmp 0x9a95
leaq -0x98(%rbp), %rdi
callq 0x4878
leaq -0x70(%rbp), %rdi
callq 0x4878
jmp 0x9b69
leaq -0x98(%rbp), %rdi
callq 0x4878
leaq -0x70(%rbp), %rdi
callq 0x4878
jmp 0x9b74
leaq -0x4d9(%rbp), %rdi
movq %rdi, -0x630(%rbp)
callq 0x47a0
movq -0x630(%rbp), %rdx
leaq 0x10595(%rip), %rsi     # 0x1a07f
leaq -0x4d8(%rbp), %rdi
callq 0xe8d0
jmp 0x9af8
leaq -0x4d9(%rbp), %rdi
callq 0x4470
movq -0x10(%rbp), %rax
movl 0x30(%rax), %edi
leaq -0x4d8(%rbp), %rsi
callq 0x9bb0
jmp 0x9b19
movq -0x10(%rbp), %rax
movl 0x30(%rax), %edi
callq 0x4840
jmp 0x9b27
leaq -0x4d8(%rbp), %rdi
callq 0x4878
jmp 0x9b69
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x4d9(%rbp), %rdi
callq 0x4470
jmp 0x9b74
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x4d8(%rbp), %rdi
callq 0x4878
jmp 0x9b74
xorl %eax, %eax
movl %eax, %edi
callq 0x4790
jmp 0x9b74
leaq -0x38(%rbp), %rdi
callq 0x4878
movq -0x40(%rbp), %rdi
callq 0x4780
nopw %cs:(%rax,%rax)