// File: /workspace/github_cpp_makefile_star2_O1/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
movl $0x7, %ecx
movq %r15, %rdi
xorl %edx, %edx
callq 0x5350
leaq 0x49c7(%rip), %rsi      # 0xc031
movq %r15, %rdi
callq 0x50b0
movl %eax, %ebp
movq (%r15), %rdi
leaq 0x58(%rsp), %r13
cmpq %r13, %rdi
je 0x768e
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x5320
testl %ebp, %ebp
jne 0x76ce
leaq 0x48(%rsp), %r15
movl $0x7, %edx
movq %r15, %rdi
movq %r14, %rsi
movq $-0x1, %rcx
callq 0x5350
movq %r14, %rdi
movq %r15, %rsi
callq 0x53c0
movq (%r15), %rdi
cmpq %r13, %rdi
je 0x76ce
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x5320
leaq 0x492f(%rip), %rsi      # 0xc004
movl $0x1, %ecx
movq %r14, %rdi
xorl %edx, %edx
callq 0x54a0
movq %rax, %r12
leaq 0x4949(%rip), %rsi      # 0xc037
movl $0x1, %ecx
movq %r14, %rdi
xorl %edx, %edx
callq 0x54a0
movq %rax, %r15
leaq 0x48(%rsp), %rdi
movq %r13, (%rdi)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
callq 0x6200
cmpq $-0x1, %r12
je 0x7734
movq %r13, %rbp
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %r12, %rcx
callq 0x5350
jmp 0x774f
movq %r13, %rbp
cmpq $-0x1, %r15
je 0x777c
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %r15, %rcx
callq 0x5350
leaq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %r13
movq %r13, %rsi
callq 0x53c0
movq (%r13), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x777c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5320
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x4904(%rip), %rsi      # 0xc090
leaq 0x48ff(%rip), %rdx      # 0xc092
leaq 0x8(%rsp), %rdi
callq 0x671a
cmpq $-0x1, %r12
sete %al
cmpq $-0x1, %r15
sete %cl
orb %al, %cl
jne 0x77cc
leaq 0x1(%r12), %rdx
notq %r12
addq %r15, %r12
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rcx
callq 0x5350
jmp 0x77ec
cmpq $-0x1, %r12
je 0x7819
incq %r12
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
movq $-0x1, %rcx
callq 0x5350
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %r12
movq %r12, %rsi
callq 0x53c0
movq (%r12), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x7819
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x5320
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x480d(%rip), %rsi      # 0xc037
leaq 0x4807(%rip), %rdx      # 0xc038
leaq 0x28(%rsp), %rdi
callq 0x671a
cmpq $-0x1, %r15
je 0x7884
leaq 0x68(%rsp), %rdi
movq %r14, %rsi
movq %r15, %rdx
movq $-0x1, %rcx
callq 0x5350
leaq 0x28(%rsp), %rdi
leaq 0x68(%rsp), %r14
movq %r14, %rsi
callq 0x53c0
movq (%r14), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x7884
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x5320
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
xorl %eax, %eax
movq %rax, 0x8(%rbx)
movb %al, 0x10(%rbx)
leaq 0x30(%rbx), %rcx
movq %rcx, 0x20(%rbx)
movq %rax, 0x28(%rbx)
movb %al, 0x30(%rbx)
leaq 0x50(%rbx), %rcx
movq %rcx, 0x40(%rbx)
movq %rax, 0x48(%rbx)
movb %al, 0x50(%rbx)
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0x5180
leaq 0x20(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0x5180
leaq 0x40(%rbx), %rdi
leaq 0x28(%rsp), %rsi
callq 0x5180
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x78f2
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x5320
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x7909
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5320
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x7920
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x5320
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7947
jmp 0x7942
jmp 0x7942
movq %rax, %r14
jmp 0x7957
jmp 0x7947
movq %rax, %r14
jmp 0x796e
movq %rax, %r14
jmp 0x7985
movq %rax, %r14
movq %rbx, %rdi
callq 0x9050
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x796e
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x5320
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x7985
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5320
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x799c
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x5320
movq %r14, %rdi
callq 0x5540