// File: SNUCSE-CTA[P]GI/src/backtrack.cpp
// Function: Backtrack::backtrack(int)
bool Backtrack::backtrack(int32_t aNumMatching)
{
	#ifdef DEBUG
	cout << __PRETTY_FUNCTION__ << endl;
	#endif

	int32_t depth = aNumMatching; //the number of mapped vertices
	int32_t curr = dag->root; //current mapping node of graph 1 (start from the root)
	int32_t i, j, p, prevCand, child, cand;
	bool backtrack = false;
	bool mappingFailed, needBacktrack;
	int32_t confSize = 0; //for the partial failing set
	int32_t* confArray = global_memory->getLLArray(n);

	int32_t* childSize = dag->childSize;
	int32_t* parentSize = dag->parentSize;
	int32_t* dagArr = dag->dagArr;
	int32_t* adjPos1 = g1->adjPos;
	

	//we implement the recursive backtracking function by iterative method
	while( true ) {
		//two cases:
		//	A. beginning of a new recursive function (backtrack == false)
		//	B. retruning from a recursive function (backtrack == true)
		if( backtrack == false ) {
			// Case A. beginning
			if( depth == n ) { //we found an isomorphism
				global_memory->returnLLArray(confArray, n);
				return true;
			}

            increaseNumRecur();

			curr = getMinExtVertex(); //get a node with the min-weight and delete it from the extendable vertex array.
			computeExtCand(curr);	//compute the extendable candidates by intersection and store it in extCand[curr].
			candPos[curr] = 0;	//index of the extendable candidate array
			matchingOrder[depth] = curr;	//store the matching order so as to get the previously matched node when backtracks.

			//failing set
			vector<int32_t>& curr_f = failingset[ depth - aNumMatching ];
			curr_f.clear();
		}
		else {
			// Case B. returning
			curr = matchingOrder[depth]; //when returning, no need to call getMinExtVertex()
			prevCand = mapping[curr];
			mapping[prevCand] = -1;
			mapping[curr] = -1;

			//update extendable vertices in DAG-ordering
			for(i = 0; i < childSize[curr]; ++i) {
				//delete children whose numMappedParent == parentSize from extendable vertex
				//, and decrease numMappedParent by 1 for each DAG child of u
				child = dagArr[ adjPos1[curr] + parentSize[curr] + i ];
				if( numMappedParent[child] == parentSize[child] ) {
					deleteExtVertex(child);
				}
				--(numMappedParent[child]);
			}

			//failing set
			vector<int32_t>& child_f = failingset[depth - aNumMatching + 1]; //failing set of a child node in the search tree
			int32_t fsetIndex = binarySearch(child_f, curr);
			if( fsetIndex == -1 ) { //if curr is not in child_f
				failingset[depth - aNumMatching] = child_f;

				backtrack = true;
				--depth;
				if( depth == aNumMatching - 1 ) {
					global_memory->returnLLArray(confArray, n);
					return false;
				}
				insertExtVertex(curr, weight[curr]);
				continue;
			}
			else {
				merge( failingset[depth - aNumMatching], child_f ); //union
			}
			
			//if all candidate failed
			if( candPos[curr] == (int32_t)extCand[curr].size() - 1 ) { 
				//failing set
				if( fsetIndex != -1 ) { //if curr is in child_f (it is merged to curr_f)
					vector<int32_t>& curr_f = failingset[depth - aNumMatching];

					//remove curr from curr_f
					curr_f.erase( curr_f.begin() + fsetIndex );

					//insert parent(curr) to curr_f
					global_temp_vector.clear(); //TODO: not using vector
					for(j = 0; j < parentSize[curr]; ++j) {
						p = dagArr[ adjPos1[curr] + j ];
						if( isBinary[p] == 0 )
							global_temp_vector.push_back(p);
					}
					merge(curr_f, global_temp_vector);
				}

				backtrack = true;
				--depth;
				if( depth == aNumMatching - 1 ) {
					global_memory->returnLLArray(confArray, n);
					return false;
				}
				insertExtVertex(curr, weight[curr]);
				continue;
			} //if(candPos[curr] == size() - 1)
			else {
				++(candPos[curr]); //try the next extendable candidate of curr
			}
		} //if-else(backtrack == false)

		if( global_mark > INFINITY ) {
			memset(markCell, 0, sizeof(int32_t) * n2);
			global_mark = 0;
		}
		++global_mark;
		confSize = 0;

		//common part of Cases A and B.
		while( true ) { //while mapping is not okay
			//map curr to the extendable candidate at candPos[curr]
			//if mapping is okay
			//	- then make a new recursive call (with backtrack == false)
			//if mapping is not okay
			//	- then try the next extendable candidate
			//if all extendable candidates are failed to be mapped
			//	- then decrease depth by 1 and backtrack (with backtrack == true)
			//	- if depth becomes -1, termindate

			cand = extCand[curr][ candPos[curr] ];
			mappingFailed = false;
			needBacktrack = false; //when all candidate failed

			if( mapping[cand] != -1 ) {
				//partial failing set
				if( markCell[ mapping[cand] ] != global_mark ) {
					markCell[ mapping[cand] ] = global_mark;
					confArray[confSize] = mapping[cand];
					++confSize;
				}
				if( markCell[curr] != global_mark ) {
					markCell[curr] = global_mark;
					confArray[confSize] = curr;
					++confSize;
				}

				if( candPos[curr] == (int32_t)extCand[curr].size() - 1 ) {
					needBacktrack = true;
				}
				else {
					++(candPos[curr]);
				}
			} // if mapping[cand] != -1
			else {
				mapping[curr] = cand;
				mapping[cand] = curr;

				//for each child of curr
				for(i = 0; i < childSize[curr]; ++i) {
					child = dagArr[ adjPos1[curr] + parentSize[curr] + i ];

					++(numMappedParent[child]);
					if( numMappedParent[child] == parentSize[child] ) {
						weight[child] = computeWeight(child);
						if( weight[child] == 0 ) {	//empty-set class
							mappingFailed = true;
							--(numMappedParent[child]);
							weight[child] = INFINITY;

							vector<int32_t>& curr_f = failingset[depth - aNumMatching];
							global_temp_vector.clear(); //TODO: not using vector
							for(j = 0; j < parentSize[child]; ++j) {
								p = dagArr[ adjPos1[child] + j ];
								if( isBinary[p] == 0 )
									global_temp_vector.push_back(p);
							}
							merge(curr_f, global_temp_vector);
							break; //break the for(i) loop
						} //if weight[child] == 0
						else { //weight[child] > 0
							insertExtVertex(child, weight[child]);
						} //if-else( weight[child] == 0 )
					} //if numMappedParent[child] == parentSize
					else {
						//we can compute weight[child] even if child is not extendable
						if( numMappedParent[child] > 1 && computeWeight(child) == 0 ) {
							mappingFailed = true;
							--(numMappedParent[child]);

							vector<int32_t>& curr_f = failingset[depth - aNumMatching];
							global_temp_vector.clear(); //TODO: not using vector
							for(j = 0; j < parentSize[child]; ++j) {
								p = dagArr[ adjPos1[child] + j ];
								if( isBinary[p] == 0 )
									global_temp_vector.push_back(p);
							}
							merge(curr_f, global_temp_vector);
							break; //break the for(i) loop
						} //if
					} //if-else numMappedParent == parentSize
				} //for (i)

				if( mappingFailed ) {
					//mapping failed because one of the children belongs the empty-set class
					mapping[curr] = -1;
					mapping[cand] = -1;
					for(i = i - 1; i > -1; --i) {
						child = dagArr[ adjPos1[curr] + parentSize[curr] + i ];
						if( numMappedParent[child] == parentSize[child] ) {
							deleteExtVertex(child);
						}
						--(numMappedParent[child]);
					}

					if( candPos[curr] == (int32_t)extCand[curr].size() - 1 ) {
						needBacktrack = true;
					}
					else {
						++(candPos[curr]);
					}
				} //if mappingFailed
				else { //mapping OKAY!
					if( confSize > 0 ) {
						sort(confArray, confArray + confSize);
						merge( failingset[depth - aNumMatching], confArray, confSize );
					}

					backtrack = false;
					++depth;
					break; //break the inner while loop
				} //if-else mappingFailed
			}//if-else mapping[cand] != -1
			
			if( needBacktrack ) {
				vector<int32_t>& curr_f = failingset[depth - aNumMatching];
				if( confSize > 0 ) {
					sort(confArray, confArray + confSize);
					merge(curr_f, confArray, confSize);
				}

				if( curr_f.size() != 0 ) {
					int32_t fsetIndex = binarySearch(curr_f, curr);
					if( fsetIndex != -1 ) {
						//remove curr
						curr_f.erase(curr_f.begin() + fsetIndex);

						//add parent(curr)
						global_temp_vector.clear(); //TODO: not using vector
						for(j = 0; j < parentSize[curr]; ++j) {
							p = dagArr[ adjPos1[curr] + j ];
							if( isBinary[p] == 0 )
								global_temp_vector.push_back(p);
						}
						merge(curr_f, global_temp_vector);
					}
				} //if curr_f.size() != 0

				backtrack = true;
				--depth;
				if( depth == aNumMatching - 1 ) {
					global_memory->returnLLArray(confArray, n);
					return false;
				}
				insertExtVertex(curr, weight[curr]);
				break; //break the inner while loop
			} //if needBacktrack
		} //while(true) of inner loop.
	} //while(true) of outer loop.

	global_memory->returnLLArray(confArray, n);
	return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xf0(%rbp)
movl -0x14(%rbp), %ecx
movl %ecx, -0x18(%rbp)
movq 0x40(%rax), %rcx
movl 0x8(%rcx), %ecx
movl %ecx, -0x1c(%rbp)
movb $0x0, -0x35(%rbp)
movl $0x0, -0x3c(%rbp)
movq 0xb0(%rax), %rdi
movl 0x2c(%rax), %esi
callq 0x77d0
movq %rax, %rcx
movq -0xf0(%rbp), %rax
movq %rcx, -0x48(%rbp)
movq 0x40(%rax), %rcx
movq 0x10(%rcx), %rcx
movq %rcx, -0x50(%rbp)
movq 0x40(%rax), %rcx
movq 0x18(%rcx), %rcx
movq %rcx, -0x58(%rbp)
movq 0x40(%rax), %rcx
movq 0x20(%rcx), %rcx
movq %rcx, -0x60(%rbp)
movq 0x10(%rax), %rax
movq 0x40(%rax), %rax
movq %rax, -0x68(%rbp)
movb -0x35(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0xd812
movq -0xf0(%rbp), %rcx
movl -0x18(%rbp), %eax
cmpl 0x2c(%rcx), %eax
jne 0xd798
movq -0xf0(%rbp), %rax
movq 0xb0(%rax), %rdi
movq -0x48(%rbp), %rsi
movl 0x2c(%rax), %edx
callq 0x7a30
movb $0x1, -0x1(%rbp)
jmp 0xe3de
movq -0xf0(%rbp), %rdi
callq 0xc140
movq -0xf0(%rbp), %rdi
callq 0xeba0
movq -0xf0(%rbp), %rdi
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %esi
callq 0xec30
movq -0xf0(%rbp), %rax
movq 0x80(%rax), %rcx
movslq -0x1c(%rbp), %rdx
movl $0x0, (%rcx,%rdx,4)
movl -0x1c(%rbp), %esi
movq 0x88(%rax), %rcx
movslq -0x18(%rbp), %rdx
movl %esi, (%rcx,%rdx,4)
movq 0x58(%rax), %rax
movl -0x18(%rbp), %ecx
subl -0x14(%rbp), %ecx
movslq %ecx, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
callq 0x10980
jmp 0xdbae
movq -0xf0(%rbp), %rax
movq 0x88(%rax), %rcx
movslq -0x18(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
movl %ecx, -0x1c(%rbp)
movq 0x50(%rax), %rcx
movslq -0x1c(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
movl %ecx, -0x2c(%rbp)
movq 0x50(%rax), %rcx
movslq -0x2c(%rbp), %rdx
movl $0xffffffff, (%rcx,%rdx,4) # imm = 0xFFFFFFFF
movq 0x50(%rax), %rax
movslq -0x1c(%rbp), %rcx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x50(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xd8e7
movq -0xf0(%rbp), %rax
movq -0x60(%rbp), %rcx
movq -0x68(%rbp), %rdx
movslq -0x1c(%rbp), %rsi
movl (%rdx,%rsi,4), %edx
movq -0x58(%rbp), %rsi
movslq -0x1c(%rbp), %rdi
addl (%rsi,%rdi,4), %edx
addl -0x20(%rbp), %edx
movslq %edx, %rdx
movl (%rcx,%rdx,4), %ecx
movl %ecx, -0x30(%rbp)
movq 0x78(%rax), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x58(%rbp), %rcx
movslq -0x30(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0xd8c1
movq -0xf0(%rbp), %rdi
movl -0x30(%rbp), %esi
callq 0xf250
movq -0xf0(%rbp), %rax
movq 0x78(%rax), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $-0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xd85d
movq -0xf0(%rbp), %rdi
movq 0x58(%rdi), %rax
movl -0x18(%rbp), %ecx
subl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq 0xf280
movl %eax, -0x7c(%rbp)
cmpl $-0x1, -0x7c(%rbp)
jne 0xd99d
movq -0xf0(%rbp), %rax
movq -0x78(%rbp), %rsi
movq 0x58(%rax), %rdi
movl -0x18(%rbp), %eax
subl -0x14(%rbp), %eax
cltq
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x109a0
movb $0x1, -0x35(%rbp)
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0xd97e
movq -0xf0(%rbp), %rax
movq 0xb0(%rax), %rdi
movq -0x48(%rbp), %rsi
movl 0x2c(%rax), %edx
callq 0x7a30
movb $0x0, -0x1(%rbp)
jmp 0xe3de
movq -0xf0(%rbp), %rdi
movl -0x1c(%rbp), %esi
movq 0x70(%rdi), %rax
movslq -0x1c(%rbp), %rcx
movl (%rax,%rcx,4), %edx
callq 0xf3a0
jmp 0xd755
movq -0xf0(%rbp), %rdi
movq 0x58(%rdi), %rsi
movl -0x18(%rbp), %eax
subl -0x14(%rbp), %eax
cltq
imulq $0x18, %rax, %rax
addq %rax, %rsi
movq -0x78(%rbp), %rdx
callq 0xf3e0
movq -0xf0(%rbp), %rax
movq 0x80(%rax), %rcx
movslq -0x1c(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
movl %ecx, -0xf4(%rbp)
movq 0x60(%rax), %rdi
movslq -0x1c(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x10bf0
movq %rax, %rcx
movl -0xf4(%rbp), %eax
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0xdb91
cmpl $-0x1, -0x7c(%rbp)
je 0xdb35
movq -0xf0(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x18(%rbp), %ecx
subl -0x14(%rbp), %ecx
movslq %ecx, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x88(%rbp), %rdi
callq 0x10c80
movq %rax, -0xa0(%rbp)
movslq -0x7c(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0x10cb0
movq %rax, -0x98(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x10cf0
movq -0x100(%rbp), %rdi
movq -0x90(%rbp), %rsi
callq 0x10c10
movq -0xf0(%rbp), %rdi
movq %rax, -0xa8(%rbp)
addq $0x98, %rdi
callq 0x10980
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x58(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xdb18
movq -0xf0(%rbp), %rax
movq -0x60(%rbp), %rcx
movq -0x68(%rbp), %rdx
movslq -0x1c(%rbp), %rsi
movl (%rdx,%rsi,4), %edx
addl -0x24(%rbp), %edx
movslq %edx, %rdx
movl (%rcx,%rdx,4), %ecx
movl %ecx, -0x28(%rbp)
movq 0x90(%rax), %rax
movslq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0xdb0b
movq -0xf0(%rbp), %rdi
addq $0x98, %rdi
leaq -0x28(%rbp), %rsi
callq 0x10d30
jmp 0xdb0d
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xdaae
movq -0xf0(%rbp), %rdi
movq -0x88(%rbp), %rsi
movq %rdi, %rdx
addq $0x98, %rdx
callq 0xf3e0
movb $0x1, -0x35(%rbp)
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0xdb72
movq -0xf0(%rbp), %rax
movq 0xb0(%rax), %rdi
movq -0x48(%rbp), %rsi
movl 0x2c(%rax), %edx
callq 0x7a30
movb $0x0, -0x1(%rbp)
jmp 0xe3de
movq -0xf0(%rbp), %rdi
movl -0x1c(%rbp), %esi
movq 0x70(%rdi), %rax
movslq -0x1c(%rbp), %rcx
movl (%rax,%rcx,4), %edx
callq 0xf3a0
jmp 0xd755
movq -0xf0(%rbp), %rax
movq 0x80(%rax), %rax
movslq -0x1c(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
jmp 0xdbae
movq -0xf0(%rbp), %rax
cmpl $0x77359400, 0xc8(%rax) # imm = 0x77359400
jle 0xdbef
movq -0xf0(%rbp), %rax
movq 0xc0(%rax), %rdi
movslq 0x34(%rax), %rdx
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x3110
movq -0xf0(%rbp), %rax
movl $0x0, 0xc8(%rax)
movq -0xf0(%rbp), %rax
movl 0xc8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xc8(%rax)
movl $0x0, -0x3c(%rbp)
movq -0xf0(%rbp), %rax
movq 0x60(%rax), %rdi
movslq -0x1c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rdi
movq 0x80(%rax), %rax
movslq -0x1c(%rbp), %rcx
movslq (%rax,%rcx,4), %rsi
callq 0x10da0
movq %rax, %rcx
movq -0xf0(%rbp), %rax
movl (%rcx), %ecx
movl %ecx, -0x34(%rbp)
movb $0x0, -0x36(%rbp)
movb $0x0, -0x37(%rbp)
movq 0x50(%rax), %rax
movslq -0x34(%rbp), %rcx
cmpl $-0x1, (%rax,%rcx,4)
je 0xdd7a
movq -0xf0(%rbp), %rcx
movq 0xc0(%rcx), %rax
movq 0x50(%rcx), %rdx
movslq -0x34(%rbp), %rsi
movslq (%rdx,%rsi,4), %rdx
movl (%rax,%rdx,4), %eax
cmpl 0xc8(%rcx), %eax
je 0xdcc6
movq -0xf0(%rbp), %rax
movl 0xc8(%rax), %esi
movq 0xc0(%rax), %rcx
movq 0x50(%rax), %rdx
movslq -0x34(%rbp), %rdi
movslq (%rdx,%rdi,4), %rdx
movl %esi, (%rcx,%rdx,4)
movq 0x50(%rax), %rax
movslq -0x34(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x48(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movq -0xf0(%rbp), %rcx
movq 0xc0(%rcx), %rax
movslq -0x1c(%rbp), %rdx
movl (%rax,%rdx,4), %eax
cmpl 0xc8(%rcx), %eax
je 0xdd15
movq -0xf0(%rbp), %rax
movl 0xc8(%rax), %edx
movq 0xc0(%rax), %rax
movslq -0x1c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x1c(%rbp), %edx
movq -0x48(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movq -0xf0(%rbp), %rax
movq 0x80(%rax), %rcx
movslq -0x1c(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
movl %ecx, -0x104(%rbp)
movq 0x60(%rax), %rdi
movslq -0x1c(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x10bf0
movq %rax, %rcx
movl -0x104(%rbp), %eax
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0xdd5a
movb $0x1, -0x37(%rbp)
jmp 0xdd75
movq -0xf0(%rbp), %rax
movq 0x80(%rax), %rax
movslq -0x1c(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
jmp 0xe1d0
movq -0xf0(%rbp), %rax
movl -0x34(%rbp), %esi
movq 0x50(%rax), %rcx
movslq -0x1c(%rbp), %rdx
movl %esi, (%rcx,%rdx,4)
movl -0x1c(%rbp), %edx
movq 0x50(%rax), %rax
movslq -0x34(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x50(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xe061
movq -0xf0(%rbp), %rax
movq -0x60(%rbp), %rcx
movq -0x68(%rbp), %rdx
movslq -0x1c(%rbp), %rsi
movl (%rdx,%rsi,4), %edx
movq -0x58(%rbp), %rsi
movslq -0x1c(%rbp), %rdi
addl (%rsi,%rdi,4), %edx
addl -0x20(%rbp), %edx
movslq %edx, %rdx
movl (%rcx,%rdx,4), %ecx
movl %ecx, -0x30(%rbp)
movq 0x78(%rax), %rcx
movslq -0x30(%rbp), %rdx
movl (%rcx,%rdx,4), %esi
addl $0x1, %esi
movl %esi, (%rcx,%rdx,4)
movq 0x78(%rax), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x58(%rbp), %rcx
movslq -0x30(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0xdf4b
movq -0xf0(%rbp), %rdi
movl -0x30(%rbp), %esi
callq 0xe6a0
movl %eax, %esi
movq -0xf0(%rbp), %rax
movq 0x70(%rax), %rcx
movslq -0x30(%rbp), %rdx
movl %esi, (%rcx,%rdx,4)
movq 0x70(%rax), %rax
movslq -0x30(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0xdf2c
movq -0xf0(%rbp), %rdi
movb $0x1, -0x36(%rbp)
movq 0x78(%rdi), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $-0x1, %edx
movl %edx, (%rax,%rcx,4)
movq 0x70(%rdi), %rax
movslq -0x30(%rbp), %rcx
movl $0x77359400, (%rax,%rcx,4) # imm = 0x77359400
movq 0x58(%rdi), %rax
movl -0x18(%rbp), %ecx
subl -0x14(%rbp), %ecx
movslq %ecx, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xb0(%rbp)
addq $0x98, %rdi
callq 0x10980
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x58(%rbp), %rcx
movslq -0x30(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xdf0a
movq -0xf0(%rbp), %rax
movq -0x60(%rbp), %rcx
movq -0x68(%rbp), %rdx
movslq -0x30(%rbp), %rsi
movl (%rdx,%rsi,4), %edx
addl -0x24(%rbp), %edx
movslq %edx, %rdx
movl (%rcx,%rdx,4), %ecx
movl %ecx, -0x28(%rbp)
movq 0x90(%rax), %rax
movslq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0xdefd
movq -0xf0(%rbp), %rdi
addq $0x98, %rdi
leaq -0x28(%rbp), %rsi
callq 0x10d30
jmp 0xdeff
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xdea0
movq -0xf0(%rbp), %rdi
movq -0xb0(%rbp), %rsi
movq %rdi, %rdx
addq $0x98, %rdx
callq 0xf3e0
jmp 0xe061
movq -0xf0(%rbp), %rdi
movl -0x30(%rbp), %esi
movq 0x70(%rdi), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %edx
callq 0xf3a0
jmp 0xe051
movq -0xf0(%rbp), %rax
movq 0x78(%rax), %rax
movslq -0x30(%rbp), %rcx
cmpl $0x1, (%rax,%rcx,4)
jle 0xe04f
movq -0xf0(%rbp), %rdi
movl -0x30(%rbp), %esi
callq 0xe6a0
cmpl $0x0, %eax
jne 0xe04f
movq -0xf0(%rbp), %rdi
movb $0x1, -0x36(%rbp)
movq 0x78(%rdi), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $-0x1, %edx
movl %edx, (%rax,%rcx,4)
movq 0x58(%rdi), %rax
movl -0x18(%rbp), %ecx
subl -0x14(%rbp), %ecx
movslq %ecx, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xb8(%rbp)
addq $0x98, %rdi
callq 0x10980
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x58(%rbp), %rcx
movslq -0x30(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xe030
movq -0xf0(%rbp), %rax
movq -0x60(%rbp), %rcx
movq -0x68(%rbp), %rdx
movslq -0x30(%rbp), %rsi
movl (%rdx,%rsi,4), %edx
addl -0x24(%rbp), %edx
movslq %edx, %rdx
movl (%rcx,%rdx,4), %ecx
movl %ecx, -0x28(%rbp)
movq 0x90(%rax), %rax
movslq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0xe023
movq -0xf0(%rbp), %rdi
addq $0x98, %rdi
leaq -0x28(%rbp), %rsi
callq 0x10d30
jmp 0xe025
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xdfc6
movq -0xf0(%rbp), %rdi
movq -0xb8(%rbp), %rsi
movq %rdi, %rdx
addq $0x98, %rdx
callq 0xf3e0
jmp 0xe061
jmp 0xe051
jmp 0xe053
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xdda4
testb $0x1, -0x36(%rbp)
je 0xe178
movq -0xf0(%rbp), %rax
movq 0x50(%rax), %rcx
movslq -0x1c(%rbp), %rdx
movl $0xffffffff, (%rcx,%rdx,4) # imm = 0xFFFFFFFF
movq 0x50(%rax), %rax
movslq -0x34(%rbp), %rcx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
movl -0x20(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x20(%rbp)
cmpl $-0x1, -0x20(%rbp)
jle 0xe116
movq -0xf0(%rbp), %rax
movq -0x60(%rbp), %rcx
movq -0x68(%rbp), %rdx
movslq -0x1c(%rbp), %rsi
movl (%rdx,%rsi,4), %edx
movq -0x58(%rbp), %rsi
movslq -0x1c(%rbp), %rdi
addl (%rsi,%rdi,4), %edx
addl -0x20(%rbp), %edx
movslq %edx, %rdx
movl (%rcx,%rdx,4), %ecx
movl %ecx, -0x30(%rbp)
movq 0x78(%rax), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x58(%rbp), %rcx
movslq -0x30(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0xe0f3
movq -0xf0(%rbp), %rdi
movl -0x30(%rbp), %esi
callq 0xf250
movq -0xf0(%rbp), %rax
movq 0x78(%rax), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $-0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x20(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xe099
movq -0xf0(%rbp), %rax
movq 0x80(%rax), %rcx
movslq -0x1c(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
movl %ecx, -0x108(%rbp)
movq 0x60(%rax), %rdi
movslq -0x1c(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x10bf0
movq %rax, %rcx
movl -0x108(%rbp), %eax
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0xe15b
movb $0x1, -0x37(%rbp)
jmp 0xe176
movq -0xf0(%rbp), %rax
movq 0x80(%rax), %rax
movslq -0x1c(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
jmp 0xe1ce
cmpl $0x0, -0x3c(%rbp)
jle 0xe1bc
movq -0x48(%rbp), %rdi
movq -0x48(%rbp), %rsi
movslq -0x3c(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rsi
callq 0x10940
movq -0xf0(%rbp), %rdi
movq 0x58(%rdi), %rsi
movl -0x18(%rbp), %eax
subl -0x14(%rbp), %eax
cltq
imulq $0x18, %rax, %rax
addq %rax, %rsi
movq -0x48(%rbp), %rdx
movl -0x3c(%rbp), %ecx
callq 0xf6e0
movb $0x0, -0x35(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xe3d9
jmp 0xe1d0
testb $0x1, -0x37(%rbp)
je 0xe3d4
movq -0xf0(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x18(%rbp), %ecx
subl -0x14(%rbp), %ecx
movslq %ecx, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xc0(%rbp)
cmpl $0x0, -0x3c(%rbp)
jle 0xe234
movq -0x48(%rbp), %rdi
movq -0x48(%rbp), %rsi
movslq -0x3c(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rsi
callq 0x10940
movq -0xf0(%rbp), %rdi
movq -0xc0(%rbp), %rsi
movq -0x48(%rbp), %rdx
movl -0x3c(%rbp), %ecx
callq 0xf6e0
movq -0xc0(%rbp), %rdi
callq 0x10bf0
cmpq $0x0, %rax
je 0xe37e
movq -0xf0(%rbp), %rdi
movq -0xc0(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq 0xf280
movl %eax, -0xc4(%rbp)
cmpl $-0x1, -0xc4(%rbp)
je 0xe37c
movq -0xc0(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0xc0(%rbp), %rdi
callq 0x10c80
movq %rax, -0xe0(%rbp)
movslq -0xc4(%rbp), %rsi
leaq -0xe0(%rbp), %rdi
callq 0x10cb0
movq %rax, -0xd8(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x10cf0
movq -0x110(%rbp), %rdi
movq -0xd0(%rbp), %rsi
callq 0x10c10
movq -0xf0(%rbp), %rdi
movq %rax, -0xe8(%rbp)
addq $0x98, %rdi
callq 0x10980
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x58(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xe35f
movq -0xf0(%rbp), %rax
movq -0x60(%rbp), %rcx
movq -0x68(%rbp), %rdx
movslq -0x1c(%rbp), %rsi
movl (%rdx,%rsi,4), %edx
addl -0x24(%rbp), %edx
movslq %edx, %rdx
movl (%rcx,%rdx,4), %ecx
movl %ecx, -0x28(%rbp)
movq 0x90(%rax), %rax
movslq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0xe352
movq -0xf0(%rbp), %rdi
addq $0x98, %rdi
leaq -0x28(%rbp), %rsi
callq 0x10d30
jmp 0xe354
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xe2f5
movq -0xf0(%rbp), %rdi
movq -0xc0(%rbp), %rsi
movq %rdi, %rdx
addq $0x98, %rdx
callq 0xf3e0
jmp 0xe37e
movb $0x1, -0x35(%rbp)
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0xe3b8
movq -0xf0(%rbp), %rax
movq 0xb0(%rax), %rdi
movq -0x48(%rbp), %rsi
movl 0x2c(%rax), %edx
callq 0x7a30
movb $0x0, -0x1(%rbp)
jmp 0xe3de
movq -0xf0(%rbp), %rdi
movl -0x1c(%rbp), %esi
movq 0x70(%rdi), %rax
movslq -0x1c(%rbp), %rcx
movl (%rax,%rcx,4), %edx
callq 0xf3a0
jmp 0xe3d9
jmp 0xdc0c
jmp 0xd755
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nopl (%rax)