// File: /workspace/github_cpp_makefile_star2_O2/solaldunckel[P]webserv/srcs/HTTP/Response.cpp
// Function: Response::createResponse()
void Response::createResponse() {
  headers_["Server"] = "webserv/1.0";

  if (config_.getMethod() == "HEAD")
    body_.clear();

  if (status_code_ < 400 && redirect_code_)
    status_code_ = redirect_code_;

  std::string status_code;

  if (headers_.count("Status")) {
    status_code = headers_["Status"];
    headers_.erase("Status");
  }
  else
    status_code = ft::to_string(status_code_) + " " + g_status[status_code_];

  response_ = response_ + config_.getProtocol() + " " + status_code + "\r\n";

  headers_["Date"] = ft::get_http_date();

  for (std::map<std::string, std::string>::iterator it = headers_.begin(); it != headers_.end(); it++)
    response_ += it->first + ": " + it->second + "\r\n";

  response_ += "\r\n";

  header_size_ = response_.size();

  if (!body_.empty()) {
    body_size_ = body_.size();
    response_ += body_;
    body_.clear();
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdi, %r15
leaq 0xb0d4(%rip), %rsi      # 0x1c7b5
leaq 0x70(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x5328
leaq 0x190(%r15), %r14
leaq 0x70(%rsp), %rsi
movq %r14, %rdi
callq 0xdd56
leaq 0xb162(%rip), %rsi      # 0x1c86d
movq %rax, %rdi
callq 0x4830
leaq 0x70(%rsp), %rdi
callq 0x4898
movq (%r15), %rdi
callq 0x8e4e
leaq 0xb012(%rip), %rsi      # 0x1c73e
movq %rax, %rdi
callq 0x610b
testb %al, %al
je 0x1174a
andq $0x0, 0xe8(%r15)
movq 0xe0(%r15), %rax
movb $0x0, (%rax)
cmpl $0x18f, 0xb8(%r15) # imm = 0x18F
jg 0x11769
movl 0x128(%r15), %eax
testl %eax, %eax
je 0x11769
movl %eax, 0xb8(%r15)
leaq 0x80(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0xb0f5(%rip), %rsi      # 0x1c879
leaq 0x8(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x5328
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0xdd3c
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4898
testq %rbx, %rbx
je 0x11816
leaq 0xb0c0(%rip), %rsi      # 0x1c879
leaq 0x8(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x5328
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0xdd56
leaq 0x70(%rsp), %rdi
movq %rax, %rsi
callq 0x4240
leaq 0x8(%rsp), %rdi
callq 0x4898
leaq 0xb086(%rip), %rsi      # 0x1c879
leaq 0x8(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x5328
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x12f1a
leaq 0x8(%rsp), %rdi
jmp 0x1188b
movl 0xb8(%r15), %esi
leaq 0x50(%rsp), %rdi
callq 0x6118
leaq 0xaff8(%rip), %rdx      # 0x1c826
leaq 0x30(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x5292
movl 0xb8(%r15), %esi
leaq 0x19ced(%rip), %rdi     # 0x2b538
callq 0x1b1e4
leaq 0x8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
movq %rax, %rdx
callq 0x5273
leaq 0x70(%rsp), %rdi
leaq 0x8(%rsp), %rbx
movq %rbx, %rsi
callq 0x4560
movq %rbx, %rdi
callq 0x4898
leaq 0x30(%rsp), %rdi
callq 0x4898
leaq 0x50(%rsp), %rdi
callq 0x4898
movq (%r15), %rdi
callq 0x8e70
leaq 0xc0(%r15), %rsi
leaq 0x98(%rsp), %rdi
movq %rsi, 0x28(%rsp)
movq %rax, %rdx
callq 0x1296a
leaq 0xaf6b(%rip), %rdx      # 0x1c826
leaq 0x50(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x5292
leaq 0x30(%rsp), %rdi
leaq 0x50(%rsp), %rsi
leaq 0x70(%rsp), %rdx
callq 0x5273
leaq 0xae96(%rip), %rdx      # 0x1c77e
leaq 0x8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x5292
leaq 0x8(%rsp), %rbx
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0x4560
movq %rbx, %rdi
callq 0x4898
leaq 0x30(%rsp), %rdi
callq 0x4898
leaq 0x50(%rsp), %rdi
callq 0x4898
leaq 0x98(%rsp), %rdi
callq 0x4898
leaq 0x8(%rsp), %rdi
callq 0x1b9dc
leaq 0xaf3d(%rip), %rsi      # 0x1c880
leaq 0x30(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x5328
leaq 0x30(%rsp), %rsi
movq %r14, %rdi
callq 0xdd56
leaq 0x8(%rsp), %r14
movq %rax, %rdi
movq %r14, %rsi
callq 0x4560
leaq 0x30(%rsp), %r12
movq %r12, %rdi
callq 0x4898
movq %r14, %rdi
callq 0x4898
movq 0x1a8(%r15), %rbx
movq %r15, 0x90(%rsp)
leaq 0x198(%r15), %r13
leaq 0x50(%rsp), %rbp
leaq 0xadd8(%rip), %r15      # 0x1c77e
cmpq %r13, %rbx
je 0x11a0d
leaq 0x20(%rbx), %rsi
movq %rbp, %rdi
leaq 0xb047(%rip), %rdx      # 0x1ca00
callq 0x60d3
leaq 0x40(%rbx), %rdx
movq %r12, %rdi
movq %rbp, %rsi
callq 0x5273
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x5292
movq 0x28(%rsp), %rdi
movq %r14, %rsi
callq 0x4840
movq %r14, %rdi
callq 0x4898
movq %r12, %rdi
callq 0x4898
movq %rbp, %rdi
callq 0x4898
movq %rbx, %rdi
callq 0x42e0
movq %rax, %rbx
jmp 0x119a6
leaq 0xad6a(%rip), %rsi      # 0x1c77e
movq 0x28(%rsp), %rdi
callq 0x4820
movq 0x90(%rsp), %rbx
movq 0xc8(%rbx), %rcx
movq 0xe8(%rbx), %rax
movq %rcx, 0x130(%rbx)
testq %rax, %rax
je 0x11a6a
leaq 0xe0(%rbx), %rsi
movq %rax, 0x138(%rbx)
movq 0x28(%rsp), %rdi
callq 0x4840
andq $0x0, 0xe8(%rbx)
movq 0xe0(%rbx), %rax
movb $0x0, (%rax)
leaq 0x70(%rsp), %rdi
callq 0x4898
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x11aee
jmp 0x11ae9
jmp 0x11ad9
jmp 0x11ae9
jmp 0x11ae9
jmp 0x11af3
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x4898
jmp 0x11adc
jmp 0x11ad9
jmp 0x11ae9
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x4898
jmp 0x11ab7
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x4898
jmp 0x11ac6
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
jmp 0x11b14
jmp 0x11ad9
jmp 0x11ae9
movq %rax, %rbx
jmp 0x11b23
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
jmp 0x11b14
jmp 0x11ae9
jmp 0x11ae9
jmp 0x11ae9
movq %rax, %rbx
jmp 0x11b19
movq %rax, %rbx
jmp 0x11b0f
movq %rax, %rbx
jmp 0x11b05
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4898
leaq 0x30(%rsp), %rdi
callq 0x4898
leaq 0x50(%rsp), %rdi
callq 0x4898
leaq 0x70(%rsp), %rdi
callq 0x4898
movq %rbx, %rdi
callq 0x4750
nop