// File: /workspace/github_cpp_makefile_star2_O1/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 %rsi, %rax
movq %rdi, %rbx
leaq -0x90(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%rsi), %rsi
movq %rax, -0x38(%rbp)
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0xa0(%rbp), %r14
movq %r14, %rdi
callq 0x66d0
leaq 0x10(%rbx), %rdi
movq %r14, %rsi
callq 0x6804
movq %rax, %r14
addq $0x28, %rax
testq %r14, %r14
cmoveq %r14, %rax
movq %rax, -0x30(%rbp)
movq -0xa0(%rbp), %rdi
cmpq %r15, %rdi
je 0x40ca
callq 0x21a0
testq %r14, %r14
je 0x4305
leaq 0x80(%rbx), %rdi
movq 0xa0(%rbx), %rsi
subq 0x98(%rbx), %rsi
sarq $0x5, %rsi
incq %rsi
movq %rdi, -0x58(%rbp)
callq 0x6322
movq 0x9ed9(%rip), %rbx      # 0xdfd8
leaq 0x6133(%rip), %rsi      # 0xa239
movl $0x32, %edx
movq %rbx, %rdi
callq 0x2220
movq -0x38(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %rbx, %rdi
callq 0x2220
movq %rax, %rbx
leaq 0x613c(%rip), %rsi      # 0xa26c
movl $0x14, %edx
movq %rax, %rdi
callq 0x2220
movq -0x30(%rbp), %r14
movq 0x10(%r14), %rsi
movq %rbx, %rdi
callq 0x2140
movq %rax, %rbx
movq (%rax), %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), %rcx
movl $0x1, %eax
cmpq %r14, %rcx
je 0x430a
leaq -0x50(%rbp), %r12
movq %rcx, -0x60(%rbp)
leaq 0x10(%rcx), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x92e6
movq -0x48(%rbp), %rbx
movq -0x50(%rbp), %r14
movq %r12, %rdi
callq 0x60da
cmpq %r14, %rbx
je 0x4273
movl $0x1, %r14d
xorl %ebx, %ebx
movl $0x19, %edx
movq 0x9e0c(%rip), %r15      # 0xdfd8
movq %r15, %rdi
leaq 0x60ab(%rip), %rsi      # 0xa281
callq 0x2220
movq %r12, %rdi
movq %r13, %rsi
callq 0x92e6
movq -0x50(%rbp), %rax
movq -0x48(%rbp), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
cmpq %rbx, %rdx
jbe 0x4319
shlq $0x5, %rbx
movq (%rax,%rbx), %rsi
movq 0x8(%rax,%rbx), %rdx
movq %r15, %rdi
callq 0x2220
movq %rax, %rbx
movq (%rax), %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 %r12, %rdi
callq 0x60da
movl %r14d, %ebx
movq %r12, %rdi
movq %r13, %rsi
callq 0x92e6
movq -0x48(%rbp), %r15
subq -0x50(%rbp), %r15
sarq $0x5, %r15
movq %r12, %rdi
callq 0x60da
incl %r14d
cmpq %rbx, %r15
ja 0x41c0
movl $0x58, %edi
callq 0x21e0
movq %rax, %rbx
leaq -0x70(%rbp), %r14
movq %r14, -0x80(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x80(%rbp), %r15
movq %r15, %rdi
callq 0x66d0
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x9318
movq -0x80(%rbp), %rdi
cmpq %r14, %rdi
je 0x42c6
callq 0x21a0
movq %rbx, -0x50(%rbp)
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x42e5
movq %rbx, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x42ed
movq %r12, %rdx
callq 0x744e
movq -0x60(%rbp), %rcx
movq (%rcx), %rcx
cmpq -0x30(%rbp), %rcx
jne 0x418c
movl $0x1, %eax
jmp 0x430a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x62f5(%rip), %rdi      # 0xa615
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2280
movq %rax, %r14
movq -0xa0(%rbp), %rdi
cmpq %r15, %rdi
jne 0x4357
jmp 0x436c
movq %rax, %r14
jmp 0x4354
movq %r14, %rcx
movq %rax, %r14
movq -0x80(%rbp), %rdi
cmpq %rcx, %rdi
je 0x4354
callq 0x21a0
movq %rbx, %rdi
callq 0x21a0
jmp 0x436c
jmp 0x4360
movq %rax, %r14
leaq -0x50(%rbp), %rdi
callq 0x60da
movq %r14, %rdi
callq 0x22f0