// File: /workspace/github_cpp_makefile_star2_O1/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 0x51bcf
cmpl $0x4, %ecx
jne 0x51f00
movq %rax, 0x78(%rsp)
movq 0x8(%r14), %rax
movq %rax, 0x80(%rsp)
testq %rax, %rax
je 0x51c33
movq 0x473e3(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
je 0x51c2f
incl 0x8(%rax)
jmp 0x51c33
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 0xdde2
cmpq $0x0, 0x8(%r15)
je 0x51c24
leaq 0x477f3(%rip), %rax     # 0x993f0
movq (%rax), %rcx
movq 0x8(%rax), %rax
movq %rcx, 0x8(%rsp)
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x51c5f
movq 0x4738e(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
je 0x51c5b
incl 0x8(%rax)
jmp 0x51c5f
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
jmp 0x51edc
lock
incl 0x8(%rax)
leaq 0x78(%rsp), %rsi
movq %rbx, %rdi
callq 0x51889
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x51eeb
callq 0xdcba
jmp 0x51eeb
lock
incl 0x8(%rax)
cmpq $0x0, 0x20(%rsp)
jne 0x51cfc
leaq 0xd8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x285cf(%rip), %rsi     # 0x7a24d
leaq 0x285ef(%rip), %rdx     # 0x7a274
leaq 0xc8(%rsp), %rdi
callq 0xdf6a
movq (%r14), %rax
movq %rax, 0x68(%rsp)
movq 0x8(%r14), %rax
movq %rax, 0x70(%rsp)
testq %rax, %rax
je 0x51cbd
movq 0x472f9(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
je 0x51cb9
incl 0x8(%rax)
jmp 0x51cbd
lock
incl 0x8(%rax)
leaq 0x4764f(%rip), %rdi     # 0x99313
leaq 0xc8(%rsp), %rsi
leaq 0x68(%rsp), %rcx
movl $0x3, %edx
callq 0x1f926
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x51cea
callq 0xdcba
movq 0xc8(%rsp), %rdi
cmpq %r15, %rdi
je 0x51cfc
callq 0xa2b0
movq 0x18(%rsp), %rax
movb (%rax), %al
leal -0x30(%rax), %ecx
cmpb $0xa, %cl
setae %cl
cmpb $0x2e, %al
setne %al
testb %cl, %al
jne 0x51de4
leaq 0x10(%rsp), %r15
leaq 0x4771b(%rip), %rbp     # 0x99440
movq (%rbp), %rax
movq %rax, -0x8(%r15)
leaq 0x8(%rbp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0xde72
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x51d80
movq 0x18(%rsp), %rcx
xorl %edx, %edx
movzbl (%rcx,%rdx), %esi
cmpl $0x5f, %esi
je 0x51d65
cmpl $0x2e, %esi
je 0x51d65
incq %rdx
cmpq %rdx, %rax
jne 0x51d4d
jmp 0x51d80
leaq 0x476e4(%rip), %rsi     # 0x99450
movq (%rsi), %rax
movq %rax, 0x8(%rsp)
addq $0x8, %rsi
movq %r15, %rdi
callq 0xde72
movq 0x18(%rsp), %rax
movq 0x20(%rsp), %rcx
movzbl -0x1(%rax,%rcx), %eax
addl $-0x62, %eax
cmpl $0x7, %eax
ja 0x51de4
leaq 0x283ea(%rip), %rcx     # 0x7a188
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x476a2(%rip), %r12     # 0x99450
jmp 0x51db7
leaq 0x47669(%rip), %r12     # 0x99420
movq (%r12), %rax
movq %rax, 0x8(%rsp)
addq $0x8, %r12
jmp 0x51dcf
movq (%rbp), %rax
movq %rax, 0x8(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0xde72
leaq 0x18(%rsp), %rdi
callq 0xa360
movq 0x8(%rsp), %rax
leaq 0x47650(%rip), %rcx     # 0x99440
cmpq (%rcx), %rax
je 0x51e2c
leaq 0x47654(%rip), %rcx     # 0x99450
cmpq (%rcx), %rax
jne 0x51f6c
movq (%r14), %rax
movq %rax, 0x38(%rsp)
movq 0x8(%r14), %rax
movq %rax, 0x40(%rsp)
testq %rax, %rax
je 0x51e57
movq 0x47186(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
je 0x51e53
incl 0x8(%rax)
jmp 0x51e57
movq (%r14), %rax
movq %rax, 0x58(%rsp)
movq 0x8(%r14), %rax
movq %rax, 0x60(%rsp)
testq %rax, %rax
je 0x51e6f
movq 0x4715f(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
je 0x51e6b
incl 0x8(%rax)
jmp 0x51e6f
lock
incl 0x8(%rax)
leaq 0x38(%rsp), %rsi
movq %rbx, %rdi
callq 0x5105e
movq 0x40(%rsp), %rdi
jmp 0x51ec3
lock
incl 0x8(%rax)
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x48(%rsp)
movq %rax, 0x50(%rsp)
testq %rax, %rax
je 0x51e9d
movq 0x47119(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
je 0x51e99
incl 0x8(%rax)
jmp 0x51e9d
lock
incl 0x8(%rax)
leaq 0x58(%rsp), %rsi
leaq 0x48(%rsp), %rdx
movq %rbx, %rdi
callq 0x509d0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x51ebe
callq 0xdcba
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x51ecd
callq 0xdcba
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x51edc
callq 0xdcba
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x51eeb
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 0x282f9(%rip), %rsi     # 0x7a217
leaq 0x28300(%rip), %rdx     # 0x7a225
leaq 0x18(%rsp), %rdi
callq 0xdf6a
leaq 0x282f0(%rip), %rsi     # 0x7a226
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 0x51fe1
movups (%rcx), %xmm0
movups %xmm0, (%r13)
jmp 0x51ff4
movl $0x38, %edi
callq 0xa1b0
movq %rax, %r15
movq 0x8(%rsp), %rsi
movq (%rsi), %rax
leaq 0xe8(%rsp), %rdi
callq *0x8(%rax)
leaq 0x282e2(%rip), %rsi     # 0x7a275
leaq 0x108(%rsp), %rdi
leaq 0xe8(%rsp), %rdx
callq 0x1562b
movq (%r14), %rax
movq %rax, 0x88(%rsp)
movq 0x8(%r14), %rax
movq %rax, 0x90(%rsp)
testq %rax, %rax
je 0x5207d
movq 0x46fd9(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
jne 0x5207a
lock
incl 0x8(%rax)
jmp 0x5207d
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 0x52040
movq 0x46f76(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
jne 0x5203d
lock
incl 0x8(%rax)
jmp 0x52040
incl 0x8(%rax)
movb $0x1, %bpl
leaq 0xa8(%rsp), %rsi
leaq 0x98(%rsp), %rcx
movq %r15, %rdi
movl $0x3, %edx
callq 0x200e4
xorl %ebp, %ebp
leaq 0x445cf(%rip), %rsi     # 0x96638
leaq -0x3d778(%rip), %rdx    # 0x148f8
movq %r15, %rdi
callq 0xa4f0
jmp 0x520b5
incl 0x8(%rax)
movb $0x1, %bpl
leaq 0x108(%rsp), %rsi
leaq 0x88(%rsp), %rcx
movq %r15, %rdi
movl $0x3, %edx
callq 0x200e4
xorl %ebp, %ebp
leaq 0x44592(%rip), %rsi     # 0x96638
leaq -0x3d7b5(%rip), %rdx    # 0x148f8
movq %r15, %rdi
callq 0xa4f0
movq %rax, %rbx
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x520ca
callq 0xdcba
leaq 0x118(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x520e8
callq 0xa2b0
jmp 0x520e8
movq %rax, %rbx
movb $0x1, %bpl
leaq 0xf8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x52106
callq 0xa2b0
jmp 0x52106
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0x521b2
movq %r15, %rdi
callq 0xa240
jmp 0x521b2
movq %rax, %rbx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x5212e
callq 0xdcba
movq 0xc8(%rsp), %rdi
cmpq %r15, %rdi
je 0x521b2
callq 0xa2b0
jmp 0x521b2
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x52154
callq 0xdcba
movq 0x60(%rsp), %rdi
jmp 0x521a8
movq %rax, %rbx
jmp 0x521b2
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x52175
callq 0xdcba
movq 0xa8(%rsp), %rdi
cmpq %r13, %rdi
je 0x5218f
callq 0xa2b0
jmp 0x5218f
movq %rax, %rbx
movb $0x1, %bpl
movq 0x18(%rsp), %rdi
cmpq %r12, %rdi
je 0x521d8
callq 0xa2b0
jmp 0x521d8
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x521b2
callq 0xdcba
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x521c1
callq 0xdcba
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x521fc
callq 0xa2b0
jmp 0x521fc
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0x521fc
movq %r15, %rdi
callq 0xa240
jmp 0x521fc
movq %rax, %rbx
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x521fc
callq 0xdcba
movq %rbx, %rdi
callq 0xa510