// File: /workspace/github_cpp_makefile_star2_O1/matteorr[P]EarleyParser/EarleyParser.cpp
// Function: EarleyParser::stateExists(int, State*)
int EarleyParser::stateExists( int chartPosition, State* stateToCheck )
{
	for( vector<State*>::iterator it = this->earleyParserChart[ chartPosition ].begin(); it != this->earleyParserChart[ chartPosition ].end(); it++ )
	{
		if( (*it)->getNonTerminal() == stateToCheck->getNonTerminal() &&
			(*it)->getInputStringProgress() == stateToCheck->getInputStringProgress() &&
			(*it)->getProductionPointer() == stateToCheck->getProductionPointer() &&
			(*it)->getProductionProgress() == stateToCheck->getProductionProgress() )
		{
			cout << "[DEBUG]: found same state at position " << it - this->earleyParserChart[ chartPosition ].begin() << " of chart[" << chartPosition << "]" << endl;
			return ( it - this->earleyParserChart[ chartPosition ].begin());
		}
	}
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %r12
movslq %esi, %rcx
movq 0x80(%rdi), %rdx
leaq (%rcx,%rcx,2), %rsi
movq (%rdx,%rsi,8), %r14
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rsi, -0x80(%rbp)
cmpq 0x8(%rdx,%rsi,8), %r14
je 0x5545
movq %rdi, %r15
movq %rcx, -0x78(%rbp)
movq %r14, %r13
negq %r13
movq (%r14), %rsi
leaq -0x70(%rbp), %rdi
callq 0x945a
leaq -0x50(%rbp), %rdi
movq %r12, %rsi
callq 0x945a
movq -0x68(%rbp), %rdx
cmpq -0x48(%rbp), %rdx
jne 0x53f4
testq %rdx, %rdx
je 0x53bb
movq -0x50(%rbp), %rsi
movq -0x70(%rbp), %rdi
callq 0x21f0
testl %eax, %eax
jne 0x53f4
movq %r15, %rbx
movq (%r14), %rdi
callq 0x9450
movl %eax, %r15d
movq %r12, %rdi
callq 0x9450
cmpl %eax, %r15d
movq %rbx, %r15
jne 0x53f4
movq (%r14), %rdi
callq 0x9488
movq %rax, %r15
movq %r12, %rdi
callq 0x9488
cmpq %rax, %r15
movq %rbx, %r15
je 0x543b
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x5406
callq 0x21a0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x5418
callq 0x21a0
addq $0x8, %r14
movq 0x80(%r15), %rax
addq $-0x8, %r13
movq -0x80(%rbp), %rcx
cmpq 0x8(%rax,%rcx,8), %r14
jne 0x5383
jmp 0x5540
movq (%r14), %rdi
callq 0x94bc
movl %eax, -0x2c(%rbp)
movq %r12, %rdi
callq 0x94bc
movl %eax, %r15d
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x5463
callq 0x21a0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x5475
callq 0x21a0
cmpl %r15d, -0x2c(%rbp)
movq %rbx, %r15
jne 0x5418
movq %r15, %r14
movq 0x8b50(%rip), %r15      # 0xdfd8
leaq 0x4f43(%rip), %rsi      # 0xa3d2
movl $0x26, %edx
movq %r15, %rdi
callq 0x2220
movq 0x80(%r14), %rax
movq -0x78(%rbp), %r12
leaq (,%r12,8), %rcx
leaq (%rcx,%rcx,2), %rbx
movq (%rax,%rbx), %rsi
addq %r13, %rsi
negq %rsi
sarq $0x3, %rsi
movq %r15, %rdi
callq 0x21b0
movq %rax, %r15
leaq 0x4f26(%rip), %rsi      # 0xa3f9
movl $0xa, %edx
movq %rax, %rdi
callq 0x2220
movq %r15, %rdi
movl %r12d, %esi
callq 0x22d0
movq %rax, %r15
leaq 0x4b48(%rip), %rsi      # 0xa03d
movl $0x1, %edx
movq %rax, %rdi
callq 0x2220
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq 0x80(%r14), %rax
addq (%rax,%rbx), %r13
negq %r13
shrq $0x3, %r13
movl %r13d, %eax
jmp 0x5545
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x556e
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x556e
callq 0x21a0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x5580
callq 0x21a0
movq %rbx, %rdi
callq 0x22f0