// File: /workspace/github_cpp_makefile_star2_O1/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 $0x258, %rsp            # imm = 0x258
movl %ecx, 0x74(%rsp)
movq %rdx, %rbp
movq %rsi, %r15
movq %rdi, %r13
cmpl $0x12c, 0x8(%rsi)       # imm = 0x12C
jl 0x3823a
cmpb $0x0, 0xc(%r15)
jne 0x38143
cmpb $0x1, 0xd(%r15)
jne 0x382d8
leaq 0x1641e(%rip), %rax     # 0x4e568
cmpb $0x0, 0xc8(%rax)
jne 0x38160
cmpb $0x1, 0xc9(%rax)
jne 0x382d8
leaq 0xe0(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x213a(%rip), %rsi      # 0x3a2ad
leaq 0x2144(%rip), %rdx      # 0x3a2be
leaq 0xd0(%rsp), %rdi
callq 0x80f4
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x5704(%rip), %rsi      # 0x3d89c
leaq 0x5704(%rip), %rdx      # 0x3d8a3
leaq 0x8(%rsp), %rdi
callq 0x80f4
leaq 0x30(%r15), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x38cee
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x72c0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x381de
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x74b0
movq 0xd0(%rsp), %rdi
leaq 0xe0(%rsp), %rax
cmpq %rax, %rdi
je 0x38203
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x74b0
movl 0x8(%r15), %edx
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
callq 0x2b540
cmpq $0x65, 0x8(%r14)
jb 0x38381
leaq 0xd0(%rsp), %rsi
movq %r15, %rdi
callq 0x3799c
jmp 0x38392
cmpq $0x65, 0x68(%r15)
jb 0x385b3
leaq 0x1631c(%rip), %rax     # 0x4e568
cmpb $0x0, 0xc8(%rax)
jne 0x38262
cmpb $0x1, 0xc9(%rax)
jne 0x385b3
leaq 0x60(%r15), %rsi
movq %r15, %rdi
callq 0x3799c
leaq 0xe0(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x1e83(%rip), %rsi      # 0x3a104
leaq 0x1e8a(%rip), %rdx      # 0x3a112
leaq 0xd0(%rsp), %rdi
callq 0x80f4
movl 0x68(%r15), %esi
leaq 0x8(%rsp), %rdi
callq 0x1c07f
leaq 0x30(%r15), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x38cee
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x72c0
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x38589
jmp 0x38596
leaq 0xe0(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x1e19(%rip), %rsi      # 0x3a104
leaq 0x1e20(%rip), %rdx      # 0x3a112
leaq 0xd0(%rsp), %rdi
callq 0x80f4
movl 0x8(%r15), %edx
leaq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0x2b540
movl 0x30(%rsp), %esi
leaq 0x8(%rsp), %rdi
callq 0x1c07f
leaq 0x30(%r15), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x38cee
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x72c0
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x38357
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x74b0
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x38372
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x74b0
movq 0xd0(%rsp), %rdi
cmpq %rbx, %rdi
jne 0x383ea
jmp 0x383fa
leaq 0x60(%r15), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x72c0
cmpq $0x0, 0x68(%r15)
je 0x383d5
movq %r15, %rbx
leaq 0x60(%r15), %r14
leaq 0x8(%rsp), %rdi
movq %r14, %rdx
callq 0x37482
leaq 0x8(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x7590
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x383d2
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x74b0
movq %rbx, %r15
movq 0xd0(%rsp), %rdi
leaq 0xe0(%rsp), %rax
cmpq %rax, %rdi
je 0x383fa
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x74b0
leaq 0xe0(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x1d45(%rip), %rsi      # 0x3a152
leaq 0x1d4a(%rip), %rdx      # 0x3a15e
leaq 0xd0(%rsp), %rdi
callq 0x80f4
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x22b2(%rip), %rsi      # 0x3a6e3
leaq 0x22c3(%rip), %rdx      # 0x3a6fb
leaq 0x8(%rsp), %rdi
callq 0x80f4
leaq 0x30(%r15), %r12
leaq 0xd0(%rsp), %rsi
movq %r12, %rdi
callq 0x38cee
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x72c0
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x3847a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x74b0
movq 0xd0(%rsp), %rdi
cmpq %rbx, %rdi
je 0x38497
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x74b0
leaq 0xd0(%rsp), %rdi
movq %rbx, (%rdi)
leaq 0x4cf9(%rip), %rsi      # 0x3d1a2
leaq 0x4cfc(%rip), %rdx      # 0x3d1ac
callq 0x80f4
leaq 0x8(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x4ce9(%rip), %rsi      # 0x3d1ad
leaq 0x4cec(%rip), %rdx      # 0x3d1b7
callq 0x80f4
leaq 0xd0(%rsp), %rsi
movq %r12, %rdi
callq 0x38cee
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x72c0
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x38504
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x74b0
movq 0xd0(%rsp), %rdi
cmpq %rbx, %rdi
je 0x38521
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x74b0
movq %r15, %rdi
callq 0x377cc
leaq 0xd0(%rsp), %rdi
movq %rbx, (%rdi)
leaq 0x1d5c(%rip), %rsi      # 0x3a297
leaq 0x1d5b(%rip), %rdx      # 0x3a29d
callq 0x80f4
leaq 0x8(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x2686(%rip), %rsi      # 0x3abdc
leaq 0x2686(%rip), %rdx      # 0x3abe3
callq 0x80f4
leaq 0xd0(%rsp), %rsi
movq %r12, %rdi
callq 0x38cee
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x72c0
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x38596
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x74b0
movq 0xd0(%rsp), %rdi
cmpq %rbx, %rdi
je 0x385b3
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x74b0
leaq 0xd0(%rsp), %rdi
callq 0x7360
leaq 0xe0(%rsp), %rdi
movl 0x8(%r15), %esi
callq 0x77e0
leaq 0xe8(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x7710
leaq 0x5347(%rip), %rsi      # 0x3d931
leaq 0x78(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xe31d
leaq 0x5014(%rip), %rsi      # 0x3d614
leaq 0x78(%rsp), %rdi
callq 0x78d0
leaq 0x58(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x38631
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x38637
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x50(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl 0x8(%r15), %esi
leaq 0x98(%rsp), %rdi
callq 0x1c92e
movq 0x48(%rsp), %rcx
movq 0x50(%rsp), %r8
movq 0xa0(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
leaq 0x58(%rsp), %rdi
cmpq %rdi, %rcx
je 0x3868a
movq 0x58(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x386af
leaq 0xa8(%rsp), %rdi
movl $0xf, %esi
cmpq %rdi, -0x10(%rdi)
je 0x386aa
movq 0xa8(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x386c3
movq 0x98(%rsp), %rsi
leaq 0x48(%rsp), %rdi
callq 0x7190
jmp 0x386d4
leaq 0x98(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x7500
leaq 0x38(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x386f8
movq %rsi, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x386fe
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x30(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x51ce(%rip), %rsi      # 0x3d8f0
leaq 0x28(%rsp), %rdi
callq 0x78d0
leaq 0x10(%r13), %rsi
movq %rsi, (%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
movq %rsi, 0xb8(%rsp)
je 0x38758
movq %rdx, (%r13)
movq (%rcx), %rdx
movq %rdx, 0x10(%r13)
jmp 0x3875e
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
leaq 0x58(%rsp), %rsi
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%r13)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x38(%rsp), %rbx
movq -0x10(%rbx), %rdi
cmpq %rbx, %rdi
je 0x3879a
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x74b0
leaq 0x58(%rsp), %rsi
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x387c0
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x74b0
leaq 0x58(%rsp), %rsi
movq %r13, 0x68(%rsp)
movq 0x48(%rsp), %rdi
cmpq %rsi, %rdi
je 0x387dc
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x74b0
movq %rbp, 0xc0(%rsp)
leaq 0x88(%rsp), %r14
movq -0x10(%r14), %rdi
cmpq %r14, %rdi
je 0x38805
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x74b0
movq 0x48(%r15), %r12
movq %r15, 0xc8(%rsp)
leaq 0x38(%r15), %rbp
cmpq %rbp, %r12
je 0x3896e
leaq 0x78(%rsp), %r13
leaq 0x48(%rsp), %r15
movq %r14, 0x78(%rsp)
movq 0x20(%r12), %rsi
movq 0x28(%r12), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x8a8a
movq %r13, %rdi
leaq 0x504d(%rip), %rsi      # 0x3d899
callq 0x78d0
movq 0x40(%r12), %rsi
movq 0x48(%r12), %rdx
movq %r13, %rdi
callq 0x7190
leaq 0x58(%rsp), %rsi
movq %rsi, 0x48(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3888b
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x38891
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x50(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r15, %rdi
leaq 0x503d(%rip), %rsi      # 0x3d8f0
callq 0x78d0
movq %rbx, 0x28(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x388db
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x388e1
movups (%rcx), %xmm0
movups %xmm0, (%rbx)
movq 0x8(%rax), %rdx
movq %rdx, 0x30(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x68(%rsp), %rdi
callq 0x7190
movq 0x28(%rsp), %rdi
cmpq %rbx, %rdi
je 0x38924
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x74b0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x38940
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x74b0
movq 0x78(%rsp), %rdi
cmpq %r14, %rdi
je 0x3895a
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x74b0
movq %r12, %rdi
callq 0x7350
movq %rax, %r12
cmpq %rbp, %rax
jne 0x38828
leaq 0x4f7b(%rip), %rsi      # 0x3d8f0
movq 0x68(%rsp), %r14
movq %r14, %rdi
callq 0x78d0
movq 0xc8(%rsp), %r15
movq 0x68(%r15), %rdx
testq %rdx, %rdx
sete %al
movl 0x74(%rsp), %ecx
xorb $0x1, %cl
orb %al, %cl
jne 0x389ab
movq 0x60(%r15), %rsi
movq %r14, %rdi
callq 0x7190
cmpq $0x0, 0x68(%r15)
sete %al
movl 0x8(%r15), %edx
cmpl $0x12c, %edx            # imm = 0x12C
setge %cl
andb %al, %cl
cmpb $0x1, %cl
movq 0xc0(%rsp), %rsi
jne 0x38a02
leaq 0x28(%rsp), %rdi
callq 0x2b540
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %r14, %rdi
callq 0x7190
movq 0x28(%rsp), %rdi
cmpq %rbx, %rdi
je 0x38a02
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x74b0
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x38a1d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x74b0
movq 0x1554c(%rip), %rsi     # 0x4df70
leaq 0xd0(%rsp), %rdi
callq 0x73b0
leaq 0x150(%rsp), %rdi
callq 0x71c0
movq %r14, %rax
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x38a70
jmp 0x38af9
jmp 0x38b01
movq %rax, %r15
jmp 0x38ab5
jmp 0x38af9
jmp 0x38b01
jmp 0x38a70
movq %rax, %r15
jmp 0x38b23
jmp 0x38b01
movq %rax, %r15
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x38bf3
jmp 0x38c00
movq %rax, %r15
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x38ab5
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x74b0
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x38c00
movq 0x38(%rsp), %rsi
jmp 0x38bf8
movq %rax, %r15
movq 0x28(%rsp), %rdi
cmpq %rbx, %rdi
je 0x38c89
movq 0x38(%rsp), %rsi
jmp 0x38c81
jmp 0x38c28
jmp 0x38af9
jmp 0x38b01
jmp 0x38af9
jmp 0x38b01
movq %rax, %r15
jmp 0x38c00
movq %rax, %r15
jmp 0x38ce5
movq %rax, %r15
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x38b23
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x74b0
movq 0xd0(%rsp), %rdi
leaq 0xe0(%rsp), %rax
cmpq %rax, %rdi
jne 0x38c11
jmp 0x38ce5
jmp 0x38be6
movq %rax, %r15
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x38b69
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x74b0
jmp 0x38b69
movq %rax, %r15
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x38b8f
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x74b0
jmp 0x38b8f
movq %rax, %r15
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x38bb0
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x74b0
jmp 0x38bb0
movq %rax, %r15
leaq 0x88(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x38ca9
movq 0x88(%rsp), %rsi
jmp 0x38ca1
jmp 0x38be6
movq %rax, %r15
jmp 0x38ca9
jmp 0x38bde
movq %rax, %r15
jmp 0x38cc4
movq %rax, %r15
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x38c00
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x74b0
movq 0xd0(%rsp), %rdi
cmpq %rbx, %rdi
je 0x38ce5
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x74b0
jmp 0x38ce5
jmp 0x38c28
movq %rax, %r15
jmp 0x38c89
jmp 0x38c2f
movq %rax, %r15
jmp 0x38c6f
movq %rax, %r15
jmp 0x38c53
movq %rax, %r15
movq 0x28(%rsp), %rdi
cmpq %rbx, %rdi
je 0x38c53
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x74b0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x38c6f
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x74b0
movq 0x78(%rsp), %rdi
cmpq %r14, %rdi
je 0x38c89
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x74b0
movq 0x68(%rsp), %rax
movq (%rax), %rdi
movq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x38ca9
movq (%rax), %rsi
incq %rsi
callq 0x74b0
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x38cc4
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x74b0
movq 0x152a5(%rip), %rsi     # 0x4df70
leaq 0xd0(%rsp), %rdi
callq 0x73b0
leaq 0x150(%rsp), %rdi
callq 0x71c0
movq %r15, %rdi
callq 0x7810
nop