// File: /workspace/github_cpp_makefile_star2_O1/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, -0x50(%rbp)
movq 0x8235(%rip), %r15      # 0xdfd8
leaq 0x47a4(%rip), %rsi      # 0xa54e
movl $0xb, %edx
movq %r15, %rdi
callq 0x2220
leaq -0x48(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x945a
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %r15, %rdi
callq 0x2220
leaq 0x477e(%rip), %rsi      # 0xa55a
movl $0x4, %edx
movq %rax, %rdi
callq 0x2220
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5dfb
callq 0x21a0
movq %rbx, %rdi
callq 0x9488
movq %r14, %rdi
movq %rax, %rsi
callq 0x92e6
movq 0x8(%r14), %r15
movq (%r14), %r12
movq %r14, %rdi
callq 0x60da
cmpq %r12, %r15
je 0x5ec9
movl $0x1, %r13d
xorl %r14d, %r14d
leaq -0x48(%rbp), %r12
movq %rbx, %rdi
callq 0x9488
movq %r12, %rdi
movq %rax, %rsi
callq 0x92e6
movq -0x48(%rbp), %rax
movq -0x40(%rbp), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
cmpq %r14, %rdx
jbe 0x607d
shlq $0x5, %r14
movq (%rax,%r14), %rsi
movq 0x8(%rax,%r14), %rdx
movq 0x8166(%rip), %rdi      # 0xdfd8
callq 0x2220
movl $0x1, %edx
movq %rax, %rdi
leaq 0x471b(%rip), %rsi      # 0xa5a1
callq 0x2220
movq %r12, %rdi
callq 0x60da
movl %r13d, %r14d
movq %rbx, %rdi
callq 0x9488
movq %r12, %rdi
movq %rax, %rsi
callq 0x92e6
movq -0x40(%rbp), %r15
subq -0x48(%rbp), %r15
sarq $0x5, %r15
movq %r12, %rdi
callq 0x60da
incl %r13d
cmpq %r14, %r15
ja 0x5e33
movq %rbx, %rdi
callq 0x9446
movq %rax, %r12
movq 0x80fd(%rip), %r14      # 0xdfd8
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %r14
leaq 0x4697(%rip), %rsi      # 0xa5a3
movl $0x20, %edx
movq %rax, %rdi
callq 0x2220
movq 0x8(%r12), %rsi
subq (%r12), %rsi
sarq $0x3, %rsi
movq %r14, %rdi
callq 0x2140
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq (%r12), %rax
cmpq %rax, 0x8(%r12)
je 0x600e
movl $0x1, %r15d
xorl %r14d, %r14d
leaq 0x464d(%rip), %r13      # 0xa5c4
movq (%rax,%r14,8), %rdi
testq %rdi, %rdi
je 0x5fb1
callq 0x95ac
testb %al, %al
jne 0x5fef
movq (%r12), %rax
movq 0x8(%r12), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %r14, %rdx
jbe 0x608e
movq (%rax,%r14,8), %rsi
movq -0x50(%rbp), %rdi
callq 0x5d84
jmp 0x5fef
movl $0x26, %edx
movq 0x801b(%rip), %r14      # 0xdfd8
movq %r14, %rdi
movq %r13, %rsi
callq 0x2220
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movl %r15d, %r14d
movq (%r12), %rax
movq 0x8(%r12), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
incl %r15d
cmpq %r14, %rcx
ja 0x5f77
movq 0x7fc3(%rip), %r14      # 0xdfd8
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rbx, %rdi
callq 0x95b6
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4591(%rip), %rdi      # 0xa615
movq %r14, %rsi
xorl %eax, %eax
callq 0x2280
leaq 0x4580(%rip), %rdi      # 0xa615
movq %r14, %rsi
xorl %eax, %eax
callq 0x2280
movq %rax, %rbx
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x60c4
callq 0x21a0
jmp 0x60c4
jmp 0x60b8
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x60da
movq %rbx, %rdi
callq 0x22f0