// File: /workspace/github_cpp_makefile_star2_O3/menhits[P]phplus/src/ResolveLiteral.cpp
// Function: resolveLiteral(std::shared_ptr<TokenData>)
Action resolveLiteral(Token token)
{
	if (token->getType()==TokenData::STRING_LITERAL)
	{
		return resolveStringLiteral(token);
	}
	
	if (token->getType()!=TokenData::LITERAL)
	{
		throw PhplusError(FUNC+" called on token that is not a literal", INTERNAL_ERROR, token);
	}
	
	string in=token->getText();
	
	if (in.empty())
		return nullptr;
	
	//bool floatingPoint=false;
	
	Type type=Unknown;
	
	if (in.empty())
	{
		error.log("tried to make literal with empty string", INTERNAL_ERROR, token);
	}
	
	if ((in[0]>='0' && in[0]<='9') || in[0]=='.')
	{
		type=Int;
		
		for (auto i=in.begin(); i!=in.end(); ++i)
		{
			if (*i=='.' || *i=='_')
			{
				type=Dub;
				break;
			}
		}
		
		if (in.back()=='d' || in.back()=='f')
		{
			type=Dub;
			in.pop_back();
		}
		else if (in.back()=='i')
		{
			type=Int;
			in.pop_back();
		}
		else if (in.back()=='b')
		{
			type=Bool;
			in.pop_back();
		}
	}
	
	if (type==Int)
	{
		return resolveIntLiteral(token, type);
	}
	else if (type==Dub) //floating point
	{
		return resolveDubLiteral(token);
	}
	else
	{
		throw PhplusError("tried to make literal with invalid type of " + type->getString(), INTERNAL_ERROR, token);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rax
movl 0x38(%rax), %ecx
cmpl $0x3, %ecx
je 0x52967
cmpl $0x4, %ecx
jne 0x52c9f
movq %rax, 0x78(%rsp)
movq 0x8(%r14), %rax
movq %rax, 0x80(%rsp)
testq %rax, %rax
je 0x529d4
movq 0x4764b(%rip), %rcx     # 0x99fa8
cmpb $0x0, (%rcx)
je 0x529d0
incl 0x8(%rax)
jmp 0x529d4
leaq 0x28(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %r15
movq %r15, %rdi
callq 0xde0c
cmpq $0x0, 0x8(%r15)
je 0x529c5
leaq 0x47a5b(%rip), %rax     # 0x9a3f0
movq (%rax), %rcx
movq 0x8(%rax), %rax
movq %rcx, 0x8(%rsp)
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x52a98
movq 0x475f2(%rip), %r12     # 0x99fa8
cmpb $0x0, (%r12)
je 0x529fc
incl 0x8(%rax)
jmp 0x52a98
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
jmp 0x52c7b
lock
incl 0x8(%rax)
leaq 0x78(%rsp), %rsi
movq %rbx, %rdi
callq 0x5261d
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x52c8a
callq 0xdce4
jmp 0x52c8a
lock
incl 0x8(%rax)
cmpq $0x0, 0x20(%rsp)
jne 0x52a98
leaq 0xd8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x287ee(%rip), %rsi     # 0x7b20d
leaq 0x2880e(%rip), %rdx     # 0x7b234
leaq 0xc8(%rsp), %rdi
callq 0xdfa8
movq (%r14), %rax
movq %rax, 0x68(%rsp)
movq 0x8(%r14), %rax
movq %rax, 0x70(%rsp)
testq %rax, %rax
je 0x52a59
cmpb $0x0, (%r12)
je 0x52a55
incl 0x8(%rax)
jmp 0x52a59
lock
incl 0x8(%rax)
leaq 0x478b3(%rip), %rdi     # 0x9a313
leaq 0xc8(%rsp), %rsi
leaq 0x68(%rsp), %rcx
movl $0x3, %edx
callq 0x1fc46
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x52a86
callq 0xdce4
movq 0xc8(%rsp), %rdi
cmpq %r15, %rdi
je 0x52a98
callq 0xa2b0
movq 0x18(%rsp), %rax
movb (%rax), %al
cmpb $0x30, %al
jl 0x52aac
cmpb $0x3a, %al
jb 0x52ab4
jmp 0x52b83
cmpb $0x2e, %al
jne 0x52b83
leaq 0x10(%rsp), %r15
leaq 0x47980(%rip), %rbp     # 0x9a440
movq (%rbp), %rax
movq %rax, -0x8(%r15)
leaq 0x8(%rbp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0xdea2
movq 0x18(%rsp), %rax
movq 0x20(%rsp), %rcx
testq %rcx, %rcx
je 0x52b27
xorl %edx, %edx
movzbl (%rax,%rdx), %esi
cmpl $0x5f, %esi
je 0x52b00
cmpl $0x2e, %esi
je 0x52b00
incq %rdx
cmpq %rdx, %rcx
jne 0x52ae8
jmp 0x52b29
leaq 0x47949(%rip), %rsi     # 0x9a450
movq (%rsi), %rax
movq %rax, 0x8(%rsp)
addq $0x8, %rsi
movq %r15, %rdi
callq 0xdea2
movq 0x18(%rsp), %rax
movq 0x20(%rsp), %rcx
jmp 0x52b29
xorl %ecx, %ecx
movzbl -0x1(%rax,%rcx), %eax
addl $-0x62, %eax
cmpl $0x7, %eax
ja 0x52b83
leaq 0x2860b(%rip), %rcx     # 0x7b148
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x47903(%rip), %r12     # 0x9a450
jmp 0x52b56
leaq 0x478ca(%rip), %r12     # 0x9a420
movq (%r12), %rax
movq %rax, 0x8(%rsp)
addq $0x8, %r12
jmp 0x52b6e
movq (%rbp), %rax
movq %rax, 0x8(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0xdea2
leaq 0x18(%rsp), %rdi
callq 0xa360
movq 0x8(%rsp), %rax
leaq 0x478b1(%rip), %rcx     # 0x9a440
cmpq (%rcx), %rax
je 0x52bcb
leaq 0x478b5(%rip), %rcx     # 0x9a450
cmpq (%rcx), %rax
jne 0x52d0b
movq (%r14), %rax
movq %rax, 0x38(%rsp)
movq 0x8(%r14), %rax
movq %rax, 0x40(%rsp)
testq %rax, %rax
je 0x52bf6
movq 0x473e7(%rip), %rcx     # 0x99fa8
cmpb $0x0, (%rcx)
je 0x52bf2
incl 0x8(%rax)
jmp 0x52bf6
movq (%r14), %rcx
movq %rcx, 0x58(%rsp)
movq 0x8(%r14), %rcx
movq %rcx, 0x60(%rsp)
testq %rcx, %rcx
je 0x52c13
movq 0x473c0(%rip), %rdx     # 0x99fa8
cmpb $0x0, (%rdx)
je 0x52c0a
incl 0x8(%rcx)
jmp 0x52c13
lock
incl 0x8(%rax)
leaq 0x38(%rsp), %rsi
movq %rbx, %rdi
callq 0x51df2
movq 0x40(%rsp), %rdi
jmp 0x52c62
lock
incl 0x8(%rcx)
movq 0x8(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x50(%rsp)
testq %rax, %rax
je 0x52c3c
movq 0x4737a(%rip), %rcx     # 0x99fa8
cmpb $0x0, (%rcx)
je 0x52c38
incl 0x8(%rax)
jmp 0x52c3c
lock
incl 0x8(%rax)
leaq 0x58(%rsp), %rsi
leaq 0x48(%rsp), %rdx
movq %rbx, %rdi
callq 0x51764
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x52c5d
callq 0xdce4
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x52c6c
callq 0xdce4
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x52c7b
callq 0xdce4
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x52c8a
callq 0xa2b0
movq %rbx, %rax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x38, %edi
callq 0xa1b0
movq %rax, %r15
leaq 0x28(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x2851a(%rip), %rsi     # 0x7b1d7
leaq 0x28521(%rip), %rdx     # 0x7b1e5
leaq 0x18(%rsp), %rdi
callq 0xdfa8
leaq 0x28511(%rip), %rsi     # 0x7b1e6
leaq 0x18(%rsp), %rdi
callq 0xa560
leaq 0xb8(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x52d80
movups (%rcx), %xmm0
movups %xmm0, (%r13)
jmp 0x52d93
movl $0x38, %edi
callq 0xa1b0
movq %rax, %r15
movq 0x8(%rsp), %rsi
movq (%rsi), %rax
leaq 0xe8(%rsp), %rdi
callq *0x8(%rax)
leaq 0x28503(%rip), %rsi     # 0x7b235
leaq 0x108(%rsp), %rdi
leaq 0xe8(%rsp), %rdx
callq 0x158ca
movq (%r14), %rax
movq %rax, 0x88(%rsp)
movq 0x8(%r14), %rax
movq %rax, 0x90(%rsp)
testq %rax, %rax
je 0x52e1c
movq 0x4723a(%rip), %rcx     # 0x99fa8
cmpb $0x0, (%rcx)
jne 0x52e19
lock
incl 0x8(%rax)
jmp 0x52e1c
movq %rdx, 0xa8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xb8(%rsp)
movq 0x8(%rax), %rdx
movq %rdx, 0xb0(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq (%r14), %rax
movq %rax, 0x98(%rsp)
movq 0x8(%r14), %rax
movq %rax, 0xa0(%rsp)
testq %rax, %rax
je 0x52ddf
movq 0x471d7(%rip), %rcx     # 0x99fa8
cmpb $0x0, (%rcx)
jne 0x52ddc
lock
incl 0x8(%rax)
jmp 0x52ddf
incl 0x8(%rax)
movb $0x1, %bpl
leaq 0xa8(%rsp), %rsi
leaq 0x98(%rsp), %rcx
movq %r15, %rdi
movl $0x3, %edx
callq 0x203f4
xorl %ebp, %ebp
leaq 0x44830(%rip), %rsi     # 0x97638
leaq -0x3e2e9(%rip), %rdx    # 0x14b26
movq %r15, %rdi
callq 0xa4f0
jmp 0x52e54
incl 0x8(%rax)
movb $0x1, %bpl
leaq 0x108(%rsp), %rsi
leaq 0x88(%rsp), %rcx
movq %r15, %rdi
movl $0x3, %edx
callq 0x203f4
xorl %ebp, %ebp
leaq 0x447f3(%rip), %rsi     # 0x97638
leaq -0x3e326(%rip), %rdx    # 0x14b26
movq %r15, %rdi
callq 0xa4f0
movq %rax, %rbx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x52e66
callq 0xdce4
movq 0xc8(%rsp), %rdi
cmpq %r15, %rdi
je 0x52f78
callq 0xa2b0
jmp 0x52f78
movq %rax, %rbx
jmp 0x52f78
movq %rax, %rbx
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x52e9e
callq 0xdce4
leaq 0x118(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x52eb4
callq 0xa2b0
leaq 0xf8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x52eca
callq 0xa2b0
testb %bpl, %bpl
jne 0x52ef2
jmp 0x52f78
movq %rax, %rbx
leaq 0xf8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x52ef2
callq 0xa2b0
jmp 0x52ef2
movq %rax, %rbx
movq %r15, %rdi
callq 0xa240
jmp 0x52f78
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x52f0e
callq 0xdce4
movq 0x60(%rsp), %rdi
jmp 0x52f6e
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x52f2a
callq 0xdce4
movq 0xa8(%rsp), %rdi
cmpq %r13, %rdi
je 0x52f3c
callq 0xa2b0
movq 0x18(%rsp), %rdi
cmpq %r12, %rdi
je 0x52f4b
callq 0xa2b0
testb %bpl, %bpl
jne 0x52f9b
jmp 0x52fba
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %r12, %rdi
je 0x52f9b
callq 0xa2b0
jmp 0x52f9b
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x52f78
callq 0xdce4
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x52f87
callq 0xdce4
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x52fba
callq 0xa2b0
jmp 0x52fba
movq %rax, %rbx
movq %r15, %rdi
callq 0xa240
jmp 0x52fba
movq %rax, %rbx
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x52fba
callq 0xdce4
movq %rbx, %rdi
callq 0xa510
nop