// File: /workspace/github_cpp_makefile_star2_O1/llefranc[P]42_webserv/srcs/server/Request.cpp
// Function: Request::parseMethodToken(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void Request::parseMethodToken(const std::string& token)
{
	std::string methods[NB_METHODS] = {"GET", "HEAD", "POST", "DELETE"};
	
	for (int i = 0; i < NB_METHODS; ++i)
	{
		// Token should exactly match one of the five methods
		if (!token.compare(_index, methods[i].size(), methods[i]) &&
				token.size() == methods[i].size())
		{
			_reqLine.setMethod(i);
			return ;
		}
	}

	throw StatusLine(400, REASON_400, "unknown method");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq -0xc0(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x7f24(%rip), %rsi      # 0x15be4
leaq 0x7f20(%rip), %rdx      # 0x15be7
leaq -0xd0(%rbp), %r12
movq %r12, %rdi
callq 0x5790
leaq -0xb0(%rbp), %r15
leaq -0xa0(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x7a9d(%rip), %rsi      # 0x1578c
leaq 0x7a9a(%rip), %rdx      # 0x15790
movq %r15, %rdi
callq 0x5790
leaq -0x90(%rbp), %r15
leaq -0x80(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x7f01(%rip), %rsi      # 0x15c15
leaq 0x7efe(%rip), %rdx      # 0x15c19
movq %r15, %rdi
callq 0x5790
leaq -0x70(%rbp), %r15
leaq -0x60(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x7530(%rip), %rsi      # 0x15266
leaq 0x752f(%rip), %rdx      # 0x1526c
movq %r15, %rdi
callq 0x5790
leaq -0xd0(%rbp), %r15
xorl %r12d, %r12d
movq 0x20(%rbx), %rsi
movq 0x8(%r15), %rdx
movq %r14, %rdi
movq %r15, %rcx
callq 0x44f0
testl %eax, %eax
jne 0xdd70
movq 0x8(%r14), %rax
cmpq 0x8(%r15), %rax
je 0xddde
incq %r12
addq $0x20, %r15
cmpq $0x4, %r12
jne 0xdd4f
movl $0x48, %edi
callq 0x41f0
movq %rax, %r14
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x79f7(%rip), %rsi      # 0x15791
leaq 0x79fe(%rip), %rdx      # 0x1579f
leaq -0x48(%rbp), %rdi
callq 0x5790
movb $0x1, %r15b
leaq 0x7838(%rip), %rdx      # 0x155ec
leaq -0x48(%rbp), %rcx
movq %r14, %rdi
movl $0x190, %esi            # imm = 0x190
callq 0xe106
xorl %r15d, %r15d
leaq 0xefa1(%rip), %rsi      # 0x1cd70
leaq 0x39e(%rip), %rdx       # 0xe174
movq %r14, %rdi
callq 0x46a0
movl %r12d, 0x30(%rbx)
movq $-0x80, %rbx
movq -0x10(%r13), %rdi
cmpq %rdi, %r13
je 0xddfe
movq (%r13), %rsi
incq %rsi
callq 0x43e0
addq $-0x20, %r13
addq $0x20, %rbx
jne 0xdde9
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xde1e
jmp 0xde1e
movq %rax, %rbx
jmp 0xde29
movq %rax, %rbx
movq %r12, %r15
cmpq %r15, %r12
je 0xdebb
addq $-0x10, %r15
leaq -0xd0(%rbp), %r14
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0xde51
movq (%r15), %rsi
incq %rsi
callq 0x43e0
leaq -0x20(%r15), %rax
addq $-0x10, %r15
cmpq %r14, %r15
movq %rax, %r15
jne 0xde3d
jmp 0xdebb
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0xde83
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x43e0
jmp 0xde83
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0xde95
movq %r14, %rdi
callq 0x42e0
jmp 0xde95
movq %rax, %rbx
xorl %r14d, %r14d
movq -0x70(%rbp,%r14), %rdi
leaq (%r14,%r13), %rax
cmpq %rdi, %rax
je 0xdeb1
movq (%rax), %rsi
incq %rsi
callq 0x43e0
addq $-0x20, %r14
cmpq $-0x80, %r14
jne 0xde98
movq %rbx, %rdi
callq 0x46d0
nop