// File: 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
subq $0x390, %rsp            # imm = 0x390
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x6, -0x8(%rbp)
jge 0x118f9
movq 0xa722(%rip), %rdi      # 0x1bfd8
movq 0xa70b(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movq %rax, %rdi
leaq 0x1ef7(%rip), %rsi      # 0x137c3
callq 0x21c0
movq %rax, %rdi
movq 0xa6ed(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movq %rax, %rdi
movq 0xa6de(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movl $0x1, %edi
callq 0x2220
leaq -0xd8(%rbp), %rdi
callq 0x25e0
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x250(%rbp)
leaq -0x101(%rbp), %rdi
movq %rdi, -0x248(%rbp)
callq 0x2350
movq -0x250(%rbp), %rsi
movq -0x248(%rbp), %rdx
leaq -0x100(%rbp), %rdi
callq 0x2290
jmp 0x11943
leaq -0x100(%rbp), %rdi
leaq 0x185b(%rip), %rsi      # 0x131ac
callq 0x20b0
movl %eax, -0x254(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x2140
leaq -0x101(%rbp), %rdi
callq 0x2200
movl -0x254(%rbp), %eax
cmpl $0x0, %eax
jne 0x119ab
movb $0x1, -0xd9(%rbp)
jmp 0x119b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x101(%rbp), %rdi
callq 0x2200
jmp 0x1224d
movb $0x0, -0xd9(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x268(%rbp)
leaq -0x139(%rbp), %rdi
movq %rdi, -0x260(%rbp)
callq 0x2350
movq -0x268(%rbp), %rsi
movq -0x260(%rbp), %rdx
leaq -0x138(%rbp), %rdi
callq 0x2290
jmp 0x119f0
movzbl -0xd9(%rbp), %edx
andl $0x1, %edx
leaq -0xd8(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x2840
jmp 0x11a0f
leaq -0x138(%rbp), %rdi
callq 0x2140
leaq -0x139(%rbp), %rdi
callq 0x2200
movq 0xa5aa(%rip), %rdi      # 0x1bfd8
leaq 0x1854(%rip), %rsi      # 0x13289
callq 0x21c0
movq %rax, -0x270(%rbp)
jmp 0x11a43
movq -0x270(%rbp), %rdi
movq 0xa577(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movq %rax, -0x278(%rbp)
jmp 0x11a5f
movq -0x278(%rbp), %rdi
leaq 0x181c(%rip), %rsi      # 0x13289
callq 0x21c0
movq %rax, -0x280(%rbp)
jmp 0x11a7b
movq -0x280(%rbp), %rdi
movq 0xa53f(%rip), %rsi      # 0x1bfc8
callq 0x21f0
jmp 0x11a90
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x290(%rbp)
leaq -0x161(%rbp), %rdi
movq %rdi, -0x288(%rbp)
callq 0x2350
movq -0x290(%rbp), %rsi
movq -0x288(%rbp), %rdx
leaq -0x160(%rbp), %rdi
callq 0x2290
jmp 0x11ace
leaq -0xd8(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x3710
jmp 0x11ae3
leaq -0x160(%rbp), %rdi
callq 0x2140
leaq -0x161(%rbp), %rdi
callq 0x2200
movq 0xa4d6(%rip), %rdi      # 0x1bfd8
leaq 0x1780(%rip), %rsi      # 0x13289
callq 0x21c0
movq %rax, -0x298(%rbp)
jmp 0x11b17
movq -0x298(%rbp), %rdi
movq 0xa4a3(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movq %rax, -0x2a0(%rbp)
jmp 0x11b33
movq -0x2a0(%rbp), %rdi
leaq 0x1748(%rip), %rsi      # 0x13289
callq 0x21c0
movq %rax, -0x2a8(%rbp)
jmp 0x11b4f
movq -0x2a8(%rbp), %rdi
movq 0xa46b(%rip), %rsi      # 0x1bfc8
callq 0x21f0
jmp 0x11b64
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x2b8(%rbp)
leaq -0x189(%rbp), %rdi
movq %rdi, -0x2b0(%rbp)
callq 0x2350
movq -0x2b8(%rbp), %rsi
movq -0x2b0(%rbp), %rdx
leaq -0x188(%rbp), %rdi
callq 0x2290
jmp 0x11ba2
leaq -0xd8(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0x3f30
jmp 0x11bb7
leaq -0x188(%rbp), %rdi
callq 0x2140
leaq -0x189(%rbp), %rdi
callq 0x2200
movq 0xa402(%rip), %rdi      # 0x1bfd8
leaq 0x16ac(%rip), %rsi      # 0x13289
callq 0x21c0
movq %rax, -0x2c0(%rbp)
jmp 0x11beb
movq -0x2c0(%rbp), %rdi
movq 0xa3cf(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movq %rax, -0x2c8(%rbp)
jmp 0x11c07
movq -0x2c8(%rbp), %rdi
leaq 0x1674(%rip), %rsi      # 0x13289
callq 0x21c0
movq %rax, -0x2d0(%rbp)
jmp 0x11c23
movq -0x2d0(%rbp), %rdi
movq 0xa397(%rip), %rsi      # 0x1bfc8
callq 0x21f0
jmp 0x11c38
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x2e0(%rbp)
leaq -0x1b1(%rbp), %rdi
movq %rdi, -0x2d8(%rbp)
callq 0x2350
movq -0x2e0(%rbp), %rsi
movq -0x2d8(%rbp), %rdx
leaq -0x1b0(%rbp), %rdi
callq 0x2290
jmp 0x11c76
leaq -0x1b1(%rbp), %rdi
callq 0x2200
leaq -0x1d8(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x20f0
jmp 0x11c97
leaq -0xd8(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0x4750
movl %eax, -0x2e4(%rbp)
jmp 0x11cb2
movl -0x2e4(%rbp), %eax
movl %eax, -0xe0(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x2140
cmpl $0x0, -0xe0(%rbp)
jge 0x11e1e
movl $0x1, %edi
callq 0x2220
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x11d13
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x2140
leaq -0x139(%rbp), %rdi
callq 0x2200
jmp 0x1224d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x1224d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x11d6d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x2140
leaq -0x161(%rbp), %rdi
callq 0x2200
jmp 0x1224d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x11db0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x2140
leaq -0x189(%rbp), %rdi
callq 0x2200
jmp 0x1224d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x1b1(%rbp), %rdi
callq 0x2200
jmp 0x1224d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x12241
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x2140
jmp 0x12241
movq 0xa1b3(%rip), %rdi      # 0x1bfd8
leaq 0x145d(%rip), %rsi      # 0x13289
callq 0x21c0
movq %rax, -0x2f0(%rbp)
jmp 0x11e3a
movq -0x2f0(%rbp), %rdi
movq 0xa180(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movq %rax, -0x2f8(%rbp)
jmp 0x11e56
movq -0x2f8(%rbp), %rdi
leaq 0x1425(%rip), %rsi      # 0x13289
callq 0x21c0
movq %rax, -0x300(%rbp)
jmp 0x11e72
movq -0x300(%rbp), %rdi
movq 0xa148(%rip), %rsi      # 0x1bfc8
callq 0x21f0
jmp 0x11e87
leaq -0xd8(%rbp), %rdi
callq 0x4ad0
jmp 0x11e95
movq 0xa13c(%rip), %rdi      # 0x1bfd8
leaq 0x13e6(%rip), %rsi      # 0x13289
callq 0x21c0
movq %rax, -0x308(%rbp)
jmp 0x11eb1
movq -0x308(%rbp), %rdi
movq 0xa109(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movq %rax, -0x310(%rbp)
jmp 0x11ecd
movq -0x310(%rbp), %rdi
leaq 0x13ae(%rip), %rsi      # 0x13289
callq 0x21c0
movq %rax, -0x318(%rbp)
jmp 0x11ee9
movq -0x318(%rbp), %rdi
movq 0xa0d1(%rip), %rsi      # 0x1bfc8
callq 0x21f0
jmp 0x11efe
leaq -0x1f8(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x20f0
jmp 0x11f13
leaq -0xd8(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0x64c0
jmp 0x11f28
leaq -0x1f8(%rbp), %rdi
callq 0x2140
movq 0xa09d(%rip), %rdi      # 0x1bfd8
leaq 0x1347(%rip), %rsi      # 0x13289
callq 0x21c0
movq %rax, -0x320(%rbp)
jmp 0x11f50
movq -0x320(%rbp), %rdi
movq 0xa06a(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movq %rax, -0x328(%rbp)
jmp 0x11f6c
movq -0x328(%rbp), %rdi
leaq 0x130f(%rip), %rsi      # 0x13289
callq 0x21c0
movq %rax, -0x330(%rbp)
jmp 0x11f88
movq -0x330(%rbp), %rdi
movq 0xa032(%rip), %rsi      # 0x1bfc8
callq 0x21f0
jmp 0x11f9d
leaq -0x220(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x20f0
jmp 0x11fb2
leaq -0xd8(%rbp), %rdi
leaq -0x220(%rbp), %rsi
callq 0x5f70
movq %rax, -0x338(%rbp)
jmp 0x11fce
movq -0x338(%rbp), %rax
movq %rax, -0x200(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x2140
movq 0x9fe9(%rip), %rdi      # 0x1bfd8
leaq 0x1293(%rip), %rsi      # 0x13289
callq 0x21c0
movq %rax, -0x340(%rbp)
jmp 0x12004
movq -0x340(%rbp), %rdi
movq 0x9fb6(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movq %rax, -0x348(%rbp)
jmp 0x12020
movq -0x348(%rbp), %rdi
leaq 0x125b(%rip), %rsi      # 0x13289
callq 0x21c0
movq %rax, -0x350(%rbp)
jmp 0x1203c
movq -0x350(%rbp), %rdi
movq 0x9f7e(%rip), %rsi      # 0x1bfc8
callq 0x21f0
jmp 0x12051
movq -0x200(%rbp), %rdi
callq 0x6e00
movq %rax, -0x228(%rbp)
movq -0x200(%rbp), %rdi
callq 0x6e70
movq %rax, -0x230(%rbp)
leaq -0x228(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x6e30
testb $0x1, %al
jne 0x12093
jmp 0x12216
leaq -0x228(%rbp), %rdi
callq 0x6ea0
movq (%rax), %rdi
movzbl -0xd9(%rbp), %esi
andl $0x1, %esi
callq 0x100b0
movss %xmm0, -0x354(%rbp)
jmp 0x120bb
movss -0x354(%rbp), %xmm0
movss %xmm0, -0x234(%rbp)
movq 0x9f06(%rip), %rdi      # 0x1bfd8
leaq 0x1783(%rip), %rsi      # 0x1385c
callq 0x21c0
movq %rax, -0x360(%rbp)
jmp 0x120e7
movq -0x360(%rbp), %rdi
movss -0x234(%rbp), %xmm0
callq 0x2170
movq %rax, -0x368(%rbp)
jmp 0x12104
movq -0x368(%rbp), %rdi
leaq 0xf17(%rip), %rsi       # 0x13029
callq 0x21c0
movq %rax, -0x370(%rbp)
jmp 0x12120
movq -0x370(%rbp), %rdi
movq 0x9e9a(%rip), %rsi      # 0x1bfc8
callq 0x21f0
jmp 0x12135
movq 0x9e9c(%rip), %rdi      # 0x1bfd8
leaq 0x1146(%rip), %rsi      # 0x13289
callq 0x21c0
movq %rax, -0x378(%rbp)
jmp 0x12151
movq -0x378(%rbp), %rdi
movq 0x9e69(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movq %rax, -0x380(%rbp)
jmp 0x1216d
movq -0x380(%rbp), %rdi
leaq 0x110e(%rip), %rsi      # 0x13289
callq 0x21c0
movq %rax, -0x388(%rbp)
jmp 0x12189
movq -0x388(%rbp), %rdi
movq 0x9e31(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movq %rax, -0x390(%rbp)
jmp 0x121a5
movq -0x390(%rbp), %rdi
movq 0x9e15(%rip), %rsi      # 0x1bfc8
callq 0x21f0
jmp 0x121ba
jmp 0x121bc
leaq -0x228(%rbp), %rdi
xorl %esi, %esi
callq 0x6ec0
movq %rax, -0x240(%rbp)
jmp 0x12064
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x2140
jmp 0x12241
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x2140
jmp 0x12241
movl $0x0, -0x4(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x2140
leaq -0xd8(%rbp), %rdi
callq 0x2650
movl -0x4(%rbp), %eax
addq $0x390, %rsp            # imm = 0x390
popq %rbp
retq
leaq -0x1b0(%rbp), %rdi
callq 0x2140
leaq -0xd8(%rbp), %rdi
callq 0x2650
movq -0x110(%rbp), %rdi
callq 0x2340