// File: /workspace/github_cpp_makefile_star2_O2/menhits[P]phplus/src/main.cpp
// Function: main
int main(int argc, char ** argv)
{
	Flags flags=getFlags(argc, argv);
	
	if (flags.flagError)
	{
		cout << "coba '-h' untuk menampilkan bantuan" << endl;
		return 0;
	}
	
	if (flags.help)
	{
		cout << "PHPLUS Versi " << VERSION_X << "." << VERSION_Y << "." << VERSION_Z << endl;
		cout << "usage: Phplus [options] [source file] [options]" << endl;
		cout << "\noptions: " << endl;
		cout << "-v, -version      Menampilkan versi dari Phplus" << endl;
		cout << "-d, -debug        Menampilkan info debugging sebelum menjalankan program" << endl;
		cout << "-r, -run          Menjalankan program dengan interpreter" << endl;
		cout << "                    	aktif secara default jika tidak ada transpiling commands yang dijalankan" << endl;
		cout << "                    	pada dasarnya, apapun setelah -r sudah tersetujui" << endl;
		cout << "-cpp [file]       Transpile ke C++ dan menyimpan output file yang diberikan" << endl;
		cout << "-bin [file]       Transpile, compile dengan GCC dan menyimpan binary" << endl;
		cout << "-e, -execute      Transpile, compile dan execute file binary" << endl;
		cout << "                    beberapa kombinasi dari -cpp, -bin and -e dapat digunakan" << endl;
		cout << "                    seperti -r, apapun setelah -e akan disetujui" << endl;
		cout << "-h, -help         Menampilkan bantuan saat ini dan keluar" << endl;
		cout << endl;
		cout << endl;
		
		return 0;
	}
	
	if (flags.version)
	{
		cout << "Phplus version " << VERSION_X << "." << VERSION_Y << "." << VERSION_Z << endl;
		return 0;
	}
	
	PhplusProgram program;
	
	if (flags.inFiles.empty())
	{
		cout << "Tidak ada sumber file yang spesifik" << endl;
		cout << "coba '-h' untuk menampilkan bantuan" << endl;
		return 0;
	}
	else if (flags.inFiles.size()>1)
	{
		cout << "Sumber file multiple spesifik, Phplus tidak mendukungnya saat ini" << endl;
		cout << "coba '-h' untuk menampilkan bantuan" << endl;
		return 0;
	}
	
	program.resolveProgram(flags.inFiles[0], flags.debug);
	
	if (flags.runInterpreted)
	{
		if (error.getIfErrorLogged())
		{
			if (flags.debug)
				cout << endl << ">>>>>>    Eksekusi dibatalkan karena terdapat error    <<<<<<" << endl;
			else
				cout << "Mohon bersabar, ini ujian\nprogram tidak dijalankan karena terdapat error" << endl;
		}
		else
		{
			if (flags.debug)
				cout << endl << "Menjalankan program..." << endl << endl;
			
			program.execute();
		}
	}
	
	if (!flags.cppOutFile.empty() || !flags.binOutFile.empty() || flags.runCompiled)
	{
		string cppCode=program.getCpp();
		
		if (error.getIfErrorLogged())
		{
			if (flags.debug)
				cout << endl << ">>>>>>    transpiling gagal   <<<<<<" << endl;
			else
				cout << "transpiling gagal" << endl;
		}
		else
		{
			string cppFileName=flags.cppOutFile;
			
			if (cppFileName.empty())
				cppFileName="tmp_pp_transpiled.cpp";
			
			if (flags.debug)
				cout << endl << putStringInBox(cppCode, "C++ code", true, false, -1) << endl;
			
			writeFile(cppFileName, cppCode, flags.debug);
			
			if (!flags.binOutFile.empty() || flags.runCompiled)
			{
				string binFileName=flags.binOutFile;
				
				if (binFileName.empty())
					binFileName="tmp_pp_compiled";
				
				string cmd;
				cmd="g++ -std=c++11 '"+cppFileName+"' -o '"+binFileName+"'";
				
				if (flags.debug)
					cout << "menjalankan '"+cmd+"'" << endl;
				
				runCmd(cmd, true);
				
				if (flags.runCompiled)
				{
					if (flags.debug)
						cout << endl;
					
					cmd = "./"+binFileName + " --menjalankan-dari-phplus " + str::join(cmdLineArgs, " ", false);
					
					if (flags.debug)
						cout << "menjalankan '"+cmd+"'" << endl << endl;
					
					runCmd(cmd, true);
				}
				
				if (flags.binOutFile.empty())
					remove(binFileName.c_str());
			}
			
			if (flags.cppOutFile.empty())
				remove(cppFileName.c_str());
		}
	}
	
	if (flags.debug)
		cout << endl << "Semua selesai" << endl;
	
	return 0;
}

// Assembly:
pushq %rbx
subq $0x300, %rsp            # imm = 0x300
movq %rsi, %rdx
movl %edi, %esi
leaq 0xe8(%rsp), %rbx
movq %rbx, %rdi
callq 0x41447
cmpb $0x1, 0x81(%rbx)
jne 0x40a25
movq 0x3959f(%rip), %rdi     # 0x79fb0
leaq 0x181ee(%rip), %rsi     # 0x58c06
callq 0xa2b0
movq %rax, %rbx
jmp 0x40bf5
cmpb $0x1, 0x121(%rsp)
jne 0x40c15
movq 0x39576(%rip), %rdi     # 0x79fb0
leaq 0x181e9(%rip), %rsi     # 0x58c2a
callq 0xa2b0
movq %rax, %rdi
xorl %esi, %esi
callq 0xa4f0
leaq 0x171cd(%rip), %rsi     # 0x57c24
movq %rax, %rdi
callq 0xa2b0
movq %rax, %rdi
xorl %esi, %esi
callq 0xa4f0
leaq 0x171b4(%rip), %rsi     # 0x57c24
movq %rax, %rdi
callq 0xa2b0
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0xa4f0
movq %rax, %rdi
callq 0xa1a0
movq 0x3951e(%rip), %rdi     # 0x79fb0
leaq 0x1819f(%rip), %rsi     # 0x58c38
callq 0xa2b0
movq %rax, %rdi
callq 0xa1a0
movq 0x39503(%rip), %rdi     # 0x79fb0
leaq 0x181b4(%rip), %rsi     # 0x58c68
callq 0xa2b0
movq %rax, %rdi
callq 0xa1a0
movq 0x394e8(%rip), %rdi     # 0x79fb0
leaq 0x181a4(%rip), %rsi     # 0x58c73
callq 0xa2b0
movq %rax, %rdi
callq 0xa1a0
movq 0x394cd(%rip), %rdi     # 0x79fb0
leaq 0x181b9(%rip), %rsi     # 0x58ca3
callq 0xa2b0
movq %rax, %rdi
callq 0xa1a0
movq 0x394b2(%rip), %rdi     # 0x79fb0
leaq 0x181e7(%rip), %rsi     # 0x58cec
callq 0xa2b0
movq %rax, %rdi
callq 0xa1a0
movq 0x39497(%rip), %rdi     # 0x79fb0
leaq 0x18205(%rip), %rsi     # 0x58d25
callq 0xa2b0
movq %rax, %rdi
callq 0xa1a0
movq 0x3947c(%rip), %rdi     # 0x79fb0
leaq 0x18248(%rip), %rsi     # 0x58d83
callq 0xa2b0
movq %rax, %rdi
callq 0xa1a0
movq 0x39461(%rip), %rdi     # 0x79fb0
leaq 0x18274(%rip), %rsi     # 0x58dca
callq 0xa2b0
movq %rax, %rdi
callq 0xa1a0
movq 0x39446(%rip), %rdi     # 0x79fb0
leaq 0x182a5(%rip), %rsi     # 0x58e16
callq 0xa2b0
movq %rax, %rdi
callq 0xa1a0
movq 0x3942b(%rip), %rdi     # 0x79fb0
leaq 0x182cf(%rip), %rsi     # 0x58e5b
callq 0xa2b0
movq %rax, %rdi
callq 0xa1a0
movq 0x39410(%rip), %rdi     # 0x79fb0
leaq 0x182f1(%rip), %rsi     # 0x58e98
callq 0xa2b0
movq %rax, %rdi
callq 0xa1a0
movq 0x393f5(%rip), %rdi     # 0x79fb0
leaq 0x18324(%rip), %rsi     # 0x58ee6
callq 0xa2b0
movq %rax, %rdi
callq 0xa1a0
movq 0x393da(%rip), %rbx     # 0x79fb0
leaq 0x1834a(%rip), %rsi     # 0x58f27
movq %rbx, %rdi
callq 0xa2b0
movq %rax, %rdi
callq 0xa1a0
movq %rbx, %rdi
callq 0xa1a0
movq %rbx, %rdi
callq 0xa1a0
leaq 0xe8(%rsp), %rdi
callq 0x4183a
xorl %eax, %eax
addq $0x300, %rsp            # imm = 0x300
popq %rbx
retq
cmpb $0x1, 0x122(%rsp)
jne 0x40c74
movq 0x3938a(%rip), %rdi     # 0x79fb0
leaq 0x18334(%rip), %rsi     # 0x58f61
callq 0xa2b0
movq %rax, %rdi
xorl %esi, %esi
callq 0xa4f0
leaq 0x16fe1(%rip), %rsi     # 0x57c24
movq %rax, %rdi
callq 0xa2b0
movq %rax, %rdi
xorl %esi, %esi
callq 0xa4f0
leaq 0x16fc8(%rip), %rsi     # 0x57c24
movq %rax, %rdi
callq 0xa2b0
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0xa4f0
jmp 0x40a1d
leaq 0x270(%rsp), %rdi
callq 0x22728
movq 0x108(%rsp), %rsi
movq 0x110(%rsp), %rax
cmpq %rax, %rsi
je 0x40ca8
subq %rsi, %rax
cmpq $0x21, %rax
jb 0x40cef
leaq 0x182ef(%rip), %rsi     # 0x58f95
jmp 0x40caf
leaq 0x182c2(%rip), %rsi     # 0x58f71
movq 0x392fa(%rip), %rbx     # 0x79fb0
movq %rbx, %rdi
callq 0xa2b0
movq %rax, %rdi
callq 0xa1a0
leaq 0x17f39(%rip), %rsi     # 0x58c06
movq %rbx, %rdi
callq 0xa2b0
movq %rax, %rdi
callq 0xa1a0
leaq 0x270(%rsp), %rdi
callq 0x417e6
jmp 0x40bfd
leaq 0x210(%rsp), %rdi
callq 0xa3b0
movzbl 0x120(%rsp), %edx
leaq 0x270(%rsp), %rdi
leaq 0x210(%rsp), %rsi
callq 0x22796
leaq 0x210(%rsp), %rdi
callq 0xa558
cmpb $0x1, 0x123(%rsp)
jne 0x40dbc
leaq 0x395c0(%rip), %rcx     # 0x7a2fb
movb 0x120(%rsp), %al
cmpb $0x1, (%rcx)
jne 0x40d63
testb %al, %al
je 0x40da1
movq 0x3925e(%rip), %rdi     # 0x79fb0
callq 0xa1a0
movq %rax, %rdi
leaq 0x18276(%rip), %rsi     # 0x58fd7
jmp 0x40daf
testb %al, %al
je 0x40d92
movq 0x39242(%rip), %rdi     # 0x79fb0
callq 0xa1a0
leaq 0x182e4(%rip), %rsi     # 0x5905e
movq %rax, %rdi
callq 0xa2b0
movq %rax, %rdi
callq 0xa1a0
movq %rax, %rdi
callq 0xa1a0
leaq 0x270(%rsp), %rdi
callq 0x22f28
jmp 0x40dbc
leaq 0x1826d(%rip), %rsi     # 0x59015
movq 0x39201(%rip), %rdi     # 0x79fb0
callq 0xa2b0
movq %rax, %rdi
callq 0xa1a0
movq 0x150(%rsp), %rax
orq 0x130(%rsp), %rax
jne 0x40ddc
cmpb $0x1, 0x168(%rsp)
jne 0x412be
leaq 0x170(%rsp), %rdi
leaq 0x270(%rsp), %rsi
callq 0x22ddc
leaq 0x39503(%rip), %rax     # 0x7a2fb
cmpb $0x1, (%rax)
jne 0x40e26
cmpb $0x1, 0x120(%rsp)
jne 0x40ee9
movq 0x3919e(%rip), %rdi     # 0x79fb0
callq 0xa1a0
movq %rax, %rdi
leaq 0x18254(%rip), %rsi     # 0x59075
jmp 0x40ef7
leaq 0x128(%rsp), %rsi
leaq 0xc8(%rsp), %rdi
callq 0xa3b0
cmpq $0x0, 0xd0(%rsp)
jne 0x40e5a
leaq 0x1825f(%rip), %rsi     # 0x590ac
leaq 0xc8(%rsp), %rdi
callq 0xa530
cmpb $0x1, 0x120(%rsp)
jne 0x40f09
movq 0x39141(%rip), %rdi     # 0x79fb0
callq 0xa1a0
movq %rax, %rbx
leaq 0x17894(%rip), %rsi     # 0x58712
leaq 0x1f0(%rsp), %rdi
leaq 0x68(%rsp), %rdx
callq 0xa150
leaq 0x48(%rsp), %rdi
leaq 0x170(%rsp), %rsi
leaq 0x1f0(%rsp), %rdx
pushq $0x1
popq %rcx
pushq $-0x1
popq %r9
xorl %r8d, %r8d
callq 0x42deb
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0xa290
movq %rax, %rdi
callq 0xa1a0
leaq 0x48(%rsp), %rdi
callq 0xa558
leaq 0x1f0(%rsp), %rdi
callq 0xa558
movb 0x120(%rsp), %al
jmp 0x40f0b
leaq 0x181aa(%rip), %rsi     # 0x5909a
movq 0x390b9(%rip), %rdi     # 0x79fb0
callq 0xa2b0
movq %rax, %rdi
callq 0xa1a0
jmp 0x412b1
xorl %eax, %eax
movzbl %al, %edx
andl $0x1, %edx
leaq 0xc8(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x43cd5
cmpq $0x0, 0x150(%rsp)
jne 0x40f3f
cmpb $0x1, 0x168(%rsp)
jne 0x4128c
leaq 0x148(%rsp), %rsi
leaq 0x48(%rsp), %rdi
callq 0xa3b0
cmpq $0x0, 0x50(%rsp)
jne 0x40f6a
leaq 0x18162(%rip), %rsi     # 0x590c2
leaq 0x48(%rsp), %rdi
callq 0xa530
leaq 0x78(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x18150(%rip), %rsi     # 0x590d2
leaq 0x88(%rsp), %rdi
leaq 0xc8(%rsp), %rdx
callq 0xc8a1
leaq 0x18145(%rip), %rdx     # 0x590e3
leaq 0xa8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0xc882
leaq 0x8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x184b5
leaq 0x18281(%rip), %rdx     # 0x59252
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xc882
leaq 0x68(%rsp), %rdi
leaq 0x28(%rsp), %rbx
movq %rbx, %rsi
callq 0xa350
movq %rbx, %rdi
callq 0xa558
leaq 0x8(%rsp), %rdi
callq 0xa558
leaq 0xa8(%rsp), %rdi
callq 0xa558
leaq 0x88(%rsp), %rdi
callq 0xa558
cmpb $0x1, 0x120(%rsp)
jne 0x41081
leaq 0x180bb(%rip), %rsi     # 0x590ea
leaq 0x8(%rsp), %rdi
leaq 0x68(%rsp), %rdx
callq 0xc8a1
leaq 0x1820d(%rip), %rdx     # 0x59252
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xc882
movq 0x38f55(%rip), %rdi     # 0x79fb0
leaq 0x28(%rsp), %rsi
callq 0xa290
movq %rax, %rdi
callq 0xa1a0
leaq 0x28(%rsp), %rdi
callq 0xa558
leaq 0x8(%rsp), %rdi
callq 0xa558
leaq 0x1d0(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0xa3b0
leaq 0x250(%rsp), %rdi
leaq 0x1d0(%rsp), %rsi
pushq $0x1
popq %rdx
callq 0x440b2
leaq 0x250(%rsp), %rdi
callq 0xa558
leaq 0x1d0(%rsp), %rdi
callq 0xa558
cmpb $0x1, 0x168(%rsp)
jne 0x41263
cmpb $0x1, 0x120(%rsp)
jne 0x410e9
movq 0x38ecc(%rip), %rdi     # 0x79fb0
callq 0xa1a0
leaq 0x18008(%rip), %rsi     # 0x590f8
leaq 0xa8(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0xc8a1
leaq 0x17ff2(%rip), %rdx     # 0x590fb
leaq 0x8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0xc882
leaq 0x1394a(%rip), %rsi     # 0x54a6c
leaq 0x1b0(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0xa150
leaq 0x3931d(%rip), %rsi     # 0x7a458
leaq 0x88(%rsp), %rdi
leaq 0x1b0(%rsp), %rdx
xorl %ecx, %ecx
callq 0x4faac
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
leaq 0x88(%rsp), %rdx
callq 0x1205e
leaq 0x68(%rsp), %rdi
leaq 0x28(%rsp), %rbx
movq %rbx, %rsi
callq 0xa350
movq %rbx, %rdi
callq 0xa558
leaq 0x88(%rsp), %rdi
callq 0xa558
leaq 0x1b0(%rsp), %rdi
callq 0xa558
leaq 0x8(%rsp), %rdi
callq 0xa558
leaq 0xa8(%rsp), %rdi
callq 0xa558
cmpb $0x1, 0x120(%rsp)
jne 0x4121f
leaq 0x17f25(%rip), %rsi     # 0x590ea
leaq 0x8(%rsp), %rdi
leaq 0x68(%rsp), %rdx
callq 0xc8a1
leaq 0x18077(%rip), %rdx     # 0x59252
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xc882
movq 0x38dbf(%rip), %rdi     # 0x79fb0
leaq 0x28(%rsp), %rsi
callq 0xa290
movq %rax, %rdi
callq 0xa1a0
movq %rax, %rdi
callq 0xa1a0
leaq 0x28(%rsp), %rdi
callq 0xa558
leaq 0x8(%rsp), %rdi
callq 0xa558
leaq 0x190(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0xa3b0
leaq 0x230(%rsp), %rdi
leaq 0x190(%rsp), %rsi
pushq $0x1
popq %rdx
callq 0x440b2
leaq 0x230(%rsp), %rdi
callq 0xa558
leaq 0x190(%rsp), %rdi
callq 0xa558
cmpq $0x0, 0x150(%rsp)
jne 0x41278
movq 0x48(%rsp), %rdi
callq 0xa510
leaq 0x68(%rsp), %rdi
callq 0xa558
leaq 0x48(%rsp), %rdi
callq 0xa558
cmpq $0x0, 0x130(%rsp)
jne 0x412a4
movq 0xc8(%rsp), %rdi
callq 0xa510
leaq 0xc8(%rsp), %rdi
callq 0xa558
leaq 0x170(%rsp), %rdi
callq 0xa558
cmpb $0x1, 0x120(%rsp)
jne 0x40cdd
movq 0x38cdd(%rip), %rdi     # 0x79fb0
callq 0xa1a0
movq %rax, %rbx
leaq 0x17e35(%rip), %rsi     # 0x59117
jmp 0x40ccd
jmp 0x4134b
jmp 0x413cf
movq %rax, %rbx
jmp 0x413dc
movq %rax, %rbx
leaq 0x190(%rsp), %rdi
jmp 0x413ab
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0xa558
jmp 0x4131b
movq %rax, %rbx
leaq 0x1b0(%rsp), %rdi
callq 0xa558
jmp 0x4132d
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xa558
jmp 0x4133c
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
jmp 0x413ab
jmp 0x413cf
movq %rax, %rbx
jmp 0x41378
jmp 0x413cf
movq %rax, %rbx
jmp 0x413c3
jmp 0x413e8
jmp 0x4136b
movq %rax, %rbx
leaq 0x1d0(%rsp), %rdi
jmp 0x413ab
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xa558
leaq 0x8(%rsp), %rdi
jmp 0x413ab
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xa558
jmp 0x41391
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0xa558
jmp 0x413a3
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0xa558
jmp 0x413d2
jmp 0x413cf
jmp 0x413e8
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0xa558
leaq 0x1f0(%rsp), %rdi
jmp 0x413e1
jmp 0x41409
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0xa558
leaq 0x48(%rsp), %rdi
callq 0xa558
jmp 0x413eb
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0xa558
leaq 0x170(%rsp), %rdi
callq 0xa558
jmp 0x41420
jmp 0x4141d
movq %rax, %rbx
jmp 0x413f8
movq %rax, %rbx
leaq 0x210(%rsp), %rdi
jmp 0x41400
jmp 0x4142f
movq %rax, %rbx
leaq 0x270(%rsp), %rdi
callq 0x417e6
jmp 0x41432
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x4183a
movq %rbx, %rdi
callq 0xa500