// File: /workspace/github_cpp_makefile_star2_O2/mbourand[P]webserv/srcs/Response.cpp
// Function: Response::getResponseText[abi:cxx11](ConfigContext const&, bool)
std::string Response::getResponseText(const ConfigContext& config, bool generate_body)
{
	if (_code >= 300)
	{
		if ((_candeflate || _cangzip) && (g_webserv.compression_deflate || g_webserv.compression_gzip))
		{
			this->addHeader("Transfer-Encoding", "chunked");

			std::string errorPage = config.getErrorPage(_code);
			if (errorPage.size() > MIN_COMPRESS_SIZE)
				this->compressBody(errorPage);
			else
				_body = errorPage;

			if (!_body.empty())
				_body = Chunk(_body);
		}
		else
			this->addHeader("Content-Length", ft::toString(config.getErrorPage(_code).size()));
		this->addHeader("Content-Type", "text/html; charset=UTF-8");
		this->addHeader("Connection", "keep-alive");
		this->addDateHeader();
		this->addHeader("Server", "Webserv");
	}
	else
	{
		if (_body.size() > MIN_COMPRESS_SIZE && (g_webserv.compression_deflate || g_webserv.compression_gzip))
		{
			compressBody(_body);
			this->addHeader("Content-Length", ft::toString(_body.size()));
		}
	}
	std::stringstream ss;
	ss << _code;
	std::string code_str = ss.str();
	std::string str = "HTTP/1.1 " + code_str + " " + ft::getErrorMessage(_code) + "\r\n";

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


	if (!_body.empty() && generate_body)
		str += _body;
	if (_body.empty() && _code >= 300)
		str += config.getErrorPage(_code);

	return str;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x248, %rsp            # imm = 0x248
movl %ecx, %r12d
movq %rdx, %r15
movq %rsi, %rbp
movq %rdi, (%rsp)
cmpl $0x12c, 0x8(%rsi)       # imm = 0x12C
jl 0x2aa7f
cmpb $0x0, 0xc(%rbp)
jne 0x2a9d1
cmpb $0x1, 0xd(%rbp)
jne 0x2aaf3
leaq 0x18bd8(%rip), %rax     # 0x435b0
cmpb $0x0, 0xc8(%rax)
jne 0x2a9ee
cmpb $0x1, 0xc9(%rax)
jne 0x2aaf3
leaq 0x186d(%rip), %rsi      # 0x2c262
leaq 0xc0(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x8032
leaq 0x4e1e(%rip), %rsi      # 0x2f82c
leaq 0x8(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x8032
leaq 0xc0(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %rbp, %rdi
callq 0x2a124
leaq 0x8(%rsp), %rdi
callq 0x79b8
leaq 0xc0(%rsp), %rdi
callq 0x79b8
movl 0x8(%rbp), %edx
leaq 0xc0(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x216f2
cmpq $0x65, 0x8(%rbx)
jb 0x2ab50
leaq 0xc0(%rsp), %rsi
movq %rbp, %rdi
callq 0x2a42c
jmp 0x2ab61
cmpq $0x65, 0x68(%rbp)
jb 0x2acb7
leaq 0x18b1f(%rip), %rax     # 0x435b0
cmpb $0x0, 0xc8(%rax)
jne 0x2aaa7
cmpb $0x1, 0xc9(%rax)
jne 0x2acb7
leaq 0x60(%rbp), %rsi
movq %rbp, %rdi
callq 0x2a42c
leaq 0x164a(%rip), %rsi      # 0x2c104
leaq 0xc0(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x8032
movl 0x68(%rbp), %esi
leaq 0x8(%rsp), %rdi
callq 0x16dd9
leaq 0xc0(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %rbp, %rdi
callq 0x2a124
jmp 0x2aca0
leaq 0x160a(%rip), %rsi      # 0x2c104
leaq 0xc0(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x8032
movl 0x8(%rbp), %edx
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
callq 0x216f2
movl 0x30(%rsp), %esi
leaq 0x8(%rsp), %rdi
callq 0x16dd9
leaq 0xc0(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %rbp, %rdi
callq 0x2a124
leaq 0x8(%rsp), %rdi
callq 0x79b8
leaq 0x28(%rsp), %rdi
jmp 0x2ab8c
leaq 0x60(%rbp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0x7300
cmpq $0x0, 0x68(%rbp)
je 0x2ab91
leaq 0x60(%rbp), %rbx
leaq 0x8(%rsp), %rdi
movq %rbx, %rdx
callq 0x2a148
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x75f0
movq %r14, %rdi
callq 0x79b8
leaq 0xc0(%rsp), %rdi
callq 0x79b8
leaq 0x15ad(%rip), %rsi      # 0x2c152
leaq 0xc0(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x8032
leaq 0x1ad9(%rip), %rsi      # 0x2c697
leaq 0x8(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x8032
leaq 0xc0(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %rbp, %rdi
callq 0x2a124
leaq 0x8(%rsp), %rdi
callq 0x79b8
leaq 0xc0(%rsp), %rdi
callq 0x79b8
leaq 0x4532(%rip), %rsi      # 0x2f132
leaq 0xc0(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x8032
leaq 0x4524(%rip), %rsi      # 0x2f13d
leaq 0x8(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x8032
leaq 0xc0(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %rbp, %rdi
callq 0x2a124
leaq 0x8(%rsp), %rdi
callq 0x79b8
leaq 0xc0(%rsp), %rdi
callq 0x79b8
movq %rbp, %rdi
callq 0x2a2f0
leaq 0x15e9(%rip), %rsi      # 0x2c24c
leaq 0xc0(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x8032
leaq 0x1f14(%rip), %rsi      # 0x2cb90
leaq 0x8(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x8032
leaq 0xc0(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %rbp, %rdi
callq 0x2a124
leaq 0x8(%rsp), %rdi
callq 0x79b8
leaq 0xc0(%rsp), %rdi
callq 0x79b8
leaq 0xc0(%rsp), %rdi
callq 0x73a0
leaq 0xd0(%rsp), %rdi
movl 0x8(%rbp), %esi
callq 0x7840
leaq 0xd8(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x7780
leaq 0x4bd4(%rip), %rsi      # 0x2f8c1
leaq 0x80(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xc154
leaq 0x489e(%rip), %rdx      # 0x2f5a4
leaq 0x50(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0xbe83
movl 0x8(%rbp), %esi
leaq 0xa0(%rsp), %rdi
callq 0x173e3
leaq 0x28(%rsp), %rdi
leaq 0x50(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
callq 0xc221
movl %r12d, 0x4c(%rsp)
movq %r15, 0x78(%rsp)
leaq 0x4b30(%rip), %rdx      # 0x2f880
leaq 0x28(%rsp), %rsi
movq (%rsp), %rdi
callq 0xbe83
leaq 0x28(%rsp), %r12
movq %r12, %rdi
callq 0x79b8
leaq 0xa0(%rsp), %rdi
callq 0x79b8
leaq 0x50(%rsp), %r13
movq %r13, %rdi
callq 0x79b8
leaq 0x80(%rsp), %r14
movq %r14, %rdi
callq 0x79b8
movq 0x48(%rbp), %rbx
movq %rbp, 0x70(%rsp)
addq $0x38, %rbp
leaq 0x4ad7(%rip), %r15      # 0x2f880
cmpq %rbp, %rbx
je 0x2ae0f
leaq 0x20(%rbx), %rsi
movq %r14, %rdi
leaq 0x4a6d(%rip), %rdx      # 0x2f829
callq 0xc1e9
leaq 0x40(%rbx), %rdx
movq %r13, %rdi
movq %r14, %rsi
callq 0xc1ca
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0xbe83
movq (%rsp), %rdi
movq %r12, %rsi
callq 0x7950
movq %r12, %rdi
callq 0x79b8
movq %r13, %rdi
callq 0x79b8
movq %r14, %rdi
callq 0x79b8
movq %rbx, %rdi
callq 0x7390
movq %rax, %rbx
jmp 0x2ada9
leaq 0x4a6a(%rip), %rsi      # 0x2f880
movq (%rsp), %rdi
callq 0x7920
movq 0x78(%rsp), %rbx
movq 0x70(%rsp), %r14
movq 0x68(%r14), %rax
testq %rax, %rax
sete %cl
movl 0x4c(%rsp), %edx
xorb $0x1, %dl
orb %cl, %dl
jne 0x2ae4f
leaq 0x60(%r14), %rsi
movq (%rsp), %rdi
callq 0x7950
movq 0x68(%r14), %rax
testq %rax, %rax
sete %al
movl 0x8(%r14), %edx
cmpl $0x12c, %edx            # imm = 0x12C
setge %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x2ae8e
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0x216f2
leaq 0x28(%rsp), %rsi
movq (%rsp), %rdi
callq 0x7950
leaq 0x28(%rsp), %rdi
callq 0x79b8
leaq 0x8(%rsp), %rdi
callq 0x79b8
leaq 0xc0(%rsp), %rdi
callq 0x73f0
movq (%rsp), %rax
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2af15
jmp 0x2af06
jmp 0x2af15
jmp 0x2af2a
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x79b8
jmp 0x2aed5
movq %rax, %r14
leaq 0x28(%rsp), %rdi
jmp 0x2af0e
jmp 0x2af15
jmp 0x2af2a
jmp 0x2af15
jmp 0x2af06
jmp 0x2af15
jmp 0x2af2a
movq %rax, %r14
leaq 0x28(%rsp), %rdi
jmp 0x2afab
jmp 0x2af7d
jmp 0x2af06
jmp 0x2af15
jmp 0x2af2a
jmp 0x2af06
jmp 0x2af15
jmp 0x2af2a
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x79b8
jmp 0x2af18
movq %rax, %r14
leaq 0xc0(%rsp), %rdi
callq 0x79b8
jmp 0x2afd0
movq %rax, %r14
jmp 0x2afd0
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x79b8
jmp 0x2af44
movq %rax, %r14
leaq 0xa0(%rsp), %rdi
callq 0x79b8
jmp 0x2af56
movq %rax, %r14
leaq 0x50(%rsp), %rdi
callq 0x79b8
jmp 0x2af65
movq %rax, %r14
leaq 0x80(%rsp), %rdi
jmp 0x2afb4
movq %rax, %r14
jmp 0x2afb9
jmp 0x2af76
movq %rax, %r14
jmp 0x2afc3
jmp 0x2af7d
movq %rax, %r14
jmp 0x2afb0
movq %rax, %r14
jmp 0x2afa3
movq %rax, %r14
jmp 0x2af99
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x79b8
leaq 0x50(%rsp), %rdi
callq 0x79b8
leaq 0x80(%rsp), %rdi
callq 0x79b8
movq (%rsp), %rdi
callq 0x79b8
leaq 0x8(%rsp), %rdi
callq 0x79b8
leaq 0xc0(%rsp), %rdi
callq 0x73f0
movq %r14, %rdi
callq 0x7860