// File: /workspace/github_cpp_makefile_star2_O1/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 0xa7e0
movq 0x10(%r14), %rsi
movq 0x18(%r14), %rdx
movq %r12, %rdi
callq 0xa6a0
movq %rax, %r12
leaq 0x1d88f(%rip), %rsi     # 0x3f5bc
movl $0x1, %edx
movq %rax, %rdi
callq 0xa6a0
movq 0x35ed7(%rip), %rsi     # 0x57c18
movq 0x35ed8(%rip), %rdx     # 0x57c20
movq %r12, %rdi
callq 0xa6a0
movq 0x30(%r14), %rsi
movq 0x38(%r14), %rdx
movq %rax, %rdi
callq 0xa6a0
leaq 0x1e9b9(%rip), %rsi     # 0x40720
movl $0xb, %edx
movq %rax, %rdi
callq 0xa6a0
leaq 0x1d7de(%rip), %rsi     # 0x3f559
leaq 0x40(%rsp), %rdi
movl $0xd, %edx
callq 0xa6a0
leaq 0x1d7d6(%rip), %rsi     # 0x3f567
leaq 0x40(%rsp), %rdi
movl $0x18, %edx
callq 0xa6a0
leaq 0x1d7d9(%rip), %rsi     # 0x3f580
leaq 0x40(%rsp), %rdi
movl $0x6, %edx
callq 0xa6a0
movq 0x35e3b(%rip), %rsi     # 0x57bf8
movq 0x35e3c(%rip), %rdx     # 0x57c00
leaq 0x40(%rsp), %rdi
callq 0xa6a0
leaq 0x1d7b2(%rip), %rsi     # 0x3f587
movl $0x6, %edx
movq %rax, %rdi
callq 0xa6a0
leaq 0x1d7a5(%rip), %rsi     # 0x3f58e
leaq 0x40(%rsp), %rdi
movl $0x13, %edx
callq 0xa6a0
movq 0x8(%r15), %rsi
movq 0x10(%r15), %rdx
leaq 0x40(%rsp), %rdi
callq 0xa6a0
leaq 0x1d9ea(%rip), %rsi     # 0x3f7fb
movl $0x2, %edx
movq %rax, %rdi
callq 0xa6a0
leaq 0x1d77d(%rip), %rsi     # 0x3f5a2
leaq 0x40(%rsp), %rdi
movl $0x18, %edx
callq 0xa6a0
movq 0x35d3d(%rip), %rsi     # 0x57b78
movq 0x35d3e(%rip), %rdx     # 0x57b80
leaq 0x40(%rsp), %rdi
callq 0xa6a0
movq %rax, %r12
leaq 0x1d765(%rip), %rsi     # 0x3f5bb
movl $0x2, %edx
movq %rax, %rdi
callq 0xa6a0
movq 0x35d4e(%rip), %rsi     # 0x57bb8
movq 0x35d4f(%rip), %rdx     # 0x57bc0
movq %r12, %rdi
callq 0xa6a0
leaq 0x1d73e(%rip), %rsi     # 0x3f5be
movl $0x3, %edx
movq %rax, %rdi
callq 0xa6a0
cmpq $0x0, 0x58(%r14)
je 0x21ed2
leaq 0x1d727(%rip), %rsi     # 0x3f5c2
leaq 0x40(%rsp), %rdi
movl $0x14, %edx
callq 0xa6a0
movq 0x50(%r14), %rsi
movq 0x58(%r14), %rdx
leaq 0x40(%rsp), %rdi
callq 0xa6a0
movq 0x35d95(%rip), %rsi     # 0x57c58
movq 0x35d96(%rip), %rdx     # 0x57c60
movq %rax, %rdi
callq 0xa6a0
movq 0x130(%r15), %rax
cmpq 0x138(%r15), %rax
je 0x21f58
leaq 0x1d6ee(%rip), %rsi     # 0x3f5d7
leaq 0x40(%rsp), %rdi
movl $0x8, %edx
callq 0xa6a0
movq 0x130(%r15), %r13
movq 0x138(%r15), %rbp
cmpq %rbp, %r13
je 0x21f40
leaq 0x40(%rsp), %r15
leaq 0x1d6c9(%rip), %r12     # 0x3f5e0
movq (%r13), %rsi
movq 0x8(%r13), %rdx
movq %r15, %rdi
callq 0xa6a0
movl $0x2, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0xa6a0
addq $0x20, %r13
cmpq %rbp, %r13
jne 0x21f17
movq 0x35d11(%rip), %rsi     # 0x57c58
movq 0x35d12(%rip), %rdx     # 0x57c60
leaq 0x40(%rsp), %rdi
callq 0xa6a0
movzbl (%r14), %eax
cmpl $0x1, %eax
je 0x21f77
cmpl $0x2, %eax
jne 0x22031
movq 0x8(%r14), %rcx
movq (%rcx), %rdx
cmpq 0x8(%rcx), %rdx
jmp 0x21f80
movq 0x8(%r14), %rcx
cmpq $0x0, 0x28(%rcx)
sete %cl
cmpb $0x1, %al
jne 0x22031
testb %cl, %cl
jne 0x22031
leaq 0x20(%rsp), %rdi
movq %r14, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x20, %ecx
xorl %r8d, %r8d
callq 0x14514
leaq 0x1d62f(%rip), %rsi     # 0x3f5e3
leaq 0x40(%rsp), %rdi
movl $0x2f, %edx
callq 0xa6a0
leaq 0x1d649(%rip), %rsi     # 0x3f613
leaq 0x40(%rsp), %rdi
movl $0x10, %edx
callq 0xa6a0
movq 0x28(%rsp), %r14
movl $0x1, %esi
cmpq $0xa, %r14
jb 0x22055
movl $0x4, %esi
movabsq $0x346dc5d63886594b, %rdi # imm = 0x346DC5D63886594B
movq %r14, %rcx
cmpq $0x63, %rcx
jbe 0x2204e
cmpq $0x3e7, %rcx            # imm = 0x3E7
jbe 0x22053
cmpq $0x2710, %rcx           # imm = 0x2710
jb 0x22055
movq %rcx, %rax
mulq %rdi
shrq $0xb, %rdx
addl $0x4, %esi
cmpq $0x1869f, %rcx          # imm = 0x1869F
movq %rdx, %rcx
ja 0x21ffb
addl $-0x3, %esi
jmp 0x22055
movq 0x35c20(%rip), %rsi     # 0x57c58
movq 0x35c21(%rip), %rdx     # 0x57c60
leaq 0x40(%rsp), %rdi
callq 0xa6a0
jmp 0x220fe
addl $-0x2, %esi
jmp 0x22055
decl %esi
movl %esi, %esi
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
movq %rsp, %rdi
xorl %edx, %edx
callq 0xa6c0
movq (%rsp), %rdi
movl 0x8(%rsp), %esi
movq %r14, %rdx
callq 0x1fdd0
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x40(%rsp), %rdi
callq 0xa6a0
movq 0x35bc4(%rip), %rsi     # 0x57c58
movq 0x35bc5(%rip), %rdx     # 0x57c60
movq %rax, %rdi
callq 0xa6a0
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x220b9
movq 0x10(%rsp), %rsi
incq %rsi
callq 0xa5d0
movq 0x35b98(%rip), %rsi     # 0x57c58
movq 0x35b99(%rip), %rdx     # 0x57c60
leaq 0x40(%rsp), %rdi
callq 0xa6a0
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %rax, %rdi
callq 0xa6a0
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x220fe
movq 0x30(%rsp), %rsi
incq %rsi
callq 0xa5d0
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0xa960
movq 0x34ea6(%rip), %rsi     # 0x56fb8
leaq 0x40(%rsp), %rdi
callq 0xa330
leaq 0xb0(%rsp), %rdi
callq 0xa1f0
movq %rbx, %rax
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2215d
jmp 0x2217f
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x22160
movq 0x10(%rsp), %rsi
incq %rsi
callq 0xa5d0
jmp 0x22160
movq %rax, %rbx
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x22182
movq 0x30(%rsp), %rsi
incq %rsi
callq 0xa5d0
jmp 0x22182
jmp 0x2217f
movq %rax, %rbx
movq 0x34e2f(%rip), %rsi     # 0x56fb8
leaq 0x40(%rsp), %rdi
callq 0xa330
leaq 0xb0(%rsp), %rdi
callq 0xa1f0
movq %rbx, %rdi
callq 0xaa30