// File: /workspace/github_cpp_makefile_star2_O1/kztomita[P]http-dump/httpv1.cc
// Function: httpv1::get(boost::asio::ip::address const&, unsigned short, http_scheme, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::list<std::unique_ptr<http_header, std::default_delete<http_header>>, std::allocator<std::unique_ptr<http_header, std::default_delete<http_header>>>> const&)
http_response httpv1::get(const boost::asio::ip::address& ip, uint16_t port, http_scheme scheme, const std::string& host, const std::string& path, const http_header_list& headers) {
  std::unique_ptr<sync_stream_wrapper> socket = create_socket(scheme);

  socket->set_host(host);
  socket->connect(ip, port);

  std::ostringstream request_stream;
  request_stream << "GET " << path << " HTTP/1.1\r\n"
                 << "Host: " << host << "\r\n";
                 //<< "Connection: Close\r\n"
  for (const auto& h : headers) {
    request_stream << h->key << ": " << h->value << "\r\n";
  }
  request_stream << "\r\n";

  debug_message("Sending Request");
  debug_message(request_stream.str());
  asio::write(*socket, asio::buffer(request_stream.str()));

  return read_response(*socket);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %r9, %r15
movl %ecx, %ebp
movq %rdx, %r12
movq %rdi, %r14
cmpl $0x1, %r8d
jne 0x217ca
movl $0x60, %edi
callq 0xb5e0
movq %rax, %rbx
movzbl 0x26f9e(%rip), %esi     # 0x48748
movq %rax, %rdi
xorl %edx, %edx
callq 0x2b742
leaq 0x90(%rsp), %rdi
movq $0x0, (%rdi)
callq 0x22688
jmp 0x217df
movl $0x68, %edi
callq 0xb5e0
movq %rax, %rbx
movq %rax, %rdi
callq 0x2b668
movq (%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
callq *(%rax)
movq (%rbx), %rax
movzwl %bp, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq *0x8(%rax)
leaq 0x90(%rsp), %rdi
callq 0xb8c0
movq %rbx, (%rsp)
leaq 0x12653(%rip), %rsi     # 0x33e64
leaq 0x90(%rsp), %rdi
movl $0x4, %edx
callq 0xb730
movq 0x240(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
leaq 0x90(%rsp), %rdi
callq 0xb730
movq %rax, %r12
leaq 0x12620(%rip), %rsi     # 0x33e69
movl $0xb, %edx
movq %rax, %rdi
callq 0xb730
leaq 0x12618(%rip), %rsi     # 0x33e75
movl $0x6, %edx
movq %r12, %rdi
callq 0xb730
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %r12, %rdi
callq 0xb730
leaq 0x12a2e(%rip), %rsi     # 0x342ae
movl $0x2, %edx
movq %rax, %rdi
callq 0xb730
movq %r14, 0x48(%rsp)
movq 0x248(%rsp), %rbx
leaq 0x90(%rsp), %r15
leaq 0x12ee8(%rip), %r12     # 0x34791
leaq 0x129fe(%rip), %r13     # 0x342ae
movq %rbx, %r14
movq (%r14), %r14
cmpq %rbx, %r14
je 0x21907
movq 0x10(%r14), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r15, %rdi
callq 0xb730
movq %rax, %rbp
movl $0x2, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0xb730
movq 0x10(%r14), %rax
movq 0x20(%rax), %rsi
movq 0x28(%rax), %rdx
movq %rbp, %rdi
callq 0xb730
movl $0x2, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0xb730
jmp 0x218b3
leaq 0x129a0(%rip), %rsi     # 0x342ae
leaq 0x90(%rsp), %rdi
movl $0x2, %edx
callq 0xb730
movq 0x48(%rsp), %r14
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x12547(%rip), %rsi     # 0x33e7c
leaq 0x1254f(%rip), %rdx     # 0x33e8b
leaq 0x8(%rsp), %rdi
callq 0x10322
cmpb $0x1, 0x2727b(%rip)     # 0x48bc8
jne 0x2198f
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x26628(%rip), %rdi     # 0x47f88
callq 0xb730
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0xb5b0
movsbl %al, %esi
movq %r15, %rdi
callq 0xb050
movq %rax, %rdi
callq 0xb450
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x219a6
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb600
leaq 0x98(%rsp), %r15
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0xba80
cmpb $0x1, 0x27206(%rip)     # 0x48bc8
jne 0x21a04
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x265b3(%rip), %rdi     # 0x47f88
callq 0xb730
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0xb5b0
movsbl %al, %esi
movq %r12, %rdi
callq 0xb050
movq %rax, %rdi
callq 0xb450
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x21a1b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb600
leaq 0x60(%rsp), %rdi
movq %r15, %rsi
movq (%rsp), %rbx
callq 0xba80
movups 0x60(%rsp), %xmm0
leaq 0x80(%rsp), %rsi
movups %xmm0, (%rsi)
leaq 0x50(%rsp), %rcx
movl $0x0, (%rcx)
movb $0x0, 0x4(%rcx)
leaq 0x2481e(%rip), %rax     # 0x46270
movq %rax, 0x8(%rcx)
leaq 0x8(%rsp), %rdx
movq %rsi, (%rdx)
movq %rbx, %rdi
callq 0x23315
cmpb $0x1, 0x54(%rsp)
je 0x21ad7
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x21a88
movq 0x70(%rsp), %rsi
incq %rsi
callq 0xb600
movq %r14, %rdi
movq %rbx, %rsi
callq 0x21bc8
movq 0x264ce(%rip), %rsi     # 0x47f68
leaq 0x90(%rsp), %rdi
callq 0xb380
leaq 0x100(%rsp), %rdi
callq 0xb1f0
movl $0x8, %esi
movq (%rsp), %rdi
callq 0xb600
movq %r14, %rax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x50(%rsp), %rbx
movq 0x58(%rsp), %r14
leaq 0x12423(%rip), %rsi     # 0x33f0b
leaq 0x8(%rsp), %rdi
callq 0xbc90
leaq 0x24747(%rip), %rax     # 0x46240
leaq 0x38(%rsp), %rcx
movq %rax, -0x30(%rcx)
movq %rbx, -0x20(%rcx)
movq %r14, -0x18(%rcx)
movq %rcx, -0x10(%rcx)
movq $0x0, -0x8(%rcx)
movb $0x0, (%rcx)
leaq 0x8(%rsp), %rdi
callq 0xe1ef
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0xde76
jmp 0x21b51
movq %rax, %r14
movl $0x68, %esi
jmp 0x21bb8
movq %rax, %r14
movl $0x60, %esi
jmp 0x21bb8
jmp 0x21b8b
jmp 0x21b8b
jmp 0x21b8b
jmp 0x21b84
movq %rax, %r14
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x21b8e
movq 0x70(%rsp), %rsi
jmp 0x21b7a
jmp 0x21b68
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x21b8e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb600
jmp 0x21b8e
movq %rax, %r14
jmp 0x21bb3
jmp 0x21b8b
movq %rax, %r14
movq 0x263d3(%rip), %rsi     # 0x47f68
leaq 0x90(%rsp), %rdi
callq 0xb380
leaq 0x100(%rsp), %rdi
callq 0xb1f0
movq (%rsp), %rbx
movl $0x8, %esi
movq %rbx, %rdi
callq 0xb600
movq %r14, %rdi
callq 0xbbb0