// File: /workspace/github_cpp_makefile_star2_O2/mbourand[P]webserv/srcs/Utils/CGI.cpp
// Function: CGI::add_http_headers(std::vector<Header*, std::allocator<Header*>> const&)
void			CGI::add_http_headers(const Request::HeadersVector& headers)
{
	for (Request::HeadersVector::const_iterator it = headers.begin(); it != headers.end(); it++)
	{
		if ((*it)->getType() == AcceptCharsetsHeader().getType() || (*it)->getType() == AcceptEncodingHeader().getType()
			|| (*it)->getType() == AcceptLanguageHeader().getType() || (*it)->getType() == HostHeader().getType()
			|| (*it)->getType() == RefererHeader().getType() || (*it)->getType() == UserAgentHeader().getType()
			|| (*it)->getType().find("X-") == 0)
		{
			std::string	temp;
			temp = "HTTP_" + (*it)->getType();
			for (std::string::iterator its = temp.begin() + 6; its != temp.end(); its++)
			{
				if (*its == '-')
					*its = '_';
				else
					*its = std::toupper(*its);
			}
			temp += '=' + (*it)->getValue();
			m_env.push_back(temp);
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2a8, %rsp            # imm = 0x2A8
movq %rsi, 0x38(%rsp)
movq (%rsi), %rbx
addq $0xf8, %rdi
movq %rdi, 0x30(%rsp)
leaq 0x108(%rsp), %r15
leaq 0x8(%rsp), %rbp
leaq 0x268(%rsp), %r13
leaq 0x40(%rsp), %r12
leaq 0x240(%rsp), %r14
movq 0x38(%rsp), %rax
cmpq 0x8(%rax), %rbx
je 0x110b5
movq (%rbx), %rsi
movq (%rsi), %rax
movq %r15, %rdi
callq *0x10(%rax)
movq %rbp, %rdi
callq 0x7f8c
movq %r13, %rdi
movq %rbp, %rsi
callq 0x7fd8
movq %r15, %rdi
movq %r13, %rsi
callq 0xc2ad
testb %al, %al
je 0x10d4d
movq %r13, %rdi
callq 0x79b8
movq %rbp, %rdi
callq 0x7fb8
movq %r15, %rdi
callq 0x79b8
jmp 0x10fe8
movq (%rbx), %rsi
movq (%rsi), %rax
leaq 0xe8(%rsp), %rdi
callq *0x10(%rax)
movq %r14, %rdi
callq 0x8104
leaq 0x1a8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rbp
movq %r14, %rsi
callq 0x8150
leaq 0xe8(%rsp), %rdi
movq %r15, %rsi
callq 0xc2ad
movb $0x1, %r12b
testb %al, %al
jne 0x10f90
movq (%rbx), %rsi
movq (%rsi), %rax
leaq 0xc8(%rsp), %rdi
callq *0x10(%rax)
leaq 0x40(%rsp), %r15
movq %r15, %rdi
callq 0x81ac
leaq 0x188(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x81f8
leaq 0xc8(%rsp), %rdi
movq %r14, %rsi
callq 0xc2ad
movb $0x1, %r12b
testb %al, %al
jne 0x10f6c
movq (%rbx), %rsi
movq (%rsi), %rax
leaq 0xa8(%rsp), %rdi
callq *0x10(%rax)
leaq 0x218(%rsp), %r14
movq %r14, %rdi
callq 0x896c
leaq 0x168(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x89c4
leaq 0xa8(%rsp), %rdi
movq %r15, %rsi
callq 0xc2ad
movb $0x1, %r12b
testb %al, %al
jne 0x10f45
movq (%rbx), %rsi
movq (%rsi), %rax
leaq 0x88(%rsp), %rdi
callq *0x10(%rax)
leaq 0x1f0(%rsp), %r14
movq %r14, %rdi
callq 0x91c4
leaq 0x148(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x921c
leaq 0x88(%rsp), %rdi
movq %r15, %rsi
callq 0xc2ad
movb $0x1, %r12b
testb %al, %al
jne 0x10f1e
movq (%rbx), %rsi
movq (%rsi), %rax
leaq 0x68(%rsp), %rdi
callq *0x10(%rax)
leaq 0x1c8(%rsp), %r14
movq %r14, %rdi
callq 0x9444
leaq 0x128(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x949c
leaq 0x68(%rsp), %rdi
movq %r15, %rsi
callq 0xc2ad
movb $0x1, %r12b
testb %al, %al
jne 0x10efa
movq (%rbx), %rsi
movq (%rsi), %rax
leaq 0x288(%rsp), %r14
movq %r14, %rdi
callq *0x10(%rax)
movq %r14, %rdi
leaq 0x1bcc7(%rip), %rsi     # 0x2cbab
xorl %edx, %edx
callq 0x7980
testq %rax, %rax
sete %r12b
movq %r14, %rdi
callq 0x79b8
leaq 0x128(%rsp), %rdi
callq 0x79b8
leaq 0x1c8(%rsp), %rdi
callq 0x947c
leaq 0x68(%rsp), %rdi
callq 0x79b8
leaq 0x148(%rsp), %rdi
callq 0x79b8
leaq 0x1f0(%rsp), %rdi
callq 0x91fc
leaq 0x88(%rsp), %rdi
callq 0x79b8
leaq 0x168(%rsp), %rdi
callq 0x79b8
leaq 0x218(%rsp), %rdi
callq 0x89a4
leaq 0xa8(%rsp), %rdi
callq 0x79b8
leaq 0x188(%rsp), %rdi
callq 0x79b8
leaq 0x40(%rsp), %rdi
callq 0x81d8
leaq 0xc8(%rsp), %rdi
callq 0x79b8
leaq 0x1a8(%rsp), %rdi
callq 0x79b8
movq %rbp, %r14
movq %rbp, %rdi
callq 0x8130
leaq 0xe8(%rsp), %rdi
callq 0x79b8
movq %r13, %rdi
callq 0x79b8
leaq 0x8(%rsp), %rbp
movq %rbp, %rdi
callq 0x7fb8
leaq 0x108(%rsp), %r15
movq %r15, %rdi
callq 0x79b8
testb %r12b, %r12b
leaq 0x40(%rsp), %r12
je 0x110ac
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
andq $0x0, 0x10(%rsp)
movb $0x0, 0x18(%rsp)
movq (%rbx), %rsi
movq (%rsi), %rax
movq %r12, %rdi
callq *0x10(%rax)
movq %r14, %rdi
leaq 0x1bb9b(%rip), %rsi     # 0x2cbae
movq %r12, %rdx
callq 0xc30e
movq %rbp, %rdi
movq %r14, %rsi
callq 0x75f0
movq %r14, %rdi
callq 0x79b8
movq %r12, %rdi
callq 0x79b8
movq 0x8(%rsp), %rax
leaq 0x6(%rax), %r15
addq 0x10(%rsp), %rax
cmpq %rax, %r15
je 0x11066
movsbl (%r15), %edi
movb $0x5f, %al
cmpl $0x2d, %edi
je 0x11059
callq 0x7900
movb %al, (%r15)
incq %r15
movq 0x8(%rsp), %rax
jmp 0x1103f
movq (%rbx), %rdi
callq 0x8964
movq %r14, %rdi
pushq $0x3d
popq %rsi
movq %rax, %rdx
callq 0x11fa7
movq %rbp, %rdi
movq %r14, %rsi
callq 0x7950
leaq 0x108(%rsp), %r15
movq %r14, %rdi
callq 0x79b8
movq 0x30(%rsp), %rdi
movq %rbp, %rsi
callq 0x11f5a
movq %rbp, %rdi
callq 0x79b8
addq $0x8, %rbx
jmp 0x10cf3
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
callq 0x79b8
jmp 0x110dc
movq %rax, %rbx
leaq 0x1c8(%rsp), %rdi
callq 0x947c
jmp 0x110ee
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x79b8
jmp 0x110fd
movq %rax, %rbx
leaq 0x148(%rsp), %rdi
callq 0x79b8
jmp 0x1110f
movq %rax, %rbx
leaq 0x1f0(%rsp), %rdi
callq 0x91fc
jmp 0x11121
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x79b8
jmp 0x11133
movq %rax, %rbx
leaq 0x168(%rsp), %rdi
callq 0x79b8
jmp 0x11145
movq %rax, %rbx
leaq 0x218(%rsp), %rdi
callq 0x89a4
jmp 0x11157
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x79b8
leaq 0x188(%rsp), %rdi
callq 0x79b8
jmp 0x1117b
movq %rax, %rbx
jmp 0x11164
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x81d8
jmp 0x1118a
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x79b8
leaq 0x1a8(%rsp), %rdi
callq 0x79b8
jmp 0x111b3
movq %rax, %rbx
jmp 0x11197
movq %rax, %rbx
jmp 0x111d2
movq %rax, %rbx
leaq 0x240(%rsp), %rdi
callq 0x8130
jmp 0x111c5
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x79b8
leaq 0x268(%rsp), %rdi
callq 0x79b8
jmp 0x11209
jmp 0x1121d
movq %rax, %rbx
leaq 0x240(%rsp), %rdi
jmp 0x111f8
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x79b8
jmp 0x11220
jmp 0x1121d
movq %rax, %rbx
jmp 0x11213
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x7fb8
leaq 0x108(%rsp), %rdi
jmp 0x11225
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x79b8
movq %rbx, %rdi
callq 0x7860