// File: 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
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq 0x156a3(%rip), %rdi     # 0x1bfd8
leaq 0xcbfe(%rip), %rsi      # 0x1353a
callq 0x21c0
movq %rax, -0x98(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x30(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0x116a0
movq -0x98(%rbp), %rdi
movq -0x90(%rbp), %rsi
callq 0x21a0
movq %rax, -0x88(%rbp)
jmp 0x6978
movq -0x88(%rbp), %rdi
leaq 0xcbc0(%rip), %rsi      # 0x13546
callq 0x21c0
jmp 0x698d
leaq -0x30(%rbp), %rdi
callq 0x2140
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
movq %rax, -0xa8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x116d0
movq %rax, %rsi
leaq -0x58(%rbp), %rdi
callq 0x114b0
leaq -0x58(%rbp), %rdi
callq 0x6c90
movq %rax, -0xb0(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x6f60
movq -0xb0(%rbp), %rcx
movq -0xa8(%rbp), %rax
cmpq %rcx, %rax
jae 0x6a9e
movq -0x10(%rbp), %rdi
callq 0x116d0
movq %rax, %rsi
leaq -0x70(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x114b0
movq -0xc0(%rbp), %rdi
movl -0x40(%rbp), %eax
movl %eax, %esi
callq 0x7090
movq %rax, -0xb8(%rbp)
jmp 0x6a22
movq -0xb8(%rbp), %rsi
movq 0x155a8(%rip), %rdi     # 0x1bfd8
callq 0x21a0
movq %rax, -0xc8(%rbp)
jmp 0x6a3e
movq -0xc8(%rbp), %rdi
leaq 0xcb41(%rip), %rsi      # 0x1358d
callq 0x21c0
jmp 0x6a53
leaq -0x70(%rbp), %rdi
callq 0x6f60
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x699d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x2140
jmp 0x6be1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x6f60
jmp 0x6be1
movq -0x10(%rbp), %rdi
callq 0x11660
movq %rax, -0x78(%rbp)
movq 0x15526(%rip), %rdi     # 0x1bfd8
movq 0x1550f(%rip), %rsi     # 0x1bfc8
callq 0x21f0
movq %rax, %rdi
leaq 0xcac7(%rip), %rsi      # 0x1358f
callq 0x21c0
movq %rax, -0xd0(%rbp)
movq -0x78(%rbp), %rdi
callq 0x7a20
movq -0xd0(%rbp), %rdi
movq %rax, %rsi
callq 0x2080
movq %rax, %rdi
movq 0x154d2(%rip), %rsi     # 0x1bfc8
callq 0x21f0
movl $0x0, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movq %rax, -0xd8(%rbp)
movq -0x78(%rbp), %rdi
callq 0x7a20
movq %rax, %rcx
movq -0xd8(%rbp), %rax
cmpq %rcx, %rax
jae 0x6bad
movq -0x78(%rbp), %rdi
movl -0x7c(%rbp), %eax
movl %eax, %esi
callq 0x7a40
cmpq $0x0, (%rax)
jne 0x6b60
movq 0x15495(%rip), %rdi     # 0x1bfd8
leaq 0xca66(%rip), %rsi      # 0x135b0
callq 0x21c0
movq %rax, %rdi
movq 0x1546f(%rip), %rsi     # 0x1bfc8
callq 0x21f0
jmp 0x6b9f
movq -0x78(%rbp), %rdi
movl -0x7c(%rbp), %eax
movl %eax, %esi
callq 0x7a40
movq (%rax), %rdi
callq 0x11850
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x6b9d
movq -0x78(%rbp), %rdi
movl -0x7c(%rbp), %eax
movl %eax, %esi
callq 0x7a40
movq -0xa0(%rbp), %rdi
movq (%rax), %rsi
callq 0x6910
jmp 0x6b9f
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x6b02
movq 0x15424(%rip), %rdi     # 0x1bfd8
movq 0x1540d(%rip), %rsi     # 0x1bfc8
callq 0x21f0
movq %rax, %rdi
movq 0x153fe(%rip), %rsi     # 0x1bfc8
callq 0x21f0
movq -0x10(%rbp), %rdi
callq 0x11870
addq $0xe0, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x2340
nopw (%rax,%rax)