// File: /workspace/github_cpp_makefile_star2_O2/king1600[P]cordpp/src/http.cc
// Function: cordpp::RestClient::to_string[abi:cxx11](cordpp::Request const&)
const std::string RestClient::to_string(const Request &req) {
  std::ostringstream output;

  // add method and endpoint
  output << req.method << " " << base_endpoint << req.endpoint << " HTTP/1.1\r\n";

  // add default headers
  output << "Accept: */*\r\n";
  //output << "Accept-Encoding: gzip\r\n";
  output << "Connection: keep-alive\r\n";
  output << "Host: " << base_host << ":443\r\n";
  output << "Authorization: Bot " << token << "\r\n";
  output << "User-Agent: DiscordBot (" << lib << ", " << version << ")\r\n";

  // add variable headers
  if (!req.audit_reason.empty())
    output << "X-Audit-Log-Reason: " << req.audit_reason << CLRF;
  if (!cookies.empty()) {
    output << "Cookie: ";
    for (const std::string &cookie : cookies)
      output << cookie << "; ";
    output << CLRF;
  }

  // add conditional body headers & create content
  if (!req.body.empty() && req.body.is_object()) {
    std::string content = req.body.dump();
    //output << "Content-Encoding: gzip\r\n";
    output << "Content-Type: application/json; charset=UTF-8\r\n";
    output << "Content-Length: " << std::to_string(content.size()) << CLRF;
    output << CLRF << content;
  } else output << CLRF;

  // return built http request
  return output.str();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x40(%rsp), %r12
movq %r12, %rdi
callq 0xa9a0
leaq 0x10(%r14), %rsi
movq %r12, %rdi
callq 0xa2e0
leaq 0x169ee(%rip), %rsi     # 0x3467c
movq %rax, %rdi
callq 0xa5e0
leaq 0x33fa3(%rip), %rsi     # 0x51c40
movq %rax, %rdi
callq 0xa2e0
leaq 0x30(%r14), %rsi
movq %rax, %rdi
callq 0xa2e0
leaq 0x17b9d(%rip), %rsi     # 0x35855
movq %rax, %rdi
callq 0xa5e0
leaq 0x16952(%rip), %rsi     # 0x34619
leaq 0x40(%rsp), %rdi
callq 0xa5e0
leaq 0x1694f(%rip), %rsi     # 0x34627
leaq 0x40(%rsp), %rdi
callq 0xa5e0
leaq 0x16957(%rip), %rsi     # 0x34640
leaq 0x40(%rsp), %rdi
callq 0xa5e0
leaq 0x33f26(%rip), %rsi     # 0x51c20
movq %rax, %rdi
callq 0xa2e0
leaq 0x1693e(%rip), %rsi     # 0x34647
movq %rax, %rdi
callq 0xa5e0
leaq 0x16936(%rip), %rsi     # 0x3464e
leaq 0x40(%rsp), %rdi
callq 0xa5e0
leaq 0x8(%r15), %rsi
movq %rax, %rdi
callq 0xa2e0
leaq 0x16b86(%rip), %rsi     # 0x348bb
movq %rax, %rdi
callq 0xa5e0
leaq 0x1691e(%rip), %rsi     # 0x34662
leaq 0x40(%rsp), %rdi
callq 0xa5e0
leaq 0x33e4b(%rip), %rsi     # 0x51ba0
movq %rax, %rdi
callq 0xa2e0
leaq 0x16917(%rip), %rsi     # 0x3467b
movq %rax, %rdi
callq 0xa5e0
leaq 0x33e6d(%rip), %rsi     # 0x51be0
movq %rax, %rdi
callq 0xa2e0
leaq 0x168fc(%rip), %rsi     # 0x3467e
movq %rax, %rdi
callq 0xa5e0
cmpq $0x0, 0x58(%r14)
je 0x1ddbd
leaq 0x168ea(%rip), %rsi     # 0x34682
leaq 0x40(%rsp), %rdi
callq 0xa5e0
leaq 0x50(%r14), %rsi
movq %rax, %rdi
callq 0xa2e0
leaq 0x33ecb(%rip), %rsi     # 0x51c80
movq %rax, %rdi
callq 0xa2e0
movq 0x130(%r15), %rax
cmpq 0x138(%r15), %rax
je 0x1de2a
leaq 0x168c3(%rip), %rsi     # 0x34697
leaq 0x40(%rsp), %rdi
callq 0xa5e0
movq 0x130(%r15), %r12
movq 0x138(%r15), %rbp
leaq 0x40(%rsp), %r15
leaq 0x168a8(%rip), %r13     # 0x346a0
cmpq %rbp, %r12
je 0x1de19
movq %r15, %rdi
movq %r12, %rsi
callq 0xa2e0
movq %rax, %rdi
movq %r13, %rsi
callq 0xa5e0
addq $0x20, %r12
jmp 0x1ddf8
leaq 0x33e60(%rip), %rsi     # 0x51c80
leaq 0x40(%rsp), %rdi
callq 0xa2e0
movq %r14, %rdi
callq 0x1f2ae
testb %al, %al
jne 0x1ded8
cmpb $0x1, (%r14)
jne 0x1ded8
movq %rsp, %rdi
pushq $-0x1
popq %rdx
pushq $0x20
popq %rcx
movq %r14, %rsi
xorl %r8d, %r8d
callq 0x12630
leaq 0x16844(%rip), %rsi     # 0x346a3
leaq 0x40(%rsp), %rdi
callq 0xa5e0
leaq 0x16863(%rip), %rsi     # 0x346d3
leaq 0x40(%rsp), %rdi
callq 0xa5e0
movq %rax, %r14
movq 0x8(%rsp), %rsi
leaq 0x20(%rsp), %rdi
callq 0x1bfd2
leaq 0x20(%rsp), %rsi
movq %r14, %rdi
callq 0xa2e0
leaq 0x33de0(%rip), %rsi     # 0x51c80
movq %rax, %rdi
callq 0xa2e0
leaq 0x20(%rsp), %rdi
callq 0xac38
leaq 0x33dc7(%rip), %rsi     # 0x51c80
leaq 0x40(%rsp), %rdi
callq 0xa2e0
movq %rsp, %rsi
movq %rax, %rdi
callq 0xa2e0
movq %rsp, %rdi
callq 0xac38
jmp 0x1dee9
leaq 0x33da1(%rip), %rsi     # 0x51c80
leaq 0x40(%rsp), %rdi
callq 0xa2e0
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0xa3e0
leaq 0x40(%rsp), %rdi
callq 0xa900
movq %rbx, %rax
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1df28
jmp 0x1df37
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xac38
jmp 0x1df2b
movq %rax, %rbx
movq %rsp, %rdi
callq 0xac38
jmp 0x1df3a
jmp 0x1df37
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0xa900
movq %rbx, %rdi
callq 0xa6c0