// File: mbourand[P]webserv/srcs/Request.cpp
// Function: operator<<(std::ostream&, Request const&)
std::ostream& operator<<(std::ostream& out, const Request& request)
{
	if (request._error_code < 400)
	{
		out <<	"Method: " << request._method->getType() << '\n' <<
				"Path: " << request._url._path << '\n' <<
				"Protocol Version: " << request._protocolVersion << '\n' <<
				"Headers: " << std::endl;
		for (Request::HeadersVector::const_iterator it = request._headers.begin(); it != request._headers.end(); it++)
			out << "  \"" << (*it)->getType() << "\" -> \"" << (*it)->getValue() << '"' << std::endl;
		if (request._body.size() < 100)
			out << "Body:\n\"" << request._body << "\"" << std::endl;
		else
			out << "Body:\n\"" << "<<<BODY TOO LONG>>>" << "\"" << std::endl;
	}
	return out;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x190, 0x188(%rax)     # imm = 0x190
jge 0x613fb
movq -0x8(%rbp), %rdi
leaq 0xcba2(%rip), %rsi      # 0x6dc64
callq 0x9670
movq %rax, -0x90(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
movq (%rsi), %rax
movq 0x10(%rax), %rax
leaq -0x30(%rbp), %rdi
movq %rdi, -0x88(%rbp)
callq *%rax
movq -0x90(%rbp), %rdi
movq -0x88(%rbp), %rsi
callq 0x95d0
movq %rax, -0x80(%rbp)
jmp 0x61103
movq -0x80(%rbp), %rdi
movl $0xa, %esi
callq 0x9780
movq %rax, -0x98(%rbp)
jmp 0x6111a
movq -0x98(%rbp), %rdi
leaq 0xcb45(%rip), %rsi      # 0x6dc6d
callq 0x9670
movq %rax, -0xa0(%rbp)
jmp 0x61136
movq -0xa0(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0xb8, %rsi
callq 0x95d0
movq %rax, -0xa8(%rbp)
jmp 0x61156
movq -0xa8(%rbp), %rdi
movl $0xa, %esi
callq 0x9780
movq %rax, -0xb0(%rbp)
jmp 0x61170
movq -0xb0(%rbp), %rdi
leaq 0xcaf6(%rip), %rsi      # 0x6dc74
callq 0x9670
movq %rax, -0xb8(%rbp)
jmp 0x6118c
movq -0xb8(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x120, %rsi            # imm = 0x120
callq 0x95d0
movq %rax, -0xc0(%rbp)
jmp 0x611ac
movq -0xc0(%rbp), %rdi
movl $0xa, %esi
callq 0x9780
movq %rax, -0xc8(%rbp)
jmp 0x611c6
movq -0xc8(%rbp), %rdi
leaq 0xcab3(%rip), %rsi      # 0x6dc87
callq 0x9670
movq %rax, -0xd0(%rbp)
jmp 0x611e2
movq -0xd0(%rbp), %rdi
movq 0x2dd90(%rip), %rsi     # 0x8ef80
callq 0x96d0
jmp 0x611f7
leaq -0x30(%rbp), %rdi
callq 0x9c98
movq -0x10(%rbp), %rdi
addq $0x140, %rdi            # imm = 0x140
callq 0x14440
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
addq $0x140, %rdi            # imm = 0x140
callq 0x144b0
movq %rax, -0x50(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x14470
testb $0x1, %al
jne 0x6123e
jmp 0x61363
movq -0x8(%rbp), %rdi
leaq 0xca48(%rip), %rsi      # 0x6dc91
callq 0x9670
movq %rax, -0xe8(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x14570
movq (%rax), %rsi
movq (%rsi), %rax
movq 0x10(%rax), %rax
leaq -0x70(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq *%rax
movq -0xe8(%rbp), %rdi
movq -0xe0(%rbp), %rsi
callq 0x95d0
movq %rax, -0xd8(%rbp)
jmp 0x61291
movq -0xd8(%rbp), %rdi
leaq 0xc9f6(%rip), %rsi      # 0x6dc95
callq 0x9670
movq %rax, -0xf0(%rbp)
jmp 0x612ad
leaq -0x48(%rbp), %rdi
callq 0x14570
movq (%rax), %rdi
callq 0xbf40
movq %rax, -0xf8(%rbp)
jmp 0x612c7
movq -0xf8(%rbp), %rsi
movq -0xf0(%rbp), %rdi
callq 0x95d0
movq %rax, -0x100(%rbp)
jmp 0x612e3
movq -0x100(%rbp), %rdi
movl $0x22, %esi
callq 0x9780
movq %rax, -0x108(%rbp)
jmp 0x612fd
movq -0x108(%rbp), %rdi
movq 0x2dc75(%rip), %rsi     # 0x8ef80
callq 0x96d0
jmp 0x61312
leaq -0x70(%rbp), %rdi
callq 0x9c98
leaq -0x48(%rbp), %rdi
xorl %esi, %esi
callq 0x14590
movq %rax, -0x78(%rbp)
jmp 0x61214
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x9c98
jmp 0x61408
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x9c98
jmp 0x61408
movq -0x10(%rbp), %rdi
addq $0x158, %rdi            # imm = 0x158
callq 0x9480
cmpq $0x64, %rax
jae 0x613bc
movq -0x8(%rbp), %rdi
leaq 0xc918(%rip), %rsi      # 0x6dc9c
callq 0x9670
movq %rax, %rdi
movq -0x10(%rbp), %rsi
addq $0x158, %rsi            # imm = 0x158
callq 0x95d0
movq %rax, %rdi
leaq 0xc8fc(%rip), %rsi      # 0x6dca2
callq 0x9670
movq %rax, %rdi
movq 0x2dbcb(%rip), %rsi     # 0x8ef80
callq 0x96d0
jmp 0x613f9
movq -0x8(%rbp), %rdi
leaq 0xc8d5(%rip), %rsi      # 0x6dc9c
callq 0x9670
movq %rax, %rdi
leaq 0xc715(%rip), %rsi      # 0x6daeb
callq 0x9670
movq %rax, %rdi
leaq 0xc8bd(%rip), %rsi      # 0x6dca2
callq 0x9670
movq %rax, %rdi
movq 0x2db8c(%rip), %rsi     # 0x8ef80
callq 0x96d0
jmp 0x613fb
movq -0x8(%rbp), %rax
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x9af0
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)