// File: /workspace/github_cpp_makefile_star2_O2/menhits[P]phplus/src/PhplusProgram.cpp
// Function: PhplusProgram::resolveProgram(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool)
void PhplusProgram::resolveProgram(string inFilename, bool printOutput)
{
	AllOperators::init();
	populatePhplusStdLib();
	
	//initialProgramPopulation();
	
	//globalFrame.resolve(printOutput);
	
	if (!error.getIfErrorLogged())
	{
		try
		{
			file=shared_ptr<SourceFile>(new SourceFile(inFilename, printOutput));
			
			if (printOutput)
			{
				cout << endl << endl << file->getBoxedString() << endl;
			}
		}
		catch (PhplusError err)
		{
			err.log();
		}
	}
	
	if (!error.getIfErrorLogged())
	{
		try
		{
			lexString(file, tokens);
		}
		catch (PhplusError err)
		{
			err.log();
			astRoot=AstVoid::make();
		}
		
		/*
		if (printOutput)
		{
			cout << endl << tableStringFromTokens(tokens, "lexer output") << endl;
		}
		*/
	}
	
	//astRoot=parseFunction(tokens, 0, tokens.size()-1, Void, Void);
	
	if (!error.getIfErrorLogged())
	{
		try
		{
			astRoot=astNodeFromTokens(tokens, 0, tokens.size()-1);
		}
		catch (PhplusError err)
		{
			err.log();
			astRoot=AstVoid::make();
		}
		
		if (printOutput)
		{
			cout << " ╭──────────────────────╮" << endl;
			cout << " │ abstract syntax tree │" << endl;
			cout << " ╰──────────────────────╯" << endl;
			cout << astRoot->getString() << endl;
			//cout << endl << putStringInBox(astRoot->getString(), "abstract syntax tree") << endl;
			//cout << endl << str::getBoxedString(astRoot->getString(), "abstract syntax tree") << endl;
		}
	}
	
	if (!error.getIfErrorLogged())
	{
		try
		{
			astRoot->setInput(globalNamespace, true, Void, Void);
		}
		catch (PhplusError err)
		{
			err.log();
			astRoot=AstVoid::make();
		}
		
		try
		{
			actionRoot=astRoot->getAction();
			
			if (printOutput)
			{
				cout << " ╭─────────────╮" << endl;
				cout << " │ action tree │" << endl;
				cout << " ╰─────────────╯" << endl;
				cout << actionRoot->getDescription() << endl;
				//cout << endl << str::getBoxedString(actionRoot->getDescription(), "action tree") << endl;
			}
		}
		catch (PhplusError err)
		{
			err.log();
		}
	}
	
	/*if (printOutput)
	{
		cout << endl << "C source code:\n" << astRoot->getCSource() << endl;
	}*/
	
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movl %edx, 0xc(%rsp)
movq %rsi, %r14
movq %rdi, %rbx
callq 0xaadc
callq 0x2e5bb
leaq 0x57b39(%rip), %r13     # 0x7a2fb
cmpb $0x0, (%r13)
jne 0x2287d
pushq $0x40
popq %rdi
callq 0xa2c0
movq %rax, %r12
leaq 0x98(%rsp), %rdi
movq %r14, %rsi
callq 0xa3b0
movb $0x1, %bpl
movzbl 0xc(%rsp), %edx
leaq 0x98(%rsp), %rsi
movq %r12, %rdi
callq 0x3c4bc
xorl %ebp, %ebp
leaq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0x22660
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x23092
leaq 0x20(%rsp), %rdi
callq 0xc984
leaq 0x98(%rsp), %rdi
callq 0xa558
cmpb $0x0, 0xc(%rsp)
je 0x2287d
movq 0x5776f(%rip), %rdi     # 0x79fb0
callq 0xa1a0
movq %rax, %rdi
callq 0xa1a0
movq %rax, %r14
movq (%rbx), %rsi
leaq 0x18(%rsp), %rdi
callq 0x3c65c
leaq 0x18(%rsp), %rsi
movq %r14, %rdi
callq 0xa290
movq %rax, %rdi
callq 0xa1a0
leaq 0x18(%rsp), %rdi
callq 0xa558
cmpb $0x0, (%r13)
jne 0x228b0
leaq 0x88(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x19fe6
leaq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0x1a19a
leaq 0x90(%rsp), %rdi
callq 0xc984
cmpb $0x0, (%r13)
jne 0x22978
leaq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rcx
subq 0x10(%rbx), %rcx
shrq $0x4, %rcx
decl %ecx
leaq 0x18(%rsp), %rdi
xorl %edx, %edx
callq 0x1ebe8
leaq 0x28(%rbx), %rdi
leaq 0x18(%rsp), %r14
movq (%r14), %rsi
andq $0x0, (%r14)
callq 0x12dbe
movq %r14, %rdi
callq 0x11c58
cmpb $0x0, 0xc(%rsp)
je 0x22978
movq 0x576ac(%rip), %r14     # 0x79fb0
leaq 0x32e50(%rip), %rsi     # 0x5575b
movq %r14, %rdi
callq 0xa2b0
movq %rax, %rdi
callq 0xa1a0
leaq 0x32e83(%rip), %rsi     # 0x557a5
movq %r14, %rdi
callq 0xa2b0
movq %rax, %rdi
callq 0xa1a0
leaq 0x32e8a(%rip), %rsi     # 0x557c3
movq %r14, %rdi
callq 0xa2b0
movq %rax, %rdi
callq 0xa1a0
movq 0x28(%rbx), %rsi
movq (%rsi), %rax
leaq 0x18(%rsp), %r15
movq %r15, %rdi
callq *0x18(%rax)
movq %r14, %rdi
movq %r15, %rsi
callq 0xa290
movq %rax, %rdi
callq 0xa1a0
leaq 0x18(%rsp), %rdi
callq 0xa558
cmpb $0x0, (%r13)
jne 0x22aba
leaq 0x28(%rbx), %rax
movq %rax, 0x50(%rsp)
movq 0x28(%rbx), %r14
leaq 0x579c9(%rip), %rsi     # 0x7a360
leaq 0x78(%rsp), %r12
movq %r12, %rdi
callq 0x12bf6
leaq 0x57a35(%rip), %r13     # 0x7a3e0
leaq 0x68(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0x12c0a
leaq 0x58(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0x12c0a
pushq $0x1
popq %rdx
movq %r14, %rdi
movq %r12, %rsi
movq %rbp, %rcx
movq %r15, %r8
callq 0x116a8
leaq 0x60(%rsp), %rdi
callq 0xc984
leaq 0x70(%rsp), %rdi
callq 0xc984
leaq 0x80(%rsp), %rdi
callq 0xc984
movq 0x50(%rsp), %rax
movq (%rax), %rsi
leaq 0x18(%rsp), %rdi
callq 0x1189c
addq $0x30, %rbx
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x13816
leaq 0x20(%rsp), %rdi
callq 0xc984
cmpb $0x0, 0xc(%rsp)
je 0x22aba
movq 0x57571(%rip), %rdi     # 0x79fb0
leaq 0x32dc7(%rip), %rsi     # 0x5580d
callq 0xa2b0
movq %rax, %rdi
callq 0xa1a0
movq 0x57556(%rip), %rdi     # 0x79fb0
leaq 0x32ddb(%rip), %rsi     # 0x5583c
callq 0xa2b0
movq %rax, %rdi
callq 0xa1a0
movq 0x5753b(%rip), %rdi     # 0x79fb0
leaq 0x32dd5(%rip), %rsi     # 0x55851
callq 0xa2b0
movq %rax, %rdi
callq 0xa1a0
movq (%rbx), %rsi
movq (%rsi), %rax
leaq 0x18(%rsp), %rdi
callq *0x18(%rax)
movq 0x57512(%rip), %rdi     # 0x79fb0
leaq 0x18(%rsp), %rsi
callq 0xa290
movq %rax, %rdi
callq 0xa1a0
leaq 0x18(%rsp), %rdi
callq 0xa558
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x22d73
jmp 0x22cef
movq %rdx, %rbx
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0xa558
jmp 0x22d79
movq %rdx, %r15
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0xa558
jmp 0x22d17
jmp 0x22cef
movq %rdx, %r15
movq %rax, %r14
jmp 0x22d0f
jmp 0x22d73
movq %rdx, %r15
movq %rax, %r14
leaq 0x60(%rsp), %rdi
callq 0xc984
leaq 0x70(%rsp), %rdi
callq 0xc984
leaq 0x80(%rsp), %rdi
callq 0xc984
cmpl $0x1, %r15d
jne 0x22bcc
movq %r14, %rdi
callq 0xa360
leaq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0x119b8
movq %r14, %rdi
callq 0xa160
leaq 0x18(%rsp), %rdi
callq 0x19f60
leaq 0x10(%rsp), %rdi
callq 0x21bcc
leaq 0x10(%rsp), %r14
movq (%r14), %rsi
andq $0x0, (%r14)
movq 0x50(%rsp), %rdi
callq 0x12dbe
movq %r14, %rdi
callq 0x21c0a
leaq 0x18(%rsp), %rdi
callq 0x11692
callq 0xa4b0
jmp 0x22a00
jmp 0x22bab
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0x11692
callq 0xa4b0
jmp 0x22bcc
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0xa558
movq %r14, %rdi
callq 0xa500
movq %rax, %r14
cmpl $0x1, %edx
jne 0x22bcc
movq %r14, %rdi
callq 0xa360
leaq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0x119b8
movq %r14, %rdi
callq 0xa160
leaq 0x18(%rsp), %rdi
callq 0x19f60
leaq 0x10(%rsp), %rdi
callq 0x21bcc
leaq 0x28(%rbx), %rdi
leaq 0x10(%rsp), %r14
movq (%r14), %rsi
andq $0x0, (%r14)
callq 0x12dbe
movq %r14, %rdi
callq 0x21c0a
leaq 0x18(%rsp), %rdi
callq 0x11692
callq 0xa4b0
jmp 0x228f6
jmp 0x22c40
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0x11692
callq 0xa4b0
jmp 0x22bcc
movq %rdx, %r15
movq %rax, %r14
leaq 0x90(%rsp), %rdi
callq 0xc984
cmpl $0x1, %r15d
jne 0x22bcc
movq %r14, %rdi
callq 0xa360
leaq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0x119b8
movq %r14, %rdi
callq 0xa160
leaq 0x18(%rsp), %rdi
callq 0x19f60
leaq 0x10(%rsp), %rdi
callq 0x21bcc
leaq 0x28(%rbx), %rdi
leaq 0x10(%rsp), %r14
movq (%r14), %rsi
andq $0x0, (%r14)
callq 0x12dbe
movq %r14, %rdi
callq 0x21c0a
leaq 0x18(%rsp), %rdi
callq 0x11692
callq 0xa4b0
jmp 0x228b0
jmp 0x22cd8
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0x11692
callq 0xa4b0
jmp 0x22bcc
movq %rdx, %r15
movq %rax, %r14
jmp 0x22d17
movq %rdx, %r15
movq %rax, %r14
leaq 0x98(%rsp), %rdi
callq 0xa558
testb %bpl, %bpl
je 0x22d17
movq %r12, %rdi
callq 0xa2a0
cmpl $0x1, %r15d
jne 0x22bcc
movq %r14, %rdi
callq 0xa360
leaq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0x119b8
movq %r14, %rdi
callq 0xa160
leaq 0x18(%rsp), %rdi
callq 0x19f60
leaq 0x18(%rsp), %rdi
callq 0x11692
callq 0xa4b0
jmp 0x2287d
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0x11692
callq 0xa4b0
jmp 0x22bcc
movq %rdx, %rbx
movq %rax, %r14
cmpl $0x1, %ebx
jne 0x22bcc
movq %r14, %rdi
callq 0xa360
leaq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0x119b8
movq %r14, %rdi
callq 0xa160
leaq 0x18(%rsp), %rdi
callq 0x19f60
leaq 0x18(%rsp), %rdi
callq 0x11692
callq 0xa4b0
jmp 0x22aba
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0x11692
callq 0xa4b0
jmp 0x22bcc
movq %rax, %rdi
callq 0xc944