// File: mbourand[P]webserv/srcs/tcp-server.cpp
// Function: main
int	main(int argc, char **argv)
{
	std::cout << "\e[34m" << " __      __      ___.                              \n/  \\    /  \\ ____\\_ |__   ______ ______________  __\n\\   \\/\\/   // __ \\| __ \\ /  ___// __ \\_  __ \\  \\/ /\n \\        /\\  ___/| \\_\\ \\\\___ \\\\  ___/|  | \\/\\   / \n  \\__/\\  /  \\___  >___  /____  >\\___  >__|    \\_/  \n       \\/       \\/    \\/     \\/     \\/         V1.0.0\e[39m" << std::endl;
	std::cout << "\e[34m" << "Available commands are: help|stop|gzip|deflate|info|workers|uptime|logger|types|debug" << "\e[39m" << std::endl;
	Logger::setMode(SILENT);
	Logger::print("Webserv is starting...", NULL, INFO, SILENT);
	if (argc > 2)
	{
		std::cerr << "Format: ./webserv <path_to_config_file>" << std::endl;
		return 1;
	}

	try { g_webserv.init_config(std::string(argc == 1 ? "./config/default.conf" : argv[1])); }
	catch (std::exception& e) { return Logger::print(std::string("Invalid config file: ") + e.what(), 1, ERROR, SILENT); }

	g_webserv.creds = new Credentials();
	Threadpool* workers = new Threadpool(g_webserv.workers_amount);
	sighandler();

	try
	{
		fd_set							read_sockets, read_sockets_z, write_sockets, write_sockets_z, error_sockets, error_sockets_z;
		std::list<Client>				clients;
		std::list<Client>::iterator		it;
		int								highestFd = 0;
		int								serverFd = 0;
		int								readyfd = 0;
		struct timeval 					start_time;

		gettimeofday(&start_time, NULL);
		Logger::print("Webserv is ready, waiting for connection...", NULL, SUCCESS, SILENT);
		FD_ZERO(&read_sockets_z);
		FD_ZERO(&write_sockets_z);
		FD_ZERO(&error_sockets_z);
		for (std::map<int, ServerSocket*>::iterator its = g_webserv.sockets.begin(); its != g_webserv.sockets.end(); its++)
		{
			if (its->second->GetSocket() > serverFd)
				serverFd = its->second->GetSocket();
			FD_SET(its->second->GetSocket(), &read_sockets_z);
		}
		FD_SET(STDIN_FILENO, &read_sockets_z);
		highestFd = serverFd;
		while (g_webserv.run)
		{
			it = clients.begin();
			read_sockets = read_sockets_z;
			write_sockets = write_sockets_z;
			error_sockets = error_sockets_z;
			struct timeval timeout = {30, 0};
			readyfd = select(highestFd + 1, &read_sockets, &write_sockets, &error_sockets, &timeout);
			switch (readyfd)
			{
			case -1:
				if (g_webserv.run)
					Logger::print("Error select(): "+std::string(strerror(errno)), NULL, ERROR, SILENT);
				break;
			case 0:
				Logger::print(std::string("Idle.. Active Connections: ")+ft::toString(clients.size()), NULL, INFO, NORMAL);
				break;//webserv was idling for the past 30s
			default:
				if (FD_ISSET(STDIN_FILENO, &read_sockets))
				{
					std::string line;
					std::getline(std::cin, line);
					handle_terminal_input(line, clients, &start_time, workers);
					readyfd--;
				}
				for (std::map<int, ServerSocket*>::iterator its = g_webserv.sockets.begin(); its != g_webserv.sockets.end(); its++)
				{
					if (FD_ISSET(its->second->GetSocket(), &read_sockets))
					{
						int fd = 0;
						if ((fd = handle_new_connection(*its->second, clients)))
						{
							FD_SET(fd, &read_sockets_z);
							FD_SET(fd, &write_sockets_z);
							FD_SET(fd, &error_sockets_z);
							if (fd > highestFd)
								highestFd = fd;
						}
						readyfd--;
					}
				}
				it = clients.begin();
				while (readyfd && it != clients.end())
				{
					bool	error = false;
					if (FD_ISSET(it->sckt->GetSocket(), &error_sockets))
					{
						error = true;
						Logger::print("FD Error flagged by Select", NULL, WARNING, SILENT);
					}
					if (!error && FD_ISSET(it->sckt->GetSocket(), &read_sockets))
					{
						error = handle_client_request((*it));
						readyfd--;
					}
					if (!error && FD_ISSET(it->sckt->GetSocket(), &write_sockets))
					{
						if (it->req->isfinished())
							error = workers->AddJob((*it));
						readyfd--;
					}
					if (error)
					{
						bool busy = false;
						workers->Lock();
						if (!workers->getJobs().empty())
							for (std::deque<Client*>::const_iterator jobs_it = workers->getJobs().begin(); jobs_it != workers->getJobs().end(); jobs_it++)
								if (it->sckt == (*jobs_it)->sckt)
									busy = true;
						if (!workers->getCurrentJobs().empty())
							for (std::list<Client*>::const_iterator jobs_it = workers->getCurrentJobs().begin(); jobs_it != workers->getCurrentJobs().end(); jobs_it++)
								if (it->sckt == (*jobs_it)->sckt)
									busy = true;
						workers->Unlock();
						if (busy)
							continue;
						Logger::print("Client Disconnected", NULL, SUCCESS, NORMAL);
						FD_CLR(it->sckt->GetSocket(), &read_sockets_z);
						FD_CLR(it->sckt->GetSocket(), &write_sockets_z);
						FD_CLR(it->sckt->GetSocket(), &error_sockets_z);
						if (highestFd == it->sckt->GetSocket())
							highestFd = 0;
						delete it->sckt;
						delete it->req;
						it = clients.erase(it);
					}
					else
					{
						++it;
					}
				}
				if (!highestFd)
				{
					highestFd = serverFd;
					for (std::list<Client>::iterator its = clients.begin(); its != clients.end(); ++its)
					{
						if (its->sckt->GetSocket() > highestFd)
							highestFd = its->sckt->GetSocket();
					}
				}
				break;
			}
		}
		Logger::print("Webserv is shutting down...", NULL, INFO, SILENT);
		delete workers;
		it = clients.begin();
		while (it != clients.end())
		{
			Logger::print("Socket closed", NULL, SUCCESS, SILENT);
			delete it->sckt;
			delete it->req;
			it = clients.erase(it);
		}
	}
	catch(ServerSocket::ServerSocketException& e)
	{
		g_webserv.run = false;
		Logger::print(e.what(), NULL, ERROR, SILENT);
	}

	for (std::map<int, ServerSocket*>::iterator its = g_webserv.sockets.begin(); its != g_webserv.sockets.end(); its++)
		delete its->second;
	delete g_webserv.file_formatname;
	delete g_webserv.languages;
	delete g_webserv.creds;
	Logger::print("Webserv Shutdown complete", NULL, SUCCESS, SILENT);
	std::cout << std::flush;
	return (0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x9c0, %rsp            # imm = 0x9C0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq 0x36a98(%rip), %rdi     # 0x8efa8
movq %rdi, -0x780(%rbp)
leaq 0x15073(%rip), %rsi     # 0x6d591
movq %rsi, -0x778(%rbp)
callq 0x9670
movq %rax, %rdi
leaq 0x15063(%rip), %rsi     # 0x6d597
callq 0x9670
movq %rax, %rdi
movq 0x36a3d(%rip), %rsi     # 0x8ef80
movq %rsi, -0x770(%rbp)
callq 0x96d0
movq -0x780(%rbp), %rdi
movq -0x778(%rbp), %rsi
callq 0x9670
movq %rax, %rdi
leaq 0x1516a(%rip), %rsi     # 0x6d6d6
callq 0x9670
movq %rax, %rdi
leaq 0x15155(%rip), %rsi     # 0x6d6d0
callq 0x9670
movq -0x770(%rbp), %rsi
movq %rax, %rdi
callq 0x96d0
movl $0x2, -0x14(%rbp)
leaq -0x14(%rbp), %rdi
callq 0x5bec0
leaq -0x39(%rbp), %rdi
movq %rdi, -0x768(%rbp)
callq 0x9b10
movq -0x768(%rbp), %rdx
leaq 0x1516f(%rip), %rsi     # 0x6d72c
leaq -0x38(%rbp), %rdi
callq 0xa780
jmp 0x585c8
xorl %edx, %edx
movl %edx, %esi
leaq -0x38(%rbp), %rdi
movl $0x2, %ecx
callq 0x138a0
jmp 0x585dc
leaq -0x38(%rbp), %rdi
callq 0x9c98
leaq -0x39(%rbp), %rdi
callq 0x9700
cmpl $0x2, -0x8(%rbp)
jle 0x58653
movq 0x369ed(%rip), %rdi     # 0x8efe8
leaq 0x15141(%rip), %rsi     # 0x6d743
callq 0x9670
movq %rax, %rdi
movq 0x3696f(%rip), %rsi     # 0x8ef80
callq 0x96d0
movl $0x1, -0x4(%rbp)
jmp 0x5a1b7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x58645
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x9c98
leaq -0x39(%rbp), %rdi
callq 0x9700
jmp 0x5a1c3
cmpl $0x1, -0x8(%rbp)
jne 0x58669
leaq 0x1510b(%rip), %rax     # 0x6d76b
movq %rax, -0x788(%rbp)
jmp 0x58678
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x788(%rbp)
movq -0x788(%rbp), %rax
movq %rax, -0x798(%rbp)
leaq -0x71(%rbp), %rdi
movq %rdi, -0x790(%rbp)
callq 0x9b10
movq -0x798(%rbp), %rsi
movq -0x790(%rbp), %rdx
leaq -0x70(%rbp), %rdi
callq 0xa780
jmp 0x586af
leaq 0x3706a(%rip), %rdi     # 0x8f720
leaq -0x70(%rbp), %rsi
callq 0x43c50
jmp 0x586c1
leaq -0x70(%rbp), %rdi
callq 0x9c98
leaq -0x71(%rbp), %rdi
callq 0x9700
jmp 0x58827
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x586fb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x9c98
leaq -0x71(%rbp), %rdi
callq 0x9700
movl -0x4c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x5a1c3
movq -0x48(%rbp), %rdi
callq 0x92a0
movq %rax, -0x80(%rbp)
leaq -0xc1(%rbp), %rdi
movq %rdi, -0x7a0(%rbp)
callq 0x9b10
movq -0x7a0(%rbp), %rdx
leaq 0x1503f(%rip), %rsi     # 0x6d781
leaq -0xc0(%rbp), %rdi
callq 0xa780
jmp 0x58750
movq -0x80(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, %rdx
leaq -0xa0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x13970
jmp 0x58775
leaq -0xa0(%rbp), %rdi
movl $0x1, %esi
movl $0x3, %edx
movl $0x2, %ecx
callq 0x1cdd0
movl %eax, -0x7a4(%rbp)
jmp 0x58798
movl -0x7a4(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x9c98
leaq -0xc0(%rbp), %rdi
callq 0x9c98
leaq -0xc1(%rbp), %rdi
callq 0x9700
callq 0x9a40
jmp 0x5a1b7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x5880f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x58803
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x9c98
leaq -0xc0(%rbp), %rdi
callq 0x9c98
leaq -0xc1(%rbp), %rdi
callq 0x9700
callq 0x9a40
jmp 0x58822
jmp 0x5a1c3
movl $0x18, %edi
callq 0x9680
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x7b0(%rbp)
callq 0x230e0
jmp 0x58845
movq -0x7b0(%rbp), %rax
movq %rax, 0x36f9d(%rip)     # 0x8f7f0
movl $0xb8, %edi
callq 0x9680
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x7b8(%rbp)
movl 0x36f70(%rip), %esi     # 0x8f7e0
callq 0x268b0
jmp 0x58877
movq -0x7b8(%rbp), %rax
movq %rax, -0xd0(%rbp)
callq 0x267b0
leaq -0x3e8(%rbp), %rdi
callq 0x5bef0
leaq -0x3f0(%rbp), %rdi
callq 0x5bf10
movl $0x0, -0x3f4(%rbp)
movl $0x0, -0x3f8(%rbp)
movl $0x0, -0x3fc(%rbp)
xorl %eax, %eax
movl %eax, %esi
leaq -0x410(%rbp), %rdi
callq 0x9a10
leaq -0x431(%rbp), %rdi
movq %rdi, -0x7c0(%rbp)
callq 0x9b10
movq -0x7c0(%rbp), %rdx
leaq 0x14ea6(%rip), %rsi     # 0x6d797
leaq -0x430(%rbp), %rdi
callq 0xa780
jmp 0x588ff
xorl %eax, %eax
movl %eax, %esi
leaq -0x430(%rbp), %rdi
movl $0x1, %edx
movl $0x2, %ecx
callq 0x138a0
jmp 0x5891b
leaq -0x430(%rbp), %rdi
callq 0x9c98
leaq -0x431(%rbp), %rdi
callq 0x9700
leaq -0x1d0(%rbp), %rax
movq %rax, -0x440(%rbp)
movl $0x0, -0x438(%rbp)
movl -0x438(%rbp), %eax
cmpq $0x10, %rax
jae 0x589fc
movq -0x440(%rbp), %rax
movl -0x438(%rbp), %ecx
movq $0x0, (%rax,%rcx,8)
movl -0x438(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x438(%rbp)
jmp 0x5894b
movq -0x7b0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl $0x18, %esi
callq 0x9690
jmp 0x5a1c3
movq -0x7b8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl $0xb8, %esi
callq 0x9690
jmp 0x5a1c3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x589eb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x430(%rbp), %rdi
callq 0x9c98
leaq -0x431(%rbp), %rdi
callq 0x9700
jmp 0x59ef4
jmp 0x589fe
jmp 0x58a00
jmp 0x58a02
leaq -0x2d0(%rbp), %rax
movq %rax, -0x450(%rbp)
movl $0x0, -0x444(%rbp)
movl -0x444(%rbp), %eax
cmpq $0x10, %rax
jae 0x58a4c
movq -0x450(%rbp), %rax
movl -0x444(%rbp), %ecx
movq $0x0, (%rax,%rcx,8)
movl -0x444(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x444(%rbp)
jmp 0x58a1a
jmp 0x58a4e
jmp 0x58a50
jmp 0x58a52
leaq -0x3d0(%rbp), %rax
movq %rax, -0x460(%rbp)
movl $0x0, -0x454(%rbp)
movl -0x454(%rbp), %eax
cmpq $0x10, %rax
jae 0x58a9c
movq -0x460(%rbp), %rax
movl -0x454(%rbp), %ecx
movq $0x0, (%rax,%rcx,8)
movl -0x454(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x454(%rbp)
jmp 0x58a6a
jmp 0x58a9e
jmp 0x58aa0
leaq 0x36c79(%rip), %rdi     # 0x8f720
addq $0x18, %rdi
callq 0x5bf30
movq %rax, -0x468(%rbp)
leaq 0x36c62(%rip), %rdi     # 0x8f720
addq $0x18, %rdi
callq 0x5bf90
movq %rax, -0x470(%rbp)
leaq -0x468(%rbp), %rdi
leaq -0x470(%rbp), %rsi
callq 0x5bf60
testb $0x1, %al
jne 0x58aea
jmp 0x58c07
leaq -0x468(%rbp), %rdi
callq 0x5bfc0
movq 0x8(%rax), %rdi
callq 0x1cdb0
movl %eax, -0x7c4(%rbp)
jmp 0x58b07
movl -0x7c4(%rbp), %eax
cmpl -0x3f8(%rbp), %eax
jle 0x58b51
leaq -0x468(%rbp), %rdi
callq 0x5bfc0
movq 0x8(%rax), %rdi
callq 0x1cdb0
movl %eax, -0x7c8(%rbp)
jmp 0x58b32
movl -0x7c8(%rbp), %eax
movl %eax, -0x3f8(%rbp)
jmp 0x58b51
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x59ef4
leaq -0x468(%rbp), %rdi
callq 0x5bfc0
movq 0x8(%rax), %rdi
callq 0x1cdb0
movl %eax, -0x7cc(%rbp)
jmp 0x58b6e
movl -0x7cc(%rbp), %eax
movl %eax, %edx
addl $0x3f, %edx
testl %eax, %eax
movl %eax, %ecx
cmovsl %edx, %ecx
andl $0xc0, %ecx
subl %ecx, %eax
movb %al, %cl
movl $0x1, %eax
shlq %cl, %rax
movq %rax, -0x7e0(%rbp)
leaq -0x1d0(%rbp), %rax
movq %rax, -0x7d8(%rbp)
leaq -0x468(%rbp), %rdi
callq 0x5bfc0
movq 0x8(%rax), %rdi
callq 0x1cdb0
movl %eax, -0x7d0(%rbp)
jmp 0x58bc4
movl -0x7d0(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x7e0(%rbp), %rdx
movl %eax, %ecx
movq -0x7d8(%rbp), %rax
movslq %ecx, %rcx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
leaq -0x468(%rbp), %rdi
xorl %esi, %esi
callq 0x5bfe0
movq %rax, -0x478(%rbp)
jmp 0x58ab7
movq -0x1d0(%rbp), %rax
orq $0x1, %rax
movq %rax, -0x1d0(%rbp)
movl -0x3f8(%rbp), %eax
movl %eax, -0x3f4(%rbp)
testb $0x1, 0x36af4(%rip)     # 0x8f720
je 0x59ca6
leaq -0x3e8(%rbp), %rdi
callq 0x5c020
movq %rax, -0x480(%rbp)
movq -0x480(%rbp), %rax
movq %rax, -0x3f0(%rbp)
movups -0x160(%rbp), %xmm0
movaps %xmm0, -0xe0(%rbp)
movups -0x170(%rbp), %xmm0
movaps %xmm0, -0xf0(%rbp)
movups -0x180(%rbp), %xmm0
movaps %xmm0, -0x100(%rbp)
movups -0x190(%rbp), %xmm0
movaps %xmm0, -0x110(%rbp)
movups -0x1d0(%rbp), %xmm0
movups -0x1c0(%rbp), %xmm1
movups -0x1b0(%rbp), %xmm2
movups -0x1a0(%rbp), %xmm3
movaps %xmm3, -0x120(%rbp)
movaps %xmm2, -0x130(%rbp)
movaps %xmm1, -0x140(%rbp)
movaps %xmm0, -0x150(%rbp)
movups -0x260(%rbp), %xmm0
movaps %xmm0, -0x1e0(%rbp)
movups -0x270(%rbp), %xmm0
movaps %xmm0, -0x1f0(%rbp)
movups -0x280(%rbp), %xmm0
movaps %xmm0, -0x200(%rbp)
movups -0x290(%rbp), %xmm0
movaps %xmm0, -0x210(%rbp)
movups -0x2d0(%rbp), %xmm0
movups -0x2c0(%rbp), %xmm1
movups -0x2b0(%rbp), %xmm2
movups -0x2a0(%rbp), %xmm3
movaps %xmm3, -0x220(%rbp)
movaps %xmm2, -0x230(%rbp)
movaps %xmm1, -0x240(%rbp)
movaps %xmm0, -0x250(%rbp)
movups -0x360(%rbp), %xmm0
movaps %xmm0, -0x2e0(%rbp)
movups -0x370(%rbp), %xmm0
movaps %xmm0, -0x2f0(%rbp)
movups -0x380(%rbp), %xmm0
movaps %xmm0, -0x300(%rbp)
movups -0x390(%rbp), %xmm0
movaps %xmm0, -0x310(%rbp)
movups -0x3d0(%rbp), %xmm0
movups -0x3c0(%rbp), %xmm1
movups -0x3b0(%rbp), %xmm2
movups -0x3a0(%rbp), %xmm3
movaps %xmm3, -0x320(%rbp)
movaps %xmm2, -0x330(%rbp)
movaps %xmm1, -0x340(%rbp)
movaps %xmm0, -0x350(%rbp)
movups 0x14c5e(%rip), %xmm0    # 0x6da08
movaps %xmm0, -0x490(%rbp)
movl -0x3f4(%rbp), %edi
incl %edi
leaq -0x150(%rbp), %rsi
leaq -0x250(%rbp), %rdx
leaq -0x350(%rbp), %rcx
leaq -0x490(%rbp), %r8
callq 0x9630
movl %eax, -0x7e4(%rbp)
jmp 0x58de2
movl -0x7e4(%rbp), %eax
movl %eax, -0x3fc(%rbp)
movl -0x3fc(%rbp), %eax
movl %eax, -0x7e8(%rbp)
subl $-0x1, %eax
je 0x58e14
jmp 0x58e01
movl -0x7e8(%rbp), %eax
testl %eax, %eax
je 0x58f17
jmp 0x59035
testb $0x1, 0x36905(%rip)     # 0x8f720
je 0x58f12
callq 0x9080
movl (%rax), %edi
callq 0x9230
movq %rax, -0x7f8(%rbp)
leaq -0x4d1(%rbp), %rdi
movq %rdi, -0x7f0(%rbp)
callq 0x9b10
movq -0x7f8(%rbp), %rsi
movq -0x7f0(%rbp), %rdx
leaq -0x4d0(%rbp), %rdi
callq 0xa780
jmp 0x58e63
leaq 0x14959(%rip), %rsi     # 0x6d7c3
leaq -0x4b0(%rbp), %rdi
leaq -0x4d0(%rbp), %rdx
callq 0x14790
jmp 0x58e7f
xorl %eax, %eax
movl %eax, %esi
leaq -0x4b0(%rbp), %rdi
movl $0x3, %edx
movl $0x2, %ecx
callq 0x138a0
jmp 0x58e9b
leaq -0x4b0(%rbp), %rdi
callq 0x9c98
leaq -0x4d0(%rbp), %rdi
callq 0x9c98
leaq -0x4d1(%rbp), %rdi
callq 0x9700
jmp 0x58f12
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x58f01
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x58ef5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x4b0(%rbp), %rdi
callq 0x9c98
leaq -0x4d0(%rbp), %rdi
callq 0x9c98
leaq -0x4d1(%rbp), %rdi
callq 0x9700
jmp 0x59ef4
jmp 0x59ca1
leaq -0x519(%rbp), %rdi
movq %rdi, -0x800(%rbp)
callq 0x9b10
movq -0x800(%rbp), %rdx
leaq 0x1489c(%rip), %rsi     # 0x6d7d4
leaq -0x518(%rbp), %rdi
callq 0xa780
jmp 0x58f46
leaq -0x3e8(%rbp), %rdi
callq 0x5bcd0
movl %eax, %esi
leaq -0x540(%rbp), %rdi
callq 0x2f700
jmp 0x58f62
leaq -0x4f8(%rbp), %rdi
leaq -0x518(%rbp), %rsi
leaq -0x540(%rbp), %rdx
callq 0x14210
jmp 0x58f7e
xorl %edx, %edx
movl %edx, %esi
leaq -0x4f8(%rbp), %rdi
movl $0x1, %ecx
callq 0x138a0
jmp 0x58f95
leaq -0x4f8(%rbp), %rdi
callq 0x9c98
leaq -0x540(%rbp), %rdi
callq 0x9c98
leaq -0x518(%rbp), %rdi
callq 0x9c98
leaq -0x519(%rbp), %rdi
callq 0x9700
jmp 0x59ca1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x59024
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x59018
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x5900c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x4f8(%rbp), %rdi
callq 0x9c98
leaq -0x540(%rbp), %rdi
callq 0x9c98
leaq -0x518(%rbp), %rdi
callq 0x9c98
leaq -0x519(%rbp), %rdi
callq 0x9700
jmp 0x59ef4
movq -0x150(%rbp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0x590cf
leaq -0x560(%rbp), %rdi
movq %rdi, -0x808(%rbp)
callq 0x98c0
movq -0x808(%rbp), %rsi
movq 0x35f65(%rip), %rdi     # 0x8efd0
callq 0x9130
jmp 0x59072
movq -0xd0(%rbp), %rcx
leaq -0x560(%rbp), %rdi
leaq -0x3e8(%rbp), %rsi
leaq -0x410(%rbp), %rdx
callq 0x5a1e0
jmp 0x59095
movl -0x3fc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3fc(%rbp)
leaq -0x560(%rbp), %rdi
callq 0x9c98
jmp 0x590cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x560(%rbp), %rdi
callq 0x9c98
jmp 0x59ef4
leaq 0x3664a(%rip), %rdi     # 0x8f720
addq $0x18, %rdi
callq 0x5bf30
movq %rax, -0x568(%rbp)
leaq 0x36633(%rip), %rdi     # 0x8f720
addq $0x18, %rdi
callq 0x5bf90
movq %rax, -0x570(%rbp)
leaq -0x568(%rbp), %rdi
leaq -0x570(%rbp), %rsi
callq 0x5bf60
testb $0x1, %al
jne 0x59119
jmp 0x592f9
leaq -0x150(%rbp), %rax
movq %rax, -0x818(%rbp)
leaq -0x568(%rbp), %rdi
callq 0x5bfc0
movq 0x8(%rax), %rdi
callq 0x1cdb0
movl %eax, -0x80c(%rbp)
jmp 0x59144
movq -0x818(%rbp), %rax
movl -0x80c(%rbp), %ecx
movl %ecx, %edx
addl $0x3f, %edx
testl %ecx, %ecx
cmovsl %edx, %ecx
sarl $0x6, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x828(%rbp)
leaq -0x568(%rbp), %rdi
callq 0x5bfc0
movq 0x8(%rax), %rdi
callq 0x1cdb0
movl %eax, -0x81c(%rbp)
jmp 0x59189
movl -0x81c(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x828(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x592dd
movl $0x0, -0x574(%rbp)
leaq -0x568(%rbp), %rdi
callq 0x5bfc0
movq 0x8(%rax), %rdi
leaq -0x3e8(%rbp), %rsi
callq 0x56cd0
movl %eax, -0x82c(%rbp)
jmp 0x591e6
movl -0x82c(%rbp), %eax
movl %eax, -0x574(%rbp)
cmpl $0x0, %eax
je 0x592ce
movl -0x574(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, %rcx
movl -0x574(%rbp), %eax
movl $0x40, %esi
cltd
idivl %esi
cltq
orq -0x1d0(%rbp,%rax,8), %rcx
movq %rcx, -0x1d0(%rbp,%rax,8)
movl -0x574(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, %rcx
movl -0x574(%rbp), %eax
movl $0x40, %esi
cltd
idivl %esi
cltq
orq -0x2d0(%rbp,%rax,8), %rcx
movq %rcx, -0x2d0(%rbp,%rax,8)
movl -0x574(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, %rcx
movl -0x574(%rbp), %eax
movl $0x40, %esi
cltd
idivl %esi
cltq
orq -0x3d0(%rbp,%rax,8), %rcx
movq %rcx, -0x3d0(%rbp,%rax,8)
movl -0x574(%rbp), %eax
cmpl -0x3f4(%rbp), %eax
jle 0x592cc
movl -0x574(%rbp), %eax
movl %eax, -0x3f4(%rbp)
jmp 0x592ce
movl -0x3fc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3fc(%rbp)
jmp 0x592df
leaq -0x568(%rbp), %rdi
xorl %esi, %esi
callq 0x5bfe0
movq %rax, -0x580(%rbp)
jmp 0x590e6
leaq -0x3e8(%rbp), %rdi
callq 0x5c020
movq %rax, -0x588(%rbp)
movq -0x588(%rbp), %rax
movq %rax, -0x3f0(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x3fc(%rbp)
movb %al, -0x82d(%rbp)
je 0x59357
leaq -0x3e8(%rbp), %rdi
callq 0x5c080
movq %rax, -0x590(%rbp)
leaq -0x3f0(%rbp), %rdi
leaq -0x590(%rbp), %rsi
callq 0x5c050
movb %al, -0x82d(%rbp)
movb -0x82d(%rbp), %al
testb $0x1, %al
jne 0x59366
jmp 0x59be0
movb $0x0, -0x591(%rbp)
leaq -0x350(%rbp), %rax
movq %rax, -0x840(%rbp)
leaq -0x3f0(%rbp), %rdi
callq 0x5c0b0
movq (%rax), %rdi
callq 0x1cdb0
movl %eax, -0x834(%rbp)
jmp 0x59397
movq -0x840(%rbp), %rax
movl -0x834(%rbp), %ecx
movl %ecx, %edx
addl $0x3f, %edx
testl %ecx, %ecx
cmovsl %edx, %ecx
sarl $0x6, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x850(%rbp)
leaq -0x3f0(%rbp), %rdi
callq 0x5c0b0
movq (%rax), %rdi
callq 0x1cdb0
movl %eax, -0x844(%rbp)
jmp 0x593db
movl -0x844(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x850(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x594aa
movb $0x1, -0x591(%rbp)
leaq -0x5b9(%rbp), %rdi
movq %rdi, -0x858(%rbp)
callq 0x9b10
movq -0x858(%rbp), %rdx
leaq 0x143be(%rip), %rsi     # 0x6d7f0
leaq -0x5b8(%rbp), %rdi
callq 0xa780
jmp 0x59440
xorl %eax, %eax
movl %eax, %esi
leaq -0x5b8(%rbp), %rdi
movl $0x2, %ecx
movl %ecx, %edx
callq 0x138a0
jmp 0x59459
leaq -0x5b8(%rbp), %rdi
callq 0x9c98
leaq -0x5b9(%rbp), %rdi
callq 0x9700
jmp 0x594aa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x59499
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x5b8(%rbp), %rdi
callq 0x9c98
leaq -0x5b9(%rbp), %rdi
callq 0x9700
jmp 0x59ef4
testb $0x1, -0x591(%rbp)
jne 0x59589
leaq -0x150(%rbp), %rax
movq %rax, -0x868(%rbp)
leaq -0x3f0(%rbp), %rdi
callq 0x5c0b0
movq (%rax), %rdi
callq 0x1cdb0
movl %eax, -0x85c(%rbp)
jmp 0x594e1
movq -0x868(%rbp), %rax
movl -0x85c(%rbp), %ecx
movl %ecx, %edx
addl $0x3f, %edx
testl %ecx, %ecx
cmovsl %edx, %ecx
sarl $0x6, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x878(%rbp)
leaq -0x3f0(%rbp), %rdi
callq 0x5c0b0
movq (%rax), %rdi
callq 0x1cdb0
movl %eax, -0x86c(%rbp)
jmp 0x59525
movl -0x86c(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x878(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x59589
leaq -0x3f0(%rbp), %rdi
callq 0x5c0d0
movq %rax, %rdi
callq 0x571a0
movb %al, -0x879(%rbp)
jmp 0x5956c
movb -0x879(%rbp), %al
andb $0x1, %al
movb %al, -0x591(%rbp)
movl -0x3fc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3fc(%rbp)
testb $0x1, -0x591(%rbp)
jne 0x596a6
leaq -0x250(%rbp), %rax
movq %rax, -0x888(%rbp)
leaq -0x3f0(%rbp), %rdi
callq 0x5c0b0
movq (%rax), %rdi
callq 0x1cdb0
movl %eax, -0x880(%rbp)
jmp 0x595c0
movq -0x888(%rbp), %rax
movl -0x880(%rbp), %ecx
movl %ecx, %edx
addl $0x3f, %edx
testl %ecx, %ecx
cmovsl %edx, %ecx
sarl $0x6, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x898(%rbp)
leaq -0x3f0(%rbp), %rdi
callq 0x5c0b0
movq (%rax), %rdi
callq 0x1cdb0
movl %eax, -0x88c(%rbp)
jmp 0x59604
movl -0x88c(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x898(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x596a6
leaq -0x3f0(%rbp), %rdi
callq 0x5c0b0
movq 0x8(%rax), %rdi
callq 0x60d50
movb %al, -0x899(%rbp)
jmp 0x5964c
movb -0x899(%rbp), %al
testb $0x1, %al
jne 0x59658
jmp 0x59697
movq -0xd0(%rbp), %rax
movq %rax, -0x8a8(%rbp)
leaq -0x3f0(%rbp), %rdi
callq 0x5c0d0
movq -0x8a8(%rbp), %rdi
movq %rax, %rsi
callq 0x26d00
movb %al, -0x89a(%rbp)
jmp 0x59689
movb -0x89a(%rbp), %al
andb $0x1, %al
movb %al, -0x591(%rbp)
movl -0x3fc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3fc(%rbp)
testb $0x1, -0x591(%rbp)
je 0x59bcf
movb $0x0, -0x5ba(%rbp)
movq -0xd0(%rbp), %rdi
callq 0x26c80
jmp 0x596c8
movq -0xd0(%rbp), %rdi
callq 0x26f50
movq %rax, -0x8b0(%rbp)
jmp 0x596dd
movq -0x8b0(%rbp), %rdi
callq 0x5c0f0
testb $0x1, %al
jne 0x597b3
movq -0xd0(%rbp), %rdi
callq 0x26f50
movq %rax, -0x8b8(%rbp)
jmp 0x59706
movq -0x8b8(%rbp), %rsi
leaq -0x5e0(%rbp), %rdi
callq 0x29a00
movq -0xd0(%rbp), %rdi
callq 0x26f50
movq %rax, -0x8c0(%rbp)
jmp 0x5972e
movq -0x8c0(%rbp), %rsi
leaq -0x600(%rbp), %rdi
callq 0x29a30
leaq -0x5e0(%rbp), %rdi
leaq -0x600(%rbp), %rsi
callq 0x5c120
testb $0x1, %al
jne 0x5975a
jmp 0x597b1
leaq -0x3f0(%rbp), %rdi
callq 0x5c0b0
movq (%rax), %rax
movq %rax, -0x8c8(%rbp)
leaq -0x5e0(%rbp), %rdi
callq 0x5c150
movq %rax, %rcx
movq -0x8c8(%rbp), %rax
movq (%rcx), %rcx
cmpq (%rcx), %rax
jne 0x59795
movb $0x1, -0x5ba(%rbp)
jmp 0x59797
leaq -0x620(%rbp), %rdi
leaq -0x5e0(%rbp), %rsi
xorl %edx, %edx
callq 0x5c170
jmp 0x59719
jmp 0x597b3
movq -0xd0(%rbp), %rdi
callq 0x26f70
movq %rax, -0x8d0(%rbp)
jmp 0x597c8
movq -0x8d0(%rbp), %rdi
callq 0x5c1b0
testb $0x1, %al
jne 0x5989e
movq -0xd0(%rbp), %rdi
callq 0x26f70
movq %rax, -0x8d8(%rbp)
jmp 0x597f1
movq -0x8d8(%rbp), %rdi
callq 0x5c1d0
movq %rax, -0x628(%rbp)
movq -0xd0(%rbp), %rdi
callq 0x26f70
movq %rax, -0x8e0(%rbp)
jmp 0x59819
movq -0x8e0(%rbp), %rdi
callq 0x5c230
movq %rax, -0x630(%rbp)
leaq -0x628(%rbp), %rdi
leaq -0x630(%rbp), %rsi
callq 0x5c200
testb $0x1, %al
jne 0x59845
jmp 0x5989c
leaq -0x3f0(%rbp), %rdi
callq 0x5c0b0
movq (%rax), %rax
movq %rax, -0x8e8(%rbp)
leaq -0x628(%rbp), %rdi
callq 0x5c260
movq %rax, %rcx
movq -0x8e8(%rbp), %rax
movq (%rcx), %rcx
cmpq (%rcx), %rax
jne 0x59880
movb $0x1, -0x5ba(%rbp)
jmp 0x59882
leaq -0x628(%rbp), %rdi
xorl %esi, %esi
callq 0x5c290
movq %rax, -0x638(%rbp)
jmp 0x59804
jmp 0x5989e
movq -0xd0(%rbp), %rdi
callq 0x26cc0
jmp 0x598ac
testb $0x1, -0x5ba(%rbp)
je 0x598ba
jmp 0x5931a
leaq -0x659(%rbp), %rdi
movq %rdi, -0x8f0(%rbp)
callq 0x9b10
movq -0x8f0(%rbp), %rdx
leaq 0x13f30(%rip), %rsi     # 0x6d80b
leaq -0x658(%rbp), %rdi
callq 0xa780
jmp 0x598e9
xorl %eax, %eax
movl %eax, %esi
leaq -0x658(%rbp), %rdi
movl $0x1, %ecx
movl %ecx, %edx
callq 0x138a0
jmp 0x59902
leaq -0x658(%rbp), %rdi
callq 0x9c98
leaq -0x659(%rbp), %rdi
callq 0x9700
leaq -0x3f0(%rbp), %rdi
callq 0x5c0b0
movq (%rax), %rdi
callq 0x1cdb0
movl %eax, -0x8f4(%rbp)
jmp 0x59936
movl -0x8f4(%rbp), %eax
movb %al, %cl
movq $-0x2, %rax
rolq %cl, %rax
movq %rax, -0x908(%rbp)
leaq -0x1d0(%rbp), %rax
movq %rax, -0x900(%rbp)
leaq -0x3f0(%rbp), %rdi
callq 0x5c0b0
movq (%rax), %rdi
callq 0x1cdb0
movl %eax, -0x8f8(%rbp)
jmp 0x59979
movq -0x900(%rbp), %rax
movq -0x908(%rbp), %rsi
movl -0x8f8(%rbp), %ecx
movl %ecx, %edx
addl $0x3f, %edx
testl %ecx, %ecx
cmovsl %edx, %ecx
sarl $0x6, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
andq %rsi, %rdx
movq %rdx, (%rax,%rcx,8)
leaq -0x3f0(%rbp), %rdi
callq 0x5c0b0
movq (%rax), %rdi
callq 0x1cdb0
movl %eax, -0x90c(%rbp)
jmp 0x599c4
movl -0x90c(%rbp), %eax
movb %al, %cl
movq $-0x2, %rax
rolq %cl, %rax
movq %rax, -0x920(%rbp)
leaq -0x2d0(%rbp), %rax
movq %rax, -0x918(%rbp)
leaq -0x3f0(%rbp), %rdi
callq 0x5c0b0
movq (%rax), %rdi
callq 0x1cdb0
movl %eax, -0x910(%rbp)
jmp 0x59a07
movq -0x918(%rbp), %rax
movq -0x920(%rbp), %rsi
movl -0x910(%rbp), %ecx
movl %ecx, %edx
addl $0x3f, %edx
testl %ecx, %ecx
cmovsl %edx, %ecx
sarl $0x6, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
andq %rsi, %rdx
movq %rdx, (%rax,%rcx,8)
leaq -0x3f0(%rbp), %rdi
callq 0x5c0b0
movq (%rax), %rdi
callq 0x1cdb0
movl %eax, -0x924(%rbp)
jmp 0x59a52
movl -0x924(%rbp), %eax
movb %al, %cl
movq $-0x2, %rax
rolq %cl, %rax
movq %rax, -0x938(%rbp)
leaq -0x3d0(%rbp), %rax
movq %rax, -0x930(%rbp)
leaq -0x3f0(%rbp), %rdi
callq 0x5c0b0
movq (%rax), %rdi
callq 0x1cdb0
movl %eax, -0x928(%rbp)
jmp 0x59a95
movq -0x930(%rbp), %rax
movq -0x938(%rbp), %rsi
movl -0x928(%rbp), %ecx
movl %ecx, %edx
addl $0x3f, %edx
testl %ecx, %ecx
cmovsl %edx, %ecx
sarl $0x6, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
andq %rsi, %rdx
movq %rdx, (%rax,%rcx,8)
movl -0x3f4(%rbp), %eax
movl %eax, -0x940(%rbp)
leaq -0x3f0(%rbp), %rdi
callq 0x5c0b0
movq (%rax), %rdi
callq 0x1cdb0
movl %eax, -0x93c(%rbp)
jmp 0x59aec
movl -0x940(%rbp), %eax
movl -0x93c(%rbp), %ecx
cmpl %ecx, %eax
jne 0x59b3f
movl $0x0, -0x3f4(%rbp)
jmp 0x59b3f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x59b2e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x658(%rbp), %rdi
callq 0x9c98
leaq -0x659(%rbp), %rdi
callq 0x9700
jmp 0x59ef4
leaq -0x3f0(%rbp), %rdi
callq 0x5c0b0
movq (%rax), %rax
movq %rax, -0x948(%rbp)
cmpq $0x0, %rax
je 0x59b68
movq -0x948(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
leaq -0x3f0(%rbp), %rdi
callq 0x5c0b0
movq 0x8(%rax), %rax
movq %rax, -0x950(%rbp)
cmpq $0x0, %rax
je 0x59b92
movq -0x950(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
leaq -0x670(%rbp), %rdi
leaq -0x3f0(%rbp), %rsi
callq 0x5c310
movq -0x670(%rbp), %rsi
leaq -0x3e8(%rbp), %rdi
callq 0x5c2c0
movq %rax, -0x668(%rbp)
movq -0x668(%rbp), %rax
movq %rax, -0x3f0(%rbp)
jmp 0x59bdb
leaq -0x3f0(%rbp), %rdi
callq 0x5c330
jmp 0x5931a
cmpl $0x0, -0x3f4(%rbp)
jne 0x59c9f
movl -0x3f8(%rbp), %eax
movl %eax, -0x3f4(%rbp)
leaq -0x3e8(%rbp), %rdi
callq 0x5c020
movq %rax, -0x678(%rbp)
leaq -0x3e8(%rbp), %rdi
callq 0x5c080
movq %rax, -0x680(%rbp)
leaq -0x678(%rbp), %rdi
leaq -0x680(%rbp), %rsi
callq 0x5c050
testb $0x1, %al
jne 0x59c38
jmp 0x59c9d
leaq -0x678(%rbp), %rdi
callq 0x5c0b0
movq (%rax), %rdi
callq 0x1cdb0
movl %eax, -0x954(%rbp)
jmp 0x59c54
movl -0x954(%rbp), %eax
cmpl -0x3f4(%rbp), %eax
jle 0x59c8a
leaq -0x678(%rbp), %rdi
callq 0x5c0b0
movq (%rax), %rdi
callq 0x1cdb0
movl %eax, -0x958(%rbp)
jmp 0x59c7e
movl -0x958(%rbp), %eax
movl %eax, -0x3f4(%rbp)
jmp 0x59c8c
leaq -0x678(%rbp), %rdi
callq 0x5c330
jmp 0x59c0c
jmp 0x59c9f
jmp 0x59ca1
jmp 0x58c25
leaq -0x6a1(%rbp), %rdi
movq %rdi, -0x960(%rbp)
callq 0x9b10
movq -0x960(%rbp), %rdx
leaq 0x13b58(%rip), %rsi     # 0x6d81f
leaq -0x6a0(%rbp), %rdi
callq 0xa780
jmp 0x59cd5
xorl %edx, %edx
movl %edx, %esi
leaq -0x6a0(%rbp), %rdi
movl $0x2, %ecx
callq 0x138a0
jmp 0x59cec
leaq -0x6a0(%rbp), %rdi
callq 0x9c98
leaq -0x6a1(%rbp), %rdi
callq 0x9700
movq -0xd0(%rbp), %rax
movq %rax, -0x968(%rbp)
cmpq $0x0, %rax
je 0x59d35
movq -0x968(%rbp), %rdi
callq 0x26a80
movq -0x968(%rbp), %rdi
movl $0xb8, %esi
callq 0x9690
leaq -0x3e8(%rbp), %rdi
callq 0x5c020
movq %rax, -0x6b0(%rbp)
movq -0x6b0(%rbp), %rax
movq %rax, -0x3f0(%rbp)
leaq -0x3e8(%rbp), %rdi
callq 0x5c080
movq %rax, -0x6b8(%rbp)
leaq -0x3f0(%rbp), %rdi
leaq -0x6b8(%rbp), %rsi
callq 0x5c050
testb $0x1, %al
jne 0x59d85
jmp 0x59ee3
leaq -0x6d9(%rbp), %rdi
movq %rdi, -0x970(%rbp)
callq 0x9b10
movq -0x970(%rbp), %rdx
leaq 0x13a95(%rip), %rsi     # 0x6d83b
leaq -0x6d8(%rbp), %rdi
callq 0xa780
jmp 0x59db4
xorl %eax, %eax
movl %eax, %esi
leaq -0x6d8(%rbp), %rdi
movl $0x1, %edx
movl $0x2, %ecx
callq 0x138a0
jmp 0x59dd0
leaq -0x6d8(%rbp), %rdi
callq 0x9c98
leaq -0x6d9(%rbp), %rdi
callq 0x9700
leaq -0x3f0(%rbp), %rdi
callq 0x5c0b0
movq (%rax), %rax
movq %rax, -0x978(%rbp)
cmpq $0x0, %rax
je 0x59e11
movq -0x978(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
leaq -0x3f0(%rbp), %rdi
callq 0x5c0b0
movq 0x8(%rax), %rax
movq %rax, -0x980(%rbp)
cmpq $0x0, %rax
je 0x59e3b
movq -0x980(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
leaq -0x6f0(%rbp), %rdi
leaq -0x3f0(%rbp), %rsi
callq 0x5c310
movq -0x6f0(%rbp), %rsi
leaq -0x3e8(%rbp), %rdi
callq 0x5c2c0
movq %rax, -0x6e8(%rbp)
movq -0x6e8(%rbp), %rax
movq %rax, -0x3f0(%rbp)
jmp 0x59d56
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x59ea1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x6a0(%rbp), %rdi
callq 0x9c98
leaq -0x6a1(%rbp), %rdi
callq 0x9700
jmp 0x59ef4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x59ed5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x6d8(%rbp), %rdi
callq 0x9c98
leaq -0x6d9(%rbp), %rdi
callq 0x9700
jmp 0x59ef4
leaq -0x3e8(%rbp), %rdi
callq 0x5c350
jmp 0x59fa6
leaq -0x3e8(%rbp), %rdi
callq 0x5c350
movl -0x4c(%rbp), %eax
movl $0x2, %ecx
cmpl %ecx, %eax
jne 0x5a1c3
movq -0x48(%rbp), %rdi
callq 0x92a0
movq %rax, -0x6f8(%rbp)
movb $0x0, 0x357f9(%rip)     # 0x8f720
movq -0x6f8(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, -0x990(%rbp)
leaq -0x719(%rbp), %rdi
movq %rdi, -0x988(%rbp)
callq 0x9b10
movq -0x990(%rbp), %rsi
movq -0x988(%rbp), %rdx
leaq -0x718(%rbp), %rdi
callq 0xa780
jmp 0x59f6d
xorl %eax, %eax
movl %eax, %esi
leaq -0x718(%rbp), %rdi
movl $0x3, %edx
movl $0x2, %ecx
callq 0x138a0
jmp 0x59f89
leaq -0x718(%rbp), %rdi
callq 0x9c98
leaq -0x719(%rbp), %rdi
callq 0x9700
callq 0x9a40
leaq 0x35773(%rip), %rdi     # 0x8f720
addq $0x18, %rdi
callq 0x5bf30
movq %rax, -0x728(%rbp)
leaq 0x3575c(%rip), %rdi     # 0x8f720
addq $0x18, %rdi
callq 0x5bf90
movq %rax, -0x730(%rbp)
leaq -0x728(%rbp), %rdi
leaq -0x730(%rbp), %rsi
callq 0x5bf60
testb $0x1, %al
jne 0x59ff0
jmp 0x5a071
leaq -0x728(%rbp), %rdi
callq 0x5bfc0
movq 0x8(%rax), %rax
movq %rax, -0x998(%rbp)
cmpq $0x0, %rax
je 0x5a01a
movq -0x998(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x5a01c
leaq -0x728(%rbp), %rdi
xorl %esi, %esi
callq 0x5bfe0
movq %rax, -0x738(%rbp)
jmp 0x59fbd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x5a059
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x718(%rbp), %rdi
callq 0x9c98
leaq -0x719(%rbp), %rdi
callq 0x9700
callq 0x9a40
jmp 0x5a06c
jmp 0x5a1c3
movq 0x356b0(%rip), %rax     # 0x8f728
movq %rax, -0x9a0(%rbp)
cmpq $0x0, %rax
je 0x5a0a2
movq -0x9a0(%rbp), %rdi
callq 0x25f60
movq -0x9a0(%rbp), %rdi
movl $0x10, %esi
callq 0x9690
movq 0x35687(%rip), %rax     # 0x8f730
movq %rax, -0x9a8(%rbp)
cmpq $0x0, %rax
je 0x5a0d3
movq -0x9a8(%rbp), %rdi
callq 0x25f60
movq -0x9a8(%rbp), %rdi
movl $0x10, %esi
callq 0x9690
movq 0x35716(%rip), %rax     # 0x8f7f0
movq %rax, -0x9b0(%rbp)
cmpq $0x0, %rax
je 0x5a104
movq -0x9b0(%rbp), %rdi
callq 0x23680
movq -0x9b0(%rbp), %rdi
movl $0x18, %esi
callq 0x9690
leaq -0x759(%rbp), %rdi
movq %rdi, -0x9b8(%rbp)
callq 0x9b10
movq -0x9b8(%rbp), %rdx
leaq 0x13724(%rip), %rsi     # 0x6d849
leaq -0x758(%rbp), %rdi
callq 0xa780
jmp 0x5a133
xorl %eax, %eax
movl %eax, %esi
leaq -0x758(%rbp), %rdi
movl $0x1, %edx
movl $0x2, %ecx
callq 0x138a0
jmp 0x5a14f
leaq -0x758(%rbp), %rdi
callq 0x9c98
leaq -0x759(%rbp), %rdi
callq 0x9700
movq 0x34e3a(%rip), %rdi     # 0x8efa8
movq 0x34e3b(%rip), %rsi     # 0x8efb0
callq 0x96d0
movl $0x0, -0x4(%rbp)
jmp 0x5a1b7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x5a1a9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x758(%rbp), %rdi
callq 0x9c98
leaq -0x759(%rbp), %rdi
callq 0x9700
jmp 0x5a1c3
movl -0x4(%rbp), %eax
addq $0x9c0, %rsp            # imm = 0x9C0
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x9af0
movq %rax, %rdi
callq 0xaa90
nopw %cs:(%rax,%rax)