// File: /workspace/github_cpp_makefile_star2_O3/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 0x78(%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
movq %rsp, %rdx
movb $0x2c, (%rdx)
leaq 0xa0(%rsp), %r13
movq %r13, %rdi
callq 0x1c085
movq 0xa0(%rsp), %r15
cmpq %r13, %r15
je 0x955f
movq %rbx, 0x48(%rsp)
leaq 0x38(%rsp), %rbp
leaq 0x58(%rsp), %rdi
movq %rsp, %r12
movq %r13, %rbx
leaq 0x10(%r15), %rsi
movb $0x3b, (%rsp)
movq %rdi, %r14
movq %r12, %rdx
callq 0x1c085
movq 0x68(%rsp), %r13
leaq -0x3(%r13), %rax
cmpq $-0x2, %rax
jb 0x9532
movq 0x58(%rsp), %rdi
addq $0x10, %rdi
movl $0x20, %esi
xorl %edx, %edx
callq 0x7440
cmpq $0x1, %r13
jne 0x92f5
cmpq $-0x1, %rax
je 0x9532
movq 0x58(%rsp), %r13
addq $0x10, %r13
movq %r13, %rdi
movl $0x20, %esi
xorl %edx, %edx
callq 0x7440
leaq 0x28(%rsp), %rdi
movq %r13, %rsi
movq %rax, %rdx
movq $-0x1, %rcx
callq 0x74d0
movl $0x3f800000, (%rsp)     # imm = 0x3F800000
leaq 0x18(%rsp), %rcx
movq %rcx, 0x8(%rsp)
movq 0x28(%rsp), %rax
cmpq %rbp, %rax
movq %rbx, %r13
je 0x9414
movq %rax, 0x8(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x18(%rsp)
jmp 0x941b
cmpq $-0x1, %rax
je 0x9532
movq 0x60(%rsp), %rdi
addq $0x10, %rdi
movl $0x20, %esi
xorl %edx, %edx
callq 0x7440
cmpq $-0x1, %rax
je 0x9532
movq 0x60(%rsp), %rsi
addq $0x10, %rsi
movl $0x2, %ecx
movq %r12, %rdi
xorl %edx, %edx
callq 0x74d0
movq %r12, %rdi
leaq 0x30f0a(%rip), %rsi     # 0x3a24a
callq 0x7180
movl %eax, %r13d
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x9363
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x74b0
testl %r13d, %r13d
jne 0x9532
movq 0x60(%rsp), %rsi
addq $0x10, %rsi
movl $0x2, %edx
movq %r12, %rdi
movq $-0x1, %rcx
callq 0x74d0
movq %r12, %rdi
callq 0x1bb9b
movss %xmm0, 0x54(%rsp)
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x93b2
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x74b0
movq 0x58(%rsp), %r13
addq $0x10, %r13
movq %r13, %rdi
movl $0x20, %esi
xorl %edx, %edx
callq 0x7440
leaq 0x28(%rsp), %rdi
movq %r13, %rsi
movq %rax, %rdx
movq $-0x1, %rcx
callq 0x74d0
movss 0x54(%rsp), %xmm0
movss %xmm0, (%rsp)
leaq 0x18(%rsp), %rcx
movq %rcx, 0x8(%rsp)
movq 0x28(%rsp), %rax
cmpq %rbp, %rax
movq %rbx, %r13
je 0x9447
movq %rax, 0x8(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x18(%rsp)
jmp 0x944e
movups (%rbp), %xmm0
movups %xmm0, (%rcx)
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %rbp, 0x28(%rsp)
movq $0x0, 0x30(%rsp)
movb $0x0, 0x38(%rsp)
leaq 0x70(%rsp), %rdi
movq %r12, %rsi
callq 0x9774
jmp 0x9478
movups (%rbp), %xmm0
movups %xmm0, (%rcx)
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %rbp, 0x28(%rsp)
movq $0x0, 0x30(%rsp)
movb $0x0, 0x38(%rsp)
leaq 0x70(%rsp), %rdi
movq %r12, %rsi
callq 0x9774
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x9494
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x74b0
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x94ab
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x74b0
movq %r14, %rdi
callq 0x96b6
movq %r14, %rdi
movq (%r15), %r15
cmpq %r13, %r15
jne 0x9242
movq 0x48(%rsp), %rbx
leaq 0x8(%rbx), %rax
movq 0x80(%rsp), %rsi
testq %rsi, %rsi
je 0x957d
movl 0x78(%rsp), %ecx
movq %rsi, 0x10(%rbx)
movq 0x88(%rsp), %rdi
movq 0x90(%rsp), %rdx
movq %rax, 0x8(%rsi)
movq 0x98(%rsp), %rax
movq %rax, 0x28(%rbx)
movq $0x0, 0x80(%rsp)
leaq 0x78(%rsp), %rax
movq %rax, 0x88(%rsp)
movq %rax, 0x90(%rsp)
movq %rdi, %rax
leaq 0x98(%rsp), %rsi
jmp 0x958e
movq 0x48(%rsp), %rbx
leaq 0x8(%rbx), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
xorl %ecx, %ecx
movq %rcx, 0x10(%rbx)
movq %rax, 0x18(%rbx)
movq %rax, 0x20(%rbx)
movq %rcx, 0x28(%rbx)
leaq 0x58(%rsp), %rdi
callq 0x96b6
jmp 0x95a0
leaq 0x8(%rbx), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
xorl %ecx, %ecx
movq %rcx, 0x10(%rbx)
movq %rax, 0x18(%rbx)
movq %rax, 0x20(%rbx)
movq %rcx, 0x28(%rbx)
jmp 0x95a0
movq $0x0, 0x10(%rbx)
leaq 0x28(%rbx), %rsi
xorl %ecx, %ecx
movq %rax, %rdx
movq %rax, 0x18(%rbx)
movq %rdx, 0x20(%rbx)
movq $0x0, (%rsi)
movl %ecx, 0x8(%rbx)
leaq 0xa0(%rsp), %rdi
callq 0x96b6
leaq 0x70(%rsp), %rdi
callq 0x96fc
movq %rbx, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r12
jmp 0x9698
jmp 0x9641
jmp 0x9679
movq %rdx, %r15
movq %rax, %r12
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x9604
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x74b0
jmp 0x9604
movq %rdx, %r15
movq %rax, %r12
cmpl $0x1, %r15d
jne 0x967c
movq %r12, %rdi
callq 0x7210
movq 0x48(%rsp), %rbx
leaq 0x8(%rbx), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
xorl %ecx, %ecx
movq %rcx, 0x10(%rbx)
movq %rax, 0x18(%rbx)
movq %rax, 0x20(%rbx)
movq %rcx, 0x28(%rbx)
callq 0x7780
jmp 0x9553
jmp 0x9679
jmp 0x9679
movq %rax, %r12
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x9660
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x74b0
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x967c
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x74b0
jmp 0x967c
movq %rax, %r12
leaq 0x58(%rsp), %rdi
callq 0x96b6
jmp 0x968b
movq %rax, %r12
leaq 0xa0(%rsp), %rdi
callq 0x96b6
leaq 0x70(%rsp), %rdi
callq 0x96fc
movq %r12, %rdi
callq 0x7810