// File: /workspace/github_cpp_makefile_star2_O1/mbourand[P]webserv/srcs/Headers/PreferenceHeader.cpp
// Function: PreferenceHeader::getPreferences[abi:cxx11]() const
std::multimap<float, std::string, std::greater<float> > PreferenceHeader::getPreferences() const
{
	std::multimap<float, std::string, std::greater<float> > language_preferences;
	std::list<std::string> language_tokens = ft::split(_value, ',');

	if (language_tokens.empty())
		return std::multimap<float, std::string, std::greater<float> >();

	for (std::list<std::string>::const_iterator it = language_tokens.begin(); it != language_tokens.end(); it++)
	{
		std::list<std::string> splitted = ft::split(*it, ';');
		if (splitted.size() == 0 || splitted.size() > 2)
			return std::multimap<float, std::string, std::greater<float> >();

		if (splitted.size() == 1)
		{
			if (splitted.front().find_first_not_of(' ') == std::string::npos)
				return std::multimap<float, std::string, std::greater<float> >();

			language_preferences.insert(std::make_pair(1.f, splitted.front().substr(splitted.front().find_first_not_of(' '))));
		}
		else if (splitted.size() == 2)
		{
			if (splitted.front().find_first_not_of(' ') == std::string::npos || splitted.back().find_first_not_of(' ') == std::string::npos)
				return std::multimap<float, std::string, std::greater<float> >();
			if (splitted.back().substr(0, 2) != "q=")
				return std::multimap<float, std::string, std::greater<float> >();


			float preference = 0.0f;
			try { preference = ft::toFloat(splitted.back().substr(2)); }
			catch (std::exception& e) { return std::multimap<float, std::string, std::greater<float> >(); }

			language_preferences.insert(std::make_pair(preference, splitted.front().substr(splitted.front().find_first_not_of(' '))));
		}
	}

	return language_preferences;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdi, %rbx
leaq 0x90(%rsp), %rcx
movl $0x0, (%rcx)
xorl %eax, %eax
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
addq $0x8, %rsi
leaq 0x8(%rsp), %rdx
movb $0x2c, (%rdx)
leaq 0x70(%rsp), %rbp
movq %rbp, %rdi
callq 0x1c387
movq 0x70(%rsp), %r14
cmpq %rbp, %r14
je 0x9583
leaq 0x40(%rsp), %r13
leaq 0x58(%rsp), %r15
leaq 0x8(%rsp), %r12
leaq 0x10(%r14), %rsi
movb $0x3b, 0x8(%rsp)
movq %r15, %rdi
movq %r12, %rdx
callq 0x1c387
movq 0x68(%rsp), %rax
leaq -0x3(%rax), %rcx
cmpq $-0x2, %rcx
jb 0x9555
cmpq $0x2, %rax
je 0x92ef
cmpq $0x1, %rax
jne 0x94ca
movq 0x58(%rsp), %rdi
addq $0x10, %rdi
movl $0x20, %esi
xorl %edx, %edx
callq 0x7440
cmpq $-0x1, %rax
je 0x9555
movq 0x58(%rsp), %rbp
addq $0x10, %rbp
movq %rbp, %rdi
movl $0x20, %esi
xorl %edx, %edx
callq 0x7440
leaq 0x30(%rsp), %rdi
movq %rbp, %rsi
movq %rax, %rdx
movq $-0x1, %rcx
callq 0x74d0
movl $0x3f800000, 0x8(%rsp)  # imm = 0x3F800000
leaq 0x20(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movq 0x30(%rsp), %rax
cmpq %r13, %rax
je 0x9421
movq %rax, 0x10(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x20(%rsp)
jmp 0x9429
movq 0x58(%rsp), %rdi
addq $0x10, %rdi
movl $0x20, %esi
xorl %edx, %edx
callq 0x7440
cmpq $-0x1, %rax
je 0x9555
movq 0x60(%rsp), %rdi
addq $0x10, %rdi
movl $0x20, %esi
xorl %edx, %edx
callq 0x7440
cmpq $-0x1, %rax
je 0x9555
movq 0x60(%rsp), %rsi
addq $0x10, %rsi
movl $0x2, %ecx
movq %r12, %rdi
xorl %edx, %edx
callq 0x74d0
movq %r12, %rdi
leaq 0x30efb(%rip), %rsi     # 0x3a24a
callq 0x7180
movl %eax, %ebp
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x9372
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x74b0
testl %ebp, %ebp
jne 0x9555
movq 0x60(%rsp), %rsi
addq $0x10, %rsi
movl $0x2, %edx
movq %r12, %rdi
movq $-0x1, %rcx
callq 0x74d0
movq %r12, %rdi
callq 0x1be8f
movss %xmm0, 0x54(%rsp)
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x93c1
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x74b0
movq 0x58(%rsp), %rbp
addq $0x10, %rbp
movq %rbp, %rdi
movl $0x20, %esi
xorl %edx, %edx
callq 0x7440
leaq 0x30(%rsp), %rdi
movq %rbp, %rsi
movq %rax, %rdx
movq $-0x1, %rcx
callq 0x74d0
movss 0x54(%rsp), %xmm0
movss %xmm0, 0x8(%rsp)
leaq 0x20(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movq 0x30(%rsp), %rax
cmpq %r13, %rax
je 0x945d
movq %rax, 0x10(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x20(%rsp)
jmp 0x9465
movups (%r13), %xmm0
movups %xmm0, (%rcx)
leaq 0x70(%rsp), %rbp
movq 0x38(%rsp), %rax
movq %rax, 0x18(%rsp)
movq %r13, 0x30(%rsp)
movq $0x0, 0x38(%rsp)
movb $0x0, 0x40(%rsp)
leaq 0x88(%rsp), %rdi
movq %r12, %rsi
callq 0x9796
jmp 0x9497
movups (%r13), %xmm0
movups %xmm0, (%rcx)
leaq 0x70(%rsp), %rbp
movq 0x38(%rsp), %rax
movq %rax, 0x18(%rsp)
movq %r13, 0x30(%rsp)
movq $0x0, 0x38(%rsp)
movb $0x0, 0x40(%rsp)
leaq 0x88(%rsp), %rdi
movq %r12, %rsi
callq 0x9796
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x94b3
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x74b0
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x94ca
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x74b0
movq %r15, %rdi
callq 0x96d8
movq (%r14), %r14
cmpq %rbp, %r14
jne 0x9232
leaq 0x8(%rbx), %rax
movq 0x98(%rsp), %rcx
testq %rcx, %rcx
je 0x95d1
movl 0x90(%rsp), %edx
movl %edx, 0x8(%rbx)
movq %rcx, 0x10(%rbx)
movq 0xa0(%rsp), %rdx
movq %rdx, 0x18(%rbx)
movq 0xa8(%rsp), %rdx
movq %rdx, 0x20(%rbx)
movq %rax, 0x8(%rcx)
movq 0xb0(%rsp), %rax
movq %rax, 0x28(%rbx)
xorl %eax, %eax
movq %rax, 0x98(%rsp)
leaq 0x90(%rsp), %rcx
movq %rcx, 0xa0(%rsp)
movq %rcx, 0xa8(%rsp)
movq %rax, 0xb0(%rsp)
jmp 0x95a5
leaq 0x8(%rbx), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, 0x20(%rbx)
movups %xmm0, (%rbx)
movq %rax, 0x18(%rbx)
movq %rax, 0x20(%rbx)
movq $0x0, 0x28(%rbx)
leaq 0x58(%rsp), %rdi
callq 0x96d8
jmp 0x95a5
leaq 0x8(%rbx), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, 0x20(%rbx)
movups %xmm0, (%rbx)
movq %rax, 0x18(%rbx)
movq %rax, 0x20(%rbx)
movq $0x0, 0x28(%rbx)
leaq 0x70(%rsp), %rdi
callq 0x96d8
leaq 0x88(%rsp), %rdi
callq 0x971e
movq %rbx, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x0, 0x8(%rbx)
xorl %ecx, %ecx
movq %rcx, 0x10(%rbx)
movq %rax, 0x18(%rbx)
movq %rax, 0x20(%rbx)
movq %rcx, 0x28(%rbx)
jmp 0x95a5
movq %rax, %r12
jmp 0x96b7
jmp 0x9663
jmp 0x969b
movq %rdx, %r15
movq %rax, %r12
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x9625
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x74b0
jmp 0x9625
movq %rdx, %r15
movq %rax, %r12
cmpl $0x1, %r15d
jne 0x969e
movq %r12, %rdi
callq 0x7210
leaq 0x8(%rbx), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, 0x20(%rbx)
movups %xmm0, (%rbx)
movq %rax, 0x18(%rbx)
movq %rax, 0x20(%rbx)
movq $0x0, 0x28(%rbx)
callq 0x7780
jmp 0x9577
jmp 0x969b
jmp 0x969b
movq %rax, %r12
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x9682
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x74b0
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x969e
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x74b0
jmp 0x969e
movq %rax, %r12
leaq 0x58(%rsp), %rdi
callq 0x96d8
jmp 0x96ad
movq %rax, %r12
leaq 0x70(%rsp), %rdi
callq 0x96d8
leaq 0x88(%rsp), %rdi
callq 0x971e
movq %r12, %rdi
callq 0x7810