// File: 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
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x38(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0x5c510
movq -0x90(%rbp), %rdi
callq 0x5c530
movq %rax, -0x88(%rbp)
jmp 0x5c2f8
movq -0x88(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movb $0x4, 0x3(%rax)
movq -0x40(%rbp), %rax
movb $0x0, 0x4(%rax)
movq -0x40(%rbp), %rdi
xorl %esi, %esi
callq 0x5c540
jmp 0x5c320
movq -0x40(%rbp), %rax
movb $0x0, 0x4(%rax)
leaq -0x38(%rbp), %rdi
callq 0x5a440
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
callq 0x5c5e0
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
callq 0x5c610
movq %rax, -0x70(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x5c640
testb $0x1, %al
jne 0x5c36d
jmp 0x5c43d
leaq -0x68(%rbp), %rdi
callq 0x5c680
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movzwl (%rax), %edi
callq 0xda30
movw %ax, -0x7a(%rbp)
movq -0x78(%rbp), %rax
movl 0x4(%rax), %edi
callq 0xda40
movl %eax, -0x80(%rbp)
movq -0x58(%rbp), %rdi
movq %rdi, -0x98(%rbp)
callq 0x4e6b0
movq -0x98(%rbp), %rdi
movq %rax, %rsi
addq $0x6, %rsi
callq 0x53770
jmp 0x5c3be
movq -0x58(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x58(%rbp), %rdi
callq 0x4e6b0
movq -0xa8(%rbp), %rdi
movq %rax, %rsi
subq $0x6, %rsi
callq 0x5a460
movw -0x7a(%rbp), %cx
movw %cx, (%rax)
movq -0x58(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x58(%rbp), %rdi
callq 0x4e6b0
movq -0xa0(%rbp), %rdi
movq %rax, %rsi
subq $0x4, %rsi
callq 0x5a460
movl -0x80(%rbp), %ecx
movl %ecx, (%rax)
leaq -0x68(%rbp), %rdi
callq 0x5c6a0
jmp 0x5c357
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x59c40
jmp 0x5c482
movq -0x40(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x58(%rbp), %rdi
callq 0x4e6b0
movq -0xb0(%rbp), %rdi
movl %eax, %esi
callq 0x5c6c0
jmp 0x5c461
movq -0x8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x5c770
jmp 0x5c470
leaq -0x38(%rbp), %rdi
callq 0x59c40
addq $0xb0, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0xd990
nopl (%rax,%rax)