// File: /workspace/github_cpp_makefile_star2_O1/kztomita[P]http-dump/./http2_socket.h
// Function: http2_frame read_http2_frame<boost::asio::ssl::stream<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0>>, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0>>, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0>>, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0>>, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0>>>>>>(boost::asio::ssl::stream<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0>>, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0>>, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0>>, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0>>, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0>>>>>&)
http2_frame read_http2_frame(SyncReadStream& socket) {
  namespace asio = boost::asio;

  asio::streambuf receive_buffer;

  asio::read(socket, receive_buffer, boost::asio::transfer_exactly(9));

  const char* headerp = asio::buffer_cast<const char*>(receive_buffer.data());

  http2_frame frame;

  std::memcpy(&frame.header(), headerp, 9);
  receive_buffer.consume(9);

  uint payload_size = frame.header().length();

  if (payload_size) {
    frame.payload().resize(payload_size);

    asio::read(socket, receive_buffer, boost::asio::transfer_exactly(payload_size));

    const char* payloadp = asio::buffer_cast<const char*>(receive_buffer.data());
    std::memcpy(frame.payload_buffer(), payloadp, payload_size);
  }

  debug_message("RECV");
  debug_dump(frame);

  return frame;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x58(%rsp), %r12
leaq 0x10(%rsp), %rdx
movq %r12, %rdi
movq $-0x1, %rsi
callq 0x233ae
leaq 0x50(%rsp), %rsi
movq %r12, (%rsi)
movq %rsp, %rcx
movl $0x0, (%rcx)
movb $0x0, 0x4(%rcx)
leaq 0x20625(%rip), %rbp     # 0x46270
movq %rbp, 0x8(%rcx)
movl $0x9, %edx
movq %r15, %rdi
xorl %r8d, %r8d
callq 0x276ef
cmpb $0x1, 0x4(%rsp)
je 0x25e27
movq 0x68(%rsp), %rax
movq 0x80(%rsp), %rdx
movq %rdx, %rcx
subq %rax, %rcx
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movq $0x0, 0x20(%rbx)
movb 0x8(%rax), %sil
movb %sil, 0x8(%rbx)
movq (%rax), %rsi
movq %rsi, (%rbx)
cmpq %rdx, 0x70(%rsp)
jae 0x25cb3
movq 0xa0(%rsp), %rsi
movq %rsi, 0x60(%rsp)
movq %rdx, 0x70(%rsp)
leaq 0x9(%rax), %rsi
cmpq %rdx, %rsi
movslq %ecx, %rcx
movl $0x9, %edx
cmovaq %rcx, %rdx
leaq 0x10(%rbx), %r14
addq %rax, %rdx
movq %rdx, 0x68(%rsp)
movzwl (%rbx), %eax
movzbl 0x2(%rbx), %r13d
shll $0x10, %r13d
orl %eax, %r13d
testl %r13d, %r13d
je 0x25d3a
bswapl %r13d
shrl $0x8, %r13d
movq %r14, %rdi
movq %r13, %rsi
callq 0x23970
leaq 0x50(%rsp), %rsi
movq %r12, (%rsi)
movq %rsp, %rcx
movl $0x0, (%rcx)
movb $0x0, 0x4(%rcx)
movq %rbp, 0x8(%rcx)
movq %r15, %rdi
movq %r13, %rdx
xorl %r8d, %r8d
callq 0x276ef
cmpb $0x1, 0x4(%rsp)
je 0x25e72
movq 0x68(%rsp), %rsi
movq (%r14), %rdi
movq %r13, %rdx
callq 0xb500
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xe726(%rip), %rsi      # 0x34471
leaq 0xe723(%rip), %rdx      # 0x34475
leaq 0x10(%rsp), %rdi
callq 0x10322
cmpb $0x1, 0x22e65(%rip)     # 0x48bc8
jne 0x25da5
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x22212(%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 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x25dbc
movq 0x20(%rsp), %rsi
incq %rsi
callq 0xb600
cmpb $0x1, 0x22e05(%rip)     # 0x48bc8
jne 0x25dcd
movq %rbx, %rdi
callq 0x28764
leaq 0x2137c(%rip), %rax     # 0x47150
movq %rax, 0x58(%rsp)
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x25df6
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0xb600
movq 0x22123(%rip), %rax     # 0x47f20
addq $0x10, %rax
leaq 0x90(%rsp), %rdi
movq %rax, -0x38(%rdi)
callq 0xb950
movq %rbx, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rsp), %rbx
movq 0x8(%rsp), %r14
leaq 0xc4ed(%rip), %rsi      # 0x32324
leaq 0x10(%rsp), %rdi
callq 0xbc90
leaq 0x203f8(%rip), %rax     # 0x46240
leaq 0x40(%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 0x10(%rsp), %rdi
callq 0xe1ef
movq (%rsp), %r15
movq 0x8(%rsp), %r12
leaq 0xc4a2(%rip), %rsi      # 0x32324
leaq 0x10(%rsp), %rdi
callq 0xbc90
leaq 0x203ad(%rip), %rax     # 0x46240
leaq 0x40(%rsp), %rcx
movq %rax, -0x30(%rcx)
movq %r15, -0x20(%rcx)
movq %r12, -0x18(%rcx)
movq %rcx, -0x10(%rcx)
movq $0x0, -0x8(%rcx)
movb $0x0, (%rcx)
leaq 0x10(%rsp), %rdi
callq 0xe1ef
movq %rax, %r15
leaq 0x10(%rsp), %rdi
callq 0xde76
jmp 0x25f01
movq %rax, %r15
leaq 0x10(%rsp), %rdi
callq 0xde76
jmp 0x25f15
jmp 0x25efe
movq %rax, %r15
jmp 0x25f15
movq %rax, %r15
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x25f01
movq 0x20(%rsp), %rsi
incq %rsi
callq 0xb600
jmp 0x25f01
movq %rax, %r15
movq (%r14), %rdi
testq %rdi, %rdi
je 0x25f15
movq 0x20(%rbx), %rsi
subq %rdi, %rsi
callq 0xb600
leaq 0x58(%rsp), %rdi
callq 0x2399c
movq %r15, %rdi
callq 0xbbb0