// File: /workspace/github_cpp_makefile_star2_O2/kztomita[P]http-dump/url.cc
// Function: parse_url(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
url_components parse_url(const std::string& url) {
  std::smatch m;
  if (!std::regex_search(url, m, std::regex(R"((^[a-z][a-z0-9+.-]*)://([^ /]+?)(?::(\d+))?(/[\S]*)?$)"))) {
    throw std::invalid_argument("invalid url.");
  }

  url_components c;
  c.scheme = m[1].str();
  c.host = m[2].str();

  if (m[3].matched) {
    c.port = static_cast<unsigned int>(std::stoi(m[3].str()));
  }

  if (m[4].matched) {
    c.path_and_query = m[4].str();
  } else {
    c.path_and_query = "/";
  }

  return c;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
leaq 0x1a018(%rip), %rsi     # 0x2c018
movq %rsp, %rdi
pushq $0x10
popq %rdx
callq 0x12274
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x12258
movl %eax, %ebp
movq %rsp, %rdi
callq 0x122da
testb %bpl, %bpl
je 0x121d5
movq %rbx, %rdi
callq 0x122f4
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rcx
pushq $0x18
popq %r15
subq %rsi, %rcx
je 0x12063
movq %rcx, %rax
cqto
idivq %r15
addq $-0x5, %rax
cmpq $-0x3, %rax
ja 0x12063
addq $0x18, %rsi
jmp 0x1206a
addq %rcx, %rsi
addq $-0x48, %rsi
movq %rsp, %rdi
callq 0x1232a
movq %rsp, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb7e0
movq %r14, %rdi
callq 0xb2f0
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rcx
subq %rsi, %rcx
je 0x120af
movq %rcx, %rax
cqto
idivq %r15
addq $-0x6, %rax
cmpq $-0x4, %rax
ja 0x120af
addq $0x30, %rsi
jmp 0x120b6
addq %rcx, %rsi
addq $-0x48, %rsi
movq %rsp, %rdi
callq 0x1232a
leaq 0x20(%rbx), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0xb7e0
movq %r14, %rdi
callq 0xb2f0
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdi
movq %rdi, %rcx
subq %rsi, %rcx
je 0x12105
movq %rcx, %rax
cqto
idivq %r15
addq $-0x7, %rax
cmpq $-0x4, %rax
jae 0x12110
cmpb $0x0, 0x58(%rsi)
je 0x12155
addq $0x48, %rsi
jmp 0x1211e
cmpb $0x0, -0x38(%rsi,%rcx)
jne 0x12117
xorl %ecx, %ecx
jmp 0x1217e
cmpb $0x0, -0x38(%rsi,%rcx)
je 0x12155
addq %rcx, %rsi
addq $-0x48, %rsi
movq %rsp, %rdi
callq 0x1232a
movq %rsp, %rdi
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x12364
movl %eax, %eax
btsq $0x20, %rax
movq %rax, 0x40(%rbx)
movq %rsp, %rdi
callq 0xb2f0
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rcx
movq %rcx, %rdi
jmp 0x12158
movq %rdi, %rcx
subq %rsi, %rcx
cmpq %rdi, %rsi
je 0x1217e
movq %rcx, %rax
cqto
idivq %r15
addq $-0x8, %rax
cmpq $-0x5, %rax
jae 0x1217e
cmpb $0x0, 0x70(%rsi)
je 0x121ad
addq $0x60, %rsi
jmp 0x1218c
cmpb $0x0, -0x38(%rsi,%rcx)
je 0x121ad
addq %rcx, %rsi
addq $-0x48, %rsi
movq %rsp, %rdi
callq 0x1232a
leaq 0x48(%rbx), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0xb7e0
movq %r14, %rdi
callq 0xb2f0
jmp 0x121bd
leaq 0x48(%rbx), %rdi
leaq 0x19ea3(%rip), %rsi     # 0x2c05b
callq 0xbcf0
leaq 0x20(%rsp), %rdi
callq 0x12442
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0xb330
movq %rax, %rbx
leaq 0x19e67(%rip), %rsi     # 0x2c04e
movq %rax, %rdi
callq 0xbcc0
movq 0x33dc2(%rip), %rsi     # 0x45fb8
movq 0x33d93(%rip), %rdx     # 0x45f90
movq %rbx, %rdi
callq 0xbb50
jmp 0x12229
jmp 0x12229
movq %rax, %r14
movq %rsp, %rdi
callq 0xb2f0
jmp 0x1222c
jmp 0x12229
jmp 0x12243
movq %rax, %r14
movq %rbx, %rdi
callq 0xb4d0
jmp 0x12246
jmp 0x12229
movq %rax, %r14
movq %rbx, %rdi
callq 0xd5ae
jmp 0x12246
movq %rax, %r14
movq %rsp, %rdi
callq 0x122da
jmp 0x12246
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0x12442
movq %r14, %rdi
callq 0xbba0