// File: /workspace/github_cpp_makefile_star2_O3/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 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x12850(%rip), %rsi     # 0x3b88b
leaq 0x1284c(%rip), %rdx     # 0x3b88e
movq %rsp, %rdi
callq 0x80f4
leaq 0x40(%rsp), %rdi
movq %rsp, %rdx
movq %r15, %rsi
callq 0x1bf30
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x29075
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x74b0
testb $0x1, 0x50(%rsp)
jne 0x2928d
leaq 0x68(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x40(%rsp), %rbp
leaq 0x40(%rsp), %rax
cmpq %rax, %rbp
je 0x29141
leaq 0xc8(%rbx), %r15
movb $0x1, %r14b
leaq 0x58(%rsp), %r12
movq %rsp, %r13
testb $0x1, %r14b
je 0x290da
movq 0x10(%rbp), %rax
cmpb $0x2e, (%rax)
jne 0x29259
leaq 0x10(%rbp), %rsi
movq %r12, %rdi
callq 0x72c0
jmp 0x2912b
leaq 0x10(%rbp), %rdx
movq %r13, %rdi
movq %r12, %rsi
callq 0x2ce00
movq %r15, %rdi
movq %r13, %rsi
callq 0x2da96
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x29110
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x74b0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2912b
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x74b0
xorb $0x1, %r14b
movq (%rbp), %rbp
leaq 0x40(%rsp), %rax
cmpq %rax, %rbp
jne 0x290b9
movq 0xe0(%rbx), %r14
addq $0xd0, %rbx
cmpq %rbx, %r14
je 0x291ed
movq %rsp, %r15
leaq 0x78(%rsp), %r12
leaq 0x40(%r14), %r13
movq %r15, %rdi
movq %r13, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x1d26b
movq %r13, %rdi
movq %r15, %rsi
callq 0x7590
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x29199
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x74b0
movq (%r13), %rsi
movq %r12, %rdi
movq %r15, %rdx
callq 0xde66
movq %r12, %rdi
callq 0x1d0cd
movl %eax, %ebp
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x291d4
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x74b0
testb %bpl, %bpl
je 0x29225
movq %r14, %rdi
callq 0x7350
movq %rax, %r14
cmpq %rbx, %rax
jne 0x29160
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x29209
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x74b0
leaq 0x40(%rsp), %rdi
callq 0x96b6
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x7260
movq %rax, %r14
leaq 0x13c40(%rip), %rsi     # 0x3ce79
movq %rax, %rdi
callq 0x78c0
movq 0x24d80(%rip), %rsi     # 0x4dfc8
movq 0x24d61(%rip), %rdx     # 0x4dfb0
movq %r14, %rdi
callq 0x77d0
jmp 0x292bf
movl $0x10, %edi
callq 0x7260
movq %rax, %r14
leaq 0x13bd3(%rip), %rsi     # 0x3ce40
movq %rax, %rdi
callq 0x78c0
movq 0x24d4c(%rip), %rsi     # 0x4dfc8
movq 0x24d2d(%rip), %rdx     # 0x4dfb0
movq %r14, %rdi
callq 0x77d0
jmp 0x292bf
movl $0x10, %edi
callq 0x7260
movq %rax, %r14
leaq 0x13b70(%rip), %rsi     # 0x3ce11
movq %rax, %rdi
callq 0x78c0
movq 0x24d18(%rip), %rsi     # 0x4dfc8
movq 0x24cf9(%rip), %rdx     # 0x4dfb0
movq %r14, %rdi
callq 0x77d0
movq %rax, %rbx
jmp 0x2933b
movq %rax, %rbx
movq %r14, %rdi
callq 0x7390
jmp 0x2933b
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x29345
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x74b0
jmp 0x29345
movq %rax, %rbx
jmp 0x29345
jmp 0x2931c
jmp 0x292fc
jmp 0x2931c
movq %rax, %rbx
movq %r14, %rdi
callq 0x7390
jmp 0x2931f
jmp 0x2931c
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2bfa8
jmp 0x2931f
jmp 0x2931c
jmp 0x2931c
movq %rax, %rbx
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x2933b
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x74b0
leaq 0x40(%rsp), %rdi
callq 0x96b6
movq %rbx, %rdi
callq 0x7810
movq %rax, %rbx
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x2931f
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x74b0
jmp 0x2931f