// File: /workspace/github_cpp_makefile_star2_O1/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 0x9cdb
movq %rsi, %r14
leaq -0x1e0(%rbp), %rdi
callq 0x25ec
movq 0x28(%r14), %rsi
leaq -0x50(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x20d0
leaq 0xbbc(%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 0x9624
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 0x27d2
leaq -0x108(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9669
callq 0x21a0
movq 0x4968(%rip), %rbx      # 0xdfd8
leaq 0xc26(%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 0x4936(%rip), %rdi      # 0xdfd8
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %rbx
leaq 0xbe4(%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 0x3394
leaq -0xe8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9729
callq 0x21a0
movq 0x48a8(%rip), %rbx      # 0xdfd8
leaq 0xb66(%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 0x4876(%rip), %rdi      # 0xdfd8
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %rbx
leaq 0xb24(%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 0x39a6
leaq -0xc8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x97e9
callq 0x21a0
movq 0x47e8(%rip), %rbx      # 0xdfd8
leaq 0xaa6(%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 0x47b6(%rip), %rdi      # 0xdfd8
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %rbx
leaq 0xa64(%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 0x66d0
leaq -0x1e0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x405c
movl %eax, %ebx
movq -0xb8(%rbp), %rdi
cmpq %r14, %rdi
je 0x98c6
callq 0x21a0
testl %ebx, %ebx
js 0x9d06
movq 0x4703(%rip), %rbx      # 0xdfd8
leaq 0x9c1(%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 0x46d1(%rip), %rdi      # 0xdfd8
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %rbx
leaq 0x97f(%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 0x4374
movq 0x4673(%rip), %rbx      # 0xdfd8
leaq 0x931(%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 0x4641(%rip), %rdi      # 0xdfd8
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %rbx
leaq 0x8ef(%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 0x66d0
leaq -0x1e0(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x594e
movq -0x98(%rbp), %rdi
cmpq %r14, %rdi
je 0x9a28
callq 0x21a0
movq 0x45a9(%rip), %rbx      # 0xdfd8
leaq 0x867(%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 0x4577(%rip), %rdi      # 0xdfd8
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %rbx
leaq 0x825(%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 0x66d0
leaq -0x1e0(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x5588
movq %rax, %r14
movq -0x78(%rbp), %rdi
cmpq %r15, %rdi
je 0x9ae9
callq 0x21a0
movq 0x44e8(%rip), %rbx      # 0xdfd8
leaq 0x7a6(%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 0x44b6(%rip), %r15      # 0xdfd8
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %rbx
leaq 0x761(%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 0x9ca9
leaq 0x719(%rip), %rbx       # 0xa29d
xorl %esi, %esi
cmpl $0x0, -0x30(%rbp)
sete %sil
movq (%r13), %rdi
callq 0x8e3e
movss %xmm0, -0x54(%rbp)
movl $0x24, %edx
movq %r15, %rdi
leaq 0xcf5(%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 0x46b(%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 0x9b84
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x9cbb
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 0x42f6(%rip), %rdi      # 0xdfd8
callq 0x20f0
leaq 0xb19(%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 0x9d39
jmp 0x9d7e
movq %rax, %rbx
movq -0x98(%rbp), %rdi
jmp 0x9d34
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
cmpq %r14, %rdi
je 0x9d7e
callq 0x21a0
jmp 0x9d7e
jmp 0x9d74
movq %rax, %rbx
leaq -0xc8(%rbp), %rax
jmp 0x9d68
jmp 0x9d74
movq %rax, %rbx
leaq -0xe8(%rbp), %rax
jmp 0x9d68
jmp 0x9d74
movq %rax, %rbx
leaq -0x108(%rbp), %rax
movq -0x10(%rax), %rdi
jmp 0x9d86
jmp 0x9d74
jmp 0x9d74
jmp 0x9d7b
movq %rax, %rbx
jmp 0x9d90
jmp 0x9d7b
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x9d90
callq 0x21a0
leaq -0x1e0(%rbp), %rdi
callq 0x265e
movq %rbx, %rdi
callq 0x22f0