// File: /workspace/github_cpp_makefile_star2_O2/alfanick[P]rest-cpp/src/rest/request.cpp
// Function: REST::Request::parse_header(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void Request::parse_header(std::string const &line) {
  if (line.find("GET") == 0) {
    method = Method::GET;
  } else
  if (line.find("POST") == 0) {
    method = Method::POST;
  } else
  if (line.find("PUT") == 0) {
    method = Method::PUT;
  } else
  if (line.find("DELETE") == 0) {
    method = Method::DELETE;
  } else
  if (line.find("HEAD") == 0) {
    method = Method::HEAD;
  } else
  if (line.find("PATCH") == 0) {
    method = Method::PATCH;
  } else
  if (line.find("TRACE") == 0) {
    method = Method::TRACE;
  } else
  if (line.find("CONNECT") == 0) {
    method = Method::CONNECT;
  } else
  if (line.find("OPTIONS") == 0) {
    method = Method::OPTIONS;
  }

  size_t path_start = line.find_first_of(" ")+1;
  size_t path_end = line.rfind("HTTP/1.")-1;

  path = line.substr(path_start, path_end - path_start);

  // TODO config
  if (path.size() >= 2048)
    throw HTTP::URITooLong();

  size_t path_query = path.find("?");

  if (path_query != std::string::npos) {
    std::string query = path.substr(path_query+1, path.size() - path_query);

    parse_query_string(query);

    path.erase(path_query, query.size()+1);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
leaq 0x15ccb(%rip), %rsi     # 0x4a190
movq %rdi, %rbx
xorl %r15d, %r15d
movq %r14, %rdi
xorl %edx, %edx
callq 0x33aa0
testq %rax, %rax
je 0x345b6
leaq 0x15caf(%rip), %rsi     # 0x4a194
movq %r14, %rdi
xorl %edx, %edx
callq 0x33aa0
testq %rax, %rax
je 0x3459a
leaq 0x15c9a(%rip), %rsi     # 0x4a199
movq %r14, %rdi
xorl %edx, %edx
callq 0x33aa0
testq %rax, %rax
je 0x3459e
leaq 0x15c84(%rip), %rsi     # 0x4a19d
movq %r14, %rdi
xorl %edx, %edx
callq 0x33aa0
testq %rax, %rax
je 0x345a2
leaq 0x15c75(%rip), %rsi     # 0x4a1a4
movq %r14, %rdi
xorl %edx, %edx
callq 0x33aa0
testq %rax, %rax
je 0x345a6
leaq 0x15c64(%rip), %rsi     # 0x4a1a9
movq %r14, %rdi
xorl %edx, %edx
callq 0x33aa0
testq %rax, %rax
je 0x345aa
leaq 0x15c54(%rip), %rsi     # 0x4a1af
movq %r14, %rdi
xorl %edx, %edx
callq 0x33aa0
testq %rax, %rax
je 0x345ae
leaq 0x15c44(%rip), %rsi     # 0x4a1b5
movq %r14, %rdi
xorl %edx, %edx
callq 0x33aa0
testq %rax, %rax
je 0x345b2
leaq 0x15c36(%rip), %rsi     # 0x4a1bd
movq %r14, %rdi
xorl %edx, %edx
callq 0x33aa0
testq %rax, %rax
jne 0x345b9
pushq $0x7
jmp 0x345b4
pushq $0x2
jmp 0x345b4
pushq $0x3
jmp 0x345b4
pushq $0x4
jmp 0x345b4
pushq $0x1
jmp 0x345b4
pushq $0x8
jmp 0x345b4
pushq $0x5
jmp 0x345b4
pushq $0x6
popq %r15
movl %r15d, (%rbx)
leaq 0x169e4(%rip), %rsi     # 0x4afa4
movq %r14, %rdi
xorl %edx, %edx
callq 0x30d20
movq %rax, %r15
leaq 0x1(%rax), %r12
leaq 0x15bed(%rip), %rsi     # 0x4a1c5
pushq $-0x1
popq %rdx
movq %r14, %rdi
callq 0x332b0
subq %r15, %rax
leaq 0x8(%rsp), %r15
movq %r14, %rsi
movq %r12, %rdx
leaq -0x2(%rax), %rcx
movq %r15, %rdi
callq 0x31ea0
leaq 0x8(%rbx), %r14
movq %r15, %rsi
movq %r14, %rdi
callq 0x32380
movq %r15, %rdi
callq 0x33b38
cmpq $0x800, 0x10(%rbx)      # imm = 0x800
jae 0x34687
leaq 0x15ba8(%rip), %rsi     # 0x4a1cd
movq %r14, %rdi
xorl %edx, %edx
callq 0x33aa0
cmpq $-0x1, %rax
je 0x3467b
movq 0x10(%rbx), %rcx
leaq 0x8(%rsp), %r12
leaq 0x1(%rax), %rdx
movq %rax, %r15
movq %r14, %rsi
movq %r12, %rdi
subq %rax, %rcx
callq 0x31ea0
movq %rbx, %rdi
movq %r12, %rsi
callq 0x328b0
movq 0x10(%rsp), %rdx
incq %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x304c0
leaq 0x8(%rsp), %rdi
callq 0x33b38
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
pushq $0x8
popq %rdi
callq 0x30c90
movq 0x287ea(%rip), %rcx     # 0x5ce80
movq 0x287c3(%rip), %rsi     # 0x5ce60
movq 0x2890c(%rip), %rdx     # 0x5cfb0
movq %rax, %rdi
addq $0x10, %rcx
movq %rcx, (%rax)
callq 0x333b0
leaq 0x8(%rsp), %rdi
movq %rax, %rbx
callq 0x33b38
movq %rbx, %rdi
callq 0x33510