// File: /workspace/github_cpp_makefile_star2_O3/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), %rax
movl 0x38(%rax), %ecx
leal -0x3(%rcx), %edx
cmpl $0x2, %edx
jb 0x13909
cmpl $0x5, %ecx
je 0x138ea
cmpl $0x2, %ecx
jne 0x13c69
movq 0x40(%rax), %rcx
movq 0x48(%rax), %r14
testq %r14, %r14
je 0x13960
movq 0x866aa(%rip), %rax     # 0x99fa8
cmpb $0x0, (%rax)
je 0x1395b
incl 0x8(%r14)
jmp 0x13960
movq 0x28(%rbx), %rdi
movq (%rdi), %rax
callq *0x28(%rax)
testb %al, %al
je 0x13b81
movq 0x38(%rbx), %rdi
movq (%rdi), %rax
callq *0x28(%rax)
testb %al, %al
je 0x13b81
movq 0x88(%rbx), %rax
movq %rax, 0x20(%rsp)
movq 0x90(%rbx), %rax
movq %rax, 0x28(%rsp)
testq %rax, %rax
je 0x1399c
movq 0x86657(%rip), %rcx     # 0x99fa8
cmpb $0x0, (%rcx)
je 0x13998
incl 0x8(%rax)
jmp 0x1399c
lock
incl 0x8(%r14)
testq %rcx, %rcx
je 0x1398a
movq 0x88(%rbx), %rcx
movq 0x40(%rcx), %rax
movq 0x48(%rcx), %rdi
testq %rdi, %rdi
je 0x1398e
movq 0x86628(%rip), %rcx     # 0x99fa8
cmpb $0x0, (%rcx)
je 0x139e8
incl 0x8(%rdi)
jmp 0x139ec
xorl %ebp, %ebp
jmp 0x139f9
movb 0x24(%rax), %bpl
xorb $0x1, %bpl
jmp 0x139f9
lock
incl 0x8(%rax)
movq %rsp, %rdi
leaq 0x20(%rsp), %rsi
callq 0x52915
movaps (%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, (%rsp)
movq 0x50(%rbx), %rdi
movups %xmm0, 0x48(%rbx)
testq %rdi, %rdi
je 0x139d5
callq 0xdce4
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x139d5
callq 0xdce4
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x13b71
jmp 0x13b6c
lock
incl 0x8(%rdi)
movb 0x24(%rax), %bpl
xorb $0x1, %bpl
callq 0xdce4
testq %r14, %r14
je 0x13a06
movq %r14, %rdi
callq 0xdce4
testb %bpl, %bpl
jne 0x13bf5
movq 0x70(%rbx), %rsi
movq 0x88(%rbx), %rax
movq %rax, 0x60(%rsp)
movq 0x90(%rbx), %rax
movq %rax, 0x68(%rsp)
testq %rax, %rax
je 0x13a45
movq 0x86571(%rip), %rcx     # 0x99fa8
cmpb $0x0, (%rcx)
je 0x13a41
incl 0x8(%rax)
jmp 0x13a45
lock
incl 0x8(%rax)
movq 0x28(%rbx), %rax
movq %rax, 0x50(%rsp)
movq 0x30(%rbx), %rax
movq %rax, 0x58(%rsp)
testq %rax, %rax
je 0x13a71
movq 0x86545(%rip), %rcx     # 0x99fa8
cmpb $0x0, (%rcx)
je 0x13a6d
incl 0x8(%rax)
jmp 0x13a71
lock
incl 0x8(%rax)
movq 0x38(%rbx), %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rbx), %rax
movq %rax, 0x48(%rsp)
testq %rax, %rax
je 0x13a9d
movq 0x86519(%rip), %rcx     # 0x99fa8
cmpb $0x0, (%rcx)
je 0x13a99
incl 0x8(%rax)
jmp 0x13a9d
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 0x13ad2
movq 0x864e4(%rip), %rdx     # 0x99fa8
cmpb $0x0, (%rdx)
je 0x13ace
incl 0x8(%rcx)
jmp 0x13ad2
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 0x247ec
addq $0x10, %rsp
movaps (%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, (%rsp)
movq 0x50(%rbx), %rdi
movups %xmm0, 0x48(%rbx)
testq %rdi, %rdi
je 0x13b35
callq 0xdce4
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x13b35
callq 0xdce4
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x13b44
callq 0xdce4
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x13b53
callq 0xdce4
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x13b62
callq 0xdce4
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x13b71
callq 0xdce4
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 0x639a9(%rip), %rsi     # 0x7754a
leaq 0x639c5(%rip), %rdx     # 0x7756d
leaq 0xc0(%rsp), %rdi
callq 0xdfa8
movq 0x88(%rbx), %rax
movq %rax, 0x80(%rsp)
movq 0x90(%rbx), %rax
movq %rax, 0x88(%rsp)
testq %rax, %rax
je 0x13cfd
movq 0x863c5(%rip), %rcx     # 0x99fa8
cmpb $0x0, (%rcx)
jne 0x13cfa
lock
incl 0x8(%rax)
jmp 0x13cfd
movl $0x38, %edi
callq 0xa1b0
movq %rax, %r14
leaq 0xf0(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x638d6(%rip), %rsi     # 0x774eb
leaq 0x6392d(%rip), %rdx     # 0x77549
leaq 0xe0(%rsp), %rdi
callq 0xdfa8
movq 0x88(%rbx), %rax
movq %rax, 0x90(%rsp)
movq 0x90(%rbx), %rax
movq %rax, 0x98(%rsp)
testq %rax, %rax
je 0x13d3a
movq 0x86351(%rip), %rcx     # 0x99fa8
cmpb $0x0, (%rcx)
jne 0x13d37
lock
incl 0x8(%rax)
jmp 0x13d3a
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 0xde0c
leaq 0x638c7(%rip), %rsi     # 0x7756e
leaq 0x120(%rsp), %rdi
leaq 0xa0(%rsp), %rdx
callq 0x158ca
leaq 0x638ca(%rip), %rsi     # 0x7758d
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 0x13d77
movups (%rcx), %xmm0
movups %xmm0, (%r12)
jmp 0x13d83
incl 0x8(%rax)
movb $0x1, %bpl
leaq 0xc0(%rsp), %rsi
leaq 0x80(%rsp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x203f4
xorl %ebp, %ebp
leaq 0x83915(%rip), %rsi     # 0x97638
leaq 0xdfc(%rip), %rdx       # 0x14b26
movq %r14, %rdi
callq 0xa4f0
jmp 0x13e31
incl 0x8(%rax)
movb $0x1, %bpl
leaq 0xe0(%rsp), %rsi
leaq 0x90(%rsp), %rcx
movq %r14, %rdi
movl $0x3, %edx
callq 0x203f4
xorl %ebp, %ebp
leaq 0x838d5(%rip), %rsi     # 0x97638
leaq 0xdbc(%rip), %rdx       # 0x14b26
movq %r14, %rdi
callq 0xa4f0
jmp 0x13e31
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 0x53fba
leaq 0x140(%rsp), %rdi
movq %rsp, %rsi
leaq 0x100(%rsp), %rdx
callq 0x159ca
movq 0x88(%rbx), %rax
movq %rax, 0x70(%rsp)
movq 0x90(%rbx), %rax
movq %rax, 0x78(%rsp)
testq %rax, %rax
je 0x13dfc
movq 0x861ba(%rip), %rcx     # 0x99fa8
cmpb $0x0, (%rcx)
jne 0x13df9
lock
incl 0x8(%rax)
jmp 0x13dfc
incl 0x8(%rax)
movb $0x1, %bpl
leaq 0x140(%rsp), %rsi
leaq 0x70(%rsp), %rcx
movq %r14, %rdi
movl $0x3, %edx
callq 0x203f4
xorl %ebp, %ebp
leaq 0x83816(%rip), %rsi     # 0x97638
leaq 0xcfd(%rip), %rdx       # 0x14b26
movq %r14, %rdi
callq 0xa4f0
movq %rax, %rbx
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x13e43
callq 0xdce4
leaq 0x150(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x13e61
callq 0xa2b0
jmp 0x13e61
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x110(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x13e7f
callq 0xa2b0
jmp 0x13e7f
movq %rax, %rbx
movb $0x1, %bpl
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x13e95
callq 0xa2b0
jmp 0x13e95
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x130(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x13eab
callq 0xa2b0
movq 0xa0(%rsp), %rdi
cmpq %r15, %rdi
je 0x13ebd
callq 0xa2b0
testb %bpl, %bpl
jne 0x13edc
jmp 0x13f8b
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
cmpq %r15, %rdi
je 0x13edc
callq 0xa2b0
jmp 0x13f83
jmp 0x13f80
movq %rax, %rbx
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x13efb
callq 0xdce4
movq 0xe0(%rsp), %rdi
cmpq %r15, %rdi
je 0x13f0d
callq 0xa2b0
testb %bpl, %bpl
jne 0x13f17
jmp 0x13f8b
movq %rax, %rbx
jmp 0x13f83
movq %rax, %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x13f8b
callq 0xdce4
jmp 0x13f8b
movq %rax, %rbx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x13f3f
callq 0xdce4
movq %rsp, %rcx
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xa5c9
jmp 0x13f8b
movq %rax, %rbx
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x13f67
callq 0xdce4
movq 0xc0(%rsp), %rdi
cmpq %r15, %rdi
je 0x13f79
callq 0xa2b0
testb %bpl, %bpl
je 0x13f8b
jmp 0x13f83
movq %rax, %rbx
movq %r14, %rdi
callq 0xa240
movq %rbx, %rdi
callq 0xa510
nop