// File: /workspace/github_cpp_makefile_star2_O3/matteorr[P]EarleyParser/Node.cpp
// Function: Node::expandNode(State*, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::list<Production, std::allocator<Production>>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::__cxx11::list<Production, std::allocator<Production>>>>>*)
State* Node::expandNode( State* currentStateToExpand, unordered_map< string, list<Production> >* earleyProductions )
{
	State* nextStateToExpand;

	cout << endl << "currently in expansion of - " << currentStateToExpand->getNonTerminal();
	for( unsigned int i = 0; i < currentStateToExpand->getProductionPointer()->getProductionContent().size(); i++ )
	{
		cout << " " << currentStateToExpand->getProductionPointer()->getProductionContent().at(i) << " ";
	}

	for( unsigned int i = this->production.size(); i > 0; i-- )
	{

/*		cout << endl << "check-------------------------------------------------" << endl;
		cout << endl << "[DEBUG]: production of this node - size: " << this->production.size() << endl;
		for( unsigned int k = 0; k < this->production.size(); k++ )
		{
			cout << this->production.at(k) << " ";
		}
		cout << endl << "[DEBUG]: production of current state to expand - size: " << currentStateToExpand->getProductionPointer()->getProductionContent().size() << endl;
		for( unsigned int k = 0; k < currentStateToExpand->getProductionPointer()->getProductionContent().size(); k++ )
		{
			cout << currentStateToExpand->getProductionPointer()->getProductionContent().at(k) << " ";
		}
		cout << endl << "-------------------------------------------------finish" << endl << endl;

		if( this->productionPointer != currentStateToExpand->getProductionPointer() )
		{
			exit(1);
		}
*/
		unordered_map< string, list<Production> >::iterator got = earleyProductions->find( this->production.at( i - 1 ) );
		if( got != earleyProductions->end() )
		{
			/*
			 * the element contained in the production
			 * at current position of loop is NON TERMINAL
			 * and needs to be expanded
			 */
			if( currentStateToExpand->getBacktraceStateVector()->size() > 1 ){

				cout << endl << "BACKTRACE VECTOR BIGGER THAN 1" << endl;

				for( unsigned j = 0; j < currentStateToExpand->getBacktraceStateVector()->size(); j++ )
				{
					State* state = currentStateToExpand->getBacktraceStateVector()->at(j);
					cout << endl << "[DEBUG]: at 0 -" << state->getNonTerminal() << " size: " << state->getProductionPointer()->getProductionContent().size() << endl;
					for( unsigned int k = 0; k < state->getProductionPointer()->getProductionContent().size(); k++ )
					{
						cout << state->getProductionPointer()->getProductionContent().at(k) << " ";
					}
					cout << endl;
				}

				for( unsigned j = 0; j < currentStateToExpand->getBacktraceStateVector()->size(); j++ )
				{
					if( this->father->getProductionPointer() == currentStateToExpand->getBacktraceStateVector()->at(j)->getProductionPointer() )
					{
						currentStateToExpand = currentStateToExpand->getBacktraceStateVector()->at(j);
						cout << "[DEBUG]: matching production pointer at position " << j << endl;
						break;
					}

					if( j == currentStateToExpand->getBacktraceStateVector()->size() - 1 )
					{
						cout << "[ERROR]: no matching production pointer correspondent to production in this node!" << endl;
						exit(1);
					}
				}

			}else{
				nextStateToExpand = currentStateToExpand->getBacktraceStateVector()->at(0);
			}

			// TODO CHECK THAT this->production.at( i - 1 ) == nextStateToExpand->getNonTerminal()

			Node* child;
			if( this->productionProbability >= 0 )
			{
				child =	new Node(
								this,
								nextStateToExpand->getNonTerminal(),
								nextStateToExpand->getProductionPointer()->getProductionContent(),
								nextStateToExpand->getProductionPointer(),
								nextStateToExpand->getProductionPointer()->getProductionProbability()
							);
			}else{

				child = new Node(
								this,
								nextStateToExpand->getNonTerminal(),
								nextStateToExpand->getProductionPointer()->getProductionContent(),
								nextStateToExpand->getProductionPointer(),
								-1
							);
			}

			/*
			 * insert at beginning of vector
			 */
			this->children.insert( this->children.begin(), child );

			currentStateToExpand = child->expandNode( nextStateToExpand, earleyProductions );

			cout << endl << "finished expanding - " << nextStateToExpand->getNonTerminal() << endl;

		}else{
			/*
			 * the element is TERMINAL
			 * and needs not to be exapanded
			 */

			Node* child;
			if( this->productionProbability >= 0 )
			{
				/*
				 * leaf nodes have probabilities only
				 * if terminal symbols probabilities are
				 * specified in input
				 */

				/*
				 * NULL is inserted because terminal
				 * symbols do not have a production
				 */
				child =	new Node(
								this,
								this->production.at( i - 1 ),
								vector<string>(),
								//nextStateToExpand->getProductionPointer()->getProductionProbability()
								//nextStateToExpand->getProductionPointer(),
								NULL,
								1
							);
			}else{

				child = new Node(
								this,
								this->production.at( i - 1 ),
								vector<string>(),
								//nextStateToExpand->getProductionPointer(),
								NULL,
								-1
							);
			}

			/*
			 * insert at beginning of vector
			 */
			this->children.insert( this->children.begin(), child );

			if( currentStateToExpand->getBacktraceStateVector()->size() > 1 ){

				cout << endl << "BACKTRACE VECTOR BIGGER THAN 1" << endl;

				for( unsigned j = 0; j < currentStateToExpand->getBacktraceStateVector()->size(); j++ )
				{
					State* state = currentStateToExpand->getBacktraceStateVector()->at(j);
					cout << endl << "[DEBUG]: at 0 -" << state->getNonTerminal() << " size: " << state->getProductionPointer()->getProductionContent().size() << endl;
					for( unsigned int k = 0; k < state->getProductionPointer()->getProductionContent().size(); k++ )
					{
						cout << state->getProductionPointer()->getProductionContent().at(k) << " ";
					}
					cout << endl;
				}

				for( unsigned j = 0; j < currentStateToExpand->getBacktraceStateVector()->size(); j++ )
				{
					if( this->father->getProductionPointer() == currentStateToExpand->getBacktraceStateVector()->at(j)->getProductionPointer() )
					{
						currentStateToExpand = currentStateToExpand->getBacktraceStateVector()->at(j);
						cout << "[DEBUG]: matching production pointer at position " << j << endl;
						break;
					}

					if( j == currentStateToExpand->getBacktraceStateVector()->size() - 1 )
					{
						cout << "[ERROR]: no matching production pointer correspondent to production in this node!" << endl;
						exit(1);
					}
				}

			}else{
				currentStateToExpand = currentStateToExpand->getBacktraceStateVector()->at(0);
			}

			if( currentStateToExpand->getBacktraceStateVector()->size() > 1 ){

				cout << endl << "BACKTRACE VECTOR BIGGER THAN 1" << endl;

				for( unsigned j = 0; j < currentStateToExpand->getBacktraceStateVector()->size(); j++ )
				{
					State* state = currentStateToExpand->getBacktraceStateVector()->at(j);
					cout << endl << "[DEBUG]: at 0 -" << state->getNonTerminal() << " size: " << state->getProductionPointer()->getProductionContent().size() << endl;
					for( unsigned int k = 0; k < state->getProductionPointer()->getProductionContent().size(); k++ )
					{
						cout << state->getProductionPointer()->getProductionContent().at(k) << " ";
					}
					cout << endl;
				}

				//for( unsigned j = currentStateToExpand->getBacktraceStateVector()->size() - 1; j >= 0; j-- )
				for( unsigned j = 0; j < currentStateToExpand->getBacktraceStateVector()->size(); j++ )
				{
					if( this->father->getProductionPointer() == currentStateToExpand->getBacktraceStateVector()->at(j)->getProductionPointer() )
					{
						currentStateToExpand = currentStateToExpand->getBacktraceStateVector()->at(j);
						cout << "[DEBUG]: matching production pointer at position " << j << endl;
						break;
					}else{
						cout << "[DEBUG]: no matching production pointer at position " << j << endl;
					}

					if( j == currentStateToExpand->getBacktraceStateVector()->size() - 1/*0*/ )
					{
						cout << "[ERROR]: no matching production pointer correspondent to production in this node!" << endl;
						exit(1);
					}
				}

			}else{
				currentStateToExpand = currentStateToExpand->getBacktraceStateVector()->at(0);
			}
		}
	}

	return currentStateToExpand;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %rdx, %r15
movq %rsi, %r13
movq %rdi, %r12
movq 0x65a6(%rip), %rbx      # 0xdfd8
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %rbx
leaq 0x2c45(%rip), %rsi      # 0xa6a8
movl $0x1c, %edx
movq %rax, %rdi
callq 0x2220
leaq -0x58(%rbp), %r14
movq %r14, %rdi
movq %r13, -0x30(%rbp)
movq %r13, %rsi
callq 0x944e
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbx, %rdi
callq 0x2220
movq %r12, -0x38(%rbp)
movq %r15, -0x60(%rbp)
leaq -0x48(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7aac
callq 0x21a0
movq -0x30(%rbp), %r14
movq %r14, %rdi
callq 0x947c
leaq -0x58(%rbp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x92d6
movq 0x8(%rbx), %r12
movq (%rbx), %r15
movq %rbx, %rdi
callq 0x60b2
cmpq %r15, %r12
je 0x7ba2
movl $0x1, %ebx
xorl %r13d, %r13d
movq 0x64ea(%rip), %r15      # 0xdfd8
leaq -0x58(%rbp), %r12
movl $0x1, %edx
movq %r15, %rdi
leaq 0x2aa0(%rip), %rsi      # 0xa5a1
callq 0x2220
movq %r14, %rdi
callq 0x947c
movq %r12, %rdi
movq %rax, %rsi
callq 0x92d6
movq -0x58(%rbp), %rax
movq -0x50(%rbp), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
cmpq %r13, %rdx
jbe 0x8cbe
shlq $0x5, %r13
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
movq %r15, %rdi
callq 0x2220
movl $0x1, %edx
movq %rax, %rdi
leaq 0x2a4c(%rip), %rsi      # 0xa5a1
callq 0x2220
movq %r12, %rdi
callq 0x60b2
movl %ebx, %r13d
movq -0x30(%rbp), %r14
movq %r14, %rdi
callq 0x947c
movq %r12, %rdi
movq %rax, %rsi
callq 0x92d6
movq -0x50(%rbp), %r15
subq -0x58(%rbp), %r15
sarq $0x5, %r15
movq %r12, %rdi
callq 0x60b2
incl %ebx
cmpq %r13, %r15
movq 0x643c(%rip), %r15      # 0xdfd8
ja 0x7af2
movq -0x38(%rbp), %r12
movq 0x30(%r12), %rax
subq 0x28(%r12), %rax
shrq $0x5, %rax
testl %eax, %eax
je 0x8c30
leaq 0x48(%r12), %rcx
movq %rcx, -0x98(%rbp)
movl %eax, %ebx
leaq -0x58(%rbp), %r13
movq -0x60(%rbp), %r15
movq -0x30(%rbp), %r14
decq %rbx
movq 0x28(%r12), %rsi
movq 0x30(%r12), %rdx
subq %rsi, %rdx
sarq $0x5, %rdx
cmpq %rbx, %rdx
jbe 0x8c88
movq %rbx, -0x70(%rbp)
shlq $0x5, %rbx
addq %rbx, %rsi
movq %r15, %rdi
callq 0x67f8
testq %rax, %rax
movq %r14, -0x30(%rbp)
je 0x7f92
movq %r14, %rdi
callq 0x943a
movq 0x8(%rax), %rcx
subq (%rax), %rcx
cmpq $0x9, %rcx
jb 0x805b
movq 0x63a5(%rip), %rbx      # 0xdfd8
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %rbx
movl $0x1e, %edx
movq %rax, %rdi
leaq 0x2a59(%rip), %rsi      # 0xa6c5
callq 0x2220
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %r14, %rdi
callq 0x943a
movq 0x8(%rax), %rcx
cmpq (%rax), %rcx
je 0x7ee4
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x943a
movq (%rax), %rcx
movq 0x8(%rax), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %r15, %rdx
jbe 0x8c7c
movq (%rcx,%r15,8), %r14
movq 0x62fe(%rip), %rbx      # 0xdfd8
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %r12
movl $0xf, %edx
movq %rax, %rdi
leaq 0x29d1(%rip), %rsi      # 0xa6e4
callq 0x2220
movq %r13, %rdi
movq %r14, %rsi
callq 0x944e
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq %r12, %rdi
callq 0x2220
movq %rax, %r12
movl $0x7, %edx
movq %rax, %rdi
leaq 0x29af(%rip), %rsi      # 0xa6f4
callq 0x2220
movq %r14, %rdi
callq 0x947c
leaq -0x88(%rbp), %rdi
movq %rax, %rsi
callq 0x92d6
movq -0x80(%rbp), %rsi
subq -0x88(%rbp), %rsi
sarq $0x5, %rsi
movq %r12, %rdi
callq 0x2140
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %r15, -0x68(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x60b2
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x7dc4
callq 0x21a0
movq %r14, %rdi
callq 0x947c
movq %r13, %rdi
movq %rax, %rsi
callq 0x92d6
movq -0x50(%rbp), %r15
movq -0x58(%rbp), %r12
movq %r13, %rdi
callq 0x60b2
cmpq %r12, %r15
je 0x7e8f
movl $0x1, %r15d
xorl %r12d, %r12d
movq %r14, %rdi
callq 0x947c
movq %r13, %rdi
movq %rax, %rsi
callq 0x92d6
movq -0x58(%rbp), %rax
movq -0x50(%rbp), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
cmpq %r12, %rdx
jbe 0x8c49
shlq $0x5, %r12
movq (%rax,%r12), %rsi
movq 0x8(%rax,%r12), %rdx
movq 0x61a0(%rip), %rdi      # 0xdfd8
callq 0x2220
movl $0x1, %edx
movq %rax, %rdi
leaq 0x2755(%rip), %rsi      # 0xa5a1
callq 0x2220
movq %r13, %rdi
callq 0x60b2
movl %r15d, %r12d
movq %r14, %rdi
callq 0x947c
movq %r13, %rdi
movq %rax, %rsi
callq 0x92d6
movq -0x50(%rbp), %rbx
subq -0x58(%rbp), %rbx
sarq $0x5, %rbx
movq %r13, %rdi
callq 0x60b2
incl %r15d
cmpq %r12, %rbx
ja 0x7df9
movq 0x6142(%rip), %rbx      # 0xdfd8
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq -0x68(%rbp), %r15
incl %r15d
movq -0x30(%rbp), %r14
movq %r14, %rdi
callq 0x943a
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x3, %rcx
cmpq %r15, %rcx
ja 0x7cb0
movq %r14, %rdi
callq 0x943a
movq 0x8(%rax), %rcx
cmpq (%rax), %rcx
je 0x84c7
movl $0x1, %r15d
xorl %ebx, %ebx
movq -0x38(%rbp), %r12
movq 0x40(%r12), %rax
movq 0x68(%rax), %r12
movq %r14, %rdi
callq 0x943a
movq (%rax), %rcx
movq 0x8(%rax), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %rbx, %rdx
jbe 0x8c88
movq (%rcx,%rbx,8), %rdi
callq 0x947c
movq %rax, -0x68(%rbp)
movq %r14, %rdi
callq 0x943a
movq 0x8(%rax), %rdx
subq (%rax), %rdx
sarq $0x3, %rdx
cmpq -0x68(%rbp), %r12
je 0x84d1
decq %rdx
cmpq %rbx, %rdx
movq -0x38(%rbp), %r12
je 0x8c99
movl %r15d, %ebx
movq -0x30(%rbp), %r14
movq %r14, %rdi
callq 0x943a
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x3, %rcx
incl %r15d
cmpq %rbx, %rcx
ja 0x7f05
jmp 0x852e
movss 0x60(%r12), %xmm0
movss %xmm0, -0x68(%rbp)
movl $0x70, %edi
callq 0x21e0
movq %rax, %r14
movq 0x28(%r12), %rax
movq 0x30(%r12), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
movss -0x68(%rbp), %xmm0
ucomiss 0x26dc(%rip), %xmm0     # 0xa6a4
jae 0x8078
cmpq -0x70(%rbp), %rdx
jbe 0x8cee
leaq -0xb0(%rbp), %rcx
movq %rcx, -0xc0(%rbp)
movq (%rax,%rbx), %rsi
movq 0x8(%rax,%rbx), %rdx
addq %rsi, %rdx
leaq -0xc0(%rbp), %rbx
movq %rbx, %rdi
callq 0x66bc
xorps %xmm0, %xmm0
movaps %xmm0, -0x140(%rbp)
movq $0x0, -0x130(%rbp)
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
leaq -0x140(%rbp), %rbx
movq %rbx, %rcx
xorl %r8d, %r8d
movss 0x1fd4(%rip), %xmm0     # 0xa008
callq 0x78a8
movq %r14, -0xa0(%rbp)
movq %rbx, %rdi
callq 0x60b2
movq -0xc0(%rbp), %rdi
leaq -0xb0(%rbp), %rax
jmp 0x8100
movq %r14, %rdi
callq 0x943a
movq (%rax), %rcx
cmpq %rcx, 0x8(%rax)
je 0x8ccf
movq (%rcx), %rbx
jmp 0x8539
cmpq -0x70(%rbp), %rdx
jbe 0x8cdc
leaq -0xd0(%rbp), %rcx
movq %rcx, -0xe0(%rbp)
movq (%rax,%rbx), %rsi
movq 0x8(%rax,%rbx), %rdx
addq %rsi, %rdx
leaq -0xe0(%rbp), %rbx
movq %rbx, %rdi
callq 0x66bc
xorps %xmm0, %xmm0
movaps %xmm0, -0x160(%rbp)
movq $0x0, -0x150(%rbp)
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
leaq -0x160(%rbp), %rbx
movq %rbx, %rcx
xorl %r8d, %r8d
movss 0x1f26(%rip), %xmm0     # 0xa004
callq 0x78a8
movq %r14, -0xa0(%rbp)
movq %rbx, %rdi
callq 0x60b2
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
cmpq %rax, %rdi
je 0x810a
callq 0x21a0
movq -0x98(%rbp), %rdi
movq (%rdi), %rsi
leaq -0xa0(%rbp), %rdx
callq 0x90a0
movq -0x30(%rbp), %r14
movq %r14, %rdi
callq 0x943a
movq 0x8(%rax), %rcx
subq (%rax), %rcx
cmpq $0x9, %rcx
jb 0x84aa
movq 0x5e94(%rip), %rbx      # 0xdfd8
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %rbx
movl $0x1e, %edx
movq %rax, %rdi
leaq 0x2548(%rip), %rsi      # 0xa6c5
callq 0x2220
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %r14, %rdi
callq 0x943a
movq 0x8(%rax), %rcx
cmpq (%rax), %rcx
je 0x83f5
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x943a
movq (%rax), %rcx
movq 0x8(%rax), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %r15, %rdx
jbe 0x8c7c
movq (%rcx,%r15,8), %r14
movq 0x5ded(%rip), %rbx      # 0xdfd8
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %r12
movl $0xf, %edx
movq %rax, %rdi
leaq 0x24c0(%rip), %rsi      # 0xa6e4
callq 0x2220
movq %r13, %rdi
movq %r14, %rsi
callq 0x944e
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq %r12, %rdi
callq 0x2220
movq %rax, %r12
movl $0x7, %edx
movq %rax, %rdi
leaq 0x249e(%rip), %rsi      # 0xa6f4
callq 0x2220
movq %r14, %rdi
callq 0x947c
leaq -0x88(%rbp), %rdi
movq %rax, %rsi
callq 0x92d6
movq -0x80(%rbp), %rsi
subq -0x88(%rbp), %rsi
sarq $0x5, %rsi
movq %r12, %rdi
callq 0x2140
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %r15, -0x68(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x60b2
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x82d5
callq 0x21a0
movq %r14, %rdi
callq 0x947c
movq %r13, %rdi
movq %rax, %rsi
callq 0x92d6
movq -0x50(%rbp), %r15
movq -0x58(%rbp), %r12
movq %r13, %rdi
callq 0x60b2
cmpq %r12, %r15
je 0x83a0
movl $0x1, %r15d
xorl %r12d, %r12d
movq %r14, %rdi
callq 0x947c
movq %r13, %rdi
movq %rax, %rsi
callq 0x92d6
movq -0x58(%rbp), %rax
movq -0x50(%rbp), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
cmpq %r12, %rdx
jbe 0x8c5a
shlq $0x5, %r12
movq (%rax,%r12), %rsi
movq 0x8(%rax,%r12), %rdx
movq 0x5c8f(%rip), %rdi      # 0xdfd8
callq 0x2220
movl $0x1, %edx
movq %rax, %rdi
leaq 0x2244(%rip), %rsi      # 0xa5a1
callq 0x2220
movq %r13, %rdi
callq 0x60b2
movl %r15d, %r12d
movq %r14, %rdi
callq 0x947c
movq %r13, %rdi
movq %rax, %rsi
callq 0x92d6
movq -0x50(%rbp), %rbx
subq -0x58(%rbp), %rbx
sarq $0x5, %rbx
movq %r13, %rdi
callq 0x60b2
incl %r15d
cmpq %r12, %rbx
ja 0x830a
movq 0x5c31(%rip), %rbx      # 0xdfd8
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq -0x68(%rbp), %r15
incl %r15d
movq -0x30(%rbp), %r14
movq %r14, %rdi
callq 0x943a
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x3, %rcx
cmpq %r15, %rcx
ja 0x81c1
movq %r14, %rdi
callq 0x943a
movq 0x8(%rax), %rcx
cmpq (%rax), %rcx
je 0x8748
movl $0x1, %r15d
xorl %ebx, %ebx
movq -0x38(%rbp), %r12
movq 0x40(%r12), %rax
movq 0x68(%rax), %r12
movq %r14, %rdi
callq 0x943a
movq (%rax), %rcx
movq 0x8(%rax), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %rbx, %rdx
jbe 0x8c88
movq (%rcx,%rbx,8), %rdi
callq 0x947c
movq %rax, -0x68(%rbp)
movq %r14, %rdi
callq 0x943a
movq (%rax), %rcx
movq 0x8(%rax), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq -0x68(%rbp), %r12
je 0x8752
decq %rdx
cmpq %rbx, %rdx
movq -0x38(%rbp), %r12
je 0x8c99
movl %r15d, %ebx
movq -0x30(%rbp), %r14
movq %r14, %rdi
callq 0x943a
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x3, %rcx
incl %r15d
cmpq %rbx, %rcx
ja 0x8416
movq -0x60(%rbp), %r15
jmp 0x87bf
movq %r14, %rdi
callq 0x943a
movq (%rax), %rcx
cmpq %rcx, 0x8(%rax)
je 0x8ccf
movq (%rcx), %r14
jmp 0x87bf
movq -0x60(%rbp), %r15
movq -0x38(%rbp), %r12
jmp 0x8532
cmpq %rbx, %rdx
movq -0x38(%rbp), %r12
jbe 0x8c88
movl $0x31, %edx
movq 0x5aee(%rip), %r14      # 0xdfd8
movq %r14, %rdi
leaq 0x2208(%rip), %rsi      # 0xa6fc
callq 0x2220
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2140
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq -0x60(%rbp), %r15
movq -0x90(%rbp), %rbx
movss 0x60(%r12), %xmm0
movss %xmm0, -0x30(%rbp)
movl $0x70, %edi
callq 0x21e0
movq %rax, %r14
movss -0x30(%rbp), %xmm0
ucomiss 0x2146(%rip), %xmm0     # 0xa6a4
movq %rbx, -0x90(%rbp)
jae 0x85de
leaq -0x100(%rbp), %rdi
movq %rbx, %rsi
callq 0x944e
movq %rbx, %rdi
callq 0x947c
leaq -0x190(%rbp), %rdi
movq %rax, %rsi
callq 0x92d6
movq %rbx, %rdi
callq 0x947c
leaq -0x190(%rbp), %rbx
movq %r14, %rdi
movq %r12, %rsi
leaq -0x100(%rbp), %rdx
movq %rbx, %rcx
movq %rax, %r8
movss 0x1a51(%rip), %xmm0     # 0xa008
callq 0x78a8
movq %r14, -0x88(%rbp)
movq %rbx, %rdi
callq 0x60b2
movq -0x100(%rbp), %rdi
leaq -0xf0(%rbp), %rax
jmp 0x8660
leaq -0x120(%rbp), %rdi
movq %rbx, %rsi
callq 0x944e
movq %rbx, %rdi
callq 0x947c
leaq -0x178(%rbp), %rdi
movq %rax, %rsi
callq 0x92d6
movq %rbx, %rdi
callq 0x947c
movq %rax, %rbx
movq -0x90(%rbp), %rdi
callq 0x947c
movq %rax, %rdi
callq 0x92fc
movq %r14, %rdi
movq %r12, %rsi
leaq -0x120(%rbp), %rdx
leaq -0x178(%rbp), %rcx
movq %rbx, %r8
callq 0x78a8
movq %r14, -0x88(%rbp)
leaq -0x178(%rbp), %rdi
callq 0x60b2
movq -0x120(%rbp), %rdi
leaq -0x110(%rbp), %rax
cmpq %rax, %rdi
je 0x866a
callq 0x21a0
movq -0x98(%rbp), %rdi
movq (%rdi), %rsi
leaq -0x88(%rbp), %rdx
callq 0x90a0
movq -0x88(%rbp), %rdi
movq -0x90(%rbp), %r14
movq %r14, %rsi
movq %r15, %rdx
callq 0x7a0e
movq %rax, %r15
movq 0x5935(%rip), %rbx      # 0xdfd8
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %rbx
movl $0x15, %edx
movq %rax, %rdi
leaq 0x1dfd(%rip), %rsi      # 0xa4d9
callq 0x2220
movq %r13, %rdi
movq %r14, %rsi
callq 0x944e
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq %rbx, %rdi
callq 0x2220
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x8738
callq 0x21a0
movq -0x70(%rbp), %rbx
movq %r15, %r14
movq -0x60(%rbp), %r15
jmp 0x8c25
movq -0x60(%rbp), %r15
movq -0x38(%rbp), %r12
jmp 0x87bf
cmpq %rbx, %rdx
movq -0x60(%rbp), %r15
movq -0x38(%rbp), %r12
jbe 0x8c88
movq (%rcx,%rbx,8), %rax
movq %rax, -0x30(%rbp)
movl $0x31, %edx
movq 0x5861(%rip), %r14      # 0xdfd8
movq %r14, %rdi
leaq 0x1f7b(%rip), %rsi      # 0xa6fc
callq 0x2220
movq %r14, %rdi
movq -0x30(%rbp), %r14
movq %rbx, %rsi
callq 0x2140
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %r14, %rdi
callq 0x943a
movq 0x8(%rax), %rcx
subq (%rax), %rcx
cmpq $0x9, %rcx
jb 0x8b88
movq 0x57f9(%rip), %rbx      # 0xdfd8
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %rbx
movl $0x1e, %edx
movq %rax, %rdi
leaq 0x1ead(%rip), %rsi      # 0xa6c5
callq 0x2220
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %r14, %rdi
callq 0x943a
movq 0x8(%rax), %rcx
cmpq (%rax), %rcx
movq %r14, -0x30(%rbp)
je 0x8a94
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x943a
movq (%rax), %rcx
movq 0x8(%rax), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %r15, %rdx
jbe 0x8c7c
movq (%rcx,%r15,8), %r14
movq 0x574e(%rip), %rbx      # 0xdfd8
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %r12
movl $0xf, %edx
movq %rax, %rdi
leaq 0x1e21(%rip), %rsi      # 0xa6e4
callq 0x2220
movq %r13, %rdi
movq %r14, %rsi
callq 0x944e
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq %r12, %rdi
callq 0x2220
movq %rax, %r12
movl $0x7, %edx
movq %rax, %rdi
leaq 0x1dff(%rip), %rsi      # 0xa6f4
callq 0x2220
movq %r14, %rdi
callq 0x947c
leaq -0x88(%rbp), %rdi
movq %rax, %rsi
callq 0x92d6
movq -0x80(%rbp), %rsi
subq -0x88(%rbp), %rsi
sarq $0x5, %rsi
movq %r12, %rdi
callq 0x2140
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %r15, -0x68(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x60b2
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x8974
callq 0x21a0
movq %r14, %rdi
callq 0x947c
movq %r13, %rdi
movq %rax, %rsi
callq 0x92d6
movq -0x50(%rbp), %r15
movq -0x58(%rbp), %r12
movq %r13, %rdi
callq 0x60b2
cmpq %r12, %r15
je 0x8a3f
movl $0x1, %r15d
xorl %r12d, %r12d
movq %r14, %rdi
callq 0x947c
movq %r13, %rdi
movq %rax, %rsi
callq 0x92d6
movq -0x58(%rbp), %rax
movq -0x50(%rbp), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
cmpq %r12, %rdx
jbe 0x8c6b
shlq $0x5, %r12
movq (%rax,%r12), %rsi
movq 0x8(%rax,%r12), %rdx
movq 0x55f0(%rip), %rdi      # 0xdfd8
callq 0x2220
movl $0x1, %edx
movq %rax, %rdi
leaq 0x1ba5(%rip), %rsi      # 0xa5a1
callq 0x2220
movq %r13, %rdi
callq 0x60b2
movl %r15d, %r12d
movq %r14, %rdi
callq 0x947c
movq %r13, %rdi
movq %rax, %rsi
callq 0x92d6
movq -0x50(%rbp), %rbx
subq -0x58(%rbp), %rbx
sarq $0x5, %rbx
movq %r13, %rdi
callq 0x60b2
incl %r15d
cmpq %r12, %rbx
ja 0x89a9
movq 0x5592(%rip), %rbx      # 0xdfd8
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq -0x68(%rbp), %r15
incl %r15d
movq -0x30(%rbp), %r14
movq %r14, %rdi
callq 0x943a
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x3, %rcx
cmpq %r15, %rcx
ja 0x8860
movq %r14, %rdi
callq 0x943a
movq 0x8(%rax), %rcx
cmpq (%rax), %rcx
je 0x8c19
movl $0x1, %r12d
xorl %ebx, %ebx
movq -0x38(%rbp), %rax
movq 0x40(%rax), %rax
movq %r14, %rdi
movq 0x68(%rax), %r14
callq 0x943a
movq (%rax), %rcx
movq 0x8(%rax), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %rbx, %rdx
jbe 0x8c88
movq (%rcx,%rbx,8), %rdi
callq 0x947c
cmpq %rax, %r14
je 0x8ba2
movl $0x34, %edx
movq 0x54de(%rip), %r14      # 0xdfd8
movq %r14, %rdi
leaq 0x1c7c(%rip), %rsi      # 0xa780
callq 0x2220
movq %r14, %rdi
movq %rbx, %rsi
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 -0x30(%rbp), %r14
movq %r14, %rdi
callq 0x943a
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x3, %rcx
decq %rcx
cmpq %rbx, %rcx
je 0x8c99
movl %r12d, %ebx
movq %r14, %rdi
callq 0x943a
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x3, %rcx
incl %r12d
cmpq %rbx, %rcx
ja 0x8ab1
jmp 0x8c19
movq %r14, %rdi
callq 0x943a
movq (%rax), %rcx
cmpq %rcx, 0x8(%rax)
je 0x8ccf
movq (%rcx), %r14
jmp 0x8c21
movq -0x30(%rbp), %rdi
callq 0x943a
movq (%rax), %rcx
movq 0x8(%rax), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %rbx, %rdx
jbe 0x8c88
movq (%rcx,%rbx,8), %r15
movl $0x31, %edx
movq 0x5406(%rip), %r14      # 0xdfd8
movq %r14, %rdi
leaq 0x1b20(%rip), %rsi      # 0xa6fc
callq 0x2220
movq %r14, %rdi
movq %r15, %r14
movq %rbx, %rsi
callq 0x2140
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq -0x60(%rbp), %r15
movq -0x38(%rbp), %r12
movq -0x70(%rbp), %rbx
testq %rbx, %rbx
jne 0x7bd6
jmp 0x8c34
movq -0x30(%rbp), %r14
movq %r14, %rax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x19c5(%rip), %rdi      # 0xa615
movq %r12, %rsi
xorl %eax, %eax
callq 0x2280
leaq 0x19b4(%rip), %rdi      # 0xa615
movq %r12, %rsi
xorl %eax, %eax
callq 0x2280
leaq 0x19a3(%rip), %rdi      # 0xa615
movq %r12, %rsi
xorl %eax, %eax
callq 0x2280
leaq 0x1992(%rip), %rdi      # 0xa615
movq %r15, %rsi
jmp 0x8c92
leaq 0x1986(%rip), %rdi      # 0xa615
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2280
movq 0x5338(%rip), %rdi      # 0xdfd8
leaq 0x1a87(%rip), %rsi      # 0xa72e
callq 0x21d0
movq %rax, %rdi
callq 0x20f0
movl $0x1, %edi
callq 0x2230
leaq 0x1950(%rip), %rdi      # 0xa615
movq %r13, %rsi
xorl %eax, %eax
callq 0x2280
leaq 0x193f(%rip), %rdi      # 0xa615
xorl %esi, %esi
xorl %edx, %edx
jmp 0x8c92
leaq 0x1932(%rip), %rdi      # 0xa615
movq -0x70(%rbp), %rsi
xorl %eax, %eax
callq 0x2280
leaq 0x1920(%rip), %rdi      # 0xa615
movq -0x70(%rbp), %rsi
xorl %eax, %eax
callq 0x2280
movq %rax, %rbx
leaq -0x48(%rbp), %rax
movq -0x10(%rax), %rdi
jmp 0x8de2
movq %rax, %rbx
leaq -0x140(%rbp), %rdi
callq 0x60b2
movq -0xc0(%rbp), %rdi
leaq -0xb0(%rbp), %rax
jmp 0x8da5
jmp 0x8d58
jmp 0x8d58
movq %rax, %rbx
leaq -0x160(%rbp), %rdi
callq 0x60b2
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
jmp 0x8da5
jmp 0x8d58
jmp 0x8d58
jmp 0x8d58
movq %rax, %rbx
jmp 0x8daf
movq %rax, %rbx
jmp 0x8d71
movq %rax, %rbx
leaq -0x190(%rbp), %rdi
callq 0x60b2
movq -0x100(%rbp), %rdi
leaq -0xf0(%rbp), %rax
jmp 0x8da5
movq %rax, %rbx
jmp 0x8d97
jmp 0x8df8
movq %rax, %rbx
leaq -0x178(%rbp), %rdi
callq 0x60b2
movq -0x120(%rbp), %rdi
leaq -0x110(%rbp), %rax
cmpq %rax, %rdi
je 0x8daf
callq 0x21a0
movq %r14, %rdi
jmp 0x8de7
jmp 0x8df8
jmp 0x8dc2
jmp 0x8dc2
jmp 0x8dc2
jmp 0x8dc2
jmp 0x8dc2
jmp 0x8dc2
movq %rax, %rbx
jmp 0x8dda
jmp 0x8dcb
jmp 0x8dcb
movq %rax, %rbx
leaq -0x88(%rbp), %rdi
callq 0x60b2
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x8e04
callq 0x21a0
jmp 0x8e04
jmp 0x8df8
jmp 0x8df8
jmp 0x8df8
jmp 0x8df8
jmp 0x8df8
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x60b2
movq %rbx, %rdi
callq 0x22f0