// File: /workspace/github_cpp_makefile_star2_O2/matteorr[P]EarleyParser/EarleyParser.cpp
// Function: EarleyParser::createChart(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int EarleyParser::createChart( string mainNonTerminal )
{
	list<Production>* mainProduction;

	mainProduction = this->getProduction( mainNonTerminal );
	if( mainProduction == NULL ) return -1;

	/*
	 * providing seed of parsing algorithm
	 * main production of phrase in the context grammar
	 */
	//this->earleyParserChart = new vector<State>[ this->inputVector.size() + 1 ];
	this->earleyParserChart.resize( this->inputVector.size() + 1 );

	cout << "[DEBUG]: size of list (number of productions with " << mainNonTerminal << " as non terminal) = " << mainProduction->size() << endl;

	for( list<Production>::iterator it = mainProduction->begin(); it != mainProduction->end(); it++ )
	{
		for( unsigned int j = 0; j < it->getProductionContent().size(); j++ )
		{
			cout << "[DEBUG]: element of list " << it->getProductionContent().at(j) << endl;
		}

		State *initialState = new State( mainNonTerminal, &(*it), NULL, 0, 0 );
		this->earleyParserChart[0].push_back( initialState );
	}

	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
leaq -0x80(%rbp), %r14
movq %r14, %rdi
movq %rsi, -0x30(%rbp)
callq 0x2250
movq %rbx, %rdi
movq %r14, %rsi
callq 0x35ca
movq %rax, %r14
leaq -0x80(%rbp), %rdi
callq 0x20f0
testq %r14, %r14
je 0x3787
leaq 0x80(%rbx), %rdi
movq 0xa0(%rbx), %rsi
subq 0x98(%rbx), %rsi
sarq $0x5, %rsi
incq %rsi
movq %rdi, -0x38(%rbp)
callq 0x4d9e
movq 0x9984(%rip), %rdi      # 0xcfd8
leaq 0x4bde(%rip), %rsi      # 0x8239
callq 0x21c0
movq %rax, %rdi
movq -0x30(%rbp), %rsi
callq 0x2190
leaq 0x4bf9(%rip), %rsi      # 0x826c
movq %rax, %rdi
callq 0x21c0
movq 0x10(%r14), %rsi
movq %rax, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x2100
leaq -0x60(%rbp), %r13
leaq 0x4be7(%rip), %rbx      # 0x8281
movq %r14, %rax
movq %r14, -0x40(%rbp)
movq (%rax), %rax
cmpq %r14, %rax
je 0x3783
movq %rax, -0x48(%rbp)
leaq 0x10(%rax), %r14
xorl %r15d, %r15d
movl %r15d, %r15d
movq %r13, %rdi
movq %r14, %rsi
callq 0x76d8
movq -0x58(%rbp), %r12
subq -0x60(%rbp), %r12
sarq $0x5, %r12
movq %r13, %rdi
callq 0x4ba2
cmpq %r15, %r12
jbe 0x3727
movq 0x98f2(%rip), %rdi      # 0xcfd8
movq %rbx, %rsi
callq 0x21c0
movq %rax, %r12
movq %r13, %rdi
movq %r14, %rsi
callq 0x76d8
movq %r13, %rdi
movq %r15, %rsi
callq 0x4c0a
movq %r12, %rdi
movq %rax, %rsi
callq 0x2190
movq %rax, %rdi
callq 0x2100
movq %r13, %rdi
callq 0x4ba2
incl %r15d
jmp 0x36b8
pushq $0x58
popq %rdi
callq 0x21d0
movq %rax, %r15
leaq -0xa0(%rbp), %r12
movq %r12, %rdi
movq -0x30(%rbp), %rsi
callq 0x2250
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x770c
movq %r12, %rdi
callq 0x20f0
movq %r15, -0x60(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rdi
movq %r13, %rsi
callq 0x4de0
movq -0x40(%rbp), %r14
movq -0x48(%rbp), %rax
jmp 0x36a1
pushq $0x1
jmp 0x3789
pushq $-0x1
popq %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x20f0
jmp 0x37d1
movq %rax, %rbx
jmp 0x37bb
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
callq 0x20f0
movq %r15, %rdi
callq 0x21a0
jmp 0x37d1
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x4ba2
movq %rbx, %rdi
callq 0x22c0
nop