// File: mbourand[P]webserv/srcs/Config/ConfigContext.cpp
// Function: ConfigContext::getErrorPage[abi:cxx11](int) const
std::string ConfigContext::getErrorPage(int code) const
{
	if (_error_pages.find(code) != _error_pages.end())
	{
		try
		{
			std::ifstream file(_error_pages.find(code)->second.c_str(), std::ifstream::in);
			std::string content((std::istreambuf_iterator<char>(file)), (std::istreambuf_iterator<char>()));
			return content;
		}
		catch (std::exception& e) {}
	}
	std::stringstream ss;
	ss << code;
	std::string code_str = ss.str();
	return
"<html>\r\n\
	<head><title>" + code_str + " " + ft::getErrorMessage(code) + "</title></head>\r\n\
	<body>\r\n\
		<center><h1>" + code_str + " " + ft::getErrorMessage(code) + "</h1></center>\r\n\
		<hr><center>Webserv 1.0.0</center>\r\n\
	</body>\r\n\
</html>\r\n";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x570, %rsp            # imm = 0x570
movq %rdi, -0x558(%rbp)
movq %rdi, %rax
movq %rax, -0x550(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x548(%rbp)
addq $0x68, %rdi
leaq -0x14(%rbp), %rsi
callq 0x4e2f0
movq -0x548(%rbp), %rdi
movq %rax, -0x20(%rbp)
addq $0x68, %rdi
callq 0x4e320
movq %rax, -0x28(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x4e2c0
testb $0x1, %al
jne 0x4c84d
jmp 0x4c9b5
movq -0x548(%rbp), %rdi
addq $0x68, %rdi
leaq -0x14(%rbp), %rsi
callq 0x4e2f0
movq %rax, -0x560(%rbp)
jmp 0x4c86a
movq -0x560(%rbp), %rax
movq %rax, -0x238(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x4e350
movq %rax, %rdi
addq $0x8, %rdi
callq 0x92b0
movq %rax, %rsi
leaq -0x230(%rbp), %rdi
movl $0x8, %edx
callq 0x9b80
jmp 0x4c8a6
movb $0x0, -0x245(%rbp)
leaq -0x258(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x147e0
leaq -0x268(%rbp), %rdi
callq 0x14840
leaq -0x269(%rbp), %rdi
movq %rdi, -0x568(%rbp)
callq 0x9b10
movq -0x558(%rbp), %rdi
movq -0x568(%rbp), %r9
movq -0x258(%rbp), %rsi
movl -0x250(%rbp), %edx
movq -0x268(%rbp), %rcx
movl -0x260(%rbp), %r8d
callq 0x14870
jmp 0x4c90f
leaq -0x269(%rbp), %rdi
callq 0x9700
movb $0x1, -0x245(%rbp)
testb $0x1, -0x245(%rbp)
jne 0x4c9a4
jmp 0x4c998
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x4c96b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x269(%rbp), %rdi
callq 0x9700
leaq -0x230(%rbp), %rdi
callq 0x91d0
movl -0x244(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x4ccf4
movq -0x240(%rbp), %rdi
callq 0x92a0
movq %rax, -0x278(%rbp)
callq 0x9a40
jmp 0x4c9b5
movq -0x558(%rbp), %rdi
callq 0x9c98
leaq -0x230(%rbp), %rdi
callq 0x91d0
jmp 0x4cce4
leaq -0x400(%rbp), %rdi
callq 0x9490
leaq -0x3f0(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x9ad0
jmp 0x4c9d2
leaq -0x420(%rbp), %rdi
leaq -0x400(%rbp), %rsi
callq 0x9660
jmp 0x4c9e7
leaq 0x20a3d(%rip), %rsi     # 0x6d42b
leaq -0x500(%rbp), %rdi
leaq -0x420(%rbp), %rdx
callq 0x14000
jmp 0x4ca03
leaq 0x20fca(%rip), %rdx     # 0x6d9d4
leaq -0x4e0(%rbp), %rdi
leaq -0x500(%rbp), %rsi
callq 0x13970
jmp 0x4ca1f
movl -0x14(%rbp), %esi
leaq -0x520(%rbp), %rdi
callq 0x30210
jmp 0x4ca30
leaq -0x4c0(%rbp), %rdi
leaq -0x4e0(%rbp), %rsi
leaq -0x520(%rbp), %rdx
callq 0x14210
jmp 0x4ca4c
leaq 0x209ef(%rip), %rdx     # 0x6d442
leaq -0x4a0(%rbp), %rdi
leaq -0x4c0(%rbp), %rsi
callq 0x13970
jmp 0x4ca68
leaq -0x480(%rbp), %rdi
leaq -0x4a0(%rbp), %rsi
leaq -0x420(%rbp), %rdx
callq 0x14140
jmp 0x4ca84
leaq 0x20f49(%rip), %rdx     # 0x6d9d4
leaq -0x460(%rbp), %rdi
leaq -0x480(%rbp), %rsi
callq 0x13970
jmp 0x4caa0
movl -0x14(%rbp), %esi
leaq -0x540(%rbp), %rdi
callq 0x30210
jmp 0x4cab1
leaq -0x440(%rbp), %rdi
leaq -0x460(%rbp), %rsi
leaq -0x540(%rbp), %rdx
callq 0x14210
jmp 0x4cacd
movq -0x558(%rbp), %rdi
leaq 0x20990(%rip), %rdx     # 0x6d46b
leaq -0x440(%rbp), %rsi
callq 0x13970
jmp 0x4cae9
leaq -0x440(%rbp), %rdi
callq 0x9c98
leaq -0x540(%rbp), %rdi
callq 0x9c98
leaq -0x460(%rbp), %rdi
callq 0x9c98
leaq -0x480(%rbp), %rdi
callq 0x9c98
leaq -0x4a0(%rbp), %rdi
callq 0x9c98
leaq -0x4c0(%rbp), %rdi
callq 0x9c98
leaq -0x520(%rbp), %rdi
callq 0x9c98
leaq -0x4e0(%rbp), %rdi
callq 0x9c98
leaq -0x500(%rbp), %rdi
callq 0x9c98
leaq -0x420(%rbp), %rdi
callq 0x9c98
leaq -0x400(%rbp), %rdi
callq 0x94e0
jmp 0x4cce4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x4ccd6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x4ccca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x4ccbe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x4ccb2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x4cca6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x4cc9a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x4cc8e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x4cc82
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x4cc76
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x4cc6a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x440(%rbp), %rdi
callq 0x9c98
leaq -0x540(%rbp), %rdi
callq 0x9c98
leaq -0x460(%rbp), %rdi
callq 0x9c98
leaq -0x480(%rbp), %rdi
callq 0x9c98
leaq -0x4a0(%rbp), %rdi
callq 0x9c98
leaq -0x4c0(%rbp), %rdi
callq 0x9c98
leaq -0x520(%rbp), %rdi
callq 0x9c98
leaq -0x4e0(%rbp), %rdi
callq 0x9c98
leaq -0x500(%rbp), %rdi
callq 0x9c98
leaq -0x420(%rbp), %rdi
callq 0x9c98
leaq -0x400(%rbp), %rdi
callq 0x94e0
jmp 0x4ccf4
movq -0x550(%rbp), %rax
addq $0x570, %rsp            # imm = 0x570
popq %rbp
retq
movq -0x240(%rbp), %rdi
callq 0x9af0