// File: /workspace/github_cpp_makefile_star2_O1/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 0x12508(%rip), %rsi     # 0x3b88b
leaq 0x12504(%rip), %rdx     # 0x3b88e
movq %rsp, %rdi
callq 0x80f4
leaq 0x40(%rsp), %rdi
movq %rsp, %rdx
movq %r15, %rsi
callq 0x1c232
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x293bd
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x74b0
testb $0x1, 0x50(%rsp)
jne 0x295d5
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 0x29489
leaq 0xc8(%rbx), %r15
movb $0x1, %r14b
leaq 0x58(%rsp), %r12
movq %rsp, %r13
testb $0x1, %r14b
je 0x29422
movq 0x10(%rbp), %rax
cmpb $0x2e, (%rax)
jne 0x295a1
leaq 0x10(%rbp), %rsi
movq %r12, %rdi
callq 0x72c0
jmp 0x29473
leaq 0x10(%rbp), %rdx
movq %r13, %rdi
movq %r12, %rsi
callq 0x2d13e
movq %r15, %rdi
movq %r13, %rsi
callq 0x2ddda
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x29458
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x74b0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x29473
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x74b0
xorb $0x1, %r14b
movq (%rbp), %rbp
leaq 0x40(%rsp), %rax
cmpq %rax, %rbp
jne 0x29401
movq 0xe0(%rbx), %r14
addq $0xd0, %rbx
cmpq %rbx, %r14
je 0x29535
movq %rsp, %r15
leaq 0x78(%rsp), %r12
leaq 0x40(%r14), %r13
movq %r15, %rdi
movq %r13, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x1d582
movq %r13, %rdi
movq %r15, %rsi
callq 0x7590
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x294e1
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x74b0
movq (%r13), %rsi
movq %r12, %rdi
movq %r15, %rdx
callq 0xde9a
movq %r12, %rdi
callq 0x1d3e4
movl %eax, %ebp
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x2951c
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x74b0
testb %bpl, %bpl
je 0x2956d
movq %r14, %rdi
callq 0x7350
movq %rax, %r14
cmpq %rbx, %rax
jne 0x294a8
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x29551
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x74b0
leaq 0x40(%rsp), %rdi
callq 0x96d8
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 0x138f8(%rip), %rsi     # 0x3ce79
movq %rax, %rdi
callq 0x78c0
movq 0x24a38(%rip), %rsi     # 0x4dfc8
movq 0x24a19(%rip), %rdx     # 0x4dfb0
movq %r14, %rdi
callq 0x77d0
jmp 0x29607
movl $0x10, %edi
callq 0x7260
movq %rax, %r14
leaq 0x1388b(%rip), %rsi     # 0x3ce40
movq %rax, %rdi
callq 0x78c0
movq 0x24a04(%rip), %rsi     # 0x4dfc8
movq 0x249e5(%rip), %rdx     # 0x4dfb0
movq %r14, %rdi
callq 0x77d0
jmp 0x29607
movl $0x10, %edi
callq 0x7260
movq %rax, %r14
leaq 0x13828(%rip), %rsi     # 0x3ce11
movq %rax, %rdi
callq 0x78c0
movq 0x249d0(%rip), %rsi     # 0x4dfc8
movq 0x249b1(%rip), %rdx     # 0x4dfb0
movq %r14, %rdi
callq 0x77d0
movq %rax, %rbx
jmp 0x29683
movq %rax, %rbx
movq %r14, %rdi
callq 0x7390
jmp 0x29683
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2968d
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x74b0
jmp 0x2968d
movq %rax, %rbx
jmp 0x2968d
jmp 0x29664
jmp 0x29644
jmp 0x29664
movq %rax, %rbx
movq %r14, %rdi
callq 0x7390
jmp 0x29667
jmp 0x29664
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2c2e8
jmp 0x29667
jmp 0x29664
jmp 0x29664
movq %rax, %rbx
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x29683
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x74b0
leaq 0x40(%rsp), %rdi
callq 0x96d8
movq %rbx, %rdi
callq 0x7810
movq %rax, %rbx
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x29667
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x74b0
jmp 0x29667