// File: /workspace/github_cpp_makefile_star2_O2/MisakiFx[P]P2PDownload/./httplib.h
// Function: httplib::Client::write_request(httplib::Stream&, httplib::Request&)
inline void Client::write_request(Stream &strm, Request &req) {
        BufferStream bstrm;

        // Request line
        auto path = detail::encode_url(req.path);

        bstrm.write_format("%s %s HTTP/1.1\r\n", req.method.c_str(), path.c_str());

        // Headers
        if (!req.has_header("Host")) {
            if (is_ssl()) {
                if (port_ == 443) {
                    req.set_header("Host", host_.c_str());
                } else {
                    req.set_header("Host", host_and_port_.c_str());
                }
            } else {
                if (port_ == 80) {
                    req.set_header("Host", host_.c_str());
                } else {
                    req.set_header("Host", host_and_port_.c_str());
                }
            }
        }

        if (!req.has_header("Accept")) { req.set_header("Accept", "*/*"); }

        if (!req.has_header("User-Agent")) {
            req.set_header("User-Agent", "cpp-httplib/0.2");
        }

        // TODO: Support KeepAlive connection
        // if (!req.has_header("Connection")) {
        req.set_header("Connection", "close");
        // }

        if (req.body.empty()) {
            if (req.method == "POST" || req.method == "PUT" || req.method == "PATCH") {
                req.set_header("Content-Length", "0");
            }
        } else {
            if (!req.has_header("Content-Type")) {
                req.set_header("Content-Type", "text/plain");
            }

            if (!req.has_header("Content-Length")) {
                auto length = std::to_string(req.body.size());
                req.set_header("Content-Length", length.c_str());
            }
        }

        detail::write_headers(bstrm, req);

        // Body
        if (!req.body.empty()) { bstrm.write(req.body.c_str(), req.body.size()); }

        // Flush buffer
        auto &data = bstrm.get_buffer();
        strm.write(data.data(), data.size());
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x70, %rsp
movq %rdx, %r14
leaq 0x14fb1(%rip), %rax     # 0x370d8
leaq -0x30(%rbp), %rcx
movq %rax, -0x18(%rcx)
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
movq %rsi, %rbx
movq %rdi, %r12
movb $0x0, (%rcx)
leaq 0x60(%rdx), %rsi
leaq -0x90(%rbp), %rdi
callq 0x226f1
movq 0x20(%r14), %rax
leaq -0x68(%rbp), %rdx
movq %rax, (%rdx)
movq -0x90(%rbp), %rax
leaq -0x70(%rbp), %rcx
movq %rax, (%rcx)
leaq 0x32d1(%rip), %rsi      # 0x25442
leaq -0x48(%rbp), %rdi
callq 0x1c9cc
leaq 0x80(%r14), %r15
leaq 0x2b92(%rip), %rsi      # 0x24d1a
movq %r15, %rdi
callq 0x14aa1
testb %al, %al
jne 0x221d0
movq (%r12), %rax
movq %r12, %rdi
callq *0x20(%rax)
testb %al, %al
movl $0x1bb, %eax            # imm = 0x1BB
pushq $0x50
popq %rcx
cmovnel %eax, %ecx
leaq 0x38(%r12), %rax
cmpl %ecx, 0x28(%r12)
leaq 0x8(%r12), %rcx
cmoveq %rcx, %rax
movq (%rax), %rdx
leaq 0x2b52(%rip), %rsi      # 0x24d1a
movq %r14, %rdi
callq 0x1bb24
leaq 0x327c(%rip), %rsi      # 0x25453
movq %r15, %rdi
callq 0x14aa1
testb %al, %al
jne 0x221f9
leaq 0x3269(%rip), %rsi      # 0x25453
leaq 0x3269(%rip), %rdx      # 0x2545a
movq %r14, %rdi
callq 0x1bb24
leaq 0x325e(%rip), %rsi      # 0x2545e
movq %r15, %rdi
callq 0x14aa1
testb %al, %al
jne 0x22222
leaq 0x324b(%rip), %rsi      # 0x2545e
leaq 0x324f(%rip), %rdx      # 0x25469
movq %r14, %rdi
callq 0x1bb24
leaq 0x2ecf(%rip), %rsi      # 0x250f8
leaq 0x2ed3(%rip), %rdx      # 0x25103
movq %r14, %rdi
callq 0x1bb24
cmpq $0x0, 0xb8(%r14)
je 0x222b0
leaq 0x283e(%rip), %rsi      # 0x24a87
movq %r15, %rdi
callq 0x14aa1
testb %al, %al
jne 0x2226b
leaq 0x282b(%rip), %rsi      # 0x24a87
leaq 0x3018(%rip), %rdx      # 0x2527b
movq %r14, %rdi
callq 0x1bb24
leaq 0x29f8(%rip), %rsi      # 0x24c6a
movq %r15, %rdi
callq 0x14aa1
testb %al, %al
jne 0x22303
movq 0xb8(%r14), %rsi
leaq -0x68(%rbp), %rdi
callq 0x1c697
movq -0x68(%rbp), %rdx
leaq 0x29cd(%rip), %rsi      # 0x24c6a
movq %r14, %rdi
callq 0x1bb24
leaq -0x68(%rbp), %rdi
callq 0x8aa8
jmp 0x22303
leaq 0x20(%r14), %r15
leaq 0x2e5a(%rip), %rsi      # 0x25115
movq %r15, %rdi
callq 0xe8a4
testb %al, %al
jne 0x222ed
leaq 0x2e4c(%rip), %rsi      # 0x2511a
movq %r15, %rdi
callq 0xe8a4
testb %al, %al
jne 0x222ed
leaq 0x2e3d(%rip), %rsi      # 0x2511e
movq %r15, %rdi
callq 0xe8a4
testb %al, %al
je 0x22303
leaq 0x2976(%rip), %rsi      # 0x24c6a
leaq 0x27a9(%rip), %rdx      # 0x24aa4
movq %r14, %rdi
callq 0x1bb24
leaq -0x48(%rbp), %rdi
movq %r14, %rsi
callq 0x22847
movq 0xb8(%r14), %rdx
testq %rdx, %rdx
je 0x2232b
leaq -0x40(%rbp), %rdi
movq 0xb0(%r14), %rsi
callq 0x8060
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x18(%rax)
leaq -0x90(%rbp), %rdi
callq 0x8aa8
leaq -0x48(%rbp), %rdi
callq 0x9368
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x8aa8
jmp 0x2237a
jmp 0x22377
jmp 0x22377
jmp 0x22377
movq %rax, %rbx
jmp 0x22386
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x8aa8
leaq -0x48(%rbp), %rdi
callq 0x9368
movq %rbx, %rdi
callq 0x8990
nop