// File: 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
subq $0xe0, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
addq $0x80, %rdi
movslq -0x14(%rbp), %rsi
callq 0x7990
movq %rax, %rdi
callq 0x6d00
movq %rax, -0x28(%rbp)
movq -0xa0(%rbp), %rdi
addq $0x80, %rdi
movslq -0x14(%rbp), %rsi
callq 0x7990
movq %rax, %rdi
callq 0x6d70
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x6d30
testb $0x1, %al
jne 0x5cf6
jmp 0x5f4f
leaq -0x28(%rbp), %rdi
callq 0x6da0
movq (%rax), %rsi
leaq -0x50(%rbp), %rdi
callq 0x116a0
movq -0x20(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x116a0
jmp 0x5d1a
leaq -0x50(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x7a80
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0xa1(%rbp)
jne 0x5d3b
jmp 0x5e09
leaq -0x28(%rbp), %rdi
callq 0x6da0
movq (%rax), %rdi
callq 0x11680
movl %eax, -0xa8(%rbp)
jmp 0x5d54
movq -0x20(%rbp), %rdi
callq 0x11680
movl %eax, -0xac(%rbp)
jmp 0x5d65
movl -0xa8(%rbp), %ecx
movl -0xac(%rbp), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0xa1(%rbp)
jne 0x5e09
leaq -0x28(%rbp), %rdi
callq 0x6da0
movq (%rax), %rdi
callq 0x116d0
movq %rax, -0xb8(%rbp)
jmp 0x5d9b
movq -0x20(%rbp), %rdi
callq 0x116d0
movq %rax, -0xc0(%rbp)
jmp 0x5dad
movq -0xb8(%rbp), %rcx
movq -0xc0(%rbp), %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0xa1(%rbp)
jne 0x5e09
leaq -0x28(%rbp), %rdi
callq 0x6da0
movq (%rax), %rdi
callq 0x11730
movl %eax, -0xc4(%rbp)
jmp 0x5de1
movq -0x20(%rbp), %rdi
callq 0x11730
movl %eax, -0xc8(%rbp)
jmp 0x5df2
movl -0xc4(%rbp), %eax
movl -0xc8(%rbp), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0xa1(%rbp)
movb -0xa1(%rbp), %al
movb %al, -0xc9(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x2140
leaq -0x50(%rbp), %rdi
callq 0x2140
movb -0xc9(%rbp), %al
testb $0x1, %al
jne 0x5e36
jmp 0x5f36
movq 0x1619b(%rip), %rdi     # 0x1bfd8
leaq 0xd57a(%rip), %rsi      # 0x133be
callq 0x21c0
movq -0xa0(%rbp), %rdi
movq %rax, -0xd8(%rbp)
addq $0x80, %rdi
movslq -0x14(%rbp), %rsi
callq 0x7990
movq %rax, %rdi
callq 0x6d00
movq %rax, -0x88(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x7b10
movq -0xd8(%rbp), %rdi
movq %rax, %rsi
callq 0x2360
movq %rax, %rdi
leaq 0xd546(%rip), %rsi      # 0x133e5
callq 0x21c0
movq %rax, %rdi
movl -0x14(%rbp), %esi
callq 0x2330
movq %rax, %rdi
leaq 0xd170(%rip), %rsi      # 0x13029
callq 0x21c0
movq %rax, %rdi
movq 0x16100(%rip), %rsi     # 0x1bfc8
callq 0x21f0
movq -0xa0(%rbp), %rdi
addq $0x80, %rdi
movslq -0x14(%rbp), %rsi
callq 0x7990
movq %rax, %rdi
callq 0x6d00
movq %rax, -0x90(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x7b10
movl %eax, -0x4(%rbp)
jmp 0x5f56
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x5f2b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x2140
leaq -0x50(%rbp), %rdi
callq 0x2140
jmp 0x5f62
jmp 0x5f38
leaq -0x28(%rbp), %rdi
xorl %esi, %esi
callq 0x6dc0
movq %rax, -0x98(%rbp)
jmp 0x5cbd
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
movq -0x78(%rbp), %rdi
callq 0x2340
nopl (%rax,%rax)