// File: 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
subq $0x5e0, %rsp            # imm = 0x5E0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x3a0(%rbp)
movq 0xd53f(%rip), %rdi      # 0x1bfd8
movq 0xd528(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movq %rax, %rdi
leaq 0x4bb5(%rip), %rsi      # 0x13664
callq 0x21c0
movq %rax, -0x398(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x40(%rbp), %rdi
movq %rdi, -0x390(%rbp)
callq 0x116a0
movq -0x398(%rbp), %rdi
movq -0x390(%rbp), %rsi
callq 0x21a0
jmp 0xeae4
leaq -0x40(%rbp), %rdi
callq 0x2140
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
movq %rax, -0x3a8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x116d0
movq %rax, %rsi
leaq -0x68(%rbp), %rdi
callq 0x114b0
leaq -0x68(%rbp), %rdi
callq 0x6c90
movq %rax, -0x3b0(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x6f60
movq -0x3b0(%rbp), %rcx
movq -0x3a8(%rbp), %rax
cmpq %rcx, %rax
jae 0xec0f
movq 0xd48e(%rip), %rdi      # 0x1bfd8
leaq 0x4a3c(%rip), %rsi      # 0x1358d
callq 0x21c0
movq %rax, -0x3c8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x116d0
movq %rax, %rsi
leaq -0x80(%rbp), %rdi
movq %rdi, -0x3c0(%rbp)
callq 0x114b0
movq -0x3c0(%rbp), %rdi
movl -0x50(%rbp), %eax
movl %eax, %esi
callq 0x7090
movq %rax, -0x3b8(%rbp)
jmp 0xeb93
movq -0x3b8(%rbp), %rsi
movq -0x3c8(%rbp), %rdi
callq 0x21a0
movq %rax, -0x3d0(%rbp)
jmp 0xebaf
movq -0x3d0(%rbp), %rdi
leaq 0x49d0(%rip), %rsi      # 0x1358d
callq 0x21c0
jmp 0xebc4
leaq -0x80(%rbp), %rdi
callq 0x6f60
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0xeaf4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x2140
jmp 0x100a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x6f60
jmp 0x100a6
movq -0x3a0(%rbp), %rdi
addq $0x28, %rdi
callq 0x6c90
movl %eax, -0x84(%rbp)
cmpl $0x0, -0x84(%rbp)
jbe 0x10099
movq -0x3a0(%rbp), %rdi
movq -0x18(%rbp), %rax
movq %rax, -0x3d8(%rbp)
addq $0x28, %rdi
movl -0x84(%rbp), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
callq 0x7090
movq -0x3d8(%rbp), %rdi
movq %rax, %rsi
callq 0x70d0
movq %rax, -0x90(%rbp)
movq -0x18(%rbp), %rdi
callq 0x7130
movq %rax, -0x98(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x7100
testb $0x1, %al
jne 0xec9c
jmp 0xf4a0
movq -0x10(%rbp), %rdi
callq 0x11660
movq %rax, %rdi
callq 0x7a20
cmpq $0x1, %rax
jbe 0xf0f8
movq 0xd31a(%rip), %rdi      # 0x1bfd8
movq 0xd303(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movq %rax, %rdi
leaq 0x49ad(%rip), %rsi      # 0x13681
callq 0x21c0
movq %rax, %rdi
movq 0xd2e5(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movl $0x0, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
movq %rax, -0x3e0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x11660
movq %rax, %rdi
callq 0x7a20
movq %rax, %rcx
movq -0x3e0(%rbp), %rax
cmpq %rcx, %rax
jae 0xefaf
movq -0x10(%rbp), %rdi
callq 0x11660
movq %rax, %rdi
movl -0x9c(%rbp), %eax
movl %eax, %esi
callq 0x7a40
movq (%rax), %rax
movq %rax, -0xa8(%rbp)
movq 0xd28b(%rip), %rdi      # 0x1bfd8
movq 0xd274(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movq %rax, %rdi
leaq 0x493d(%rip), %rsi      # 0x136a0
callq 0x21c0
movq %rax, -0x3f8(%rbp)
movq -0xa8(%rbp), %rsi
leaq -0xc8(%rbp), %rdi
movq %rdi, -0x3f0(%rbp)
callq 0x116a0
movq -0x3f8(%rbp), %rdi
movq -0x3f0(%rbp), %rsi
callq 0x21a0
movq %rax, -0x3e8(%rbp)
jmp 0xeda5
movq -0x3e8(%rbp), %rdi
leaq 0x48fd(%rip), %rsi      # 0x136b0
callq 0x21c0
movq %rax, -0x400(%rbp)
jmp 0xedc1
movq -0xa8(%rbp), %rdi
callq 0x116d0
movq %rax, -0x408(%rbp)
jmp 0xedd6
movq -0x408(%rbp), %rsi
leaq -0xe0(%rbp), %rdi
callq 0x114b0
jmp 0xedeb
leaq -0xe0(%rbp), %rdi
callq 0x6c90
movq -0x400(%rbp), %rdi
movq %rax, %rsi
callq 0x2080
movq %rax, -0x410(%rbp)
jmp 0xee0f
movq -0x410(%rbp), %rdi
movq 0xd1ab(%rip), %rsi      # 0x1bfc8
callq 0x21f0
jmp 0xee24
leaq -0xe0(%rbp), %rdi
callq 0x6f60
leaq -0xc8(%rbp), %rdi
callq 0x2140
movl $0x0, -0xe4(%rbp)
movl -0xe4(%rbp), %eax
movq %rax, -0x418(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x116d0
movq %rax, %rsi
leaq -0x100(%rbp), %rdi
callq 0x114b0
leaq -0x100(%rbp), %rdi
callq 0x6c90
movq %rax, -0x420(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x6f60
movq -0x420(%rbp), %rcx
movq -0x418(%rbp), %rax
cmpq %rcx, %rax
jae 0xef88
movq -0xa8(%rbp), %rdi
callq 0x116d0
movq %rax, %rsi
leaq -0x118(%rbp), %rdi
movq %rdi, -0x430(%rbp)
callq 0x114b0
movq -0x430(%rbp), %rdi
movl -0xe4(%rbp), %eax
movl %eax, %esi
callq 0x7090
movq %rax, -0x428(%rbp)
jmp 0xeee3
movq -0x428(%rbp), %rsi
movq 0xd0e7(%rip), %rdi      # 0x1bfd8
callq 0x21a0
movq %rax, -0x438(%rbp)
jmp 0xeeff
movq -0x438(%rbp), %rdi
leaq 0x4680(%rip), %rsi      # 0x1358d
callq 0x21c0
jmp 0xef14
leaq -0x118(%rbp), %rdi
callq 0x6f60
movl -0xe4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xe4(%rbp)
jmp 0xee46
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xef5a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x6f60
leaq -0xc8(%rbp), %rdi
callq 0x2140
jmp 0x100a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x6f60
jmp 0x100a6
movq 0xd049(%rip), %rdi      # 0x1bfd8
movq 0xd032(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0xecf2
movl $0x0, -0x11c(%rbp)
movl -0x11c(%rbp), %eax
movq %rax, -0x440(%rbp)
movq -0x10(%rbp), %rdi
callq 0x11660
movq %rax, %rdi
callq 0x7a20
movq %rax, %rcx
movq -0x440(%rbp), %rax
cmpq %rcx, %rax
jae 0xf0f6
movq -0x3a0(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0xea50
movq %rax, -0x448(%rbp)
movq -0x10(%rbp), %rdi
callq 0x11660
movq %rax, %rdi
movl -0x11c(%rbp), %eax
movl %eax, %esi
callq 0x7a40
movq (%rax), %rdi
callq 0x116d0
movq %rax, %rcx
movq -0x448(%rbp), %rax
cmpq %rcx, %rax
jne 0xf083
movq -0x10(%rbp), %rdi
callq 0x11660
movq %rax, %rdi
movl -0x11c(%rbp), %eax
movl %eax, %esi
callq 0x7a40
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movq 0xcf80(%rip), %rdi      # 0x1bfd8
leaq 0x4659(%rip), %rsi      # 0x136b8
callq 0x21c0
movq %rax, %rdi
movl -0x11c(%rbp), %esi
callq 0x2280
movq %rax, %rdi
movq 0xcf4c(%rip), %rsi      # 0x1bfc8
callq 0x21f0
jmp 0xf0f6
movl -0x11c(%rbp), %eax
movq %rax, -0x450(%rbp)
movq -0x10(%rbp), %rdi
callq 0x11660
movq %rax, %rdi
callq 0x7a20
movq %rax, %rcx
movq -0x450(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jne 0xf0e0
movq 0xcf1d(%rip), %rdi      # 0x1bfd8
leaq 0x4628(%rip), %rsi      # 0x136ea
callq 0x21c0
movq %rax, %rdi
movq 0xcef7(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movl $0x1, %edi
callq 0x2220
jmp 0xf0e2
movl -0x11c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x11c(%rbp)
jmp 0xefb9
jmp 0xf114
movq -0x10(%rbp), %rdi
callq 0x11660
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x7a40
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x3a0(%rbp), %rax
movss 0x60(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jb 0xf277
movl $0x70, %edi
callq 0x21d0
movq %rax, -0x458(%rbp)
movb $0x1, -0x161(%rbp)
movq -0x20(%rbp), %rsi
leaq -0x148(%rbp), %rdi
callq 0x116a0
jmp 0xf156
movq -0x20(%rbp), %rdi
callq 0x116d0
movq %rax, -0x460(%rbp)
jmp 0xf168
movq -0x460(%rbp), %rsi
leaq -0x160(%rbp), %rdi
callq 0x114b0
jmp 0xf17d
movq -0x20(%rbp), %rdi
callq 0x116d0
movq %rax, -0x468(%rbp)
jmp 0xf18f
movq -0x20(%rbp), %rdi
callq 0x116d0
movq %rax, -0x470(%rbp)
jmp 0xf1a1
movq -0x470(%rbp), %rdi
callq 0x11500
movss %xmm0, -0x474(%rbp)
jmp 0xf1b7
movss -0x474(%rbp), %xmm0
movq -0x468(%rbp), %r8
movq -0x3a0(%rbp), %rsi
movq -0x458(%rbp), %rdi
leaq -0x148(%rbp), %rdx
leaq -0x160(%rbp), %rcx
callq 0xe870
jmp 0xf1e9
movq -0x458(%rbp), %rax
movb $0x0, -0x161(%rbp)
movq %rax, -0x128(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x6f60
leaq -0x148(%rbp), %rdi
callq 0x2140
jmp 0xf397
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xf25b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xf24f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x6f60
leaq -0x148(%rbp), %rdi
callq 0x2140
testb $0x1, -0x161(%rbp)
jne 0xf266
jmp 0xf272
movq -0x458(%rbp), %rdi
callq 0x21b0
jmp 0x100a6
movl $0x70, %edi
callq 0x21d0
movq %rax, -0x480(%rbp)
movb $0x1, -0x1a1(%rbp)
movq -0x20(%rbp), %rsi
leaq -0x188(%rbp), %rdi
callq 0x116a0
jmp 0xf2a1
movq -0x20(%rbp), %rdi
callq 0x116d0
movq %rax, -0x488(%rbp)
jmp 0xf2b3
movq -0x488(%rbp), %rsi
leaq -0x1a0(%rbp), %rdi
callq 0x114b0
jmp 0xf2c8
movq -0x20(%rbp), %rdi
callq 0x116d0
movq %rax, -0x490(%rbp)
jmp 0xf2da
movq -0x490(%rbp), %r8
movq -0x3a0(%rbp), %rsi
movq -0x480(%rbp), %rdi
leaq -0x188(%rbp), %rdx
leaq -0x1a0(%rbp), %rcx
movss 0x3d03(%rip), %xmm0     # 0x13008
callq 0xe870
jmp 0xf30c
movq -0x480(%rbp), %rax
movb $0x0, -0x1a1(%rbp)
movq %rax, -0x128(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x6f60
leaq -0x188(%rbp), %rdi
callq 0x2140
jmp 0xf397
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xf37b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xf36f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x6f60
leaq -0x188(%rbp), %rdi
callq 0x2140
testb $0x1, -0x1a1(%rbp)
jne 0xf386
jmp 0xf392
movq -0x480(%rbp), %rdi
callq 0x21b0
jmp 0x100a6
movq -0x3a0(%rbp), %rdi
addq $0x48, %rdi
movq %rdi, -0x4b0(%rbp)
callq 0x6e00
movq %rax, -0x1b8(%rbp)
leaq -0x1b0(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x106c0
movq -0x4b0(%rbp), %rdi
movq -0x1b0(%rbp), %rsi
leaq -0x128(%rbp), %rdx
callq 0x104c0
movq %rax, -0x1c0(%rbp)
movq -0x128(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0xea70
movq %rax, -0x10(%rbp)
movq 0xcbd0(%rip), %rdi      # 0x1bfd8
movq 0xcbb9(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movq %rax, %rdi
leaq 0x40a7(%rip), %rsi      # 0x134c5
callq 0x21c0
movq %rax, -0x4a8(%rbp)
movq -0x20(%rbp), %rsi
leaq -0x1e0(%rbp), %rdi
movq %rdi, -0x4a0(%rbp)
callq 0x116a0
movq -0x4a8(%rbp), %rdi
movq -0x4a0(%rbp), %rsi
callq 0x21a0
movq %rax, -0x498(%rbp)
jmp 0xf45d
movq -0x498(%rbp), %rdi
movq 0xcb5d(%rip), %rsi      # 0x1bfc8
callq 0x21f0
jmp 0xf472
leaq -0x1e0(%rbp), %rdi
callq 0x2140
jmp 0x10083
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x1e0(%rbp), %rdi
callq 0x2140
jmp 0x100a6
movq -0x3a0(%rbp), %rax
movss 0x60(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jb 0xf5e0
movl $0x70, %edi
callq 0x21d0
movq -0x3a0(%rbp), %rdi
movq %rax, -0x4c0(%rbp)
movb $0x1, -0x221(%rbp)
addq $0x28, %rdi
movl -0x84(%rbp), %eax
decl %eax
movl %eax, %esi
callq 0x7090
movq %rax, -0x4b8(%rbp)
jmp 0xf4f3
movq -0x4b8(%rbp), %rsi
leaq -0x208(%rbp), %rdi
callq 0x20f0
jmp 0xf508
xorps %xmm0, %xmm0
movaps %xmm0, -0x220(%rbp)
movq $0x0, -0x210(%rbp)
leaq -0x220(%rbp), %rdi
movq %rdi, -0x4c8(%rbp)
callq 0x6c50
movq -0x4c0(%rbp), %rdi
movq -0x3a0(%rbp), %rsi
movq -0x4c8(%rbp), %rcx
xorl %eax, %eax
movl %eax, %r8d
leaq -0x208(%rbp), %rdx
movss 0x3aab(%rip), %xmm0     # 0x13004
callq 0xe870
jmp 0xf560
movq -0x4c0(%rbp), %rax
movb $0x0, -0x221(%rbp)
movq %rax, -0x1e8(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x6f60
leaq -0x208(%rbp), %rdi
callq 0x2140
jmp 0xf705
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xf5c4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x6f60
leaq -0x208(%rbp), %rdi
callq 0x2140
testb $0x1, -0x221(%rbp)
jne 0xf5cf
jmp 0xf5db
movq -0x4c0(%rbp), %rdi
callq 0x21b0
jmp 0x100a6
movl $0x70, %edi
callq 0x21d0
movq -0x3a0(%rbp), %rdi
movq %rax, -0x4d8(%rbp)
movb $0x1, -0x261(%rbp)
addq $0x28, %rdi
movl -0x84(%rbp), %eax
decl %eax
movl %eax, %esi
callq 0x7090
movq %rax, -0x4d0(%rbp)
jmp 0xf61b
movq -0x4d0(%rbp), %rsi
leaq -0x248(%rbp), %rdi
callq 0x20f0
jmp 0xf630
xorps %xmm0, %xmm0
movaps %xmm0, -0x260(%rbp)
movq $0x0, -0x250(%rbp)
leaq -0x260(%rbp), %rdi
movq %rdi, -0x4e0(%rbp)
callq 0x6c50
movq -0x4d8(%rbp), %rdi
movq -0x3a0(%rbp), %rsi
movq -0x4e0(%rbp), %rcx
xorl %eax, %eax
movl %eax, %r8d
leaq -0x248(%rbp), %rdx
movss 0x3987(%rip), %xmm0     # 0x13008
callq 0xe870
jmp 0xf688
movq -0x4d8(%rbp), %rax
movb $0x0, -0x261(%rbp)
movq %rax, -0x1e8(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x6f60
leaq -0x248(%rbp), %rdi
callq 0x2140
jmp 0xf705
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xf6e9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x6f60
leaq -0x248(%rbp), %rdi
callq 0x2140
testb $0x1, -0x261(%rbp)
jne 0xf6f4
jmp 0xf700
movq -0x4d8(%rbp), %rdi
callq 0x21b0
jmp 0x100a6
movq -0x3a0(%rbp), %rdi
movq %rdi, %rax
addq $0x48, %rax
movq %rax, -0x4e8(%rbp)
addq $0x48, %rdi
callq 0x6e00
movq %rax, -0x278(%rbp)
leaq -0x270(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x106c0
movq -0x4e8(%rbp), %rdi
movq -0x270(%rbp), %rsi
leaq -0x1e8(%rbp), %rdx
callq 0x104c0
movq %rax, -0x280(%rbp)
movq -0x10(%rbp), %rdi
callq 0x11660
movq %rax, %rdi
callq 0x7a20
cmpq $0x1, %rax
jbe 0xfbba
movq 0xc858(%rip), %rdi      # 0x1bfd8
movq 0xc841(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movq %rax, %rdi
leaq 0x3eeb(%rip), %rsi      # 0x13681
callq 0x21c0
movq %rax, %rdi
movq 0xc823(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movl $0x0, -0x284(%rbp)
movl -0x284(%rbp), %eax
movq %rax, -0x4f0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x11660
movq %rax, %rdi
callq 0x7a20
movq %rax, %rcx
movq -0x4f0(%rbp), %rax
cmpq %rcx, %rax
jae 0xfa71
movq -0x10(%rbp), %rdi
callq 0x11660
movq %rax, %rdi
movl -0x284(%rbp), %eax
movl %eax, %esi
callq 0x7a40
movq (%rax), %rax
movq %rax, -0x290(%rbp)
movq 0xc7c9(%rip), %rdi      # 0x1bfd8
movq 0xc7b2(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movq %rax, %rdi
leaq 0x3e7b(%rip), %rsi      # 0x136a0
callq 0x21c0
movq %rax, -0x508(%rbp)
movq -0x290(%rbp), %rsi
leaq -0x2b0(%rbp), %rdi
movq %rdi, -0x500(%rbp)
callq 0x116a0
movq -0x508(%rbp), %rdi
movq -0x500(%rbp), %rsi
callq 0x21a0
movq %rax, -0x4f8(%rbp)
jmp 0xf867
movq -0x4f8(%rbp), %rdi
leaq 0x3e3b(%rip), %rsi      # 0x136b0
callq 0x21c0
movq %rax, -0x510(%rbp)
jmp 0xf883
movq -0x290(%rbp), %rdi
callq 0x116d0
movq %rax, -0x518(%rbp)
jmp 0xf898
movq -0x518(%rbp), %rsi
leaq -0x2c8(%rbp), %rdi
callq 0x114b0
jmp 0xf8ad
leaq -0x2c8(%rbp), %rdi
callq 0x6c90
movq -0x510(%rbp), %rdi
movq %rax, %rsi
callq 0x2080
movq %rax, -0x520(%rbp)
jmp 0xf8d1
movq -0x520(%rbp), %rdi
movq 0xc6e9(%rip), %rsi      # 0x1bfc8
callq 0x21f0
jmp 0xf8e6
leaq -0x2c8(%rbp), %rdi
callq 0x6f60
leaq -0x2b0(%rbp), %rdi
callq 0x2140
movl $0x0, -0x2cc(%rbp)
movl -0x2cc(%rbp), %eax
movq %rax, -0x528(%rbp)
movq -0x290(%rbp), %rdi
callq 0x116d0
movq %rax, %rsi
leaq -0x2e8(%rbp), %rdi
callq 0x114b0
leaq -0x2e8(%rbp), %rdi
callq 0x6c90
movq %rax, -0x530(%rbp)
leaq -0x2e8(%rbp), %rdi
callq 0x6f60
movq -0x530(%rbp), %rcx
movq -0x528(%rbp), %rax
cmpq %rcx, %rax
jae 0xfa4a
movq -0x290(%rbp), %rdi
callq 0x116d0
movq %rax, %rsi
leaq -0x300(%rbp), %rdi
movq %rdi, -0x540(%rbp)
callq 0x114b0
movq -0x540(%rbp), %rdi
movl -0x2cc(%rbp), %eax
movl %eax, %esi
callq 0x7090
movq %rax, -0x538(%rbp)
jmp 0xf9a5
movq -0x538(%rbp), %rsi
movq 0xc625(%rip), %rdi      # 0x1bfd8
callq 0x21a0
movq %rax, -0x548(%rbp)
jmp 0xf9c1
movq -0x548(%rbp), %rdi
leaq 0x3bbe(%rip), %rsi      # 0x1358d
callq 0x21c0
jmp 0xf9d6
leaq -0x300(%rbp), %rdi
callq 0x6f60
movl -0x2cc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2cc(%rbp)
jmp 0xf908
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xfa1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x2c8(%rbp), %rdi
callq 0x6f60
leaq -0x2b0(%rbp), %rdi
callq 0x2140
jmp 0x100a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x300(%rbp), %rdi
callq 0x6f60
jmp 0x100a6
movq 0xc587(%rip), %rdi      # 0x1bfd8
movq 0xc570(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movl -0x284(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x284(%rbp)
jmp 0xf7b4
movl $0x0, -0x304(%rbp)
movl -0x304(%rbp), %eax
movq %rax, -0x550(%rbp)
movq -0x10(%rbp), %rdi
callq 0x11660
movq %rax, %rdi
callq 0x7a20
movq %rax, %rcx
movq -0x550(%rbp), %rax
cmpq %rcx, %rax
jae 0xfbb8
movq -0x3a0(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0xea50
movq %rax, -0x558(%rbp)
movq -0x10(%rbp), %rdi
callq 0x11660
movq %rax, %rdi
movl -0x304(%rbp), %eax
movl %eax, %esi
callq 0x7a40
movq (%rax), %rdi
callq 0x116d0
movq %rax, %rcx
movq -0x558(%rbp), %rax
cmpq %rcx, %rax
jne 0xfb45
movq -0x10(%rbp), %rdi
callq 0x11660
movq %rax, %rdi
movl -0x304(%rbp), %eax
movl %eax, %esi
callq 0x7a40
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movq 0xc4be(%rip), %rdi      # 0x1bfd8
leaq 0x3b97(%rip), %rsi      # 0x136b8
callq 0x21c0
movq %rax, %rdi
movl -0x304(%rbp), %esi
callq 0x2280
movq %rax, %rdi
movq 0xc48a(%rip), %rsi      # 0x1bfc8
callq 0x21f0
jmp 0xfbb8
movl -0x304(%rbp), %eax
movq %rax, -0x560(%rbp)
movq -0x10(%rbp), %rdi
callq 0x11660
movq %rax, %rdi
callq 0x7a20
movq %rax, %rcx
movq -0x560(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jne 0xfba2
movq 0xc45b(%rip), %rdi      # 0x1bfd8
leaq 0x3b66(%rip), %rsi      # 0x136ea
callq 0x21c0
movq %rax, %rdi
movq 0xc435(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movl $0x1, %edi
callq 0x2220
jmp 0xfba4
movl -0x304(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x304(%rbp)
jmp 0xfa7b
jmp 0xfbd6
movq -0x10(%rbp), %rdi
callq 0x11660
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x7a40
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x11660
movq %rax, %rdi
callq 0x7a20
cmpq $0x1, %rax
jbe 0x10065
movq 0xc3e0(%rip), %rdi      # 0x1bfd8
movq 0xc3c9(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movq %rax, %rdi
leaq 0x3a73(%rip), %rsi      # 0x13681
callq 0x21c0
movq %rax, %rdi
movq 0xc3ab(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movl $0x0, -0x308(%rbp)
movl -0x308(%rbp), %eax
movq %rax, -0x568(%rbp)
movq -0x10(%rbp), %rdi
callq 0x11660
movq %rax, %rdi
callq 0x7a20
movq %rax, %rcx
movq -0x568(%rbp), %rax
cmpq %rcx, %rax
jae 0xfee9
movq -0x10(%rbp), %rdi
callq 0x11660
movq %rax, %rdi
movl -0x308(%rbp), %eax
movl %eax, %esi
callq 0x7a40
movq (%rax), %rax
movq %rax, -0x310(%rbp)
movq 0xc351(%rip), %rdi      # 0x1bfd8
movq 0xc33a(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movq %rax, %rdi
leaq 0x3a03(%rip), %rsi      # 0x136a0
callq 0x21c0
movq %rax, -0x580(%rbp)
movq -0x310(%rbp), %rsi
leaq -0x330(%rbp), %rdi
movq %rdi, -0x578(%rbp)
callq 0x116a0
movq -0x580(%rbp), %rdi
movq -0x578(%rbp), %rsi
callq 0x21a0
movq %rax, -0x570(%rbp)
jmp 0xfcdf
movq -0x570(%rbp), %rdi
leaq 0x39c3(%rip), %rsi      # 0x136b0
callq 0x21c0
movq %rax, -0x588(%rbp)
jmp 0xfcfb
movq -0x310(%rbp), %rdi
callq 0x116d0
movq %rax, -0x590(%rbp)
jmp 0xfd10
movq -0x590(%rbp), %rsi
leaq -0x348(%rbp), %rdi
callq 0x114b0
jmp 0xfd25
leaq -0x348(%rbp), %rdi
callq 0x6c90
movq -0x588(%rbp), %rdi
movq %rax, %rsi
callq 0x2080
movq %rax, -0x598(%rbp)
jmp 0xfd49
movq -0x598(%rbp), %rdi
movq 0xc271(%rip), %rsi      # 0x1bfc8
callq 0x21f0
jmp 0xfd5e
leaq -0x348(%rbp), %rdi
callq 0x6f60
leaq -0x330(%rbp), %rdi
callq 0x2140
movl $0x0, -0x34c(%rbp)
movl -0x34c(%rbp), %eax
movq %rax, -0x5a0(%rbp)
movq -0x310(%rbp), %rdi
callq 0x116d0
movq %rax, %rsi
leaq -0x368(%rbp), %rdi
callq 0x114b0
leaq -0x368(%rbp), %rdi
callq 0x6c90
movq %rax, -0x5a8(%rbp)
leaq -0x368(%rbp), %rdi
callq 0x6f60
movq -0x5a8(%rbp), %rcx
movq -0x5a0(%rbp), %rax
cmpq %rcx, %rax
jae 0xfec2
movq -0x310(%rbp), %rdi
callq 0x116d0
movq %rax, %rsi
leaq -0x380(%rbp), %rdi
movq %rdi, -0x5b8(%rbp)
callq 0x114b0
movq -0x5b8(%rbp), %rdi
movl -0x34c(%rbp), %eax
movl %eax, %esi
callq 0x7090
movq %rax, -0x5b0(%rbp)
jmp 0xfe1d
movq -0x5b0(%rbp), %rsi
movq 0xc1ad(%rip), %rdi      # 0x1bfd8
callq 0x21a0
movq %rax, -0x5c0(%rbp)
jmp 0xfe39
movq -0x5c0(%rbp), %rdi
leaq 0x3746(%rip), %rsi      # 0x1358d
callq 0x21c0
jmp 0xfe4e
leaq -0x380(%rbp), %rdi
callq 0x6f60
movl -0x34c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34c(%rbp)
jmp 0xfd80
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xfe94
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x348(%rbp), %rdi
callq 0x6f60
leaq -0x330(%rbp), %rdi
callq 0x2140
jmp 0x100a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x380(%rbp), %rdi
callq 0x6f60
jmp 0x100a6
movq 0xc10f(%rip), %rdi      # 0x1bfd8
movq 0xc0f8(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movl -0x308(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x308(%rbp)
jmp 0xfc2c
movl $0x0, -0x384(%rbp)
movl -0x384(%rbp), %eax
movq %rax, -0x5c8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x11660
movq %rax, %rdi
callq 0x7a20
movq %rax, %rcx
movq -0x5c8(%rbp), %rax
cmpq %rcx, %rax
jae 0x10063
movq -0x3a0(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0xea50
movq %rax, -0x5d0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x11660
movq %rax, %rdi
movl -0x384(%rbp), %eax
movl %eax, %esi
callq 0x7a40
movq (%rax), %rdi
callq 0x116d0
movq %rax, %rcx
movq -0x5d0(%rbp), %rax
cmpq %rcx, %rax
jne 0xffc0
movq -0x10(%rbp), %rdi
callq 0x11660
movq %rax, %rdi
movl -0x384(%rbp), %eax
movl %eax, %esi
callq 0x7a40
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movq 0xc046(%rip), %rdi      # 0x1bfd8
leaq 0x371f(%rip), %rsi      # 0x136b8
callq 0x21c0
movq %rax, %rdi
movl -0x384(%rbp), %esi
callq 0x2280
movq %rax, %rdi
movq 0xc012(%rip), %rsi      # 0x1bfc8
callq 0x21f0
jmp 0x10063
movq 0xc011(%rip), %rdi      # 0x1bfd8
leaq 0x376e(%rip), %rsi      # 0x1373c
callq 0x21c0
movq %rax, %rdi
movl -0x384(%rbp), %esi
callq 0x2280
movq %rax, %rdi
movq 0xbfdd(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movl -0x384(%rbp), %eax
movq %rax, -0x5d8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x11660
movq %rax, %rdi
callq 0x7a20
movq %rax, %rcx
movq -0x5d8(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jne 0x1004d
movq 0xbfb0(%rip), %rdi      # 0x1bfd8
leaq 0x36bb(%rip), %rsi      # 0x136ea
callq 0x21c0
movq %rax, %rdi
movq 0xbf8a(%rip), %rsi      # 0x1bfc8
callq 0x21f0
movl $0x1, %edi
callq 0x2220
jmp 0x1004f
movl -0x384(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x384(%rbp)
jmp 0xfef3
jmp 0x10081
movq -0x10(%rbp), %rdi
callq 0x11660
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x7a40
movq (%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x10083
jmp 0x10085
movl -0x84(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0xec25
movq -0x10(%rbp), %rax
addq $0x5e0, %rsp            # imm = 0x5E0
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x2340
nop