// File: kztomita[P]http-dump/./http2_socket.h
// Function: void write_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 const&)
void write_http2_frame(SyncWriteStream& socket, const http2_frame& frame) {
  namespace asio = boost::asio;

  if (frame.header().length() != frame.payload().size()) {
    std::cerr << "payload length mismatch." << std::endl;
  }

  asio::write(socket, asio::buffer(reinterpret_cast<const char*>(&frame.header()), sizeof(http2_frame_header)));

  if (frame.payload().size()) {
    asio::write(socket, asio::buffer(reinterpret_cast<const char*>(frame.payload_buffer()), frame.payload().size()));
  }

  debug_message("SEND");
  debug_dump(frame);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5c940
movq %rax, %rdi
callq 0x5ab60
movl %eax, %eax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5c950
movq %rax, %rdi
callq 0x4e6b0
movq %rax, %rcx
movq -0x70(%rbp), %rax
cmpq %rcx, %rax
je 0x5c7d9
movq 0x507ea(%rip), %rdi     # 0xacfa8
leaq 0x18ded(%rip), %rsi     # 0x755b2
callq 0xd860
movq %rax, %rdi
movq 0x507c4(%rip), %rsi     # 0xacf98
callq 0xde80
movq -0x8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5c940
movq %rax, %rdi
movl $0x9, %esi
callq 0x5c970
movq -0x78(%rbp), %rdi
movq %rax, -0x20(%rbp)
movq %rdx, -0x18(%rbp)
leaq -0x20(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x59740
movq -0x10(%rbp), %rdi
callq 0x5c950
movq %rax, %rdi
callq 0x4e6b0
cmpq $0x0, %rax
je 0x5c878
movq -0x8(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5c9a0
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5c950
movq %rax, %rdi
callq 0x4e6b0
movq -0x88(%rbp), %rdi
movq %rax, %rsi
callq 0x5c970
movq -0x80(%rbp), %rdi
movq %rax, -0x30(%rbp)
movq %rdx, -0x28(%rbp)
leaq -0x30(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x59740
leaq -0x51(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0xddb0
movq -0x90(%rbp), %rdx
leaq 0x18d35(%rip), %rsi     # 0x755cb
leaq -0x50(%rbp), %rdi
callq 0x10a30
jmp 0x5c8a1
leaq -0x50(%rbp), %rdi
callq 0x4ee60
jmp 0x5c8ac
leaq -0x50(%rbp), %rdi
callq 0xdac0
leaq -0x51(%rbp), %rdi
callq 0xe180
movq -0x10(%rbp), %rdi
callq 0x5c9d0
addq $0x90, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x5c8f3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x50(%rbp), %rdi
callq 0xdac0
leaq -0x51(%rbp), %rdi
callq 0xe180
movq -0x60(%rbp), %rdi
callq 0xd990
nopw %cs:(%rax,%rax)
nop