// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x70, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movzwl (%rsi), %eax
movzbl 0x2(%rsi), %ecx
shll $0x10, %ecx
orl %eax, %ecx
bswapl %ecx
shrl $0x8, %ecx
movq 0x18(%rsi), %rax
subq 0x10(%rsi), %rax
cmpq %rcx, %rax
je 0x2715f
movq 0x1febc(%rip), %r15     # 0x46fe0
leaq 0xc328(%rip), %rsi      # 0x33453
movl $0x18, %edx
movq %r15, %rdi
callq 0xb730
movq (%r15), %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
leaq 0x60(%rsp), %r15
movq %rbx, (%r15)
movq $0x9, 0x8(%r15)
leaq 0x10(%rsp), %r12
movl $0x0, (%r12)
movb $0x0, 0x4(%r12)
leaq 0x1e187(%rip), %r13     # 0x45310
movq %r13, 0x8(%r12)
leaq 0x20(%rsp), %rdx
movq %r15, (%rdx)
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rcx
callq 0x263c5
cmpb $0x1, 0x4(%r12)
je 0x272a1
movq 0x10(%rbx), %rax
movq 0x18(%rbx), %rcx
subq %rax, %rcx
je 0x27201
movq %rax, 0x60(%rsp)
movq %rcx, 0x68(%rsp)
leaq 0x10(%rsp), %r12
movl $0x0, (%r12)
movb $0x0, 0x4(%r12)
movq %r13, 0x8(%r12)
leaq 0x20(%rsp), %rdx
movq %r15, (%rdx)
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rcx
callq 0x263c5
cmpb $0x1, 0x4(%r12)
je 0x272ec
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xc25b(%rip), %rsi      # 0x3346c
leaq 0xc258(%rip), %rdx      # 0x33470
leaq 0x20(%rsp), %rdi
callq 0x1025a
cmpb $0x1, 0x2099f(%rip)     # 0x47bc8
jne 0x2726b
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq 0x1fd44(%rip), %rdi     # 0x46f80
callq 0xb730
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0xb5b0
movsbl %al, %esi
movq %r14, %rdi
callq 0xb050
movq %rax, %rdi
callq 0xb450
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x27282
movq 0x30(%rsp), %rsi
incq %rsi
callq 0xb600
cmpb $0x1, 0x2093f(%rip)     # 0x47bc8
jne 0x27293
movq %rbx, %rdi
callq 0x28370
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movups 0x10(%rsp), %xmm0
movaps %xmm0, (%rsp)
leaq 0xbc5a(%rip), %rsi      # 0x32f0b
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0xbc90
leaq 0x1e01b(%rip), %rax     # 0x452e0
movq %rax, (%rbx)
movaps (%rsp), %xmm0
movups %xmm0, 0x10(%rbx)
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq %rbx, %rdi
callq 0xe1b4
movups 0x10(%rsp), %xmm0
movaps %xmm0, (%rsp)
leaq 0xbc0f(%rip), %rsi      # 0x32f0b
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0xbc90
leaq 0x1dfd0(%rip), %rax     # 0x452e0
movq %rax, (%rbx)
movaps (%rsp), %xmm0
movups %xmm0, 0x10(%rbx)
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq %rbx, %rdi
callq 0xe1b4
jmp 0x2733e
movq %rax, %rbx
jmp 0x27367
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xde38
jmp 0x27367
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x27367
movq 0x30(%rsp), %rsi
incq %rsi
callq 0xb600
movq %rbx, %rdi
callq 0xbbb0