// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rsi
movl 0x38(%rsi), %eax
cmpl $0x3, %eax
je 0x3c0d5
cmpl $0x4, %eax
jne 0x3c2bf
leaq 0x78(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x12e2e
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3bea1
leaq 0x80(%rsp), %rdi
callq 0xc984
jmp 0x3c2ae
leaq 0x18(%rsp), %r15
movq %r15, %rdi
callq 0xa3b0
cmpq $0x0, 0x8(%r15)
je 0x3c177
leaq 0x3e2dc(%rip), %rsi     # 0x7a3d0
leaq 0x8(%rsp), %rdi
callq 0x12c0a
cmpq $0x0, 0x20(%rsp)
jne 0x3c163
leaq 0x1c0f8(%rip), %rsi     # 0x58205
leaq 0xb8(%rsp), %rdi
leaq 0x88(%rsp), %rdx
callq 0xa150
leaq 0x68(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x12e2e
leaq 0x3e1c2(%rip), %rdi     # 0x7a2fb
leaq 0xb8(%rsp), %rsi
pushq $0x3
popq %rdx
movq %r15, %rcx
callq 0x19a6e
leaq 0x70(%rsp), %rdi
callq 0xc984
leaq 0xb8(%rsp), %rdi
callq 0xa558
movq 0x18(%rsp), %rax
movb (%rax), %al
cmpb $0x30, %al
jl 0x3c182
cmpb $0x3a, %al
jb 0x3c18a
jmp 0x3c210
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
jmp 0x3c2a4
cmpb $0x2e, %al
jne 0x3c210
leaq 0x3e28f(%rip), %rsi     # 0x7a420
leaq 0x8(%rsp), %rdi
callq 0x12ba2
movq 0x18(%rsp), %rax
movq 0x20(%rsp), %rcx
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x3c1da
movzbl (%rax,%rdx), %esi
cmpl $0x5f, %esi
je 0x3c1bf
cmpl $0x2e, %esi
je 0x3c1bf
incq %rdx
jmp 0x3c1a7
leaq 0x3e26a(%rip), %rsi     # 0x7a430
leaq 0x8(%rsp), %rdi
callq 0x12ba2
movq 0x18(%rsp), %rax
movq 0x20(%rsp), %rcx
movb -0x1(%rax,%rcx), %al
addb $-0x62, %al
cmpb $0x7, %al
ja 0x3c210
movzbl %al, %eax
movl $0x95, %ecx
btl %eax, %ecx
jae 0x3c210
leaq 0x3c728(%rip), %rcx     # 0x78920
movq (%rcx,%rax,8), %rsi
leaq 0x8(%rsp), %rdi
callq 0x12ba2
leaq 0x18(%rsp), %rdi
callq 0xa340
movq 0x8(%rsp), %rax
leaq 0x3e204(%rip), %rcx     # 0x7a420
cmpq (%rcx), %rax
je 0x3c253
leaq 0x3e208(%rip), %rcx     # 0x7a430
cmpq (%rcx), %rax
jne 0x3c342
leaq 0x38(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x12e2e
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3ba9b
leaq 0x40(%rsp), %r14
jmp 0x3c292
leaq 0x58(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x12e2e
leaq 0x48(%rsp), %r14
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x12c0a
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x3b738
leaq 0x60(%rsp), %r14
leaq 0x50(%rsp), %rdi
callq 0xc984
movq %r14, %rdi
callq 0xc984
leaq 0x10(%rsp), %rdi
callq 0xc984
leaq 0x18(%rsp), %rdi
callq 0xa558
movq %rbx, %rax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
pushq $0x38
popq %rdi
callq 0xa1b0
movq %rax, %r15
leaq 0x1befe(%rip), %rsi     # 0x581cf
leaq 0x18(%rsp), %rdi
leaq 0x88(%rsp), %rdx
callq 0xa150
leaq 0x1bef4(%rip), %rdx     # 0x581de
leaq 0x108(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xc882
leaq 0xd8(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x12e2e
movb $0x1, %bpl
leaq 0x108(%rsp), %rsi
pushq $0x3
popq %rdx
movq %r15, %rdi
movq %rbx, %rcx
callq 0x19f06
xorl %ebp, %ebp
leaq 0x3b267(%rip), %rsi     # 0x77598
leaq -0x2aca6(%rip), %rdx    # 0x11692
movq %r15, %rdi
callq 0xa4e0
jmp 0x3c3c0
pushq $0x38
popq %rdi
callq 0xa1b0
movq %rax, %r15
movq 0x8(%rsp), %rsi
movq (%rsi), %rax
leaq 0x88(%rsp), %rdi
callq *0x8(%rax)
leaq 0x1bec6(%rip), %rsi     # 0x5822d
leaq 0xe8(%rsp), %rdi
leaq 0x88(%rsp), %rdx
callq 0x11ff8
leaq 0xa8(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x12e2e
movb $0x1, %bpl
leaq 0xe8(%rsp), %rsi
pushq $0x3
popq %rdx
movq %r15, %rdi
movq %rbx, %rcx
callq 0x19f06
xorl %ebp, %ebp
leaq 0x3b1e7(%rip), %rsi     # 0x77598
leaq -0x2ad26(%rip), %rdx    # 0x11692
movq %r15, %rdi
callq 0xa4e0
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0xc984
leaq 0xe8(%rsp), %rdi
callq 0xa558
jmp 0x3c3e5
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x88(%rsp), %rdi
callq 0xa558
testb %bpl, %bpl
jne 0x3c3ff
jmp 0x3c481
movq %rax, %rbx
movq %r15, %rdi
callq 0xa230
jmp 0x3c481
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0xc984
leaq 0xb8(%rsp), %rdi
callq 0xa558
jmp 0x3c481
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0xc984
leaq 0x60(%rsp), %rdi
jmp 0x3c47c
movq %rax, %rbx
jmp 0x3c481
movq %rax, %rbx
leaq 0xe0(%rsp), %rdi
callq 0xc984
leaq 0x108(%rsp), %rdi
callq 0xa558
jmp 0x3c463
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x18(%rsp), %rdi
callq 0xa558
testb %bpl, %bpl
jne 0x3c49a
jmp 0x3c4b4
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0xc984
leaq 0x10(%rsp), %rdi
callq 0xc984
leaq 0x18(%rsp), %rdi
callq 0xa558
jmp 0x3c4b4
movq %rax, %rbx
movq %r15, %rdi
callq 0xa230
jmp 0x3c4b4
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0xc984
movq %rbx, %rdi
callq 0xa500