// File: /workspace/github_cpp_makefile_star2_O3/mbourand[P]webserv/srcs/Headers/Header.cpp
// Function: Header::parse(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
size_t Header::parse(std::string content)
{
	size_t len = 0;
	size_t result = content.find("\r\n") + 2;

	while (content.find_first_not_of(" \t\v\f", result) != result)
		result = content.find("\r\n", result) + 2;
	_value = content.substr(1, result - 2);
	if (_value.find_first_not_of(" \t\v\f\r\n") > _value.find("\r\n") || _value.empty())
		throw std::invalid_argument("Bad line folding");
	_value.erase(_value.find_last_not_of(" \t\v\f\r\n") + 1);
	while ((len = _value.find("\r\n", len)) != std::string::npos)
		_value.erase(len, _value.find_first_not_of(" \t\v\f\r\n", len) - len);
	return (result);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r15
movq %rdi, %r14
leaq 0x34cb5(%rip), %rsi     # 0x3d8f0
movl $0x2, %ecx
movq %r15, %rdi
xorl %edx, %edx
callq 0x77f0
movq %rax, %r12
leaq 0x2(%rax), %rbx
leaq 0x3153c(%rip), %rsi     # 0x3a194
movl $0x4, %ecx
movq %r15, %rdi
movq %rbx, %rdx
callq 0x77a0
cmpq %rbx, %rax
je 0x8cad
leaq 0x34c7c(%rip), %r13     # 0x3d8f0
leaq 0x31519(%rip), %rbp     # 0x3a194
movl $0x2, %ecx
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x77f0
movq %rax, %r12
leaq 0x2(%rax), %rbx
movl $0x4, %ecx
movq %r15, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x77a0
cmpq %rbx, %rax
jne 0x8c7b
leaq 0x8(%rsp), %r13
movl $0x1, %edx
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rcx
callq 0x74d0
leaq 0x8(%r14), %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0x7590
movq (%r13), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x8cef
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x74b0
leaq 0x314a3(%rip), %rsi     # 0x3a199
movl $0x6, %ecx
movq %r15, %rdi
xorl %edx, %edx
callq 0x77a0
movq %rax, %r12
leaq 0x34be1(%rip), %rsi     # 0x3d8f0
movl $0x2, %ecx
movq %r15, %rdi
xorl %edx, %edx
callq 0x77f0
cmpq %rax, %r12
ja 0x8de8
cmpq $0x0, 0x10(%r14)
je 0x8de8
leaq 0x31460(%rip), %rsi     # 0x3a199
movl $0x6, %ecx
movq %r15, %rdi
movq $-0x1, %rdx
callq 0x7750
incq %rax
movq 0x10(%r14), %rcx
cmpq %rax, %rcx
jb 0x8e1a
movq %rax, 0x10(%r14)
movq 0x8(%r14), %rcx
movb $0x0, (%rcx,%rax)
leaq 0x34b80(%rip), %rsi     # 0x3d8f0
movl $0x2, %ecx
movq %r15, %rdi
xorl %edx, %edx
callq 0x77f0
cmpq $-0x1, %rax
je 0x8dd6
movq %rax, %r14
leaq 0x3140a(%rip), %r12     # 0x3a199
leaq 0x34b5a(%rip), %r13     # 0x3d8f0
movl $0x6, %ecx
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x77a0
subq %r14, %rax
movq %r15, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x7120
movl $0x2, %ecx
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x77f0
movq %rax, %r14
cmpq $-0x1, %rax
jne 0x8d96
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x7260
movq %rax, %rbx
leaq 0x313a4(%rip), %rsi     # 0x3a1a0
movq %rax, %rdi
callq 0x78c0
movq 0x451bd(%rip), %rsi     # 0x4dfc8
movq 0x4519e(%rip), %rdx     # 0x4dfb0
movq %rbx, %rdi
callq 0x77d0
leaq 0x31390(%rip), %rdi     # 0x3a1b1
leaq 0x313c0(%rip), %rsi     # 0x3a1e8
movq %rax, %rdx
xorl %eax, %eax
callq 0x76b0
movq %rax, %r14
movq %rbx, %rdi
callq 0x7390
movq %r14, %rdi
callq 0x7810
nop