// File: mbourand[P]webserv/srcs/Methods/GetMethod.cpp
// Function: GetMethod::process_cgi(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, URL const&, ConfigContext const&, ServerSocket const&, Request const&)
Response GetMethod::process_cgi(const std::string& realPath, const URL& url, const ConfigContext& config, const ServerSocket& socket, const Request& request)
{
	Response response(200, url._path);
	if (!request.getHeaderValue("Accept-Encoding").empty())
		response.setCompression(request._headers);
	try
	{
		CGI	cgi(request, config, socket, realPath);
		cgi.process(response);
	}
	catch(const CGI::CGIException &e)
	{
		Logger::print(e.what(), NULL, ERROR, NORMAL);
		response.setCode(e.code());
	}
	return (response);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x220, %rsp            # imm = 0x220
movq %rdi, -0x200(%rbp)
movq %rdi, %rax
movq %rax, -0x1f8(%rbp)
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movb $0x0, -0x31(%rbp)
movq -0x20(%rbp), %rdx
addq $0x88, %rdx
movl $0xc8, %esi
callq 0x636c0
movq 0x10(%rbp), %rax
movq %rax, -0x1f0(%rbp)
leaq -0x79(%rbp), %rdi
movq %rdi, -0x1e8(%rbp)
callq 0x9b10
movq -0x1e8(%rbp), %rdx
leaq 0x56a8b(%rip), %rsi     # 0x6a055
leaq -0x78(%rbp), %rdi
callq 0xa780
jmp 0x135d5
movq -0x1f0(%rbp), %rsi
leaq -0x58(%rbp), %rdi
leaq -0x78(%rbp), %rdx
callq 0x60df0
jmp 0x135eb
leaq -0x58(%rbp), %rdi
callq 0x9a50
xorb $-0x1, %al
movb %al, -0x201(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x9c98
leaq -0x78(%rbp), %rdi
callq 0x9c98
leaq -0x79(%rbp), %rdi
callq 0x9700
movb -0x201(%rbp), %al
testb $0x1, %al
jne 0x13623
jmp 0x13692
movq -0x200(%rbp), %rdi
movq 0x10(%rbp), %rsi
addq $0x140, %rsi            # imm = 0x140
callq 0x64600
jmp 0x1363c
jmp 0x13692
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x1366d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x9c98
leaq -0x79(%rbp), %rdi
callq 0x9700
jmp 0x13854
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x13854
movq 0x10(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq -0x18(%rbp), %r8
leaq -0x1b0(%rbp), %rdi
callq 0x1d8a0
jmp 0x136b0
movq -0x200(%rbp), %rsi
leaq -0x1b0(%rbp), %rdi
callq 0x20e20
jmp 0x136c5
leaq -0x1b0(%rbp), %rdi
callq 0x204c0
jmp 0x137d1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x13708
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x204c0
movl -0x8c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x13854
movq -0x88(%rbp), %rdi
callq 0x92a0
movq %rax, -0x1b8(%rbp)
movq -0x1b8(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, -0x218(%rbp)
leaq -0x1d9(%rbp), %rdi
movq %rdi, -0x210(%rbp)
callq 0x9b10
movq -0x218(%rbp), %rsi
movq -0x210(%rbp), %rdx
leaq -0x1d8(%rbp), %rdi
callq 0xa780
jmp 0x13774
xorl %eax, %eax
movl %eax, %esi
leaq -0x1d8(%rbp), %rdi
movl $0x3, %edx
movl $0x1, %ecx
callq 0x138a0
jmp 0x13790
leaq -0x1d8(%rbp), %rdi
callq 0x9c98
leaq -0x1d9(%rbp), %rdi
callq 0x9700
movq -0x1b8(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movq -0x200(%rbp), %rdi
movl %eax, %esi
callq 0x64560
jmp 0x137c8
callq 0x9a40
jmp 0x137cf
jmp 0x137d1
movb $0x1, -0x31(%rbp)
testb $0x1, -0x31(%rbp)
jne 0x13844
jmp 0x13838
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x1380f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x9c98
leaq -0x1d9(%rbp), %rdi
callq 0x9700
jmp 0x1382f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
callq 0x9a40
jmp 0x13836
jmp 0x13854
movq -0x200(%rbp), %rdi
callq 0x634e0
movq -0x1f8(%rbp), %rax
addq $0x220, %rsp            # imm = 0x220
popq %rbp
retq
movq -0x200(%rbp), %rdi
callq 0x634e0
movq -0x88(%rbp), %rdi
callq 0x9af0
movq %rax, %rdi
callq 0xaa90
nopw %cs:(%rax,%rax)
nop