// File: /workspace/github_cpp_makefile_star2_O3/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 0x21682
movl $0x60, %edi
callq 0xb5e0
movq %rax, %rbx
movzbl 0x260e6(%rip), %esi     # 0x47748
movq %rax, %rdi
xorl %edx, %edx
callq 0x2b2e6
leaq 0x90(%rsp), %rdi
movq $0x0, (%rdi)
callq 0x22526
jmp 0x21697
movl $0x68, %edi
callq 0xb5e0
movq %rax, %rbx
movq %rax, %rdi
callq 0x2b20c
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 0x1179b(%rip), %rsi     # 0x32e64
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 0x11768(%rip), %rsi     # 0x32e69
movl $0xb, %edx
movq %rax, %rdi
callq 0xb730
leaq 0x11760(%rip), %rsi     # 0x32e75
movl $0x6, %edx
movq %r12, %rdi
callq 0xb730
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %r12, %rdi
callq 0xb730
leaq 0x11b76(%rip), %rsi     # 0x332ae
movl $0x2, %edx
movq %rax, %rdi
callq 0xb730
movq %r14, 0x48(%rsp)
movq 0x248(%rsp), %rbx
leaq 0x90(%rsp), %r15
leaq 0x12030(%rip), %r12     # 0x33791
leaq 0x11b46(%rip), %r13     # 0x332ae
movq %rbx, %r14
movq (%r14), %r14
cmpq %rbx, %r14
je 0x217bf
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 0x2176b
leaq 0x11ae8(%rip), %rsi     # 0x332ae
leaq 0x90(%rsp), %rdi
movl $0x2, %edx
callq 0xb730
movq 0x48(%rsp), %r14
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x1168f(%rip), %rsi     # 0x32e7c
leaq 0x11697(%rip), %rdx     # 0x32e8b
leaq 0x8(%rsp), %rdi
callq 0x1025a
cmpb $0x1, 0x263c3(%rip)     # 0x47bc8
jne 0x21847
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x25768(%rip), %rdi     # 0x46f80
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 0x2185e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb600
leaq 0x98(%rsp), %r15
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0xba80
cmpb $0x1, 0x2634e(%rip)     # 0x47bc8
jne 0x218bc
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x256f3(%rip), %rdi     # 0x46f80
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 0x218d3
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 0x23a06(%rip), %rax     # 0x45310
movq %rax, 0x8(%rcx)
leaq 0x8(%rsp), %rdx
movq %rsi, (%rdx)
movq %rbx, %rdi
callq 0x23123
cmpb $0x1, 0x54(%rsp)
je 0x2198f
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x21940
movq 0x70(%rsp), %rsi
incq %rsi
callq 0xb600
movq %r14, %rdi
movq %rbx, %rsi
callq 0x21a80
movq 0x2560e(%rip), %rsi     # 0x46f60
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 0x1156b(%rip), %rsi     # 0x32f0b
leaq 0x8(%rsp), %rdi
callq 0xbc90
leaq 0x2392f(%rip), %rax     # 0x452e0
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 0xe1b4
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0xde38
jmp 0x21a09
movq %rax, %r14
movl $0x68, %esi
jmp 0x21a70
movq %rax, %r14
movl $0x60, %esi
jmp 0x21a70
jmp 0x21a43
jmp 0x21a43
jmp 0x21a43
jmp 0x21a3c
movq %rax, %r14
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x21a46
movq 0x70(%rsp), %rsi
jmp 0x21a32
jmp 0x21a20
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x21a46
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb600
jmp 0x21a46
movq %rax, %r14
jmp 0x21a6b
jmp 0x21a43
movq %rax, %r14
movq 0x25513(%rip), %rsi     # 0x46f60
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