// File: /workspace/github_cpp_makefile_star2_O2/mbourand[P]webserv/srcs/Config/ConfigContext.cpp
// Function: ConfigContext::parse_cgi_ext(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void ConfigContext::parse_cgi_ext(const std::string& directive_value)
{
	std::list<std::string> words = ft::split(directive_value, " \t\n");
	if (words.size() & 1)
		throw std::invalid_argument("No cgi path was provided for cgi_ext in config");
	bool extension_arg = true;
	std::string extension;
	for (std::list<std::string>::iterator it = words.begin(); it != words.end(); it++)
	{
		if (extension_arg)
		{
			if ((*it)[0] != '.')
				throw std::invalid_argument("Extension doesn't start with a dot for cgi_ext in config");
			extension = *it;
		}
		else
			_cgi_exts.insert(std::make_pair(extension, *it));
		extension_arg = !extension_arg;
	}
	for (std::map<std::string, std::string>::iterator it = _cgi_exts.begin(); it != _cgi_exts.end(); it++)
	{
		it->second = ft::simplify_path(it->second);
		if (!ft::is_executable(it->second.c_str()))
			throw std::invalid_argument("cgi_ext parameter is not an executable in config");
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0xd56b(%rip), %rsi      # 0x2d83f
leaq 0x38(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0x8032
movq %rsp, %rdi
leaq 0x38(%rsp), %rdx
movq %r15, %rsi
callq 0x16f10
leaq 0x38(%rsp), %rdi
callq 0x79b8
testb $0x1, 0x10(%rsp)
jne 0x20482
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0xc8(%rbx), %r15
movb $0x1, %bpl
leaq 0x18(%rsp), %r12
leaq 0x38(%rsp), %r13
movq %rsp, %r14
movq (%r14), %r14
movq %rsp, %rax
cmpq %rax, %r14
je 0x20384
testb $0x1, %bpl
je 0x2035c
movq 0x10(%r14), %rax
cmpb $0x2e, (%rax)
jne 0x20450
leaq 0x10(%r14), %rsi
movq %r12, %rdi
callq 0x7300
jmp 0x2037e
leaq 0x10(%r14), %rdx
movq %r13, %rdi
movq %r12, %rsi
callq 0x22d14
movq %r15, %rdi
movq %r13, %rsi
callq 0x23a8e
movq %r13, %rdi
callq 0x21ec8
xorb $0x1, %bpl
jmp 0x20330
movq 0xe0(%rbx), %r14
addq $0xd0, %rbx
leaq 0x38(%rsp), %r15
leaq 0x78(%rsp), %r12
cmpq %rbx, %r14
je 0x203fa
leaq 0x40(%r14), %r13
movq %r15, %rdi
movq %r13, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x17b31
movq %r13, %rdi
movq %r15, %rsi
callq 0x75f0
movq %r15, %rdi
callq 0x79b8
movq (%r13), %rsi
movq %r12, %rdi
movq %r15, %rdx
callq 0x8032
movq %r12, %rdi
callq 0x17a6e
movl %eax, %ebp
movq %r12, %rdi
callq 0x79b8
testb %bpl, %bpl
je 0x2041e
movq %r14, %rdi
callq 0x7390
movq %rax, %r14
jmp 0x2039c
leaq 0x18(%rsp), %rdi
callq 0x79b8
movq %rsp, %rdi
callq 0x8f64
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x7290
movq %rax, %r14
leaq 0xe9de(%rip), %rsi      # 0x2ee0e
movq %rax, %rdi
callq 0x7910
movq 0x22b89(%rip), %rsi     # 0x42fc8
movq 0x22b6a(%rip), %rdx     # 0x42fb0
movq %r14, %rdi
callq 0x7830
jmp 0x204b2
pushq $0x10
popq %rdi
callq 0x7290
movq %rax, %r14
leaq 0xe973(%rip), %rsi      # 0x2edd5
movq %rax, %rdi
callq 0x7910
movq 0x22b57(%rip), %rsi     # 0x42fc8
movq 0x22b38(%rip), %rdx     # 0x42fb0
movq %r14, %rdi
callq 0x7830
jmp 0x204b2
pushq $0x10
popq %rdi
callq 0x7290
movq %rax, %r14
leaq 0xe912(%rip), %rsi      # 0x2eda6
movq %rax, %rdi
callq 0x7910
movq 0x22b25(%rip), %rsi     # 0x42fc8
movq 0x22b06(%rip), %rdx     # 0x42fb0
movq %r14, %rdi
callq 0x7830
movq %rax, %rbx
jmp 0x2051c
movq %rax, %rbx
movq %r14, %rdi
callq 0x73d0
jmp 0x2051c
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x79b8
jmp 0x20524
movq %rax, %rbx
jmp 0x20524
jmp 0x20500
jmp 0x204de
jmp 0x20500
movq %rax, %rbx
movq %r14, %rdi
callq 0x73d0
jmp 0x20512
jmp 0x20500
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x21ec8
jmp 0x20512
jmp 0x20500
jmp 0x20500
movq %rax, %rbx
jmp 0x20512
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x79b8
leaq 0x18(%rsp), %rdi
callq 0x79b8
movq %rsp, %rdi
callq 0x8f64
movq %rbx, %rdi
callq 0x7860