// File: /workspace/github_cpp_makefile_star2_O3/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), %r12
movq %r12, -0x10(%r12)
movq (%rsi), %rsi
movq %rax, -0x30(%rbp)
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0xa0(%rbp), %r14
movq %r14, %rdi
callq 0x66bc
leaq 0x10(%rbx), %rdi
movq %r14, %rsi
callq 0x67f8
movq %rax, %r14
leaq 0x28(%rax), %r15
testq %rax, %rax
movq %r15, %rax
cmoveq %r14, %rax
movq %rax, -0x58(%rbp)
movq -0xa0(%rbp), %rdi
cmpq %r12, %rdi
je 0x40e8
callq 0x21a0
testq %r14, %r14
je 0x4320
leaq 0x80(%rbx), %rdi
movq 0xa0(%rbx), %rsi
subq 0x98(%rbx), %rsi
sarq $0x5, %rsi
incq %rsi
movq %rdi, -0x50(%rbp)
callq 0x630e
movq 0x9ebb(%rip), %rbx      # 0xdfd8
leaq 0x6115(%rip), %rsi      # 0xa239
movl $0x32, %edx
movq %rbx, %rdi
callq 0x2220
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %rbx, %rdi
callq 0x2220
movq %rax, %rbx
leaq 0x611e(%rip), %rsi      # 0xa26c
movl $0x14, %edx
movq %rax, %rdi
callq 0x2220
movq 0x38(%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 0x28(%r14), %rcx
movl $0x1, %eax
cmpq %r15, %rcx
je 0x4325
leaq -0x48(%rbp), %r12
movq %rcx, -0x60(%rbp)
leaq 0x10(%rcx), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x92d6
movq -0x40(%rbp), %rbx
movq -0x48(%rbp), %r14
movq %r12, %rdi
callq 0x60b2
cmpq %r14, %rbx
je 0x428e
movl $0x1, %r14d
xorl %ebx, %ebx
movl $0x19, %edx
movq 0x9df1(%rip), %r15      # 0xdfd8
movq %r15, %rdi
leaq 0x6090(%rip), %rsi      # 0xa281
callq 0x2220
movq %r12, %rdi
movq %r13, %rsi
callq 0x92d6
movq -0x48(%rbp), %rax
movq -0x40(%rbp), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
cmpq %rbx, %rdx
jbe 0x4334
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 0x60b2
movl %r14d, %ebx
movq %r12, %rdi
movq %r13, %rsi
callq 0x92d6
movq -0x40(%rbp), %r15
subq -0x48(%rbp), %r15
sarq $0x5, %r15
movq %r12, %rdi
callq 0x60b2
incl %r14d
cmpq %rbx, %r15
ja 0x41db
movl $0x58, %edi
callq 0x21e0
movq %rax, %rbx
leaq -0x70(%rbp), %r14
movq %r14, -0x80(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x80(%rbp), %r15
movq %r15, %rdi
callq 0x66bc
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x9308
movq -0x80(%rbp), %rdi
cmpq %r14, %rdi
je 0x42e1
callq 0x21a0
movq %rbx, -0x48(%rbp)
movq -0x50(%rbp), %rax
movq (%rax), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x4300
movq %rbx, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x4308
movq %r12, %rdx
callq 0x7442
movq -0x60(%rbp), %rcx
movq (%rcx), %rcx
cmpq -0x58(%rbp), %rcx
jne 0x41a7
movl $0x1, %eax
jmp 0x4325
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x62da(%rip), %rdi      # 0xa615
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2280
movq %rax, %r14
movq -0xa0(%rbp), %rdi
cmpq %r12, %rdi
jne 0x4372
jmp 0x4387
movq %rax, %r14
jmp 0x436f
movq %r14, %rcx
movq %rax, %r14
movq -0x80(%rbp), %rdi
cmpq %rcx, %rdi
je 0x436f
callq 0x21a0
movq %rbx, %rdi
callq 0x21a0
jmp 0x4387
jmp 0x437b
movq %rax, %r14
leaq -0x48(%rbp), %rdi
callq 0x60b2
movq %r14, %rdi
callq 0x22f0
nop