// File: mbourand[P]webserv/srcs/tcp-server.cpp
// Function: handle_server_response(Client&)
bool	handle_server_response(Client &client)
{
	try
	{
		if (g_webserv.debug)
			std::cout << *client.req << std::endl;
		VirtualHost vhost = VirtualHost::getServerByName(client.req->getHeaderValue("Host"), client.sckt->getServerPort(), g_webserv.vhosts);
		Response response;
		if (client.req->_error_code)
			response.setCode(client.req->_error_code);
		try
		{
			if (!response.getCode() && !vhost.getConfig().getConfigPath(client.req->_url._path).getParam("auth_basic").front().empty())
			{
				std::string	credentials = client.req->getHeaderValue(AuthorizationHeader().getType());
					if (credentials.empty())
					{
						response.setCode(401); //Unauthorized (force sign-in)
						response.addHeader(WWWAuthenticateHeader().getType(), "Basic realm=\""+vhost.getConfig().getConfigPath(client.req->_url._path).getParam("auth_basic").front()+"\"");
					}
					else if (!g_webserv.creds->Check_Credentials(vhost.getConfig().getConfigPath(client.req->_url._path).getParam("auth_basic_user_file").front(), credentials.substr(6))) //TODO: comparer credentials avec ceux dans le fichier	login:password -> bG9naW46cGFzc3dvcmQ=
						response.setCode(403); //forbidden (wrong credentials)
			}
		}
		catch (std::exception& e)
		{
			response.setCode(500);
		}
		if (!response.getCode())
		{
			if (!ft::contains(vhost.getConfig().getConfigPath(client.req->_url._path).getAllowedMethods(), client.req->_method))
				response.setCode(405);
		}
		if (!response.getCode())
			response = client.req->_method->process(*client.req, vhost.getConfig().getConfigPath(client.req->_url._path), *client.sckt);
		if (client.req->_protocolVersion == "HTTP/1.0")
			response.addHeader("Connection", "keep-alive");
		*client.sckt << response.getResponseText(vhost.getConfig().getConfigPath(client.req->_url._path), (client.req->_method ? client.req->_method->getType() != "HEAD" : true));
		if (g_webserv.debug)
			std::cout << "served response " << response.getCode() << std::endl;
		if (response.getCode() != 200)
			return true;
		Logger::print("Success", NULL, SUCCESS, VERBOSE);
	}
	catch(ServerSocket::ServerSocketException &e)
	{
		Logger::print(e.what(), NULL, ERROR, NORMAL);
	}
	catch(std::invalid_argument &e)
	{
		client.req->_error_code = 500;
		Logger::print(e.what(), NULL, ERROR, NORMAL);
	}
	if (client.req && client.sckt->Success())
	{
		delete client.req;
		client.req = new Request(client.sckt->getServerPort());
	}
	return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x730, %rsp            # imm = 0x730
movq %rdi, -0x10(%rbp)
testb $0x1, 0x382ab(%rip)     # 0x8f721
je 0x574bd
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movq 0x37b21(%rip), %rdi     # 0x8efa8
callq 0x61090
movq %rax, -0x598(%rbp)
jmp 0x57495
movq -0x598(%rbp), %rdi
movq 0x37add(%rip), %rsi     # 0x8ef80
callq 0x96d0
jmp 0x574aa
jmp 0x574bd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x58240
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x5a8(%rbp)
leaq -0x199(%rbp), %rdi
movq %rdi, -0x5a0(%rbp)
callq 0x9b10
movq -0x5a0(%rbp), %rdx
leaq 0x12ccc(%rip), %rsi     # 0x6a1b9
leaq -0x198(%rbp), %rdi
callq 0xa780
jmp 0x574fb
movq -0x5a8(%rbp), %rsi
leaq -0x178(%rbp), %rdi
leaq -0x198(%rbp), %rdx
callq 0x60df0
jmp 0x57517
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x1c160
movl %eax, -0x5ac(%rbp)
jmp 0x5752b
movl -0x5ac(%rbp), %esi
leaq 0x38290(%rip), %rdx     # 0x8f7c8
leaq -0x178(%rbp), %rdi
callq 0x66960
movq %rax, -0x5b8(%rbp)
jmp 0x5754d
movq -0x5b8(%rbp), %rsi
leaq -0x158(%rbp), %rdi
callq 0x664c0
jmp 0x57562
leaq -0x178(%rbp), %rdi
callq 0x9c98
leaq -0x198(%rbp), %rdi
callq 0x9c98
leaq -0x199(%rbp), %rdi
callq 0x9700
leaq -0x240(%rbp), %rdi
callq 0x63470
jmp 0x57594
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x0, 0x188(%rax)
je 0x5763a
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x188(%rax), %esi
leaq -0x240(%rbp), %rdi
callq 0x64560
jmp 0x575c5
jmp 0x5763a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x57607
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x575fb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x178(%rbp), %rdi
callq 0x9c98
leaq -0x198(%rbp), %rdi
callq 0x9c98
leaq -0x199(%rbp), %rdi
callq 0x9700
jmp 0x58240
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x58234
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x58228
movb $0x0, -0x262(%rbp)
movb $0x0, -0x263(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x64580
movl %eax, -0x5bc(%rbp)
jmp 0x5765c
movl -0x5bc(%rbp), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x5bd(%rbp)
jne 0x57721
leaq -0x158(%rbp), %rdi
callq 0x66920
movq %rax, -0x5c8(%rbp)
jmp 0x57688
movq -0x5c8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0xb8, %rsi
callq 0x4d300
movq %rax, -0x5d0(%rbp)
jmp 0x576ac
leaq -0x261(%rbp), %rdi
movq %rdi, -0x5d8(%rbp)
callq 0x9b10
movq -0x5d8(%rbp), %rdx
movb $0x1, -0x262(%rbp)
leaq 0x15a72(%rip), %rsi     # 0x6d146
leaq -0x260(%rbp), %rdi
callq 0xa780
jmp 0x576e2
movq -0x5d0(%rbp), %rdi
movb $0x1, -0x263(%rbp)
leaq -0x260(%rbp), %rsi
callq 0x4c710
movq %rax, -0x5e0(%rbp)
jmp 0x57705
movq -0x5e0(%rbp), %rdi
callq 0x14310
movq %rax, %rdi
callq 0x9a50
xorb $-0x1, %al
movb %al, -0x5bd(%rbp)
movb -0x5bd(%rbp), %al
movb %al, -0x5e1(%rbp)
testb $0x1, -0x263(%rbp)
jne 0x57738
jmp 0x57744
leaq -0x260(%rbp), %rdi
callq 0x9c98
testb $0x1, -0x262(%rbp)
jne 0x5774f
jmp 0x5775b
leaq -0x261(%rbp), %rdi
callq 0x9700
movb -0x5e1(%rbp), %al
testb $0x1, %al
jne 0x5776a
jmp 0x57d28
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x5f0(%rbp)
leaq -0x2d0(%rbp), %rdi
callq 0xb070
jmp 0x57787
leaq -0x2a8(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
callq 0xb160
jmp 0x5779c
movq -0x5f0(%rbp), %rsi
leaq -0x288(%rbp), %rdi
leaq -0x2a8(%rbp), %rdx
callq 0x60df0
jmp 0x577b8
leaq -0x2a8(%rbp), %rdi
callq 0x9c98
leaq -0x2d0(%rbp), %rdi
callq 0xb0f0
leaq -0x288(%rbp), %rdi
callq 0x9a50
testb $0x1, %al
jne 0x577e5
jmp 0x57a92
leaq -0x240(%rbp), %rdi
movl $0x191, %esi            # imm = 0x191
callq 0x64560
jmp 0x577f8
leaq -0x318(%rbp), %rdi
callq 0xe840
jmp 0x57806
leaq -0x2f0(%rbp), %rdi
leaq -0x318(%rbp), %rsi
callq 0xe930
jmp 0x5781b
leaq -0x158(%rbp), %rdi
callq 0x66920
movq %rax, -0x5f8(%rbp)
jmp 0x57830
movq -0x5f8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0xb8, %rsi
callq 0x4d300
movq %rax, -0x600(%rbp)
jmp 0x57854
leaq -0x379(%rbp), %rdi
movq %rdi, -0x608(%rbp)
callq 0x9b10
movq -0x608(%rbp), %rdx
leaq 0x158d1(%rip), %rsi     # 0x6d146
leaq -0x378(%rbp), %rdi
callq 0xa780
jmp 0x57883
movq -0x600(%rbp), %rdi
leaq -0x378(%rbp), %rsi
callq 0x4c710
movq %rax, -0x610(%rbp)
jmp 0x5789f
movq -0x610(%rbp), %rdi
callq 0x14310
movq %rax, %rdx
leaq 0x15c96(%rip), %rsi     # 0x6d54b
leaq -0x358(%rbp), %rdi
callq 0x14000
jmp 0x578c3
leaq 0x163d8(%rip), %rdx     # 0x6dca2
leaq -0x338(%rbp), %rdi
leaq -0x358(%rbp), %rsi
callq 0x13970
jmp 0x578df
leaq -0x240(%rbp), %rdi
leaq -0x2f0(%rbp), %rsi
leaq -0x338(%rbp), %rdx
callq 0x63770
jmp 0x578fb
leaq -0x338(%rbp), %rdi
callq 0x9c98
leaq -0x358(%rbp), %rdi
callq 0x9c98
leaq -0x378(%rbp), %rdi
callq 0x9c98
leaq -0x379(%rbp), %rdi
callq 0x9700
leaq -0x2f0(%rbp), %rdi
callq 0x9c98
leaq -0x318(%rbp), %rdi
callq 0xe8c0
jmp 0x57c1d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x57c3a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x5798c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
testb $0x1, -0x263(%rbp)
jne 0x5797e
jmp 0x5798a
leaq -0x260(%rbp), %rdi
callq 0x9c98
jmp 0x5798c
testb $0x1, -0x262(%rbp)
jne 0x57997
jmp 0x579a3
leaq -0x261(%rbp), %rdi
callq 0x9700
jmp 0x57c3a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x579ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x2a8(%rbp), %rdi
callq 0x9c98
leaq -0x2d0(%rbp), %rdi
callq 0xb0f0
jmp 0x57c3a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x57c2e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x57a81
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x57a75
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x57a69
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x57a5d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x57a51
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x338(%rbp), %rdi
callq 0x9c98
leaq -0x358(%rbp), %rdi
callq 0x9c98
leaq -0x378(%rbp), %rdi
callq 0x9c98
leaq -0x379(%rbp), %rdi
callq 0x9700
leaq -0x2f0(%rbp), %rdi
callq 0x9c98
leaq -0x318(%rbp), %rdi
callq 0xe8c0
jmp 0x57c2e
movq 0x37d57(%rip), %rax     # 0x8f7f0
movq %rax, -0x620(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x66920
movq %rax, -0x618(%rbp)
jmp 0x57ab5
movq -0x618(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0xb8, %rsi
callq 0x4d300
movq %rax, -0x628(%rbp)
jmp 0x57ad9
leaq -0x3a1(%rbp), %rdi
movq %rdi, -0x630(%rbp)
callq 0x9b10
movq -0x630(%rbp), %rdx
leaq 0x1320f(%rip), %rsi     # 0x6ad09
leaq -0x3a0(%rbp), %rdi
callq 0xa780
jmp 0x57b08
movq -0x628(%rbp), %rdi
leaq -0x3a0(%rbp), %rsi
callq 0x4c710
movq %rax, -0x638(%rbp)
jmp 0x57b24
movq -0x638(%rbp), %rdi
callq 0x14310
movq %rax, -0x640(%rbp)
leaq -0x3c8(%rbp), %rdi
leaq -0x288(%rbp), %rsi
movl $0x6, %edx
movq $-0x1, %rcx
callq 0x96b0
jmp 0x57b58
movq -0x640(%rbp), %rsi
movq -0x620(%rbp), %rdi
leaq -0x3c8(%rbp), %rdx
callq 0x23800
movb %al, -0x641(%rbp)
jmp 0x57b7a
movb -0x641(%rbp), %al
xorb $-0x1, %al
movb %al, -0x642(%rbp)
leaq -0x3c8(%rbp), %rdi
callq 0x9c98
leaq -0x3a0(%rbp), %rdi
callq 0x9c98
leaq -0x3a1(%rbp), %rdi
callq 0x9700
movb -0x642(%rbp), %al
testb $0x1, %al
jne 0x57bb8
jmp 0x57c1b
leaq -0x240(%rbp), %rdi
movl $0x193, %esi            # imm = 0x193
callq 0x64560
jmp 0x57bcb
jmp 0x57c1b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x57c0d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x57c01
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x3c8(%rbp), %rdi
callq 0x9c98
leaq -0x3a0(%rbp), %rdi
callq 0x9c98
leaq -0x3a1(%rbp), %rdi
callq 0x9700
jmp 0x57c2e
jmp 0x57c1d
leaq -0x288(%rbp), %rdi
callq 0x9c98
jmp 0x57d28
leaq -0x288(%rbp), %rdi
callq 0x9c98
movl -0x1c(%rbp), %eax
movl $0x3, %ecx
cmpl %ecx, %eax
jne 0x58228
movq -0x18(%rbp), %rdi
callq 0x92a0
movq %rax, -0x3d0(%rbp)
leaq -0x240(%rbp), %rdi
movl $0x1f4, %esi            # imm = 0x1F4
callq 0x64560
jmp 0x57c6d
callq 0x9a40
jmp 0x57c74
jmp 0x57c76
leaq -0x240(%rbp), %rdi
callq 0x64580
movl %eax, -0x648(%rbp)
jmp 0x57c8a
movl -0x648(%rbp), %eax
cmpl $0x0, %eax
jne 0x57d47
leaq -0x158(%rbp), %rdi
callq 0x66920
movq %rax, -0x650(%rbp)
jmp 0x57cae
movq -0x650(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0xb8, %rsi
callq 0x4d300
movq %rax, -0x658(%rbp)
jmp 0x57cd2
movq -0x658(%rbp), %rdi
callq 0x4c6d0
movq %rax, -0x660(%rbp)
jmp 0x57ce7
movq -0x660(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0x28, %rsi
callq 0x5be50
movb %al, -0x661(%rbp)
jmp 0x57d07
movb -0x661(%rbp), %al
testb $0x1, %al
jne 0x57d45
jmp 0x57d13
leaq -0x240(%rbp), %rdi
movl $0x195, %esi            # imm = 0x195
callq 0x64560
jmp 0x57d26
jmp 0x57d45
jmp 0x57c76
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
callq 0x9a40
jmp 0x57d40
jmp 0x58228
jmp 0x57d47
leaq -0x240(%rbp), %rdi
callq 0x64580
movl %eax, -0x668(%rbp)
jmp 0x57d5b
movl -0x668(%rbp), %eax
cmpl $0x0, %eax
jne 0x57e2b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x680(%rbp)
movq 0x28(%rax), %rax
movq %rax, -0x678(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x66920
movq %rax, -0x670(%rbp)
jmp 0x57d99
movq -0x670(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0xb8, %rsi
callq 0x4d300
movq %rax, -0x688(%rbp)
jmp 0x57dbd
movq -0x688(%rbp), %rcx
movq -0x680(%rbp), %rdx
movq -0x678(%rbp), %rsi
movq -0x10(%rbp), %rax
movq (%rax), %r8
movq (%rsi), %rax
movq 0x70(%rax), %rax
leaq -0x470(%rbp), %rdi
callq *%rax
jmp 0x57deb
leaq -0x240(%rbp), %rdi
leaq -0x470(%rbp), %rsi
callq 0x63620
jmp 0x57e00
leaq -0x470(%rbp), %rdi
callq 0x634e0
jmp 0x57e2b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x470(%rbp), %rdi
callq 0x634e0
jmp 0x58228
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x120, %rdi            # imm = 0x120
leaq 0x15718(%rip), %rsi     # 0x6d559
callq 0xdf50
movb %al, -0x689(%rbp)
jmp 0x57e4e
movb -0x689(%rbp), %al
testb $0x1, %al
jne 0x57e5d
jmp 0x57f66
leaq -0x491(%rbp), %rdi
movq %rdi, -0x698(%rbp)
callq 0x9b10
movq -0x698(%rbp), %rdx
leaq 0x156e4(%rip), %rsi     # 0x6d562
leaq -0x490(%rbp), %rdi
callq 0xa780
jmp 0x57e8c
leaq -0x4b9(%rbp), %rdi
movq %rdi, -0x6a0(%rbp)
callq 0x9b10
movq -0x6a0(%rbp), %rdx
leaq 0x156c0(%rip), %rsi     # 0x6d56d
leaq -0x4b8(%rbp), %rdi
callq 0xa780
jmp 0x57ebb
leaq -0x240(%rbp), %rdi
leaq -0x490(%rbp), %rsi
leaq -0x4b8(%rbp), %rdx
callq 0x63770
jmp 0x57ed7
leaq -0x4b8(%rbp), %rdi
callq 0x9c98
leaq -0x4b9(%rbp), %rdi
callq 0x9700
leaq -0x490(%rbp), %rdi
callq 0x9c98
leaq -0x491(%rbp), %rdi
callq 0x9700
jmp 0x57f66
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x57f55
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x57f3d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x4b8(%rbp), %rdi
callq 0x9c98
leaq -0x4b9(%rbp), %rdi
callq 0x9700
leaq -0x490(%rbp), %rdi
callq 0x9c98
leaq -0x491(%rbp), %rdi
callq 0x9700
jmp 0x58228
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x6b0(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x66920
movq %rax, -0x6a8(%rbp)
jmp 0x57f89
movq -0x6a8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0xb8, %rsi
callq 0x4d300
movq %rax, -0x6b8(%rbp)
jmp 0x57fad
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x28(%rax), %rax
movb $0x0, -0x501(%rbp)
cmpq $0x0, %rax
je 0x58014
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x28(%rax), %rsi
movq (%rsi), %rax
movq 0x10(%rax), %rax
leaq -0x500(%rbp), %rdi
callq *%rax
jmp 0x57fe4
movb $0x1, -0x501(%rbp)
leaq 0x127cb(%rip), %rsi     # 0x6a7bd
leaq -0x500(%rbp), %rdi
callq 0xce40
movb %al, -0x6b9(%rbp)
jmp 0x58006
movb -0x6b9(%rbp), %al
movb %al, -0x6ba(%rbp)
jmp 0x5801e
movb $0x1, %al
movb %al, -0x6ba(%rbp)
jmp 0x5801e
movq -0x6b8(%rbp), %rdx
movb -0x6ba(%rbp), %al
movzbl %al, %ecx
andl $0x1, %ecx
leaq -0x4e0(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x64970
jmp 0x58046
movq -0x6b0(%rbp), %rdi
leaq -0x4e0(%rbp), %rsi
callq 0x1bdb0
jmp 0x5805b
leaq -0x4e0(%rbp), %rdi
callq 0x9c98
testb $0x1, -0x501(%rbp)
jne 0x58072
jmp 0x5807e
leaq -0x500(%rbp), %rdi
callq 0x9c98
testb $0x1, 0x3769c(%rip)     # 0x8f721
je 0x5812f
movq 0x36f16(%rip), %rdi     # 0x8efa8
leaq 0x154df(%rip), %rsi     # 0x6d578
callq 0x9670
movq %rax, -0x6c8(%rbp)
jmp 0x580a7
leaq -0x240(%rbp), %rdi
callq 0x64580
movl %eax, -0x6cc(%rbp)
jmp 0x580bb
movl -0x6cc(%rbp), %esi
movq -0x6c8(%rbp), %rdi
callq 0x9ad0
movq %rax, -0x6d8(%rbp)
jmp 0x580d6
movq -0x6d8(%rbp), %rdi
movq 0x36e9c(%rip), %rsi     # 0x8ef80
callq 0x96d0
jmp 0x580eb
jmp 0x5812f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x58113
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x4e0(%rbp), %rdi
callq 0x9c98
testb $0x1, -0x501(%rbp)
jne 0x5811e
jmp 0x5812a
leaq -0x500(%rbp), %rdi
callq 0x9c98
jmp 0x58228
leaq -0x240(%rbp), %rdi
callq 0x64580
movl %eax, -0x6dc(%rbp)
jmp 0x58143
movl -0x6dc(%rbp), %eax
cmpl $0xc8, %eax
je 0x58160
movb $0x1, -0x1(%rbp)
movl $0x1, -0x508(%rbp)
jmp 0x581c8
leaq -0x529(%rbp), %rdi
movq %rdi, -0x6e8(%rbp)
callq 0x9b10
movq -0x6e8(%rbp), %rdx
leaq 0x15408(%rip), %rsi     # 0x6d589
leaq -0x528(%rbp), %rdi
callq 0xa780
jmp 0x5818f
xorl %ecx, %ecx
movl %ecx, %esi
leaq -0x528(%rbp), %rdi
movl $0x1, %edx
callq 0x138a0
jmp 0x581a6
leaq -0x528(%rbp), %rdi
callq 0x9c98
leaq -0x529(%rbp), %rdi
callq 0x9700
movl $0x0, -0x508(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x634e0
leaq -0x158(%rbp), %rdi
callq 0x668a0
movl -0x508(%rbp), %eax
testl %eax, %eax
je 0x581f1
jmp 0x581ec
jmp 0x584ca
jmp 0x582e5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x5821c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x528(%rbp), %rdi
callq 0x9c98
leaq -0x529(%rbp), %rdi
callq 0x9700
leaq -0x240(%rbp), %rdi
callq 0x634e0
leaq -0x158(%rbp), %rdi
callq 0x668a0
movl -0x1c(%rbp), %eax
movl %eax, -0x6ec(%rbp)
movl $0x2, %ecx
cmpl %ecx, %eax
jne 0x58378
movq -0x18(%rbp), %rdi
callq 0x92a0
movq %rax, -0x568(%rbp)
movq -0x568(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, -0x700(%rbp)
leaq -0x589(%rbp), %rdi
movq %rdi, -0x6f8(%rbp)
callq 0x9b10
movq -0x700(%rbp), %rsi
movq -0x6f8(%rbp), %rdx
leaq -0x588(%rbp), %rdi
callq 0xa780
jmp 0x582ac
xorl %eax, %eax
movl %eax, %esi
leaq -0x588(%rbp), %rdi
movl $0x3, %edx
movl $0x1, %ecx
callq 0x138a0
jmp 0x582c8
leaq -0x588(%rbp), %rdi
callq 0x9c98
leaq -0x589(%rbp), %rdi
callq 0x9700
callq 0x9a40
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x584c6
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x1c410
testb $0x1, %al
jne 0x58309
jmp 0x584c6
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x708(%rbp)
cmpq $0x0, %rax
je 0x5832b
movq -0x708(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movl $0x1a0, %edi            # imm = 0x1A0
callq 0x9680
movq %rax, -0x718(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x1c160
movl %eax, -0x70c(%rbp)
jmp 0x58350
movl -0x70c(%rbp), %esi
movq -0x718(%rbp), %rdi
callq 0x5da30
jmp 0x58364
movq -0x718(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0x584c6
movl -0x6ec(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x584d8
movq -0x18(%rbp), %rdi
callq 0x92a0
movq %rax, -0x538(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl $0x1f4, 0x188(%rax)     # imm = 0x1F4
movq -0x538(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, -0x728(%rbp)
leaq -0x559(%rbp), %rdi
movq %rdi, -0x720(%rbp)
callq 0x9b10
movq -0x728(%rbp), %rsi
movq -0x720(%rbp), %rdx
leaq -0x558(%rbp), %rdi
callq 0xa780
jmp 0x583f3
xorl %eax, %eax
movl %eax, %esi
leaq -0x558(%rbp), %rdi
movl $0x3, %edx
movl $0x1, %ecx
callq 0x138a0
jmp 0x5840f
leaq -0x558(%rbp), %rdi
callq 0x9c98
leaq -0x559(%rbp), %rdi
callq 0x9700
callq 0x9a40
jmp 0x582e5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x58457
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x558(%rbp), %rdi
callq 0x9c98
leaq -0x559(%rbp), %rdi
callq 0x9700
callq 0x9a40
jmp 0x5846a
jmp 0x584d8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x58492
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x588(%rbp), %rdi
callq 0x9c98
leaq -0x589(%rbp), %rdi
callq 0x9700
callq 0x9a40
jmp 0x584a5
jmp 0x584d8
movq -0x718(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x1a0, %esi            # imm = 0x1A0
callq 0x9690
jmp 0x584d8
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x730, %rsp            # imm = 0x730
popq %rbp
retq
movq -0x18(%rbp), %rdi
callq 0x9af0
movq %rax, %rdi
callq 0xaa90
nopl (%rax)