// File: /workspace/github_cpp_makefile_star2_O1/kztomita[P]http-dump/./http2_socket.h
// Function: void send_http2_settings<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>>>>>, std::vector<std::pair<unsigned short, unsigned int>, std::allocator<std::pair<unsigned short, unsigned int>>>>(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>>>>>&, std::vector<std::pair<unsigned short, unsigned int>, std::allocator<std::pair<unsigned short, unsigned int>>> const&)
void send_http2_settings(SyncWriteStream& stream, const T& parameters) {
  static_assert(std::is_same<typename T::value_type, settings_parameter>::value,
                "T::value_type is not settings_parameter");

  http2_frame settings;

  auto& header = settings.header();
  header.type = http2_frame_header::TYPE_SETTINGS;
  header.flags = 0x00;
  header.set_stream_id(0);
  header.flags = 0x00;

  auto& payload = settings.payload();
  for (const auto&p : parameters) {
    auto id = htons(p.first);
    auto value = htonl(p.second);
    payload.resize(payload.size() + 6);

    std::memcpy(&payload[payload.size() - 6], &id, 2);
    std::memcpy(&payload[payload.size() - 4], &value, 4);
  }

  header.set_length(payload.size());

  write_http2_frame(stream, settings);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movw $0x4, 0x3(%rsp)
movl $0x0, 0x5(%rsp)
movq (%rsi), %r15
movq 0x8(%rsi), %r12
cmpq %r12, %r15
je 0x27345
leaq 0x10(%rsp), %r14
movzwl (%r15), %r13d
movl 0x4(%r15), %ebp
movq 0x18(%rsp), %rsi
subq 0x10(%rsp), %rsi
addq $0x6, %rsi
movq %r14, %rdi
callq 0x23970
bswapl %ebp
rolw $0x8, %r13w
movq 0x18(%rsp), %rax
movw %r13w, -0x6(%rax)
movq 0x18(%rsp), %rax
movl %ebp, -0x4(%rax)
addq $0x8, %r15
cmpq %r12, %r15
jne 0x27305
movq %rsp, %rdi
movl 0x18(%rdi), %esi
subl 0x10(%rdi), %esi
callq 0x27402
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x2746c
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x27375
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0xb600
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x27386
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x273a0
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0xb600
movq %rbx, %rdi
callq 0xbbb0