// File: /workspace/github_cpp_makefile_star2_O1/menhits[P]phplus/src/AstNode.cpp
// Function: AstToken::resolveAction()
void AstToken::resolveAction()
{
	//error.log("resolveAction called for token "+token->getText(), JSYK, token);
	
	if (token->getType()==TokenData::IDENTIFIER || token->getType()==TokenData::OPERATOR)
	{
		if (token->getOp() && !token->getOp()->isOverloadable())
		{
			throw PhplusError("non overloadable operator in AstToken, it should have been removed and processed by the parser", INTERNAL_ERROR, token);
		}
		
		/*
		if (inLeftType->getType()==TypeBase::TUPLE && inLeftType->getSubType(token->getText()).type!=nullptr)
		{
			if (inRightType->isVoid())
			{
				action=getElemFromTupleAction(inLeftType, token->getText());
				return;
			}
			else
			{
				throw PhplusError("sorry, Phplus does not yet support mutating tuples", SOURCE_ERROR, token);
			}
		}
		*/
		
		action=ns->getActionForTokenWithInput(token, inLeftType, inRightType, dynamic, true, token);
		
		/*
		try
		{
			//error.log("looking for "+token->getText()+" in\n"+ns->getStringWithParents(), JSYK, token);
			action=ns->getActionForTokenWithInput(token, inLeftType, inRightType, dynamic);
		}
		catch (IdNotFoundError err)
		{
			if (token->getType()==TokenData::OPERATOR)
			{
				throw PhplusError("unknown overload for "+inLeftType->getString()+" "+token->getText()+" "+inRightType->getString()+"'", SOURCE_ERROR, token);
			}
			else if (token->getType()==TokenData::IDENTIFIER)
			{
				vector<Action> actions;
				ns->getActions(token->getText(), actions, dynamic);
				
				if (actions.size()>0) // if there are actions with the requested name that didn't match the type
				{
					string posibleInputs="the following is the inputs it can take:";
					
					for (int i=0; i<(int)actions.size(); i++)
					{
						posibleInputs+="\n    ";
						posibleInputs+=actions[i]->getInLeftType()->getString()+" . "+actions[i]->getInRightType()->getString()+" -> "+actions[i]->getReturnType()->getString();
					}
					
					throw PhplusError(
						"'"+token->getText()+"' can not take input of type "+
						inLeftType->getString()+" . "+inRightType->getString()+"\n"+
						posibleInputs,
						SOURCE_ERROR, token);
				}
			}
			
			if (inRightType->getType()==TypeBase::METATYPE)
			{
				throw PhplusError("metatype handeling in "+FUNC+" not yet implemented", INTERNAL_ERROR, token);
			}
			else if (inRightType->isVoid())
			{
				//throw PhplusError("unknown identifier '"+token->getText()+"' (var can not be made bc right in type is "+type->getString()+")", SOURCE_ERROR, token);
				throw PhplusError("unknown identifier '"+token->getText()+"'", SOURCE_ERROR, token);
			}
			else if (!inRightType->isCreatable())
			{
				throw PhplusError("cannot create variable '"+token->getText()+"' of type {"+inRightType->getString()+"}", SOURCE_ERROR, token);
			}
			
			ns->addVar(inRightType, token->getText());
			
			try
			{
				action=ns->getActionForTokenWithInput(token, inLeftType, inRightType, dynamic);
			}
			catch (IdNotFoundError err)
			{
				throw err.toPhplusError(token);
			}
		}
		*/
	}
	else if (token->getType()==TokenData::LITERAL || token->getType()==TokenData::STRING_LITERAL)
	{
		if (!inLeftType->isVoid() || !inRightType->isVoid())
		{
			throw PhplusError("a literal can not be given an input", SOURCE_ERROR, token);
		}
		
		action=resolveLiteral(token);
	}
	else
	{
		throw PhplusError("AstToken givin invalid token '"+token->getText()+"' of type "+TokenData::typeToString(token->getType()), INTERNAL_ERROR, token);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x160, %rsp            # imm = 0x160
movq %rdi, %rbx
movq 0x88(%rdi), %rcx
movl 0x38(%rcx), %eax
leal -0x3(%rax), %edx
cmpl $0x2, %edx
jb 0x13731
cmpl $0x5, %eax
je 0x13712
cmpl $0x2, %eax
jne 0x13a91
movq 0x40(%rcx), %rax
movq 0x48(%rcx), %r14
testq %r14, %r14
je 0x13788
movq 0x85882(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
je 0x13783
incl 0x8(%r14)
jmp 0x13788
movq 0x28(%rbx), %rdi
movq (%rdi), %rax
callq *0x28(%rax)
testb %al, %al
je 0x139a9
movq 0x38(%rbx), %rdi
movq (%rdi), %rax
callq *0x28(%rax)
testb %al, %al
je 0x139a9
movq 0x88(%rbx), %rax
movq %rax, 0x20(%rsp)
movq 0x90(%rbx), %rax
movq %rax, 0x28(%rsp)
testq %rax, %rax
je 0x137ba
movq 0x8582f(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
je 0x137b6
incl 0x8(%rax)
jmp 0x137ba
lock
incl 0x8(%r14)
testq %rax, %rax
je 0x137b2
movq 0x88(%rbx), %rdx
movq 0x40(%rdx), %rcx
movq 0x48(%rdx), %rdi
testq %rdi, %rdi
je 0x1380a
movq 0x85800(%rip), %rdx     # 0x98fa8
cmpb $0x0, (%rdx)
je 0x13806
incl 0x8(%rdi)
jmp 0x1380a
xorl %ebp, %ebp
jmp 0x13812
lock
incl 0x8(%rax)
movq %rsp, %rdi
leaq 0x20(%rsp), %rsi
callq 0x51b7d
movaps (%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, (%rsp)
movq 0x50(%rbx), %rdi
movups %xmm0, 0x48(%rbx)
testq %rdi, %rdi
je 0x137e4
callq 0xdcba
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x137f3
callq 0xdcba
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x13999
jmp 0x13994
lock
incl 0x8(%rdi)
movb 0x24(%rcx), %bpl
xorb $0x1, %bpl
testq %rax, %rax
je 0x13821
testq %rdi, %rdi
je 0x13821
callq 0xdcba
testq %r14, %r14
je 0x1382e
movq %r14, %rdi
callq 0xdcba
testb %bpl, %bpl
jne 0x13a1d
movq 0x70(%rbx), %rsi
movq 0x88(%rbx), %rax
movq %rax, 0x60(%rsp)
movq 0x90(%rbx), %rax
movq %rax, 0x68(%rsp)
testq %rax, %rax
je 0x1386d
movq 0x85749(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
je 0x13869
incl 0x8(%rax)
jmp 0x1386d
lock
incl 0x8(%rax)
movq 0x28(%rbx), %rax
movq %rax, 0x50(%rsp)
movq 0x30(%rbx), %rax
movq %rax, 0x58(%rsp)
testq %rax, %rax
je 0x13899
movq 0x8571d(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
je 0x13895
incl 0x8(%rax)
jmp 0x13899
lock
incl 0x8(%rax)
movq 0x38(%rbx), %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rbx), %rax
movq %rax, 0x48(%rsp)
testq %rax, %rax
je 0x138c5
movq 0x856f1(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
je 0x138c1
incl 0x8(%rax)
jmp 0x138c5
lock
incl 0x8(%rax)
movb 0x68(%rbx), %al
movq 0x88(%rbx), %rcx
movq %rcx, 0x30(%rsp)
movq 0x90(%rbx), %rcx
movq %rcx, 0x38(%rsp)
testq %rcx, %rcx
je 0x138fa
movq 0x856bc(%rip), %rdx     # 0x98fa8
cmpb $0x0, (%rdx)
je 0x138f6
incl 0x8(%rcx)
jmp 0x138fa
lock
incl 0x8(%rcx)
leaq 0x68(%rsp), %r14
leaq 0x58(%rsp), %r15
leaq 0x48(%rsp), %r12
leaq 0x30(%rsp), %r10
movzbl %al, %r9d
movq %rsp, %rdi
leaq 0x60(%rsp), %rdx
leaq 0x50(%rsp), %rcx
leaq 0x40(%rsp), %r8
pushq %r10
pushq $0x1
callq 0x245c8
addq $0x10, %rsp
movaps (%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, (%rsp)
movq 0x50(%rbx), %rdi
movups %xmm0, 0x48(%rbx)
testq %rdi, %rdi
je 0x1394e
callq 0xdcba
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1395d
callq 0xdcba
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x1396c
callq 0xdcba
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x1397b
callq 0xdcba
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x1398a
callq 0xdcba
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x13999
callq 0xdcba
addq $0x160, %rsp            # imm = 0x160
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x38, %edi
callq 0xa1b0
movq %rax, %r14
leaq 0xd0(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x62b81(%rip), %rsi     # 0x7654a
leaq 0x62b9d(%rip), %rdx     # 0x7656d
leaq 0xc0(%rsp), %rdi
callq 0xdf6a
movq 0x88(%rbx), %rax
movq %rax, 0x80(%rsp)
movq 0x90(%rbx), %rax
movq %rax, 0x88(%rsp)
testq %rax, %rax
je 0x13b25
movq 0x8559d(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
jne 0x13b22
lock
incl 0x8(%rax)
jmp 0x13b25
movl $0x38, %edi
callq 0xa1b0
movq %rax, %r14
leaq 0xf0(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x62aae(%rip), %rsi     # 0x764eb
leaq 0x62b05(%rip), %rdx     # 0x76549
leaq 0xe0(%rsp), %rdi
callq 0xdf6a
movq 0x88(%rbx), %rax
movq %rax, 0x90(%rsp)
movq 0x90(%rbx), %rax
movq %rax, 0x98(%rsp)
testq %rax, %rax
je 0x13b62
movq 0x85529(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
jne 0x13b5f
lock
incl 0x8(%rax)
jmp 0x13b62
movl $0x38, %edi
callq 0xa1b0
movq %rax, %r14
movq 0x88(%rbx), %rax
leaq 0xb0(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0xa0(%rsp), %rdi
callq 0xdde2
leaq 0x62a9f(%rip), %rsi     # 0x7656e
leaq 0x120(%rsp), %rdi
leaq 0xa0(%rsp), %rdx
callq 0x1562b
leaq 0x62aa2(%rip), %rsi     # 0x7658d
leaq 0x120(%rsp), %rdi
callq 0xa560
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x13b9f
movups (%rcx), %xmm0
movups %xmm0, (%r12)
jmp 0x13bab
incl 0x8(%rax)
movb $0x1, %bpl
leaq 0xc0(%rsp), %rsi
leaq 0x80(%rsp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x200e4
xorl %ebp, %ebp
leaq 0x82aed(%rip), %rsi     # 0x96638
leaq 0xda6(%rip), %rdx       # 0x148f8
movq %r14, %rdi
callq 0xa4f0
jmp 0x13c59
incl 0x8(%rax)
movb $0x1, %bpl
leaq 0xe0(%rsp), %rsi
leaq 0x90(%rsp), %rcx
movq %r14, %rdi
movl $0x3, %edx
callq 0x200e4
xorl %ebp, %ebp
leaq 0x82aad(%rip), %rsi     # 0x96638
leaq 0xd66(%rip), %rdx       # 0x148f8
movq %r14, %rdi
callq 0xa4f0
jmp 0x13c59
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x88(%rbx), %rax
movl 0x38(%rax), %esi
leaq 0x100(%rsp), %rdi
callq 0x5325e
leaq 0x140(%rsp), %rdi
movq %rsp, %rsi
leaq 0x100(%rsp), %rdx
callq 0x1572b
movq 0x88(%rbx), %rax
movq %rax, 0x70(%rsp)
movq 0x90(%rbx), %rax
movq %rax, 0x78(%rsp)
testq %rax, %rax
je 0x13c24
movq 0x85392(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
jne 0x13c21
lock
incl 0x8(%rax)
jmp 0x13c24
incl 0x8(%rax)
movb $0x1, %bpl
leaq 0x140(%rsp), %rsi
leaq 0x70(%rsp), %rcx
movq %r14, %rdi
movl $0x3, %edx
callq 0x200e4
xorl %ebp, %ebp
leaq 0x829ee(%rip), %rsi     # 0x96638
leaq 0xca7(%rip), %rdx       # 0x148f8
movq %r14, %rdi
callq 0xa4f0
movq %rax, %rbx
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x13c6b
callq 0xdcba
leaq 0x150(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x13c89
callq 0xa2b0
jmp 0x13c89
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x110(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x13ca7
callq 0xa2b0
jmp 0x13ca7
movq %rax, %rbx
movb $0x1, %bpl
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x13cbd
callq 0xa2b0
jmp 0x13cbd
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x130(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x13cdb
callq 0xa2b0
jmp 0x13cdb
movq %rax, %rbx
movb $0x1, %bpl
movq 0xa0(%rsp), %rdi
cmpq %r15, %rdi
je 0x13cf5
callq 0xa2b0
jmp 0x13cf5
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0x13dae
jmp 0x13da6
movq %rax, %rbx
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x13d18
callq 0xdcba
movq 0xe0(%rsp), %rdi
cmpq %r15, %rdi
je 0x13d32
callq 0xa2b0
jmp 0x13d32
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0x13dae
jmp 0x13da6
movq %rax, %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x13dae
callq 0xdcba
jmp 0x13dae
movq %rax, %rbx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x13d5f
callq 0xdcba
movq %rsp, %rcx
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xa5e9
jmp 0x13dae
movq %rax, %rbx
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x13d87
callq 0xdcba
movq 0xc0(%rsp), %rdi
cmpq %r15, %rdi
je 0x13da1
callq 0xa2b0
jmp 0x13da1
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0x13dae
movq %r14, %rdi
callq 0xa240
movq %rbx, %rdi
callq 0xa510