// File: /workspace/github_cpp_makefile_star2_O2/matteorr[P]EarleyParser/EarleyParser.cpp
// Function: EarleyParser::printStateBackTrace(State*)
void EarleyParser::printStateBackTrace( State* stateToPrint )
{
	//cout << "[DEBUG]: in print back trace function" << endl;

	cout << "[DEBUG]: - " << stateToPrint->getNonTerminal() << " -> ";
	for( unsigned int i = 0; i < stateToPrint->getProductionPointer()->getProductionContent().size(); i++ )
	{
		cout << stateToPrint->getProductionPointer()->getProductionContent().at(i) << " ";
	}

	vector<State*>* backTraceVectorState = stateToPrint->getBacktraceStateVector();
	cout << endl << "size of backtrace vector state: " << backTraceVectorState->size() << endl;

	//for( unsigned int i = 0; i < backTraceVectorState->at(0)->getProductionPointer()->getProductionContent().size(); i++ )
	//{
	//	cout << " " << backTraceVectorState->at(0)->getProductionPointer()->getProductionContent().at(i);
	//}

	for( unsigned int i = 0; i < backTraceVectorState->size(); i++ )
	{
		if( backTraceVectorState->at(i) == NULL ){
			cout << "[DEBUG]: pointer to next state is null" << endl;
			continue;
		}

		if( backTraceVectorState->at(i)->getPrinted() == false )
		{
			//cout << "[DEBUG]: Production expanded [ " << *(*it)->getNonTerminal() << " -> ";
			//for( unsigned int i = 0; i < *(*it)->getProductionPointer()->getProductionContent().size(); i++ ){
			//	cout << (*it)->getProductionPointer()->getProductionContent().at(i) << " ";
			//}
			//cout << "]" << endl;
		//	cout << "[DEBUG]: - check if problem is iterator ->>>>>>>>>>>>" << backTraceVectorState->at(i)->getInputStringProgress() << endl << endl;
			//cout << "[DEBUG]: - " << stateToPrint->getNonTerminal() << " -> " <<endl;
			this->printStateBackTrace( backTraceVectorState->at(i) );
		}
		//backTraceVectorState->at(i)->setPrintedTrue();
	}

	//	cout << "[DEBUG]: - check if problem is pointer ->>>>>>>>>>>>" << stateToPrint->getInputStringProgress() << endl;

	cout << endl << endl;

	stateToPrint->setPrintedTrue();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, -0x30(%rbp)
movq 0x8625(%rip), %rdi      # 0xcfd8
leaq 0x3b94(%rip), %rsi      # 0x854e
callq 0x21c0
movq %rax, %r14
leaq -0x50(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x780c
movq %r14, %rdi
movq %r15, %rsi
callq 0x2190
leaq 0x3b77(%rip), %rsi      # 0x855a
movq %rax, %rdi
callq 0x21c0
movq %r15, %rdi
callq 0x20f0
xorl %r12d, %r12d
leaq 0x3ba4(%rip), %r14      # 0x85a1
movl %r12d, %r12d
movq %rbx, %rdi
callq 0x7828
movq %r15, %rdi
movq %rax, %rsi
callq 0x76d8
movq -0x48(%rbp), %r13
subq -0x50(%rbp), %r13
sarq $0x5, %r13
movq %r15, %rdi
callq 0x4ba2
movq %rbx, %rdi
cmpq %r12, %r13
jbe 0x4a71
callq 0x7828
movq %r15, %rdi
movq %rax, %rsi
callq 0x76d8
movq %r15, %rdi
movq %r12, %rsi
callq 0x4c0a
movq 0x8587(%rip), %rdi      # 0xcfd8
movq %rax, %rsi
callq 0x2190
movq %rax, %rdi
movq %r14, %rsi
callq 0x21c0
movq %r15, %rdi
callq 0x4ba2
incl %r12d
jmp 0x49fd
callq 0x77f8
movq %rax, %r15
movq 0x8558(%rip), %r12      # 0xcfd8
movq %r12, %rdi
callq 0x2100
leaq 0x3b14(%rip), %rsi      # 0x85a3
movq %rax, %rdi
callq 0x21c0
movq 0x8(%r15), %rsi
subq (%r15), %rsi
sarq $0x3, %rsi
movq %rax, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x2100
xorl %r14d, %r14d
leaq 0x3b08(%rip), %r13      # 0x85c4
movl %r14d, %r14d
movq 0x8(%r15), %rax
subq (%r15), %rax
sarq $0x3, %rax
cmpq %r14, %rax
jbe 0x4b28
movq %r15, %rdi
movq %r14, %rsi
callq 0x4e04
cmpq $0x0, (%rax)
je 0x4b10
movq %r15, %rdi
movq %r14, %rsi
callq 0x4e04
movq (%rax), %rdi
callq 0x791a
testb %al, %al
jne 0x4b23
movq %r15, %rdi
movq %r14, %rsi
callq 0x4e04
movq (%rax), %rsi
movq -0x30(%rbp), %rdi
callq 0x4994
jmp 0x4b23
movq %r12, %rdi
movq %r13, %rsi
callq 0x21c0
movq %rax, %rdi
callq 0x2100
incl %r14d
jmp 0x4abc
movq 0x84a9(%rip), %rdi      # 0xcfd8
callq 0x2100
movq %rax, %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x7924
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x20f0
jmp 0x4b6d
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x4ba2
movq %rbx, %rdi
callq 0x22c0
nop