// File: mbourand[P]webserv/srcs/Config/ConfigContext.cpp
// Function: ConfigContext::parse_error_page(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void ConfigContext::parse_error_page(const std::string& directive_value)
{
	std::list<std::string> words = ft::split(directive_value, " \t\n");
	std::string page = words.back();

	for (std::list<std::string>::const_iterator it = words.begin(); it != --words.end(); it++)
	{
		if (!ft::is_integer<int>(*it))
			throw std::invalid_argument("Bad integer for error_page in config");
		int nb = ft::toInt(*it);

		if (page == "none")
		{
			if (_error_pages.find(nb) != _error_pages.end())
				_error_pages.erase(_error_pages.find(nb));
		}
		else
			_error_pages.insert(std::make_pair(ft::toInt(*it), page));
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x128(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x120(%rbp)
leaq -0x49(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0x9b10
movq -0x118(%rbp), %rdx
leaq 0x22fa0(%rip), %rsi     # 0x6bc67
leaq -0x48(%rbp), %rdi
callq 0xa780
jmp 0x48cd2
movq -0x120(%rbp), %rsi
leaq -0x28(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0x2f910
jmp 0x48ce8
leaq -0x48(%rbp), %rdi
callq 0x9c98
leaq -0x49(%rbp), %rdi
callq 0x9700
leaq -0x28(%rbp), %rdi
callq 0xce00
movq %rax, %rsi
leaq -0x80(%rbp), %rdi
callq 0x92c0
jmp 0x48d11
leaq -0x28(%rbp), %rdi
callq 0xcc30
movq %rax, -0x90(%rbp)
leaq -0x88(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0xcc60
leaq -0x28(%rbp), %rdi
callq 0xccb0
movq %rax, -0xa0(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0xdf30
movq %rax, %rsi
leaq -0x98(%rbp), %rdi
callq 0xcc60
leaq -0x88(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0xcc80
testb $0x1, %al
jne 0x48d7b
jmp 0x4903f
leaq -0x88(%rbp), %rdi
callq 0xcce0
movq %rax, %rdi
callq 0x45b70
movb %al, -0x129(%rbp)
jmp 0x48d97
movb -0x129(%rbp), %al
testb $0x1, %al
jne 0x48e5b
jmp 0x48da7
movl $0x10, %edi
callq 0x9340
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x138(%rbp)
leaq 0x24597(%rip), %rsi     # 0x6d35c
callq 0x9be0
jmp 0x48dcc
movq -0x138(%rbp), %rdi
movq 0x461ee(%rip), %rsi     # 0x8efc8
movq 0x461d7(%rip), %rdx     # 0x8efb8
callq 0x9aa0
jmp 0x49075
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x48e0e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x9c98
leaq -0x49(%rbp), %rdi
callq 0x9700
jmp 0x4906c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x49063
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x4905a
movq -0x138(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
callq 0x94c0
jmp 0x4905a
leaq -0x88(%rbp), %rdi
callq 0xcce0
movq %rax, %rdi
callq 0x2f2a0
movl %eax, -0x13c(%rbp)
jmp 0x48e77
movl -0x13c(%rbp), %eax
movl %eax, -0xa4(%rbp)
leaq 0x24303(%rip), %rsi     # 0x6d18d
leaq -0x80(%rbp), %rdi
callq 0xdf50
movb %al, -0x13d(%rbp)
jmp 0x48e9b
movb -0x13d(%rbp), %al
testb $0x1, %al
jne 0x48eaa
jmp 0x48f6c
movq -0x128(%rbp), %rdi
addq $0x68, %rdi
leaq -0xa4(%rbp), %rsi
callq 0x4e0d0
movq %rax, -0x148(%rbp)
jmp 0x48eca
movq -0x128(%rbp), %rdi
movq -0x148(%rbp), %rax
movq %rax, -0xb0(%rbp)
addq $0x68, %rdi
callq 0x4e100
movq %rax, -0xb8(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x4e0a0
testb $0x1, %al
jne 0x48f08
jmp 0x48f67
movq -0x128(%rbp), %rdi
addq $0x68, %rdi
movq %rdi, -0x158(%rbp)
leaq -0xa4(%rbp), %rsi
callq 0x4e0d0
movq %rax, -0x150(%rbp)
jmp 0x48f2f
movq -0x158(%rbp), %rdi
movq -0x150(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rsi
callq 0x4e130
movq %rax, -0x160(%rbp)
jmp 0x48f59
movq -0x160(%rbp), %rax
movq %rax, -0xc8(%rbp)
jmp 0x49023
movq -0x128(%rbp), %rax
addq $0x68, %rax
movq %rax, -0x170(%rbp)
leaq -0x88(%rbp), %rdi
callq 0xcce0
movq %rax, %rdi
callq 0x2f2a0
movl %eax, -0x164(%rbp)
jmp 0x48f9a
movl -0x164(%rbp), %eax
movl %eax, -0xf4(%rbp)
leaq -0xf0(%rbp), %rdi
leaq -0xf4(%rbp), %rsi
leaq -0x80(%rbp), %rdx
callq 0x4e1b0
jmp 0x48fbf
movq -0x170(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x4e170
movb %dl, -0x179(%rbp)
movq %rax, -0x178(%rbp)
jmp 0x48fe1
movb -0x179(%rbp), %al
movq -0x178(%rbp), %rcx
movq %rcx, -0x108(%rbp)
movb %al, -0x100(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x4e1f0
jmp 0x49023
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x4e1f0
jmp 0x4905a
jmp 0x49025
leaq -0x88(%rbp), %rdi
xorl %esi, %esi
callq 0xced0
movq %rax, -0x110(%rbp)
jmp 0x48d34
leaq -0x80(%rbp), %rdi
callq 0x9c98
leaq -0x28(%rbp), %rdi
callq 0xceb0
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
leaq -0x80(%rbp), %rdi
callq 0x9c98
leaq -0x28(%rbp), %rdi
callq 0xceb0
movq -0x58(%rbp), %rdi
callq 0x9af0
nopw %cs:(%rax,%rax)