// File: mbourand[P]webserv/srcs/Request.cpp
// Function: Request::parse()
void Request::parse()
{
	if (_finished_parsing)
		return;
	if (_method == NULL)
		parse_method();
	if (_method == NULL)
		return;

	if (!_url_finished)
	{
		if (_parse_start + 1 >= _raw.size())
			return;
		if (_raw[_parse_start + 1] == ' ')
		{
			_error_code = 400;
			throw std::invalid_argument("Bad whitespace after method.");
		}

		parse_uri();
	}
	if (!_url_finished)
		return;

	if (_protocolVersion.empty())
	{
		if (_parse_start + 1 >= _raw.size())
			return;
		if (_raw[_parse_start + 1] == ' ')
		{
			_error_code = 400;
			throw std::invalid_argument("Bad whitespace after uri.");
		}
		parse_protocol_version();
	}
	if (_protocolVersion.empty())
		return;

	while (!_header_section_finished && parse_headers())
		;

	if (_header_section_finished)
	{
		size_t cnt = 0;
		for (size_t i = 0; i < _headers.size(); i++)
		{
			if (_headers[i]->getType() == HostHeader().getType())
			{
				if (++cnt > 1)
					break ;
				if (_port && !_max_body_size)
				{
					try
					{
						VirtualHost vhost = VirtualHost::getServerByName(_headers[i]->getValue(), _port, g_webserv.vhosts);
						std::stringstream	convert;
						convert << vhost.getConfig().getConfigPath(_url._path).getParam("max_client_body_size").front();
						convert >> _max_body_size;
					}
					catch(const std::exception& e)
					{}
				}
			}
		}
		if (cnt > 1)
		{
			_error_code = 400;
			throw std::invalid_argument("Multiple Host header in request");
		}
		if (cnt == 0 && _protocolVersion != "HTTP/1.0")
		{
			_error_code = 400;
			throw std::invalid_argument("No Host header in request");
		}

	}
	if (_header_section_finished && !_chunked && !_content_length && _method->getType() != "PUT" && _method->requestHasBody())
	{
		_body = "";
		_finished_parsing = true;
	}
	else if (_header_section_finished && ((_raw.find("\r\n\r\n", _parse_start) != std::string::npos)
		|| (_content_length && ((_raw.size() - _parse_start) >= _content_length))))
	{
		if (_method->requestHasBody())
		{
			if (!_chunked && !_content_length)
			{
				_error_code = 411;
				throw std::invalid_argument("Body Length Required.");
			}
			if (!_chunked && ((_raw.size() - _parse_start) > _max_body_size)
				&& _raw.find("\r\n", _parse_start + _max_body_size) != (_parse_start + _max_body_size))
			{
				_error_code = 413;
				throw std::invalid_argument("Request Entity too large.");
			}
			if ((_raw.size() - _parse_start) == _content_length)
				_body = dechunk(_raw.substr(_parse_start, _raw.substr(_parse_start).size()));
			else
				_body = dechunk(_raw.substr(_parse_start, _raw.substr(_parse_start).size() - 2));
			if (_body.size() < 100)
				Logger::print("Request body is \"" + _body + "\"", NULL, INFO, VERBOSE);
			else
				Logger::print("Request body is <<<BODY TOO LONG>>>", NULL, INFO, VERBOSE);
		}
		_finished_parsing = true;
	}
	else if (_header_section_finished && _method->requestHasBody() && !_chunked && (_raw.size() - _parse_start) > _max_body_size
		&& _raw.find("\r\n", _parse_start + _max_body_size) != (_parse_start + _max_body_size))
	{
		_error_code = 413;
		throw std::invalid_argument("Request Entity too large.");
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x5d0, %rsp            # imm = 0x5D0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x4d8(%rbp)
testb $0x1, 0x192(%rax)
je 0x5dc88
jmp 0x5ebb1
movq -0x4d8(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x5dca2
movq -0x4d8(%rbp), %rdi
callq 0x5ebd0
movq -0x4d8(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x5dcb5
jmp 0x5ebb1
movq -0x4d8(%rbp), %rax
testb $0x1, 0x191(%rax)
jne 0x5dd9e
movq -0x4d8(%rbp), %rdi
movq 0x198(%rdi), %rax
addq $0x1, %rax
movq %rax, -0x4e0(%rbp)
addq $0x8, %rdi
callq 0x9480
movq %rax, %rcx
movq -0x4e0(%rbp), %rax
cmpq %rcx, %rax
jb 0x5dcff
jmp 0x5ebb1
movq -0x4d8(%rbp), %rax
movq %rax, %rdi
addq $0x8, %rdi
movq 0x198(%rax), %rsi
addq $0x1, %rsi
callq 0x9c70
movsbl (%rax), %eax
cmpl $0x20, %eax
jne 0x5dd92
movq -0x4d8(%rbp), %rax
movl $0x190, 0x188(%rax)     # imm = 0x190
movl $0x10, %edi
callq 0x9340
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x4e8(%rbp)
leaq 0xfcd4(%rip), %rsi      # 0x6da28
callq 0x9be0
jmp 0x5dd5b
movq -0x4e8(%rbp), %rdi
movq 0x3125f(%rip), %rsi     # 0x8efc8
movq 0x31248(%rip), %rdx     # 0x8efb8
callq 0x9aa0
movq -0x4e8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
callq 0x94c0
jmp 0x5ebba
movq -0x4d8(%rbp), %rdi
callq 0x5ee60
movq -0x4d8(%rbp), %rax
testb $0x1, 0x191(%rax)
jne 0x5ddb3
jmp 0x5ebb1
movq -0x4d8(%rbp), %rdi
addq $0x120, %rdi            # imm = 0x120
callq 0x9a50
testb $0x1, %al
jne 0x5ddcf
jmp 0x5dea4
movq -0x4d8(%rbp), %rdi
movq 0x198(%rdi), %rax
addq $0x1, %rax
movq %rax, -0x4f0(%rbp)
addq $0x8, %rdi
callq 0x9480
movq %rax, %rcx
movq -0x4f0(%rbp), %rax
cmpq %rcx, %rax
jb 0x5de05
jmp 0x5ebb1
movq -0x4d8(%rbp), %rax
movq %rax, %rdi
addq $0x8, %rdi
movq 0x198(%rax), %rsi
addq $0x1, %rsi
callq 0x9c70
movsbl (%rax), %eax
cmpl $0x20, %eax
jne 0x5de98
movq -0x4d8(%rbp), %rax
movl $0x190, 0x188(%rax)     # imm = 0x190
movl $0x10, %edi
callq 0x9340
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x4f8(%rbp)
leaq 0xfbeb(%rip), %rsi      # 0x6da45
callq 0x9be0
jmp 0x5de61
movq -0x4f8(%rbp), %rdi
movq 0x31159(%rip), %rsi     # 0x8efc8
movq 0x31142(%rip), %rdx     # 0x8efb8
callq 0x9aa0
movq -0x4f8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
callq 0x94c0
jmp 0x5ebba
movq -0x4d8(%rbp), %rdi
callq 0x5f070
movq -0x4d8(%rbp), %rdi
addq $0x120, %rdi            # imm = 0x120
callq 0x9a50
testb $0x1, %al
jne 0x5debd
jmp 0x5dec2
jmp 0x5ebb1
jmp 0x5dec4
movq -0x4d8(%rbp), %rcx
xorl %eax, %eax
testb $0x1, 0x190(%rcx)
movb %al, -0x4f9(%rbp)
jne 0x5deee
movq -0x4d8(%rbp), %rdi
callq 0x5f6c0
movb %al, -0x4f9(%rbp)
movb -0x4f9(%rbp), %al
testb $0x1, %al
jne 0x5defa
jmp 0x5defc
jmp 0x5dec4
movq -0x4d8(%rbp), %rax
testb $0x1, 0x190(%rax)
je 0x5e384
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x4d8(%rbp), %rdi
movq -0x28(%rbp), %rax
movq %rax, -0x508(%rbp)
addq $0x140, %rdi            # imm = 0x140
callq 0x615d0
movq %rax, %rcx
movq -0x508(%rbp), %rax
cmpq %rcx, %rax
jae 0x5e276
movq -0x4d8(%rbp), %rdi
addq $0x140, %rdi            # imm = 0x140
movq -0x28(%rbp), %rsi
callq 0x615f0
movq (%rax), %rsi
movq (%rsi), %rax
movq 0x10(%rax), %rax
leaq -0x48(%rbp), %rdi
callq *%rax
leaq -0x90(%rbp), %rdi
callq 0xbf70
jmp 0x5df86
leaq -0x68(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0xc060
jmp 0x5df98
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x144e0
movb %al, -0x509(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x9c98
leaq -0x90(%rbp), %rdi
callq 0xbff0
leaq -0x48(%rbp), %rdi
callq 0x9c98
movb -0x509(%rbp), %al
testb $0x1, %al
jne 0x5dfd8
jmp 0x5e263
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
cmpq $0x1, %rax
jbe 0x5e023
jmp 0x5e276
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x5e015
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x90(%rbp), %rdi
callq 0xbff0
leaq -0x48(%rbp), %rdi
callq 0x9c98
jmp 0x5ebba
movq -0x4d8(%rbp), %rax
cmpl $0x0, 0x18c(%rax)
je 0x5e261
movq -0x4d8(%rbp), %rax
cmpq $0x0, 0x180(%rax)
jne 0x5e261
movq -0x4d8(%rbp), %rdi
addq $0x140, %rdi            # imm = 0x140
movq -0x28(%rbp), %rsi
callq 0x615f0
movq (%rax), %rdi
callq 0xbf40
movq %rax, -0x518(%rbp)
jmp 0x5e074
movq -0x518(%rbp), %rdi
movq -0x4d8(%rbp), %rax
movl 0x18c(%rax), %esi
leaq 0x31691(%rip), %rdx     # 0x8f720
addq $0xa8, %rdx
callq 0x66960
movq %rax, -0x520(%rbp)
jmp 0x5e0a4
movq -0x520(%rbp), %rsi
leaq -0x1c8(%rbp), %rdi
callq 0x664c0
jmp 0x5e0b9
leaq -0x350(%rbp), %rdi
callq 0x9490
jmp 0x5e0c7
leaq -0x340(%rbp), %rax
movq %rax, -0x530(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0x66920
movq %rax, -0x528(%rbp)
jmp 0x5e0ea
movq -0x528(%rbp), %rdi
movq -0x4d8(%rbp), %rsi
addq $0xb8, %rsi
callq 0x4d300
movq %rax, -0x538(%rbp)
jmp 0x5e10d
leaq -0x371(%rbp), %rdi
movq %rdi, -0x540(%rbp)
callq 0x9b10
movq -0x540(%rbp), %rdx
leaq 0xf03e(%rip), %rsi      # 0x6d16c
leaq -0x370(%rbp), %rdi
callq 0xa780
jmp 0x5e13c
movq -0x538(%rbp), %rdi
leaq -0x370(%rbp), %rsi
callq 0x4c710
movq %rax, -0x548(%rbp)
jmp 0x5e158
movq -0x548(%rbp), %rdi
callq 0x14310
movq -0x530(%rbp), %rdi
movq %rax, %rsi
callq 0x95d0
jmp 0x5e175
leaq -0x370(%rbp), %rdi
callq 0x9c98
leaq -0x371(%rbp), %rdi
callq 0x9700
movq -0x4d8(%rbp), %rsi
addq $0x180, %rsi            # imm = 0x180
leaq -0x350(%rbp), %rdi
callq 0x98f0
jmp 0x5e1a9
leaq -0x350(%rbp), %rdi
callq 0x94e0
leaq -0x1c8(%rbp), %rdi
callq 0x668a0
jmp 0x5e25f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x5e23a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x5e22e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x5e222
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x5e216
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x370(%rbp), %rdi
callq 0x9c98
leaq -0x371(%rbp), %rdi
callq 0x9700
leaq -0x350(%rbp), %rdi
callq 0x94e0
leaq -0x1c8(%rbp), %rdi
callq 0x668a0
movl -0x14(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x5ebba
movq -0x10(%rbp), %rdi
callq 0x92a0
movq %rax, -0x380(%rbp)
callq 0x9a40
jmp 0x5e261
jmp 0x5e263
jmp 0x5e265
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x5df20
cmpq $0x1, -0x20(%rbp)
jbe 0x5e2ea
movq -0x4d8(%rbp), %rax
movl $0x190, 0x188(%rax)     # imm = 0x190
movl $0x10, %edi
callq 0x9340
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x550(%rbp)
leaq 0xf7b3(%rip), %rsi      # 0x6da5f
callq 0x9be0
jmp 0x5e2b3
movq -0x550(%rbp), %rdi
movq 0x30d07(%rip), %rsi     # 0x8efc8
movq 0x30cf0(%rip), %rdx     # 0x8efb8
callq 0x9aa0
movq -0x550(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
callq 0x94c0
jmp 0x5ebba
cmpq $0x0, -0x20(%rbp)
jne 0x5e382
movq -0x4d8(%rbp), %rdi
addq $0x120, %rdi            # imm = 0x120
leaq 0xf24f(%rip), %rsi      # 0x6d559
callq 0xce40
testb $0x1, %al
jne 0x5e315
jmp 0x5e382
movq -0x4d8(%rbp), %rax
movl $0x190, 0x188(%rax)     # imm = 0x190
movl $0x10, %edi
callq 0x9340
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x558(%rbp)
leaq 0xf73b(%rip), %rsi      # 0x6da7f
callq 0x9be0
jmp 0x5e34b
movq -0x558(%rbp), %rdi
movq 0x30c6f(%rip), %rsi     # 0x8efc8
movq 0x30c58(%rip), %rdx     # 0x8efb8
callq 0x9aa0
movq -0x558(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
callq 0x94c0
jmp 0x5ebba
jmp 0x5e384
movq -0x4d8(%rbp), %rax
movb 0x190(%rax), %cl
movb $0x0, -0x3a1(%rbp)
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x559(%rbp)
je 0x5e465
movq -0x4d8(%rbp), %rcx
xorl %eax, %eax
testb $0x1, 0x193(%rcx)
movb %al, -0x559(%rbp)
jne 0x5e465
movq -0x4d8(%rbp), %rcx
xorl %eax, %eax
cmpq $0x0, 0x178(%rcx)
movb %al, -0x559(%rbp)
jne 0x5e465
movq -0x4d8(%rbp), %rax
movq 0x28(%rax), %rsi
movq (%rsi), %rax
movq 0x10(%rax), %rax
leaq -0x3a0(%rbp), %rdi
movq %rdi, -0x568(%rbp)
callq *%rax
movq -0x568(%rbp), %rdi
movb $0x1, -0x3a1(%rbp)
leaq 0xc41b(%rip), %rsi      # 0x6a834
callq 0xce40
movb %al, -0x55a(%rbp)
jmp 0x5e426
movb -0x55a(%rbp), %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x559(%rbp)
jne 0x5e43b
jmp 0x5e465
movq -0x4d8(%rbp), %rax
movq 0x28(%rax), %rdi
movq (%rdi), %rax
movq 0x40(%rax), %rax
callq *%rax
movb %al, -0x569(%rbp)
jmp 0x5e457
movb -0x569(%rbp), %al
movb %al, -0x559(%rbp)
jmp 0x5e465
movb -0x559(%rbp), %al
movb %al, -0x56a(%rbp)
testb $0x1, -0x3a1(%rbp)
jne 0x5e47c
jmp 0x5e488
leaq -0x3a0(%rbp), %rdi
callq 0x9c98
movb -0x56a(%rbp), %al
testb $0x1, %al
jne 0x5e494
jmp 0x5e4e9
movq -0x4d8(%rbp), %rdi
addq $0x158, %rdi            # imm = 0x158
leaq 0xc8c7(%rip), %rsi      # 0x6ad70
callq 0x98a0
movq -0x4d8(%rbp), %rax
movb $0x1, 0x192(%rax)
jmp 0x5ebb1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
testb $0x1, -0x3a1(%rbp)
jne 0x5e4d8
jmp 0x5e4e4
leaq -0x3a0(%rbp), %rdi
callq 0x9c98
jmp 0x5ebba
movq -0x4d8(%rbp), %rax
testb $0x1, 0x190(%rax)
je 0x5ea94
movq -0x4d8(%rbp), %rax
movq %rax, %rdi
addq $0x8, %rdi
movq 0x198(%rax), %rdx
leaq 0xf795(%rip), %rsi      # 0x6dcae
callq 0x9c60
cmpq $-0x1, %rax
jne 0x5e564
movq -0x4d8(%rbp), %rax
cmpq $0x0, 0x178(%rax)
je 0x5ea94
movq -0x4d8(%rbp), %rdi
addq $0x8, %rdi
callq 0x9480
movq -0x4d8(%rbp), %rcx
subq 0x198(%rcx), %rax
cmpq 0x178(%rcx), %rax
jb 0x5ea94
movq -0x4d8(%rbp), %rax
movq 0x28(%rax), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
testb $0x1, %al
jne 0x5e57e
jmp 0x5ea81
movq -0x4d8(%rbp), %rax
testb $0x1, 0x193(%rax)
jne 0x5e60c
movq -0x4d8(%rbp), %rax
cmpq $0x0, 0x178(%rax)
jne 0x5e60c
movq -0x4d8(%rbp), %rax
movl $0x19b, 0x188(%rax)     # imm = 0x19B
movl $0x10, %edi
callq 0x9340
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x578(%rbp)
leaq 0xf4cb(%rip), %rsi      # 0x6da99
callq 0x9be0
jmp 0x5e5d5
movq -0x578(%rbp), %rdi
movq 0x309e5(%rip), %rsi     # 0x8efc8
movq 0x309ce(%rip), %rdx     # 0x8efb8
callq 0x9aa0
movq -0x578(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
callq 0x94c0
jmp 0x5ebba
movq -0x4d8(%rbp), %rax
testb $0x1, 0x193(%rax)
jne 0x5e6fa
movq -0x4d8(%rbp), %rdi
addq $0x8, %rdi
callq 0x9480
movq -0x4d8(%rbp), %rcx
subq 0x198(%rcx), %rax
cmpq 0x180(%rcx), %rax
jbe 0x5e6fa
movq -0x4d8(%rbp), %rax
movq %rax, %rdi
addq $0x8, %rdi
movq 0x198(%rax), %rdx
addq 0x180(%rax), %rdx
leaq 0xf642(%rip), %rsi      # 0x6dcb0
callq 0x9c60
movq -0x4d8(%rbp), %rdx
movq 0x198(%rdx), %rcx
addq 0x180(%rdx), %rcx
cmpq %rcx, %rax
je 0x5e6fa
movq -0x4d8(%rbp), %rax
movl $0x19d, 0x188(%rax)     # imm = 0x19D
movl $0x10, %edi
callq 0x9340
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x580(%rbp)
leaq 0xf3f3(%rip), %rsi      # 0x6daaf
callq 0x9be0
jmp 0x5e6c3
movq -0x580(%rbp), %rdi
movq 0x308f7(%rip), %rsi     # 0x8efc8
movq 0x308e0(%rip), %rdx     # 0x8efb8
callq 0x9aa0
movq -0x580(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
callq 0x94c0
jmp 0x5ebba
movq -0x4d8(%rbp), %rdi
addq $0x8, %rdi
callq 0x9480
movq -0x4d8(%rbp), %rcx
subq 0x198(%rcx), %rax
cmpq 0x178(%rcx), %rax
jne 0x5e823
movq -0x4d8(%rbp), %rax
movq %rax, %rsi
addq $0x8, %rsi
movq %rsi, -0x590(%rbp)
movq 0x198(%rax), %rdx
movq %rdx, -0x588(%rbp)
leaq -0x408(%rbp), %rdi
movq %rdi, -0x598(%rbp)
movq $-0x1, %rcx
callq 0x96b0
movq -0x598(%rbp), %rdi
callq 0x9480
movq -0x590(%rbp), %rsi
movq -0x588(%rbp), %rdx
movq %rax, %rcx
leaq -0x3e8(%rbp), %rdi
callq 0x96b0
jmp 0x5e78d
movq -0x4d8(%rbp), %rsi
leaq -0x3c8(%rbp), %rdi
leaq -0x3e8(%rbp), %rdx
callq 0x601d0
jmp 0x5e7a9
movq -0x4d8(%rbp), %rdi
addq $0x158, %rdi            # imm = 0x158
leaq -0x3c8(%rbp), %rsi
callq 0x97e0
leaq -0x3c8(%rbp), %rdi
callq 0x9c98
leaq -0x3e8(%rbp), %rdi
callq 0x9c98
leaq -0x408(%rbp), %rdi
callq 0x9c98
jmp 0x5e922
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x5e812
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x3e8(%rbp), %rdi
callq 0x9c98
leaq -0x408(%rbp), %rdi
callq 0x9c98
jmp 0x5ebba
movq -0x4d8(%rbp), %rax
movq %rax, %rsi
addq $0x8, %rsi
movq %rsi, -0x5a8(%rbp)
movq 0x198(%rax), %rdx
movq %rdx, -0x5a0(%rbp)
leaq -0x468(%rbp), %rdi
movq %rdi, -0x5b0(%rbp)
movq $-0x1, %rcx
callq 0x96b0
movq -0x5b0(%rbp), %rdi
callq 0x9480
movq -0x5a8(%rbp), %rsi
movq -0x5a0(%rbp), %rdx
movq %rax, %rcx
addq $-0x2, %rcx
leaq -0x448(%rbp), %rdi
callq 0x96b0
jmp 0x5e88f
movq -0x4d8(%rbp), %rsi
leaq -0x428(%rbp), %rdi
leaq -0x448(%rbp), %rdx
callq 0x601d0
jmp 0x5e8ab
movq -0x4d8(%rbp), %rdi
addq $0x158, %rdi            # imm = 0x158
leaq -0x428(%rbp), %rsi
callq 0x97e0
leaq -0x428(%rbp), %rdi
callq 0x9c98
leaq -0x448(%rbp), %rdi
callq 0x9c98
leaq -0x468(%rbp), %rdi
callq 0x9c98
jmp 0x5e922
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x5e911
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x448(%rbp), %rdi
callq 0x9c98
leaq -0x468(%rbp), %rdi
callq 0x9c98
jmp 0x5ebba
movq -0x4d8(%rbp), %rdi
addq $0x158, %rdi            # imm = 0x158
callq 0x9480
cmpq $0x64, %rax
jae 0x5e9eb
movq -0x4d8(%rbp), %rdx
addq $0x158, %rdx            # imm = 0x158
leaq 0xf175(%rip), %rsi      # 0x6dac9
leaq -0x4a8(%rbp), %rdi
movq %rdi, -0x5b8(%rbp)
callq 0x14000
movq -0x5b8(%rbp), %rsi
leaq 0xf32d(%rip), %rdx      # 0x6dca2
leaq -0x488(%rbp), %rdi
callq 0x13970
jmp 0x5e983
xorl %ecx, %ecx
movl %ecx, %esi
leaq -0x488(%rbp), %rdi
movl %ecx, %edx
callq 0x138a0
jmp 0x5e997
leaq -0x488(%rbp), %rdi
callq 0x9c98
leaq -0x4a8(%rbp), %rdi
callq 0x9c98
jmp 0x5ea7f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x5e9da
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x488(%rbp), %rdi
callq 0x9c98
leaq -0x4a8(%rbp), %rdi
callq 0x9c98
jmp 0x5ebba
leaq -0x4c9(%rbp), %rdi
movq %rdi, -0x5c0(%rbp)
callq 0x9b10
movq -0x5c0(%rbp), %rdx
leaq 0xf0cf(%rip), %rsi      # 0x6dadb
leaq -0x4c8(%rbp), %rdi
callq 0xa780
jmp 0x5ea1a
xorl %ecx, %ecx
movl %ecx, %esi
leaq -0x4c8(%rbp), %rdi
movl %ecx, %edx
callq 0x138a0
jmp 0x5ea2e
leaq -0x4c8(%rbp), %rdi
callq 0x9c98
leaq -0x4c9(%rbp), %rdi
callq 0x9700
jmp 0x5ea7f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x5ea6e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x4c8(%rbp), %rdi
callq 0x9c98
leaq -0x4c9(%rbp), %rdi
callq 0x9700
jmp 0x5ebba
jmp 0x5ea81
movq -0x4d8(%rbp), %rax
movb $0x1, 0x192(%rax)
jmp 0x5ebaf
movq -0x4d8(%rbp), %rax
testb $0x1, 0x190(%rax)
je 0x5ebad
movq -0x4d8(%rbp), %rax
movq 0x28(%rax), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
testb $0x1, %al
jne 0x5eac2
jmp 0x5ebad
movq -0x4d8(%rbp), %rax
testb $0x1, 0x193(%rax)
jne 0x5ebad
movq -0x4d8(%rbp), %rdi
addq $0x8, %rdi
callq 0x9480
movq -0x4d8(%rbp), %rcx
subq 0x198(%rcx), %rax
cmpq 0x180(%rcx), %rax
jbe 0x5ebad
movq -0x4d8(%rbp), %rax
movq %rax, %rdi
addq $0x8, %rdi
movq 0x198(%rax), %rdx
addq 0x180(%rax), %rdx
leaq 0xf18c(%rip), %rsi      # 0x6dcb0
callq 0x9c60
movq -0x4d8(%rbp), %rdx
movq 0x198(%rdx), %rcx
addq 0x180(%rdx), %rcx
cmpq %rcx, %rax
je 0x5ebad
movq -0x4d8(%rbp), %rax
movl $0x19d, 0x188(%rax)     # imm = 0x19D
movl $0x10, %edi
callq 0x9340
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x5c8(%rbp)
leaq 0xef3d(%rip), %rsi      # 0x6daaf
callq 0x9be0
jmp 0x5eb79
movq -0x5c8(%rbp), %rdi
movq 0x30441(%rip), %rsi     # 0x8efc8
movq 0x3042a(%rip), %rdx     # 0x8efb8
callq 0x9aa0
movq -0x5c8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
callq 0x94c0
jmp 0x5ebba
jmp 0x5ebaf
jmp 0x5ebb1
addq $0x5d0, %rsp            # imm = 0x5D0
popq %rbp
retq
movq -0x10(%rbp), %rdi
callq 0x9af0
nopw %cs:(%rax,%rax)