// File: /workspace/github_cpp_makefile_star2_O3/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 0x49f3(%rip), %rsi      # 0xc031
movq %r15, %rdi
callq 0x50b0
movl %eax, %ebp
movq (%r15), %rdi
leaq 0x58(%rsp), %r13
cmpq %r13, %rdi
je 0x7662
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x5320
testl %ebp, %ebp
jne 0x76a2
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 0x76a2
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x5320
leaq 0x495b(%rip), %rsi      # 0xc004
movl $0x1, %ecx
movq %r14, %rdi
xorl %edx, %edx
callq 0x54a0
movq %rax, %r12
leaq 0x4975(%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 0x61d2
cmpq $-0x1, %r12
je 0x7708
movq %r13, %rbp
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %r12, %rcx
callq 0x5350
jmp 0x7723
movq %r13, %rbp
cmpq $-0x1, %r15
je 0x7750
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 0x7750
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5320
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x4930(%rip), %rsi      # 0xc090
leaq 0x492b(%rip), %rdx      # 0xc092
leaq 0x8(%rsp), %rdi
callq 0x66e8
cmpq $-0x1, %r12
sete %al
cmpq $-0x1, %r15
sete %cl
orb %al, %cl
jne 0x77a0
leaq 0x1(%r12), %rdx
notq %r12
addq %r15, %r12
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rcx
callq 0x5350
jmp 0x77c0
cmpq $-0x1, %r12
je 0x77ed
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 0x77ed
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x5320
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x4839(%rip), %rsi      # 0xc037
leaq 0x4833(%rip), %rdx      # 0xc038
leaq 0x28(%rsp), %rdi
callq 0x66e8
cmpq $-0x1, %r15
je 0x7858
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 0x7858
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 0x78c6
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x5320
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x78dd
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5320
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x78f4
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 0x791b
jmp 0x7916
jmp 0x7916
movq %rax, %r14
jmp 0x792b
jmp 0x791b
movq %rax, %r14
jmp 0x7942
movq %rax, %r14
jmp 0x7959
movq %rax, %r14
movq %rbx, %rdi
callq 0x9008
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x7942
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x5320
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x7959
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5320
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x7970
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x5320
movq %r14, %rdi
callq 0x5540