// File: /workspace/github_cpp_makefile_star2_O2/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 0x7cfd
movq %rsi, %r14
leaq -0x1d8(%rbp), %rdi
callq 0x24fc
movq 0x28(%r14), %rsi
leaq -0x50(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x20c0
leaq 0x84c(%rip), %rsi       # 0x81c0
leaq -0x50(%rbp), %rbx
movq %rbx, %rdi
callq 0x20a0
movl %eax, %r13d
movq %rbx, %rdi
callq 0x20f0
movq 0x8(%r14), %rsi
leaq -0x110(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x20c0
xorl %edx, %edx
testl %r13d, %r13d
sete %dl
leaq -0x1d8(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x267c
leaq -0x110(%rbp), %rdi
callq 0x20f0
movq 0x560b(%rip), %rdi      # 0xcfd8
leaq 0x8c9(%rip), %rsi       # 0x829d
callq 0x21c0
movq %rax, %rdi
callq 0x2100
leaq 0x8b5(%rip), %rsi       # 0x829d
movq %rax, %rdi
callq 0x21c0
movq %rax, %rdi
callq 0x2100
movq 0x10(%r14), %rsi
leaq -0xf0(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x20c0
leaq -0x1d8(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x2e2a
leaq -0xf0(%rbp), %rdi
callq 0x20f0
movq 0x55a6(%rip), %rdi      # 0xcfd8
leaq 0x864(%rip), %rsi       # 0x829d
callq 0x21c0
movq %rax, %rdi
callq 0x2100
leaq 0x850(%rip), %rsi       # 0x829d
movq %rax, %rdi
callq 0x21c0
movq %rax, %rdi
callq 0x2100
movq 0x18(%r14), %rsi
leaq -0xd0(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x20c0
leaq -0x1d8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x31ea
leaq -0xd0(%rbp), %rdi
callq 0x20f0
movq 0x5541(%rip), %rdi      # 0xcfd8
leaq 0x7ff(%rip), %rsi       # 0x829d
callq 0x21c0
movq %rax, %rdi
callq 0x2100
leaq 0x7eb(%rip), %rsi       # 0x829d
movq %rax, %rdi
callq 0x21c0
movq %rax, %rdi
callq 0x2100
movq 0x20(%r14), %rsi
leaq -0x50(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x20c0
leaq -0xb0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x2250
leaq -0x1d8(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x35e4
movl %eax, %ebx
leaq -0xb0(%rbp), %rdi
callq 0x20f0
testl %ebx, %ebx
js 0x7d28
movq 0x54c5(%rip), %rdi      # 0xcfd8
leaq 0x783(%rip), %rsi       # 0x829d
callq 0x21c0
movq %rax, %rdi
callq 0x2100
leaq 0x76f(%rip), %rsi       # 0x829d
movq %rax, %rdi
callq 0x21c0
movq %rax, %rdi
callq 0x2100
leaq -0x1d8(%rbp), %rdi
callq 0x37da
movq 0x5487(%rip), %rdi      # 0xcfd8
leaq 0x745(%rip), %rsi       # 0x829d
callq 0x21c0
movq %rax, %rdi
callq 0x2100
leaq 0x731(%rip), %rsi       # 0x829d
movq %rax, %rdi
callq 0x21c0
movq %rax, %rdi
callq 0x2100
leaq -0x90(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x2250
leaq -0x1d8(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x46fc
leaq -0x90(%rbp), %rdi
callq 0x20f0
movq 0x5426(%rip), %rdi      # 0xcfd8
leaq 0x6e4(%rip), %rsi       # 0x829d
callq 0x21c0
movq %rax, %rdi
callq 0x2100
leaq 0x6d0(%rip), %rsi       # 0x829d
movq %rax, %rdi
callq 0x21c0
movq %rax, %rdi
callq 0x2100
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x2250
leaq -0x1d8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x4400
movq %rax, %r14
leaq -0x70(%rbp), %rdi
callq 0x20f0
movq 0x53cb(%rip), %rdi      # 0xcfd8
leaq 0x689(%rip), %rsi       # 0x829d
callq 0x21c0
movq %rax, %rdi
callq 0x2100
leaq 0x675(%rip), %rsi       # 0x829d
movq %rax, %rdi
callq 0x21c0
movq %rax, %rdi
callq 0x2100
movq (%r14), %r12
movq 0x5396(%rip), %r15      # 0xcfd8
leaq 0x654(%rip), %rbx       # 0x829d
cmpq 0x8(%r14), %r12
je 0x7cd4
xorl %esi, %esi
testl %r13d, %r13d
sete %sil
movq (%r12), %rdi
callq 0x7258
movss %xmm0, -0x30(%rbp)
movq %r15, %rdi
leaq 0xc00(%rip), %rsi       # 0x8874
callq 0x21c0
movq %rax, %rdi
movss -0x30(%rbp), %xmm0
callq 0x2160
movq %rax, %rdi
leaq 0x3ad(%rip), %rsi       # 0x803d
callq 0x21c0
movq %rax, %rdi
callq 0x2100
movq %r15, %rdi
movq %rbx, %rsi
callq 0x21c0
movq %rax, %rdi
callq 0x2100
movq %rax, %rdi
movq %rbx, %rsi
callq 0x21c0
movq %rax, %rdi
callq 0x2100
movq %rax, %rdi
callq 0x2100
addq $0x8, %r12
jmp 0x7c49
leaq -0x50(%rbp), %rdi
callq 0x20f0
leaq -0x1d8(%rbp), %rdi
callq 0x2570
xorl %eax, %eax
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x52d4(%rip), %rdi      # 0xcfd8
callq 0x2100
leaq 0xacb(%rip), %rsi       # 0x87db
movq %rax, %rdi
callq 0x21c0
movq %rax, %rdi
callq 0x2100
movq %rax, %rdi
callq 0x2100
pushq $0x1
popq %rdi
callq 0x2200
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
jmp 0x7d4f
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
jmp 0x7d4f
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
callq 0x20f0
jmp 0x7d90
jmp 0x7d86
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
jmp 0x7d94
jmp 0x7d86
movq %rax, %rbx
leaq -0xf0(%rbp), %rdi
jmp 0x7d94
jmp 0x7d86
movq %rax, %rbx
leaq -0x110(%rbp), %rdi
jmp 0x7d94
jmp 0x7d86
jmp 0x7d86
jmp 0x7d8d
movq %rax, %rbx
jmp 0x7d99
jmp 0x7d8d
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x20f0
leaq -0x1d8(%rbp), %rdi
callq 0x2570
movq %rbx, %rdi
callq 0x22c0