// File: /workspace/github_cpp_makefile_star2_O2/m1c0l[P]http-client-server/web-client.cpp
// Function: parseUrl(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Url parseUrl(string urlStr) {
	// remove http:// at start of URL
	if (urlStr.substr(0, 7) == "http://") {
		urlStr = urlStr.substr(7);
	}

	size_t colonPos = urlStr.find_first_of(":");
	size_t slashPos = urlStr.find_first_of("/");

	string hostname = urlStr;
	if (colonPos != string::npos) {
		hostname = urlStr.substr(0, colonPos);
	}
	else if (slashPos != string::npos) {
		hostname = urlStr.substr(0, slashPos);
	}

	string port = "80";
	if (colonPos != string::npos && slashPos != string::npos) {
		port = urlStr.substr(colonPos + 1, slashPos - colonPos - 1);
	}
	else if (colonPos != string::npos) {
		port = urlStr.substr(colonPos + 1);
	}

	string filename = "/";
	if (slashPos != string::npos) {
		filename = urlStr.substr(slashPos);
	}

	Url url;
	url.host = hostname;
	url.port = port;
	url.path = filename;
	return url;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x48(%rsp), %r15
pushq $0x7
popq %rcx
movq %r15, %rdi
xorl %edx, %edx
callq 0x5350
leaq 0x45f5(%rip), %rsi      # 0xb031
movq %r15, %rdi
callq 0x6677
movl %eax, %ebp
movq %r15, %rdi
callq 0x5140
testb %bpl, %bpl
je 0x6a7c
leaq 0x48(%rsp), %r15
pushq $0x7
popq %rdx
pushq $-0x1
popq %rcx
movq %r15, %rdi
movq %r14, %rsi
callq 0x5350
movq %r14, %rdi
movq %r15, %rsi
callq 0x53a0
movq %r15, %rdi
callq 0x5140
leaq 0x4581(%rip), %rsi      # 0xb004
movq %r14, %rdi
xorl %edx, %edx
callq 0x51a0
movq %rax, %r12
leaq 0x45a0(%rip), %rsi      # 0xb037
movq %r14, %rdi
xorl %edx, %edx
callq 0x51a0
movq %rax, %r15
leaq 0x48(%rsp), %rdi
movq %r14, %rsi
callq 0x5420
cmpq $-0x1, %r12
je 0x6acb
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %r12, %rcx
callq 0x5350
jmp 0x6ae3
cmpq $-0x1, %r15
je 0x6afd
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %r15, %rcx
callq 0x5350
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %r13
movq %r13, %rsi
callq 0x53a0
movq %r13, %rdi
callq 0x5140
leaq 0x458c(%rip), %rsi      # 0xb090
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x5bba
cmpq $-0x1, %r12
sete %al
cmpq $-0x1, %r15
sete %cl
orb %al, %cl
jne 0x6b42
leaq 0x1(%r12), %rdx
notq %r12
addq %r15, %r12
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rcx
callq 0x5350
jmp 0x6b5e
cmpq $-0x1, %r12
je 0x6b78
incq %r12
leaq 0x8(%rsp), %rdi
pushq $-0x1
popq %rcx
movq %r14, %rsi
movq %r12, %rdx
callq 0x5350
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %r12
movq %r12, %rsi
callq 0x53a0
movq %r12, %rdi
callq 0x5140
leaq 0x44b8(%rip), %rsi      # 0xb037
leaq 0x8(%rsp), %rdi
leaq 0x68(%rsp), %rdx
callq 0x5bba
cmpq $-0x1, %r15
je 0x6bc1
leaq 0x68(%rsp), %rdi
pushq $-0x1
popq %rcx
movq %r14, %rsi
movq %r15, %rdx
callq 0x5350
leaq 0x8(%rsp), %rdi
leaq 0x68(%rsp), %r14
movq %r14, %rsi
callq 0x53a0
movq %r14, %rdi
callq 0x5140
movq %rbx, %rdi
callq 0x7a28
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0x51b0
leaq 0x20(%rbx), %rdi
leaq 0x28(%rsp), %rsi
callq 0x51b0
leaq 0x40(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0x51b0
leaq 0x8(%rsp), %rdi
callq 0x5140
leaq 0x28(%rsp), %rdi
callq 0x5140
leaq 0x48(%rsp), %rdi
callq 0x5140
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6c37
jmp 0x6c32
jmp 0x6c32
movq %rax, %r14
jmp 0x6c47
jmp 0x6c37
movq %rax, %r14
jmp 0x6c51
movq %rax, %r14
jmp 0x6c5b
movq %rax, %r14
movq %rbx, %rdi
callq 0x7a5a
leaq 0x8(%rsp), %rdi
callq 0x5140
leaq 0x28(%rsp), %rdi
callq 0x5140
leaq 0x48(%rsp), %rdi
callq 0x5140
movq %r14, %rdi
callq 0x5500