// File: 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:
subq $0x318, %rsp            # imm = 0x318
movq %rsi, 0xc0(%rsp)
movb %dl, %al
movq %rdi, 0x310(%rsp)
movq %rsi, 0x308(%rsp)
andb $0x1, %al
movb %al, 0x307(%rsp)
movq 0x310(%rsp), %rax
movq %rax, 0xc8(%rsp)
callq 0xbed0
callq 0x64e30
leaq 0xcaed8(%rip), %rdi     # 0x1183c3
callq 0x4e370
testb $0x1, %al
jne 0x4d76d
movl $0x40, %edi
callq 0xb390
movq %rax, 0xb8(%rsp)
jmp 0x4d50c
movq 0xc0(%rsp), %rsi
movb $0x1, 0x2bf(%rsp)
leaq 0x2c0(%rsp), %rdi
callq 0xb1a0
jmp 0x4d52b
movq 0xb8(%rsp), %rdi
movzbl 0x307(%rsp), %edx
andl $0x1, %edx
leaq 0x2c0(%rsp), %rsi
callq 0x9b6c0
jmp 0x4d54d
movq 0xb8(%rsp), %rsi
movb $0x0, 0x2bf(%rsp)
leaq 0x2f0(%rsp), %rdi
callq 0x49640
jmp 0x4d56c
movq 0xc8(%rsp), %rdi
leaq 0x2f0(%rsp), %rsi
callq 0x4e380
leaq 0x2f0(%rsp), %rdi
callq 0x357d0
leaq 0x2c0(%rsp), %rdi
callq 0xb6e8
testb $0x1, 0x307(%rsp)
je 0x4d73e
movq 0xcaa00(%rip), %rdi     # 0x117fb0
movq 0xca9c9(%rip), %rsi     # 0x117f80
callq 0xb3c0
movq %rax, 0xb0(%rsp)
jmp 0x4d5c6
movq 0xb0(%rsp), %rdi
movq 0xca9ab(%rip), %rsi     # 0x117f80
callq 0xb3c0
movq %rax, 0xa8(%rsp)
jmp 0x4d5e4
movq 0xc8(%rsp), %rdi
callq 0x35780
movq %rax, %rsi
leaq 0x298(%rsp), %rdi
callq 0x9b9b0
jmp 0x4d603
movq 0xa8(%rsp), %rdi
leaq 0x298(%rsp), %rsi
callq 0xb340
movq %rax, 0xa0(%rsp)
jmp 0x4d622
movq 0xa0(%rsp), %rdi
movq 0xca94f(%rip), %rsi     # 0x117f80
callq 0xb3c0
jmp 0x4d638
leaq 0x298(%rsp), %rdi
callq 0xb6e8
jmp 0x4d73e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2e8(%rsp)
movl %eax, 0x2e4(%rsp)
jmp 0x4d6d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2e8(%rsp)
movl %eax, 0x2e4(%rsp)
jmp 0x4d697
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2e8(%rsp)
movl %eax, 0x2e4(%rsp)
leaq 0x2c0(%rsp), %rdi
callq 0xb6e8
testb $0x1, 0x2bf(%rsp)
jne 0x4d6a3
jmp 0x4d6b0
movq 0xb8(%rsp), %rdi
callq 0xb350
jmp 0x4d6d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2e8(%rsp)
movl %eax, 0x2e4(%rsp)
leaq 0x298(%rsp), %rdi
callq 0xb6e8
movl 0x2e4(%rsp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x4dede
movq 0x2e8(%rsp), %rdi
movq %rdi, 0x98(%rsp)
callq 0xb460
movq %rax, %rsi
leaq 0x260(%rsp), %rdi
callq 0x1ad40
jmp 0x4d70e
movq 0x98(%rsp), %rdi
callq 0xb180
leaq 0x260(%rsp), %rdi
callq 0x356b0
jmp 0x4d72a
leaq 0x260(%rsp), %rdi
callq 0x1a670
callq 0xb5f0
jmp 0x4d76d
jmp 0x4d73c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2e8(%rsp)
movl %eax, 0x2e4(%rsp)
leaq 0x260(%rsp), %rdi
callq 0x1a670
callq 0xb5f0
jmp 0x4d768
jmp 0x4dede
leaq 0xcac4f(%rip), %rdi     # 0x1183c3
callq 0x4e370
testb $0x1, %al
jne 0x4d8b9
movq 0xc8(%rsp), %rsi
leaq 0x250(%rsp), %rdi
movq %rdi, 0x90(%rsp)
callq 0x357f0
movq 0xc8(%rsp), %rsi
movq 0x90(%rsp), %rdi
addq $0x10, %rsi
callq 0x35b80
jmp 0x4d7b9
leaq 0x250(%rsp), %rdi
callq 0x357d0
jmp 0x4d88a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2e8(%rsp)
movl %eax, 0x2e4(%rsp)
leaq 0x250(%rsp), %rdi
callq 0x357d0
movl 0x2e4(%rsp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x4dede
movq 0x2e8(%rsp), %rdi
movq %rdi, 0x88(%rsp)
callq 0xb460
movq %rax, %rsi
leaq 0x218(%rsp), %rdi
callq 0x1ad40
jmp 0x4d827
movq 0x88(%rsp), %rdi
callq 0xb180
leaq 0x218(%rsp), %rdi
callq 0x356b0
jmp 0x4d843
leaq 0x210(%rsp), %rdi
callq 0x483a0
jmp 0x4d852
movq 0xc8(%rsp), %rdi
addq $0x28, %rdi
leaq 0x210(%rsp), %rsi
callq 0x48bd0
leaq 0x210(%rsp), %rdi
callq 0x48470
leaq 0x218(%rsp), %rdi
callq 0x1a670
callq 0xb5f0
jmp 0x4d8b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2e8(%rsp)
movl %eax, 0x2e4(%rsp)
leaq 0x218(%rsp), %rdi
callq 0x1a670
callq 0xb5f0
jmp 0x4d8b4
jmp 0x4dede
leaq 0xcab03(%rip), %rdi     # 0x1183c3
callq 0x4e370
testb $0x1, %al
jne 0x4db07
movq 0xc8(%rsp), %rdi
addq $0x10, %rdi
movq %rdi, 0x80(%rsp)
callq 0x393f0
movq 0x80(%rsp), %rsi
movl %eax, %ecx
decl %ecx
leaq 0x208(%rsp), %rdi
xorl %edx, %edx
callq 0x42900
jmp 0x4d903
movq 0xc8(%rsp), %rdi
addq $0x28, %rdi
leaq 0x208(%rsp), %rsi
callq 0x1b3c0
leaq 0x208(%rsp), %rdi
callq 0x1b3f0
jmp 0x4d9da
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2e8(%rsp)
movl %eax, 0x2e4(%rsp)
movl 0x2e4(%rsp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x4dede
movq 0x2e8(%rsp), %rdi
movq %rdi, 0x78(%rsp)
callq 0xb460
movq %rax, %rsi
leaq 0x1d0(%rsp), %rdi
callq 0x1ad40
jmp 0x4d97a
movq 0x78(%rsp), %rdi
callq 0xb180
leaq 0x1d0(%rsp), %rdi
callq 0x356b0
jmp 0x4d993
leaq 0x1c8(%rsp), %rdi
callq 0x483a0
jmp 0x4d9a2
movq 0xc8(%rsp), %rdi
addq $0x28, %rdi
leaq 0x1c8(%rsp), %rsi
callq 0x48bd0
leaq 0x1c8(%rsp), %rdi
callq 0x48470
leaq 0x1d0(%rsp), %rdi
callq 0x1a670
callq 0xb5f0
testb $0x1, 0x307(%rsp)
je 0x4db05
movq 0xca5c1(%rip), %rdi     # 0x117fb0
movq %rdi, 0x60(%rsp)
leaq 0x84d60(%rip), %rsi     # 0xd275b
callq 0xb380
movq %rax, %rdi
movq 0xca576(%rip), %rsi     # 0x117f80
movq %rsi, 0x58(%rsp)
callq 0xb3c0
movq 0x60(%rsp), %rdi
leaq 0x84d85(%rip), %rsi     # 0xd27a5
callq 0xb380
movq 0x58(%rsp), %rsi
movq %rax, %rdi
callq 0xb3c0
movq 0x60(%rsp), %rdi
leaq 0x84d85(%rip), %rsi     # 0xd27c3
callq 0xb380
movq 0x58(%rsp), %rsi
movq %rax, %rdi
callq 0xb3c0
movq 0xc8(%rsp), %rdi
addq $0x28, %rdi
callq 0x1a5f0
movq %rax, %rsi
movq (%rsi), %rax
movq 0x18(%rax), %rax
leaq 0x1a8(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq *%rax
movq 0x60(%rsp), %rdi
movq 0x68(%rsp), %rsi
callq 0xb340
movq %rax, 0x70(%rsp)
jmp 0x4da90
movq 0x70(%rsp), %rdi
movq 0xca4e4(%rip), %rsi     # 0x117f80
callq 0xb3c0
jmp 0x4daa3
leaq 0x1a8(%rsp), %rdi
callq 0xb6e8
jmp 0x4db05
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2e8(%rsp)
movl %eax, 0x2e4(%rsp)
leaq 0x1d0(%rsp), %rdi
callq 0x1a670
callq 0xb5f0
jmp 0x4dada
jmp 0x4dede
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2e8(%rsp)
movl %eax, 0x2e4(%rsp)
leaq 0x1a8(%rsp), %rdi
callq 0xb6e8
jmp 0x4dede
jmp 0x4db07
leaq 0xca8b5(%rip), %rdi     # 0x1183c3
callq 0x4e370
testb $0x1, %al
jne 0x4ded6
movq 0xc8(%rsp), %rdi
addq $0x28, %rdi
callq 0x1a5f0
movq %rax, 0x38(%rsp)
leaq 0xca8f0(%rip), %rsi     # 0x118428
leaq 0x198(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x1a8f0
leaq 0xca957(%rip), %rsi     # 0x1184a8
movq %rsi, 0x30(%rsp)
leaq 0x188(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x1a920
movq 0x30(%rsp), %rsi
leaq 0x178(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x1a920
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rcx
movq 0x50(%rsp), %r8
movl $0x1, %edx
callq 0x1a6f0
jmp 0x4db9f
leaq 0x178(%rsp), %rdi
callq 0x1a950
leaq 0x188(%rsp), %rdi
callq 0x1a950
leaq 0x198(%rsp), %rdi
callq 0x1a6e0
jmp 0x4dc9e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2e8(%rsp)
movl %eax, 0x2e4(%rsp)
leaq 0x178(%rsp), %rdi
callq 0x1a950
leaq 0x188(%rsp), %rdi
callq 0x1a950
leaq 0x198(%rsp), %rdi
callq 0x1a6e0
movl 0x2e4(%rsp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x4dede
movq 0x2e8(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0xb460
movq %rax, %rsi
leaq 0x140(%rsp), %rdi
callq 0x1ad40
jmp 0x4dc3e
movq 0x28(%rsp), %rdi
callq 0xb180
leaq 0x140(%rsp), %rdi
callq 0x356b0
jmp 0x4dc57
leaq 0x138(%rsp), %rdi
callq 0x483a0
jmp 0x4dc66
movq 0xc8(%rsp), %rdi
addq $0x28, %rdi
leaq 0x138(%rsp), %rsi
callq 0x48bd0
leaq 0x138(%rsp), %rdi
callq 0x48470
leaq 0x140(%rsp), %rdi
callq 0x1a670
callq 0xb5f0
movq 0xc8(%rsp), %rdi
addq $0x28, %rdi
callq 0x1a5f0
movq %rax, %rsi
leaq 0x128(%rsp), %rdi
callq 0x1aaa0
jmp 0x4dcc1
movq 0xc8(%rsp), %rdi
addq $0x30, %rdi
leaq 0x128(%rsp), %rsi
callq 0x1ac90
leaq 0x128(%rsp), %rdi
callq 0x1acc0
testb $0x1, 0x307(%rsp)
je 0x4deaa
movq 0xca2b4(%rip), %rdi     # 0x117fb0
leaq 0x84b0a(%rip), %rsi     # 0xd280d
callq 0xb380
movq %rax, 0x20(%rsp)
jmp 0x4dd0f
movq 0x20(%rsp), %rdi
movq 0xca265(%rip), %rsi     # 0x117f80
callq 0xb3c0
jmp 0x4dd22
movq 0xca287(%rip), %rdi     # 0x117fb0
leaq 0x84b0c(%rip), %rsi     # 0xd283c
callq 0xb380
movq %rax, 0x18(%rsp)
jmp 0x4dd3c
movq 0x18(%rsp), %rdi
movq 0xca238(%rip), %rsi     # 0x117f80
callq 0xb3c0
jmp 0x4dd4f
movq 0xca25a(%rip), %rdi     # 0x117fb0
leaq 0x84af4(%rip), %rsi     # 0xd2851
callq 0xb380
movq %rax, 0x10(%rsp)
jmp 0x4dd69
movq 0x10(%rsp), %rdi
movq 0xca20b(%rip), %rsi     # 0x117f80
callq 0xb3c0
jmp 0x4dd7c
movq 0xc8(%rsp), %rdi
addq $0x30, %rdi
callq 0x1bb50
movq %rax, %rsi
movq (%rsi), %rax
movq 0x18(%rax), %rax
leaq 0x108(%rsp), %rdi
callq *%rax
jmp 0x4dda3
movq 0xca206(%rip), %rdi     # 0x117fb0
leaq 0x108(%rsp), %rsi
callq 0xb340
movq %rax, 0x8(%rsp)
jmp 0x4ddbe
movq 0x8(%rsp), %rdi
movq 0xca1b6(%rip), %rsi     # 0x117f80
callq 0xb3c0
jmp 0x4ddd1
leaq 0x108(%rsp), %rdi
callq 0xb6e8
jmp 0x4deaa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2e8(%rsp)
movl %eax, 0x2e4(%rsp)
leaq 0x140(%rsp), %rdi
callq 0x1a670
callq 0xb5f0
jmp 0x4de0b
jmp 0x4dede
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2e8(%rsp)
movl %eax, 0x2e4(%rsp)
jmp 0x4de47
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2e8(%rsp)
movl %eax, 0x2e4(%rsp)
leaq 0x108(%rsp), %rdi
callq 0xb6e8
movl 0x2e4(%rsp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x4dede
movq 0x2e8(%rsp), %rdi
movq %rdi, (%rsp)
callq 0xb460
movq %rax, %rsi
leaq 0xd0(%rsp), %rdi
callq 0x1ad40
jmp 0x4de7e
movq (%rsp), %rdi
callq 0xb180
leaq 0xd0(%rsp), %rdi
callq 0x356b0
jmp 0x4de96
leaq 0xd0(%rsp), %rdi
callq 0x1a670
callq 0xb5f0
jmp 0x4ded6
jmp 0x4dea8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2e8(%rsp)
movl %eax, 0x2e4(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x1a670
callq 0xb5f0
jmp 0x4ded4
jmp 0x4dede
addq $0x318, %rsp            # imm = 0x318
retq
movq 0x2e8(%rsp), %rdi
callq 0xb680
movq %rax, %rdi
callq 0xffe0
nopw %cs:(%rax,%rax)