// File: /workspace/github_cpp_makefile_star2_O3/matteorr[P]EarleyParser/NLP_Earley_Parser_main.cpp
// Function: main
int main( int argc, char** argv )
{
	if( argc < 6 ){

		cout << endl << "Usage: ./NLP_Early_Parser 'Context Free Input Grammar File' 'Input Dictionary File' 'Input string file path' 'main production' 'probability parse?(y/n)'" << endl << endl;
		exit(1);
	}

	EarleyParser myEarleyParser;
	bool probabilityParser;

	int checkOperation;

	if( string( argv[5] ).compare("y") == 0 )
		probabilityParser = true;
	else
		probabilityParser = false;

	myEarleyParser.initialize( string( argv[1] ), probabilityParser );
	cout << "*****************************************************" << endl << "*****************************************************" << endl;

	myEarleyParser.createDictionary( string( argv[2] ) );
	cout << "*****************************************************" << endl << "*****************************************************" << endl;

	myEarleyParser.createInputStringVector( string( argv[3] ) );
	cout << "*****************************************************" << endl << "*****************************************************" << endl;

	string mainNonTerminal = string( argv[4] );
	checkOperation = myEarleyParser.createChart( mainNonTerminal );
	if( checkOperation < 0 ) exit(1);
	cout << "*****************************************************" << endl << "*****************************************************" << endl;

	myEarleyParser.parse();
	cout << "*****************************************************" << endl << "*****************************************************" << endl;

	myEarleyParser.printProductions( mainNonTerminal );
	cout << "*****************************************************" << endl << "*****************************************************" << endl;

	vector<Node*>* vectorOfParsingTreeRoots;

	vectorOfParsingTreeRoots = myEarleyParser.returnParsingTrees( mainNonTerminal );
	cout << "*****************************************************" << endl << "*****************************************************" << endl;

	for( vector<Node*>::iterator it = vectorOfParsingTreeRoots->begin(); it != vectorOfParsingTreeRoots->end(); it++ )
	{
		float prob;
		prob = (*it)->print( probabilityParser );
		cout << "Probaility of the printed tree is: [" << prob << "]" << endl;
		cout << "*****************************************************" << endl << "*****************************************************" << endl << endl;
	}

	return 0;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
cmpl $0x5, %edi
jle 0x9ccf
movq %rsi, %r14
leaq -0x1e0(%rbp), %rdi
callq 0x25ec
movq 0x28(%r14), %rsi
leaq -0x50(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x20d0
leaq 0xbc8(%rip), %rsi       # 0xa1c0
leaq -0x50(%rbp), %rbx
movq %rbx, %rdi
callq 0x20a0
movl %eax, -0x30(%rbp)
movq (%rbx), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x9618
callq 0x21a0
movq 0x8(%r14), %rsi
leaq -0x118(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x20d0
xorl %edx, %edx
cmpl $0x0, -0x30(%rbp)
sete %dl
leaq -0x1e0(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x27e6
leaq -0x108(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x965d
callq 0x21a0
movq 0x4974(%rip), %rbx      # 0xdfd8
leaq 0xc32(%rip), %rsi       # 0xa29d
movl $0x35, %edx
movq %rbx, %rdi
callq 0x2220
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq 0x4942(%rip), %rdi      # 0xdfd8
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %rbx
leaq 0xbf0(%rip), %rsi       # 0xa29d
movl $0x35, %edx
movq %rax, %rdi
callq 0x2220
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq 0x10(%r14), %rsi
leaq -0xf8(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x20d0
leaq -0x1e0(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x33ae
leaq -0xe8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x971d
callq 0x21a0
movq 0x48b4(%rip), %rbx      # 0xdfd8
leaq 0xb72(%rip), %rsi       # 0xa29d
movl $0x35, %edx
movq %rbx, %rdi
callq 0x2220
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq 0x4882(%rip), %rdi      # 0xdfd8
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %rbx
leaq 0xb30(%rip), %rsi       # 0xa29d
movl $0x35, %edx
movq %rax, %rdi
callq 0x2220
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq 0x18(%r14), %rsi
leaq -0xd8(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x20d0
leaq -0x1e0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x39c0
leaq -0xc8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x97dd
callq 0x21a0
movq 0x47f4(%rip), %rbx      # 0xdfd8
leaq 0xab2(%rip), %rsi       # 0xa29d
movl $0x35, %edx
movq %rbx, %rdi
callq 0x2220
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq 0x47c2(%rip), %rdi      # 0xdfd8
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %rbx
leaq 0xa70(%rip), %rsi       # 0xa29d
movl $0x35, %edx
movq %rax, %rdi
callq 0x2220
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq 0x20(%r14), %rsi
leaq -0x50(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x20d0
leaq -0xa8(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
leaq -0xb8(%rbp), %rdi
callq 0x66bc
leaq -0x1e0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x4076
movl %eax, %ebx
movq -0xb8(%rbp), %rdi
cmpq %r14, %rdi
je 0x98ba
callq 0x21a0
testl %ebx, %ebx
js 0x9cfa
movq 0x470f(%rip), %rbx      # 0xdfd8
leaq 0x9cd(%rip), %rsi       # 0xa29d
movl $0x35, %edx
movq %rbx, %rdi
callq 0x2220
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq 0x46dd(%rip), %rdi      # 0xdfd8
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %rbx
leaq 0x98b(%rip), %rsi       # 0xa29d
movl $0x35, %edx
movq %rax, %rdi
callq 0x2220
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
leaq -0x1e0(%rbp), %rdi
callq 0x4390
movq 0x467f(%rip), %rbx      # 0xdfd8
leaq 0x93d(%rip), %rsi       # 0xa29d
movl $0x35, %edx
movq %rbx, %rdi
callq 0x2220
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq 0x464d(%rip), %rdi      # 0xdfd8
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %rbx
leaq 0x8fb(%rip), %rsi       # 0xa29d
movl $0x35, %edx
movq %rax, %rdi
callq 0x2220
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
leaq -0x88(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
leaq -0x98(%rbp), %rdi
callq 0x66bc
leaq -0x1e0(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x5926
movq -0x98(%rbp), %rdi
cmpq %r14, %rdi
je 0x9a1c
callq 0x21a0
movq 0x45b5(%rip), %rbx      # 0xdfd8
leaq 0x873(%rip), %rsi       # 0xa29d
movl $0x35, %edx
movq %rbx, %rdi
callq 0x2220
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq 0x4583(%rip), %rdi      # 0xdfd8
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %rbx
leaq 0x831(%rip), %rsi       # 0xa29d
movl $0x35, %edx
movq %rax, %rdi
callq 0x2220
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
leaq -0x68(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
leaq -0x78(%rbp), %rdi
callq 0x66bc
leaq -0x1e0(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x5576
movq %rax, %r14
movq -0x78(%rbp), %rdi
cmpq %r15, %rdi
je 0x9add
callq 0x21a0
movq 0x44f4(%rip), %rbx      # 0xdfd8
leaq 0x7b2(%rip), %rsi       # 0xa29d
movl $0x35, %edx
movq %rbx, %rdi
callq 0x2220
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq 0x44c2(%rip), %r15      # 0xdfd8
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %rbx
leaq 0x76d(%rip), %rsi       # 0xa29d
movl $0x35, %edx
movq %rax, %rdi
callq 0x2220
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq (%r14), %r13
cmpq 0x8(%r14), %r13
je 0x9c9d
leaq 0x725(%rip), %rbx       # 0xa29d
xorl %esi, %esi
cmpl $0x0, -0x30(%rbp)
sete %sil
movq (%r13), %rdi
callq 0x8e0c
movss %xmm0, -0x54(%rbp)
movl $0x24, %edx
movq %r15, %rdi
leaq 0xd01(%rip), %rsi       # 0xa8a0
callq 0x2220
xorps %xmm0, %xmm0
cvtss2sd -0x54(%rbp), %xmm0
movq %r15, %rdi
callq 0x22a0
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
leaq 0x477(%rip), %rsi       # 0xa03d
callq 0x2220
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movl $0x35, %edx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2220
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %r12
movl $0x35, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2220
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
addq $0x8, %r13
cmpq 0x8(%r14), %r13
jne 0x9b78
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x9caf
callq 0x21a0
leaq -0x1e0(%rbp), %rdi
callq 0x265e
xorl %eax, %eax
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x4302(%rip), %rdi      # 0xdfd8
callq 0x20f0
leaq 0xb25(%rip), %rsi       # 0xa807
movq %rax, %rdi
callq 0x21d0
movq %rax, %rdi
callq 0x20f0
movq %rax, %rdi
callq 0x20f0
movl $0x1, %edi
callq 0x2230
movq %rax, %rbx
movq -0x78(%rbp), %rdi
cmpq %r15, %rdi
jne 0x9d2d
jmp 0x9d72
movq %rax, %rbx
movq -0x98(%rbp), %rdi
jmp 0x9d28
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
cmpq %r14, %rdi
je 0x9d72
callq 0x21a0
jmp 0x9d72
jmp 0x9d68
movq %rax, %rbx
leaq -0xc8(%rbp), %rax
jmp 0x9d5c
jmp 0x9d68
movq %rax, %rbx
leaq -0xe8(%rbp), %rax
jmp 0x9d5c
jmp 0x9d68
movq %rax, %rbx
leaq -0x108(%rbp), %rax
movq -0x10(%rax), %rdi
jmp 0x9d7a
jmp 0x9d68
jmp 0x9d68
jmp 0x9d6f
movq %rax, %rbx
jmp 0x9d84
jmp 0x9d6f
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x9d84
callq 0x21a0
leaq -0x1e0(%rbp), %rdi
callq 0x265e
movq %rbx, %rdi
callq 0x22f0