// File: kztomita[P]http-dump/./http2_socket.h
// Function: void send_http2_window_update<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>>>>>&, unsigned int, unsigned int)
void send_http2_window_update(SyncWriteStream& stream, uint32_t stream_id, uint32_t increment) {
  if (increment & 0x80000000) {
    throw std::invalid_argument("increment too large");
  }

  http2_frame window_update;

  auto& header = window_update.header();
  header.set_length(4);
  header.type = http2_frame_header::TYPE_WINDOW_UPDATE;
  header.flags = 0x00;
  header.set_stream_id(stream_id);

  auto& payload = window_update.payload();
  payload.resize(4);
  uint32_t value;
  value = htonl(increment);
  std::memcpy(&payload[0], &value, 4);

  write_http2_frame(stream, window_update);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl -0x10(%rbp), %eax
andl $0x80000000, %eax       # imm = 0x80000000
cmpl $0x0, %eax
je 0x5a7a2
movl $0x10, %edi
callq 0xd580
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x68(%rbp)
leaq 0x1aea8(%rip), %rsi     # 0x75612
callq 0xd2e0
jmp 0x5a771
movq -0x68(%rbp), %rdi
movq 0x527ac(%rip), %rsi     # 0xacf28
movq 0x5279d(%rip), %rdx     # 0xacf20
callq 0xd970
movq -0x68(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
callq 0xdc70
jmp 0x5a857
leaq -0x48(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0x5c510
movq -0x70(%rbp), %rdi
callq 0x5c530
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
movl $0x4, %esi
callq 0x5c6c0
jmp 0x5a7cc
movq -0x50(%rbp), %rax
movb $0x8, 0x3(%rax)
movq -0x50(%rbp), %rax
movb $0x0, 0x4(%rax)
movq -0x50(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x5c540
jmp 0x5a7ea
leaq -0x48(%rbp), %rdi
callq 0x5a440
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
movl $0x4, %esi
callq 0x53770
jmp 0x5a807
movl -0x10(%rbp), %edi
callq 0xda40
movl %eax, -0x5c(%rbp)
movq -0x58(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5a460
movl -0x5c(%rbp), %ecx
movl %ecx, (%rax)
movq -0x8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x5c770
jmp 0x5a833
leaq -0x48(%rbp), %rdi
callq 0x59c40
addq $0x70, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x59c40
movq -0x18(%rbp), %rdi
callq 0xd990