// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %esi, %r12d
movq %rdi, %rbx
movq 0xb0(%rdi), %rdi
movl 0x2c(%rbx), %esi
callq 0x4b34
movq %rax, 0x18(%rsp)
movq 0x10(%rbx), %rax
movq 0x40(%rbx), %rcx
movq 0x10(%rcx), %r15
movq 0x18(%rcx), %r13
movq 0x20(%rcx), %rcx
movq %rcx, 0x38(%rsp)
movq 0x40(%rax), %rax
movq %rax, 0x30(%rsp)
leaq 0x98(%rbx), %rax
movq %rax, 0x20(%rsp)
xorl %ecx, %ecx
movl %r12d, %r14d
movl %r12d, 0xc(%rsp)
movq %r15, 0x10(%rsp)
testb $0x1, %cl
jne 0x6f74
movl 0x2c(%rbx), %edx
cmpl %edx, %r14d
je 0x77a4
incl 0x8(%rbx)
movq %rbx, %rdi
callq 0x7bd2
movl %eax, %ebp
movq %rbx, %rdi
movl %eax, %esi
callq 0x7c5a
movq 0x80(%rbx), %rax
movl %ebp, 0x4(%rsp)
movslq %ebp, %rcx
movl $0x0, (%rax,%rcx,4)
movq 0x88(%rbx), %rax
movslq %r14d, %rdx
movl %ecx, (%rax,%rdx,4)
movq 0x58(%rbx), %rax
movl %r14d, %ecx
subl %r12d, %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rdx
movq (%rax,%rdx,8), %rcx
cmpq %rcx, 0x8(%rax,%rdx,8)
je 0x720e
leaq (%rax,%rdx,8), %rax
movq %rcx, 0x8(%rax)
jmp 0x720e
movq %rcx, 0x40(%rsp)
movq 0x50(%rbx), %rax
movq 0x88(%rbx), %rcx
movq %r14, 0x48(%rsp)
movslq %r14d, %rdx
movl (%rcx,%rdx,4), %ecx
movl %ecx, 0x4(%rsp)
movslq %ecx, %r14
movslq (%rax,%r14,4), %rcx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %edx, (%rax,%rcx,4)
movl %edx, (%rax,%r14,4)
cmpl $0x0, (%r15,%r14,4)
jle 0x6ffe
xorl %ebp, %ebp
movq 0x30(%rsp), %rax
movl (%rax,%r14,4), %eax
addl (%r13,%r14,4), %eax
addl %ebp, %eax
cltq
movq 0x38(%rsp), %rcx
movslq (%rcx,%rax,4), %r15
movq 0x78(%rbx), %rax
movl (%rax,%r15,4), %eax
cmpl (%r13,%r15,4), %eax
jne 0x6fe9
movq 0x68(%rbx), %rdi
movq 0x70(%rbx), %rsi
movl %r15d, %edx
callq 0x92c0
movq 0x78(%rbx), %rax
decl (%rax,%r15,4)
incl %ebp
movq 0x10(%rsp), %rax
cmpl (%rax,%r14,4), %ebp
jl 0x6faf
movq 0x58(%rbx), %rax
movq 0x48(%rsp), %rbp
movl %ebp, %ecx
subl %r12d, %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %r12
leaq (%rax,%r12,8), %rcx
movq %rcx, 0x28(%rsp)
leaq (%rax,%r12,8), %r15
addq $0x18, %r15
movq %r15, %rsi
movl 0x4(%rsp), %edx
callq 0x8094
cmpl $-0x1, %eax
je 0x716d
movl %eax, %ebp
movq %rbx, %rdi
movq 0x28(%rsp), %rsi
movq %r15, %rdx
callq 0x8122
movq 0x60(%rbx), %rcx
movq 0x80(%rbx), %rax
leaq (%r14,%r14,2), %rdx
movq 0x8(%rcx,%rdx,8), %rsi
subq (%rcx,%rdx,8), %rsi
movl (%rax,%r14,4), %ecx
shrq $0x2, %rsi
decl %esi
cmpl %esi, %ecx
jne 0x71a5
movq 0x58(%rbx), %r15
movslq %ebp, %rax
movq (%r15,%r12,8), %rcx
movq 0x8(%r15,%r12,8), %rdx
leaq (%rcx,%rax,4), %rsi
addq $0x4, %rsi
cmpq %rdx, %rsi
je 0x709e
leaq (%rcx,%rax,4), %rdi
subq %rsi, %rdx
callq 0x2290
leaq (%r15,%r12,8), %r15
addq $-0x4, 0x8(%r15)
movq 0x98(%rbx), %rax
cmpq %rax, 0xa0(%rbx)
je 0x70be
movq %rax, 0xa0(%rbx)
cmpl $0x0, (%r13,%r14,4)
jle 0x7127
xorl %r12d, %r12d
movq 0x30(%rsp), %rax
movslq (%rax,%r14,4), %rax
addq %r12, %rax
movq 0x38(%rsp), %rcx
movslq (%rcx,%rax,4), %rax
movl %eax, 0x8(%rsp)
movq 0x90(%rbx), %rcx
cmpb $0x0, (%rcx,%rax)
jne 0x711d
movq 0xa0(%rbx), %rsi
cmpq 0xa8(%rbx), %rsi
je 0x710e
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0xa0(%rbx)
jmp 0x711d
movq 0x20(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x8df0
incq %r12
cmpl (%r13,%r14,4), %r12d
jl 0x70c9
movq %rbx, %rdi
movq %r15, %rsi
movq 0x20(%rsp), %rdx
callq 0x8122
movq 0x48(%rsp), %rax
leal -0x1(%rax), %ebp
movl 0xc(%rsp), %r12d
cmpl %r12d, %eax
jne 0x71dd
movq 0xb0(%rbx), %rdi
movl 0x2c(%rbx), %edx
movq 0x18(%rsp), %rsi
callq 0x4cf0
movb $0x1, %cl
movl $0x1, %eax
jmp 0x71f5
movq 0x28(%rsp), %rdi
movq %r15, %rsi
callq 0x88f8
leal -0x1(%rbp), %r14d
movl 0xc(%rsp), %r12d
cmpl %r12d, %ebp
jne 0x71c3
movq 0xb0(%rbx), %rdi
movl 0x2c(%rbx), %edx
movq 0x18(%rsp), %rsi
callq 0x4cf0
movb $0x1, %cl
movl $0x1, %eax
jmp 0x71db
incl %ecx
movl %ecx, (%rax,%r14,4)
xorl %eax, %eax
movl 0xc(%rsp), %r12d
movq 0x10(%rsp), %r15
movq 0x48(%rsp), %r14
movq 0x40(%rsp), %rcx
jmp 0x71fd
movq 0x68(%rbx), %rdi
movq 0x70(%rbx), %rsi
movl 0x4(%rsp), %edx
callq 0x925e
movb $0x1, %cl
movl $0x2, %eax
jmp 0x71f8
movq 0x68(%rbx), %rdi
movq 0x70(%rbx), %rsi
movl 0x4(%rsp), %edx
callq 0x925e
movb $0x1, %cl
movl $0x2, %eax
movl %ebp, %r14d
movq 0x10(%rsp), %r15
cmpl $0x2, %eax
je 0x6efd
testl %eax, %eax
jne 0x77a0
cmpl $0x77359401, 0xc8(%rbx) # imm = 0x77359401
jl 0x723a
movq 0xc0(%rbx), %rdi
movslq 0x34(%rbx), %rdx
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x20e0
movl $0x0, 0xc8(%rbx)
incl 0xc8(%rbx)
movslq 0x4(%rsp), %r12
movl %r14d, %eax
subl 0xc(%rsp), %eax
cltq
movq %rax, 0x40(%rsp)
xorl %ebp, %ebp
leaq (%r12,%r12,2), %r10
movq %r14, 0x48(%rsp)
movq %r10, 0x58(%rsp)
movq 0x50(%rbx), %rsi
movq 0x60(%rbx), %rcx
movq 0x80(%rbx), %rdx
movslq (%rdx,%r12,4), %rdi
movq (%rcx,%r10,8), %rax
movl (%rax,%rdi,4), %edi
movslq %edi, %r11
movslq (%rsi,%r11,4), %r8
cmpq $-0x1, %r8
je 0x72f8
movq 0xc0(%rbx), %rdi
movl 0xc8(%rbx), %r9d
cmpl %r9d, (%rdi,%r8,4)
je 0x72b4
movl %r9d, (%rdi,%r8,4)
movl (%rsi,%r11,4), %esi
movslq %ebp, %rbp
movq 0x18(%rsp), %r8
movl %esi, (%r8,%rbp,4)
incl %ebp
movl 0xc8(%rbx), %esi
cmpl %esi, (%rdi,%r12,4)
je 0x72d2
movl %esi, (%rdi,%r12,4)
movslq %ebp, %rbp
movq 0x18(%rsp), %rsi
movl %r12d, (%rsi,%rbp,4)
incl %ebp
leaq (%rcx,%r10,8), %rsi
leaq (%rdx,%r12,4), %rdx
movl (%rdx), %ecx
movq 0x8(%rsi), %rsi
subq %rax, %rsi
shrq $0x2, %rsi
decl %esi
movb $0x1, %al
cmpl %esi, %ecx
jne 0x7597
jmp 0x759d
movq %rbp, 0x28(%rsp)
movl %r11d, (%rsi,%r12,4)
movq %r11, 0x60(%rsp)
movl %r12d, (%rsi,%r11,4)
cmpl $0x0, (%r15,%r12,4)
jle 0x770c
xorl %r14d, %r14d
movq 0x30(%rsp), %rax
movl (%rax,%r12,4), %eax
addl (%r13,%r12,4), %eax
addl %r14d, %eax
cltq
movq 0x38(%rsp), %rcx
movslq (%rcx,%rax,4), %rbp
movq 0x78(%rbx), %rcx
movl (%rcx,%rbp,4), %eax
leal 0x1(%rax), %edx
movl %edx, (%rcx,%rbp,4)
cmpl (%r13,%rbp,4), %edx
jne 0x736d
movq %rbx, %rdi
movl %ebp, %esi
callq 0x78b8
movq 0x70(%rbx), %rsi
movl %eax, (%rsi,%rbp,4)
testl %eax, %eax
je 0x7391
movl %eax, (%rsi,%rbp,4)
movq 0x68(%rbx), %rdi
movl %ebp, %edx
callq 0x925e
jmp 0x7383
testl %eax, %eax
jle 0x7383
movq %rbx, %rdi
movl %ebp, %esi
callq 0x78b8
testl %eax, %eax
je 0x743e
incl %r14d
cmpl (%r15,%r12,4), %r14d
jl 0x7318
jmp 0x770c
movq 0x78(%rbx), %rax
decl (%rax,%rbp,4)
movl $0x77359400, (%rsi,%rbp,4) # imm = 0x77359400
movq 0x98(%rbx), %rax
cmpq %rax, 0xa0(%rbx)
je 0x73b6
movq %rax, 0xa0(%rbx)
movq 0x40(%rsp), %rax
leaq (%rax,%rax,2), %rax
shlq $0x3, %rax
addq 0x58(%rbx), %rax
movq %rax, 0x50(%rsp)
cmpl $0x0, (%r13,%rbp,4)
jle 0x74db
xorl %r15d, %r15d
movq 0x30(%rsp), %rax
movslq (%rax,%rbp,4), %rax
addq %r15, %rax
movq 0x38(%rsp), %rcx
movslq (%rcx,%rax,4), %rax
movl %eax, 0x8(%rsp)
movq 0x90(%rbx), %rcx
cmpb $0x0, (%rcx,%rax)
jne 0x742f
movq 0xa0(%rbx), %rsi
cmpq 0xa8(%rbx), %rsi
je 0x7420
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0xa0(%rbx)
jmp 0x742f
movq 0x20(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x8df0
incq %r15
cmpl (%r13,%rbp,4), %r15d
jl 0x73db
jmp 0x74db
movq 0x78(%rbx), %rax
decl (%rax,%rbp,4)
movq 0x98(%rbx), %rax
cmpq %rax, 0xa0(%rbx)
je 0x745c
movq %rax, 0xa0(%rbx)
movq 0x40(%rsp), %rax
leaq (%rax,%rax,2), %rax
shlq $0x3, %rax
addq 0x58(%rbx), %rax
movq %rax, 0x50(%rsp)
cmpl $0x0, (%r13,%rbp,4)
jle 0x74db
xorl %r15d, %r15d
movq 0x30(%rsp), %rax
movslq (%rax,%rbp,4), %rax
addq %r15, %rax
movq 0x38(%rsp), %rcx
movslq (%rcx,%rax,4), %rax
movl %eax, 0x8(%rsp)
movq 0x90(%rbx), %rcx
cmpb $0x0, (%rcx,%rax)
jne 0x74d1
movq 0xa0(%rbx), %rsi
cmpq 0xa8(%rbx), %rsi
je 0x74c2
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0xa0(%rbx)
jmp 0x74d1
movq 0x20(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x8df0
incq %r15
cmpl (%r13,%rbp,4), %r15d
jl 0x747d
movq %rbx, %rdi
movq 0x50(%rsp), %rsi
movq 0x20(%rsp), %rdx
callq 0x8122
movq 0x50(%rbx), %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl %ecx, (%rax,%r12,4)
movq 0x60(%rsp), %rdx
movl %ecx, (%rax,%rdx,4)
testl %r14d, %r14d
movq 0x28(%rsp), %rbp
je 0x755e
incl %r14d
movq 0x30(%rsp), %rax
movl (%rax,%r12,4), %eax
addl (%r13,%r12,4), %eax
addl %r14d, %eax
addl $-0x2, %eax
cltq
movq 0x38(%rsp), %rcx
movslq (%rcx,%rax,4), %r15
movq 0x78(%rbx), %rax
movl (%rax,%r15,4), %eax
cmpl (%r13,%r15,4), %eax
jne 0x754d
movq 0x68(%rbx), %rdi
movq 0x70(%rbx), %rsi
movl %r15d, %edx
callq 0x92c0
movq 0x78(%rbx), %rax
decl (%rax,%r15,4)
decl %r14d
cmpl $0x1, %r14d
jg 0x750f
movq 0x60(%rbx), %rax
movq 0x80(%rbx), %rdx
movl (%rdx,%r12,4), %ecx
movq 0x58(%rsp), %r10
movq 0x8(%rax,%r10,8), %rsi
subq (%rax,%r10,8), %rsi
shrq $0x2, %rsi
decl %esi
movb $0x1, %al
cmpl %esi, %ecx
jne 0x758e
movq 0x10(%rsp), %r15
jmp 0x759d
leaq (%rdx,%r12,4), %rdx
movq 0x10(%rsp), %r15
incl %ecx
movl %ecx, (%rdx)
xorl %eax, %eax
testb %al, %al
je 0x7263
movq %rbp, %r15
movq 0x40(%rsp), %rax
leaq (%rax,%rax,2), %rbp
shlq $0x3, %rbp
addq 0x58(%rbx), %rbp
testl %r15d, %r15d
jle 0x7602
movl %r15d, %eax
movq 0x18(%rsp), %r14
leaq (%r14,%rax,4), %rsi
movq %rsi, 0x28(%rsp)
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r14, %rdi
callq 0x8a95
movq %r14, %rdi
movq 0x28(%rsp), %rsi
callq 0x8b70
movq %rbx, %rdi
movq %rbp, %rsi
movq %r14, %rdx
movl %r15d, %ecx
callq 0x8322
movq (%rbp), %r14
movq 0x8(%rbp), %r15
cmpq %r14, %r15
je 0x76db
movq %rbp, %rsi
movl 0x4(%rsp), %edx
callq 0x8094
cmpl $-0x1, %eax
je 0x76db
cltq
leaq (%r14,%rax,4), %rsi
addq $0x4, %rsi
cmpq %r15, %rsi
je 0x7646
leaq (%r14,%rax,4), %rdi
subq %rsi, %r15
movq %r15, %rdx
callq 0x2290
addq $-0x4, 0x8(%rbp)
movq 0x98(%rbx), %rax
cmpq %rax, 0xa0(%rbx)
je 0x7662
movq %rax, 0xa0(%rbx)
cmpl $0x0, (%r13,%r12,4)
jle 0x76cb
xorl %r14d, %r14d
movq 0x30(%rsp), %rax
movslq (%rax,%r12,4), %rax
addq %r14, %rax
movq 0x38(%rsp), %rcx
movslq (%rcx,%rax,4), %rax
movl %eax, 0x8(%rsp)
movq 0x90(%rbx), %rcx
cmpb $0x0, (%rcx,%rax)
jne 0x76c1
movq 0xa0(%rbx), %rsi
cmpq 0xa8(%rbx), %rsi
je 0x76b2
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0xa0(%rbx)
jmp 0x76c1
movq 0x20(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x8df0
incq %r14
cmpl (%r13,%r12,4), %r14d
jl 0x766d
movq %rbx, %rdi
movq %rbp, %rsi
movq 0x20(%rsp), %rdx
callq 0x8122
movl 0xc(%rsp), %r12d
movq 0x48(%rsp), %r14
cmpl %r12d, %r14d
movq 0x10(%rsp), %r15
jne 0x777d
movq 0xb0(%rbx), %rdi
movl 0x2c(%rbx), %edx
movq 0x18(%rsp), %rsi
callq 0x4cf0
jmp 0x778e
movq 0x28(%rsp), %r12
testl %r12d, %r12d
jle 0x7769
movl %r12d, %eax
movq 0x18(%rsp), %r14
leaq (%r14,%rax,4), %r15
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x8a95
movq %r14, %rdi
movq %r15, %rsi
movq 0x10(%rsp), %r15
callq 0x8b70
movq 0x40(%rsp), %rax
leaq (%rax,%rax,2), %rsi
shlq $0x3, %rsi
addq 0x58(%rbx), %rsi
movq %rbx, %rdi
movq %r14, %rdx
movl %r12d, %ecx
callq 0x8322
movq 0x48(%rsp), %r14
incl %r14d
xorl %ecx, %ecx
movl 0xc(%rsp), %r12d
jmp 0x6efd
movq 0x68(%rbx), %rdi
movq 0x70(%rbx), %rsi
movl 0x4(%rsp), %edx
callq 0x925e
leal -0x1(%r14), %eax
movb $0x1, %cl
cmpl %r12d, %r14d
movl %eax, %r14d
jne 0x6efd
xorl %eax, %eax
jmp 0x77b7
movq 0xb0(%rbx), %rdi
movq 0x18(%rsp), %rsi
callq 0x4cf0
movb $0x1, %al
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq