// File: mbourand[P]webserv/srcs/Utils/URL.cpp
// Function: URL::parse_full(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void URL::parse_full(const std::string& url)
{
	if (url.substr(0, 7) != "http://")
		throw std::invalid_argument("Full url doesnt start with 'http://'");
	_scheme = "http";
	size_t i = 7;

	parse_userinfo(i, url);
	_host = url.substr(i, url.find_first_of(":/", i) - i);
	if (_host.size() == 0)
		throw std::invalid_argument("Empty host in uri");
	i += _host.size();
	if (url[i] == ':')
	{
		i++;
		_port = url.substr(i, url.find_first_of('/', i) - i);
		if (_port.size() == 0)
			throw std::invalid_argument("Empty port in uri");
		i += _port.size();
	}
	if (url[i] == '/')
		parse_partial(url.substr(i));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x10(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
leaq -0x30(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
movl $0x7, %ecx
callq 0x96b0
movq -0xb8(%rbp), %rdi
leaq 0x3c400(%rip), %rsi     # 0x6ae79
callq 0xce40
movb %al, -0xa9(%rbp)
jmp 0x2ea86
leaq -0x30(%rbp), %rdi
callq 0x9c98
movb -0xa9(%rbp), %al
testb $0x1, %al
jne 0x2ea9b
jmp 0x2eb11
movl $0x10, %edi
callq 0x9340
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xc8(%rbp)
leaq 0x3c3c8(%rip), %rsi     # 0x6ae81
callq 0x9be0
jmp 0x2eac0
movq -0xc8(%rbp), %rdi
movq 0x604fa(%rip), %rsi     # 0x8efc8
movq 0x604e3(%rip), %rdx     # 0x8efb8
callq 0x9aa0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x9c98
jmp 0x2edcb
movq -0xc8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
callq 0x94c0
jmp 0x2edcb
movq -0xc0(%rbp), %rdi
addq $0x8, %rdi
leaq 0x3c383(%rip), %rsi     # 0x6aea6
callq 0x98a0
movq -0xc0(%rbp), %rdi
movq $0x7, -0x48(%rbp)
movq -0x10(%rbp), %rdx
leaq -0x48(%rbp), %rsi
callq 0x2f090
movq -0x10(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rdx
leaq 0x3c342(%rip), %rsi     # 0x6aeab
callq 0x9360
movq -0xd8(%rbp), %rsi
movq -0xd0(%rbp), %rdx
movq %rax, %rcx
subq -0x48(%rbp), %rcx
leaq -0x68(%rbp), %rdi
callq 0x96b0
movq -0xc0(%rbp), %rdi
addq $0x48, %rdi
leaq -0x68(%rbp), %rsi
callq 0x97e0
leaq -0x68(%rbp), %rdi
callq 0x9c98
movq -0xc0(%rbp), %rdi
addq $0x48, %rdi
callq 0x9480
cmpq $0x0, %rax
jne 0x2ec1b
movl $0x10, %edi
callq 0x9340
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xe0(%rbp)
leaq 0x3c2d1(%rip), %rsi     # 0x6aeae
callq 0x9be0
jmp 0x2ebe4
movq -0xe0(%rbp), %rdi
movq 0x603d6(%rip), %rsi     # 0x8efc8
movq 0x603bf(%rip), %rdx     # 0x8efb8
callq 0x9aa0
movq -0xe0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
callq 0x94c0
jmp 0x2edcb
movq -0xc0(%rbp), %rdi
addq $0x48, %rdi
callq 0x9480
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x9720
movsbl (%rax), %eax
cmpl $0x3a, %eax
jne 0x2ed4e
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rdx
movl $0x2f, %esi
callq 0x9450
movq -0xf0(%rbp), %rsi
movq -0xe8(%rbp), %rdx
movq %rax, %rcx
subq -0x48(%rbp), %rcx
leaq -0x88(%rbp), %rdi
callq 0x96b0
movq -0xc0(%rbp), %rdi
addq $0x68, %rdi
leaq -0x88(%rbp), %rsi
callq 0x97e0
leaq -0x88(%rbp), %rdi
callq 0x9c98
movq -0xc0(%rbp), %rdi
addq $0x68, %rdi
callq 0x9480
cmpq $0x0, %rax
jne 0x2ed36
movl $0x10, %edi
callq 0x9340
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xf8(%rbp)
leaq 0x3c1c8(%rip), %rsi     # 0x6aec0
callq 0x9be0
jmp 0x2ecff
movq -0xf8(%rbp), %rdi
movq 0x602bb(%rip), %rsi     # 0x8efc8
movq 0x602a4(%rip), %rdx     # 0x8efb8
callq 0x9aa0
movq -0xf8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
callq 0x94c0
jmp 0x2edcb
movq -0xc0(%rbp), %rdi
addq $0x68, %rdi
callq 0x9480
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x9720
movsbl (%rax), %eax
cmpl $0x2f, %eax
jne 0x2edc2
movq -0x10(%rbp), %rsi
movq -0x48(%rbp), %rdx
leaq -0xa8(%rbp), %rdi
movq %rdi, -0x100(%rbp)
movq $-0x1, %rcx
callq 0x96b0
movq -0xc0(%rbp), %rdi
movq -0x100(%rbp), %rsi
callq 0x2e710
jmp 0x2ed9a
leaq -0xa8(%rbp), %rdi
callq 0x9c98
jmp 0x2edc2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x9c98
jmp 0x2edcb
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x9af0
nopw %cs:(%rax,%rax)