// File: /workspace/github_cpp_makefile_star2_O1/SNUCSE-CTA[P]GI/src/refine.cpp
// Function: Refinement::refine(Coloring*, Graph*, Graph*)
bool Refinement::refine(Coloring* coloring, Graph* aG1, Graph* aG2)
{
	#ifdef DEBUG
	cout << __PRETTY_FUNCTION__ << endl;
	#endif

	auto deg = [aG1, aG2](const int32_t& u) -> int32_t {
		return (u < aG1->numNode) ? aG1->d[u] : aG2->d[u - aG1->numNode];
	};

	auto adj = [aG1, aG2](const int32_t& u, const int32_t& i) -> int32_t {
		return (u < aG1->numNode) ? aG1->e[u][i] : (aG2->e[u - aG1->numNode][i] + aG1->numNode);
	};

	const int32_t numNode = aG1->numNode + aG2->numNode;

	int32_t* inStack = global_memory->getLLArray(numNode);
	int32_t* stackCand = global_memory->getLLArray(numNode);

	memset(inStack, 0, sizeof(int32_t) * numNode);
	memset(stackCand, 0, sizeof(int32_t) * numNode);

	int32_t numStackCand = 0;
	int32_t numVisitCell = 0;
	int32_t numSplitCell = 0;
	int32_t numSplitCount = 0;

	// Push all cells of the coloring into the stack.
	stackSize = 0;
	for (int32_t i = 0; i < numNode; i += coloring->cellSize[i]) {
		cellStack[stackSize] = i;
		++stackSize;
		inStack[i] = 1;
	}

	while (stackSize > 0) {
		if (coloring->numCell == numNode)
			break;

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

		int32_t weightend = 0;
		int32_t idx = selectFromStack(coloring);
		int32_t currCell = cellStack[idx];
		int32_t currEnd = currCell + coloring->cellSize[currCell];

		cellStack[idx] = cellStack[stackSize - 1];
		--stackSize;
		inStack[currCell] = 0;

		// The first node.
		int32_t currNode = coloring->perm[currCell];
		int32_t currDegree = deg(currNode);
		do {
			int32_t start = currCell;
			int32_t end = currEnd;
			weightend = deg(currNode);

			if (coloring->cellSize[start] == 1) {
				return false;
			} else if (coloring->cellSize[start] == 2) {
				bool u_in_G1 = (coloring->perm[start] < aG1->numNode);
				bool v_in_G1 = (coloring->perm[start+1] < aG1->numNode);
				if ((u_in_G1 && v_in_G1) || (!u_in_G1 && !v_in_G1)) {
					return false;
				}

				numVisitCell = 0;
				for (int32_t i = 0; i < 2; ++i) {
					currNode = coloring->perm[start+i];
					for (int32_t j = 0; j < deg(currNode); ++j) {
						int32_t neigh = adj(currNode, j);
						int32_t c = coloring->color[coloring->inv[neigh]];
						if (coloring->cellSize[c] > 1) {
							if (markCell[c] != global_mark) {
								visitCell[numVisitCell++] = c;
								markCell[c] = global_mark;
								visitNode[c] = neigh;
								numVisitNode[c] = 1;
							} else {
								visitNode[c + numVisitNode[c]] = neigh;
								++numVisitNode[c];
							}
						}
					}
				}
				++global_mark;

				// Find cells that needs to be split.
				numSplitCell = 0;
				for (int32_t idx = 0; idx < numVisitCell; ++idx) {
					int32_t c = visitCell[idx];
					if (numVisitNode[c] < coloring->cellSize[c]) {
						splitCell[numSplitCell++] = c;
					}
				}

				if (numSplitCell > 0) {
					sort(splitCell, splitCell+numSplitCell);

					for (int32_t idx = 0; idx < numSplitCell; ++idx) {
						int32_t sc = splitCell[idx];

						coloring->cellSize[sc] -= numVisitNode[sc];

						int32_t newCell = sc + coloring->cellSize[sc];
						coloring->cellSize[newCell] = numVisitNode[sc];

						++coloring->numCell;

						if (inStack[sc] == 1) {
							cellStack[stackSize] = newCell;
							++stackSize;
							inStack[newCell] = 1;
						} else {
							if (coloring->cellSize[newCell] < coloring->cellSize[sc]) {
								cellStack[stackSize] = newCell;
								++stackSize;
								inStack[newCell] = 1;
							} else {
								cellStack[stackSize] = sc;
								++stackSize;
								inStack[sc] = 1;
							}
						}

						for (int32_t i = 0; i < numVisitNode[sc]; ++i) {
							int32_t node = visitNode[sc+i];

							int32_t newPos = newCell + i;
							int32_t oldPos = coloring->inv[node];

							coloring->perm[oldPos] = coloring->perm[newPos];
							coloring->perm[newPos] = node;
							coloring->inv[node] = newPos;
							coloring->inv[coloring->perm[oldPos]] = oldPos;
							coloring->color[newPos] = newCell;
						}
					}
				}
			} else { // if cellSize[start] > 2
				if (coloring->cellSize[start] != numNode) {
					numVisitCell = 0;
					for (int32_t i = start; i < end; ++i) {
						currNode = coloring->perm[i];
						for (int32_t j = 0; j < deg(currNode); ++j) {
							int32_t neigh = adj(currNode, j);

							if (markNode[neigh] == global_mark) {
								++neighCount[neigh];
							} else {
								int32_t c = coloring->color[coloring->inv[neigh]];
								if (coloring->cellSize[c] > 1) {
									markNode[neigh] = global_mark;
									neighCount[neigh] = 1;

									if (markCell[c] != global_mark) {
										visitCell[numVisitCell++] = c;
										markCell[c] = global_mark;
										visitNode[c] = neigh;
										numVisitNode[c] = 1;
									} else {
										visitNode[c + numVisitNode[c]++] = neigh;
									}
								} //if (cellSize[c] > 1)
							} //if-else (markNode[neigh])
						} //for (j)
					} //for (i)
				} //if
				++global_mark;

				// Find cells that need to be split.
				numSplitCell = 0;
				for (int32_t idx = 0; idx < numVisitCell; ++idx) {
					int32_t c = visitCell[idx];

					if (numVisitNode[c] < coloring->cellSize[c]) {
						splitCell[numSplitCell++] = c;
					} else {
						int32_t count = neighCount[coloring->perm[c]];
						for (int32_t i = c+1; i < c+coloring->cellSize[c]; ++i) {
							if (neighCount[coloring->perm[i]] != count) {
								splitCell[numSplitCell++] = c;
								break;
							}
						}
					}
				}

				if (numSplitCell > 0) {
					sort(splitCell, splitCell+numSplitCell);

					for (int32_t idx = 0; idx < numSplitCell; ++idx) {
						int32_t sc = splitCell[idx];

						int32_t scEnd = sc + coloring->cellSize[sc];
						numSplitCount = 0;
						if (numVisitNode[sc] < coloring->cellSize[sc]) {
							splitCount[numSplitCount] = 0;
							++numSplitCount;
							splitPos[0] = coloring->cellSize[sc] - numVisitNode[sc];
						}

						int32_t thisEnd = sc + numVisitNode[sc];
						for (int32_t i = sc; i < thisEnd; ++i) {
							int32_t count = neighCount[visitNode[i]];

							if (markCell[count] != global_mark) {
								markCell[count] = global_mark;
								splitCount[numSplitCount] = count;
								++numSplitCount;
								splitPos[count] = 1;
							} else {
								++splitPos[count];
							}
						}
						++global_mark;

						sort(splitCount, splitCount+numSplitCount);

						stackCand[0] = sc;
						numStackCand = 1;

						int32_t newCell = sc;
						for (int32_t k = 0; k < numSplitCount; ++k) {
							int32_t size = splitPos[splitCount[k]];
							coloring->cellSize[newCell] = size;
							splitPos[splitCount[k]] = newCell;

							newCell += size;
							if (newCell < scEnd) {
								// Push new cells into the stack.
								// Note that the first new cell is not pushed.
								stackCand[numStackCand] = newCell;
								++numStackCand;
								++coloring->numCell;
							}
						}

						if (inStack[sc]) {
							for (int32_t k = 1; k < numStackCand; ++k) {
								cellStack[stackSize] = stackCand[k];
								inStack[stackCand[k]] = 1;
								++stackSize;
							}
						} else {
							int32_t maxCell = sc;
							int32_t maxCellSize = coloring->cellSize[sc];
							for (int32_t k = 1; k < numStackCand; ++k) {
								if (coloring->cellSize[stackCand[k]] > maxCellSize) {
									maxCell = stackCand[k];
									maxCellSize = coloring->cellSize[maxCell];
								}
							}

							for (int32_t k = 0; k < numStackCand; ++k) {
								if (stackCand[k] != maxCell) {
									cellStack[stackSize] = stackCand[k];
									inStack[stackCand[k]] = 1;
									++stackSize;
								}
							}
						}

						for (int32_t i = sc; i < thisEnd; ++i) {
							int32_t node = visitNode[i];

							int32_t newPos = splitPos[neighCount[node]]++;
							int32_t oldPos = coloring->inv[node];

							coloring->perm[oldPos] = coloring->perm[newPos];
							coloring->perm[newPos] = node;
							coloring->inv[node] = newPos;
							coloring->inv[coloring->perm[oldPos]] = oldPos;
							neighCount[node] = 0;
						}

						newCell = scEnd - numVisitNode[sc];
						int32_t nc = newCell;
						int32_t ncEnd = newCell + coloring->cellSize[newCell] - 1;
						do {
							coloring->color[nc] = newCell;
							if (nc == ncEnd) {
								newCell = nc + 1;
								if (newCell < numNode) {
									ncEnd = newCell + coloring->cellSize[newCell] - 1;
								}
							}
							++nc;
						} while (nc < scEnd);
					}
				}
			} //if-else (cellSize[start])
		} while (weightend < currDegree);
	}

	return checkColoring(coloring);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, %r13
movq %rsi, 0x8(%rsp)
movq %rdi, %r12
movslq 0xc(%rdx), %rax
movq %rcx, 0x38(%rsp)
movslq 0xc(%rcx), %rbx
addq %rax, %rbx
movq 0x68(%rdi), %rdi
movl %ebx, %esi
callq 0x4b34
movq %rax, %r14
movq 0x68(%r12), %rdi
movl %ebx, %esi
callq 0x4b34
movq %rax, %r15
movq %rbx, %rbp
shlq $0x2, %rbp
movq %r14, %rdi
xorl %esi, %esi
movq %rbp, %rdx
callq 0x20e0
movq %r15, %rdi
xorl %esi, %esi
movq %rbp, 0x88(%rsp)
movq %rbp, %rdx
callq 0x20e0
movq %r14, %rdi
movl $0x0, 0x28(%r12)
testl %ebx, %ebx
jle 0xa16e
movq 0x20(%r12), %rax
movq 0x8(%rsp), %rcx
movq 0x20(%rcx), %rcx
xorl %edx, %edx
movslq 0x28(%r12), %rsi
movl %edx, (%rax,%rsi,4)
incl 0x28(%r12)
movslq %edx, %rsi
movl $0x1, (%rdi,%rsi,4)
movl (%rcx,%rsi,4), %edx
addl %esi, %edx
cmpl %ebx, %edx
jl 0xa14e
movq %rbx, 0x80(%rsp)
movslq %ebx, %rax
movq %rax, 0xa0(%rsp)
xorl %r11d, %r11d
movq %r13, 0x60(%rsp)
movq %r15, 0x78(%rsp)
movq %rdi, 0x68(%rsp)
cmpl $0x0, 0x28(%r12)
movq 0x80(%rsp), %rcx
jle 0xac30
movq 0x8(%rsp), %rax
cmpl %ecx, 0x4(%rax)
je 0xac30
movl %r11d, %ebp
cmpl $0x77359401, 0x80(%r12) # imm = 0x77359401
jl 0xa1f8
movq 0x70(%r12), %rdi
xorl %esi, %esi
movq 0x88(%rsp), %rbx
movq %rbx, %rdx
callq 0x20e0
movq 0x78(%r12), %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x20e0
movl $0x0, 0x80(%r12)
incl 0x80(%r12)
movq %r12, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rsi
callq 0xacc0
movq 0x20(%r12), %rcx
cltq
movslq (%rcx,%rax,4), %r8
movq 0x20(%rbx), %rdx
movslq (%rdx,%r8,4), %rsi
movq %rsi, 0x90(%rsp)
addq %r8, %rsi
movq %rsi, 0x98(%rsp)
movslq 0x28(%r12), %rdx
movl -0x4(%rcx,%rdx,4), %edx
movl %edx, (%rcx,%rax,4)
decl 0x28(%r12)
movq 0x68(%rsp), %rdi
movl $0x0, (%rdi,%r8,4)
movq 0x10(%rbx), %rax
movl (%rax,%r8,4), %r14d
movl %r14d, %eax
subl 0xc(%r13), %eax
cmovll %r14d, %eax
movq 0x38(%rsp), %rcx
cmovlq %r13, %rcx
movq 0x20(%rcx), %rcx
cltq
movl (%rcx,%rax,4), %r9d
movq %r8, 0x40(%rsp)
movl %r9d, 0x2c(%rsp)
movl %ebp, %r11d
movl 0xc(%r13), %ecx
movl %r14d, %eax
subl %ecx, %eax
cmovll %r14d, %eax
movq 0x38(%rsp), %rdx
cmovlq %r13, %rdx
movq 0x20(%rdx), %rdx
cltq
movl (%rdx,%rax,4), %r10d
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rax
movl (%rax,%r8,4), %edx
cmpl $0x1, %edx
je 0xa464
cmpl $0x2, %edx
jne 0xa46b
movq 0x8(%rsp), %rdx
movq 0x10(%rdx), %rdx
cmpl %ecx, (%rdx,%r8,4)
setl %sil
cmpl %ecx, 0x4(%rdx,%r8,4)
setl %cl
cmpb %cl, %sil
movl $0x0, %esi
je 0xabef
movq $0x0, 0x10(%rsp)
movl %r10d, 0x1c(%rsp)
leaq (%rdx,%r8,4), %rcx
movq %rcx, 0x30(%rsp)
xorl %esi, %esi
movq 0x30(%rsp), %rcx
movq %rsi, 0x20(%rsp)
movl (%rcx,%rsi,4), %r14d
movslq %r14d, %rsi
movq 0x70(%r12), %rdi
movq 0x38(%r12), %r8
movq 0x40(%r12), %r9
movq 0x48(%r12), %r10
leaq (,%rsi,4), %r11
xorl %ebx, %ebx
movl 0xc(%r13), %ebp
movl %r14d, %r15d
subl %ebp, %r15d
jge 0xa34a
movq 0x20(%r13), %r15
addq %r11, %r15
jmp 0xa35a
movslq %r15d, %r15
shlq $0x2, %r15
movq 0x38(%rsp), %rcx
addq 0x20(%rcx), %r15
movslq (%r15), %r15
cmpq %r15, %rbx
jge 0xa402
movl %r14d, %r15d
subl %ebp, %r15d
jge 0xa37c
movq 0x38(%r13), %r15
movq (%r15,%rsi,8), %r15
movl (%r15,%rbx,4), %ebp
jmp 0xa38f
movq 0x38(%rsp), %rcx
movq 0x38(%rcx), %rcx
movslq %r15d, %r15
movq (%rcx,%r15,8), %rcx
addl (%rcx,%rbx,4), %ebp
movq 0x8(%rsp), %rdx
movq 0x8(%rdx), %rcx
movq 0x18(%rdx), %r15
movslq %ebp, %rdx
movslq (%r15,%rdx,4), %rdx
movl (%rcx,%rdx,4), %ecx
movslq %ecx, %r15
cmpl $0x2, (%rax,%r15,4)
jl 0xa3fa
movl (%rdi,%r15,4), %ecx
cmpl 0x80(%r12), %ecx
jne 0xa3cf
movslq (%r10,%r15,4), %rcx
addq %r15, %rcx
movl %ebp, (%r9,%rcx,4)
incl (%r10,%r15,4)
jmp 0xa3fa
movq 0x10(%rsp), %rdx
movslq %edx, %rcx
incl %edx
movq %rdx, 0x10(%rsp)
movl %r15d, (%r8,%rcx,4)
movl 0x80(%r12), %ecx
movl %ecx, (%rdi,%r15,4)
movl %ebp, (%r9,%r15,4)
movl $0x1, (%r10,%r15,4)
incq %rbx
jmp 0xa335
movq 0x20(%rsp), %rcx
leaq 0x1(%rcx), %rsi
testq %rcx, %rcx
je 0xa306
incl 0x80(%r12)
movq 0x10(%rsp), %rbx
testl %ebx, %ebx
jle 0xaa52
movq 0x38(%r12), %rdx
movq 0x48(%r12), %rsi
movq 0x50(%r12), %rdi
movl %ebx, %r8d
xorl %r9d, %r9d
xorl %ecx, %ecx
movslq (%rdx,%r9,4), %r10
movl (%rsi,%r10,4), %r11d
cmpl (%rax,%r10,4), %r11d
jge 0xa457
movslq %ecx, %r11
incl %ecx
movl %r10d, (%rdi,%r11,4)
incq %r9
cmpq %r9, %r8
jne 0xa440
jmp 0xaa54
xorl %esi, %esi
jmp 0xabef
movl %r10d, 0x1c(%rsp)
cmpl $0x0, 0x90(%rsp)
setle %cl
cmpl 0x80(%rsp), %edx
sete %dl
movl $0x0, %esi
cmovnel %esi, %r11d
movl %r11d, 0x20(%rsp)
orb %cl, %dl
jne 0xa61e
movq 0x8(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq %rcx, 0x50(%rsp)
movl $0x0, 0x20(%rsp)
movq 0x40(%rsp), %rdx
movq 0x50(%rsp), %rcx
movq %rdx, 0x58(%rsp)
movl (%rcx,%rdx,4), %r14d
movslq %r14d, %rsi
movq 0x78(%r12), %rdi
movq 0x30(%r12), %r8
movq 0x38(%r12), %rcx
movq %rcx, 0x30(%rsp)
movq 0x70(%r12), %r10
movq 0x40(%r12), %rcx
movq %rcx, 0x10(%rsp)
movq 0x48(%r12), %rbx
leaq (,%rsi,4), %r13
xorl %ebp, %ebp
movq 0x60(%rsp), %rdx
movl 0xc(%rdx), %r15d
movl %r14d, %ecx
subl %r15d, %ecx
jge 0xa513
movq 0x20(%rdx), %rcx
addq %r13, %rcx
jmp 0xa523
movslq %ecx, %rcx
shlq $0x2, %rcx
movq 0x38(%rsp), %rdx
addq 0x20(%rdx), %rcx
movslq (%rcx), %rcx
cmpq %rcx, %rbp
jge 0xa608
movl %r14d, %ecx
subl %r15d, %ecx
jge 0xa54a
movq 0x60(%rsp), %rcx
movq 0x38(%rcx), %rcx
movq (%rcx,%rsi,8), %rcx
movl (%rcx,%rbp,4), %r15d
jmp 0xa55e
movq 0x38(%rsp), %rdx
movq 0x38(%rdx), %rdx
movslq %ecx, %rcx
movq (%rdx,%rcx,8), %rcx
addl (%rcx,%rbp,4), %r15d
movslq %r15d, %r9
movl 0x80(%r12), %edx
cmpl %edx, (%rdi,%r9,4)
jne 0xa578
incl (%r8,%r9,4)
jmp 0xa600
movq 0x8(%rsp), %r11
movq 0x8(%r11), %rcx
movq 0x18(%r11), %r11
movslq (%r11,%r9,4), %r11
movl (%rcx,%r11,4), %ecx
movslq %ecx, %rcx
cmpl $0x2, (%rax,%rcx,4)
jl 0xa600
movl %edx, (%rdi,%r9,4)
movl $0x1, (%r8,%r9,4)
movl (%r10,%rcx,4), %edx
cmpl 0x80(%r12), %edx
jne 0xa5cb
movl (%rbx,%rcx,4), %edx
leal 0x1(%rdx), %r9d
movl %r9d, (%rbx,%rcx,4)
addl %edx, %ecx
movslq %ecx, %rcx
movq 0x10(%rsp), %rdx
movl %r15d, (%rdx,%rcx,4)
jmp 0xa600
movl 0x20(%rsp), %r9d
movslq %r9d, %rdx
incl %r9d
movl %r9d, 0x20(%rsp)
movq 0x30(%rsp), %r9
movl %ecx, (%r9,%rdx,4)
movl 0x80(%r12), %edx
movl %edx, (%r10,%rcx,4)
movq 0x10(%rsp), %rdx
movl %r15d, (%rdx,%rcx,4)
movl $0x1, (%rbx,%rcx,4)
incq %rbp
jmp 0xa4f9
movq 0x58(%rsp), %rdx
incq %rdx
cmpq 0x98(%rsp), %rdx
jl 0xa4b6
incl 0x80(%r12)
movl 0x20(%rsp), %edx
testl %edx, %edx
jle 0xa6a3
movq 0x30(%r12), %rcx
movq 0x38(%r12), %rsi
movq 0x48(%r12), %rdi
movq 0x50(%r12), %r8
movq %r8, 0x10(%rsp)
movl %edx, %r9d
xorl %r10d, %r10d
xorl %edx, %edx
movl (%rsi,%r10,4), %r11d
movslq %r11d, %rbx
movl (%rax,%rbx,4), %r13d
cmpl %r13d, (%rdi,%rbx,4)
jl 0xa68b
movq 0x8(%rsp), %r8
movq 0x10(%r8), %r15
movslq (%r15,%rbx,4), %rbp
movl (%rcx,%rbp,4), %ebp
addl %r11d, %r13d
movslq %r13d, %r13
incq %rbx
cmpq %r13, %rbx
jge 0xa699
movslq (%r15,%rbx,4), %r8
incq %rbx
cmpl %ebp, (%rcx,%r8,4)
je 0xa679
movslq %edx, %r8
incl %edx
movq 0x10(%rsp), %rbx
movl %r11d, (%rbx,%r8,4)
incq %r10
cmpq %r9, %r10
jne 0xa64f
jmp 0xa6a5
xorl %edx, %edx
movb $0x1, %sil
testl %edx, %edx
jle 0xaa34
movl %edx, %eax
movq 0x50(%r12), %rbx
leaq (%rbx,%rax,4), %r15
movq %rax, 0x70(%rsp)
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x8a95
movq %rbx, %rdi
movq %r15, %rsi
callq 0x8b70
xorl %edx, %edx
movq 0x48(%r12), %rax
movq 0x50(%r12), %rcx
movq %rdx, 0x30(%rsp)
movl (%rcx,%rdx,4), %ebx
movq 0x8(%rsp), %rcx
movq 0x20(%rcx), %rcx
movslq %ebx, %r8
movl (%rcx,%r8,4), %r13d
xorl %r15d, %r15d
cmpl %r13d, (%rax,%r8,4)
jge 0xa730
movq 0x58(%r12), %rdx
movl $0x0, (%rdx)
movl (%rcx,%r8,4), %ecx
subl (%rax,%r8,4), %ecx
movq 0x60(%r12), %rdx
movl %ecx, (%rdx)
movl $0x1, %r15d
movl (%rax,%r8,4), %ecx
leal (%rcx,%rbx), %eax
movslq %eax, %rbp
movq %rcx, 0x58(%rsp)
testl %ecx, %ecx
movq %r8, 0x10(%rsp)
jle 0xa79e
movq 0x30(%r12), %rax
movq 0x40(%r12), %rcx
movq 0x70(%r12), %rdx
movq 0x58(%r12), %rsi
movq 0x60(%r12), %rdi
movslq (%rcx,%r8,4), %r9
movl (%rax,%r9,4), %r9d
movslq %r9d, %r9
movl 0x80(%r12), %r10d
cmpl %r10d, (%rdx,%r9,4)
jne 0xa780
incl (%rdi,%r9,4)
jmp 0xa796
movl %r10d, (%rdx,%r9,4)
movslq %r15d, %r15
movl %r9d, (%rsi,%r15,4)
incl %r15d
movl $0x1, (%rdi,%r9,4)
incq %r8
cmpq %rbp, %r8
jl 0xa761
incl 0x80(%r12)
testl %r15d, %r15d
je 0xa7e5
movslq %r15d, %rax
movq 0x58(%r12), %rcx
leaq (%rcx,%rax,4), %rsi
movq %rsi, 0x50(%rsp)
movq %rcx, %rdi
movq %rcx, 0x48(%rsp)
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
callq 0x8a95
movq 0x48(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x8b70
addl %ebx, %r13d
movq 0x78(%rsp), %rax
movl %ebx, (%rax)
testl %r15d, %r15d
jle 0xa854
movq 0x58(%r12), %rcx
movq 0x60(%r12), %rdx
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rsi
movl %r15d, %edi
movl $0x1, %eax
xorl %r8d, %r8d
movl %ebx, %r9d
movq 0x78(%rsp), %r15
movslq (%rcx,%r8,4), %r10
movslq %r9d, %r11
movl (%rdx,%r10,4), %r9d
movl %r9d, (%rsi,%r11,4)
movslq (%rcx,%r8,4), %r10
movl %r11d, (%rdx,%r10,4)
addl %r11d, %r9d
cmpl %r13d, %r9d
jge 0xa84a
cltq
movl %r9d, (%r15,%rax,4)
incl %eax
movq 0x8(%rsp), %r10
incl 0x4(%r10)
incq %r8
cmpq %r8, %rdi
jne 0xa81a
jmp 0xa85e
movl $0x1, %eax
movq 0x78(%rsp), %r15
movq 0x68(%rsp), %r8
movq 0x10(%rsp), %rdx
cmpl $0x0, (%r8,%rdx,4)
je 0xa8ab
cmpl $0x2, %eax
jl 0xa919
movq 0x20(%r12), %rcx
movl %eax, %eax
movl $0x1, %edx
movl (%r15,%rdx,4), %esi
movslq 0x28(%r12), %rdi
movl %esi, (%rcx,%rdi,4)
movslq (%r15,%rdx,4), %rsi
movl $0x1, (%r8,%rsi,4)
incl 0x28(%r12)
incq %rdx
cmpq %rdx, %rax
jne 0xa884
jmp 0xa919
cmpl $0x2, %eax
jl 0xa8de
movq 0x8(%rsp), %rcx
movq 0x20(%rcx), %rcx
movl (%rcx,%rdx,4), %edx
movl %eax, %esi
movl $0x1, %edi
movslq (%r15,%rdi,4), %r8
movl (%rcx,%r8,4), %r9d
cmpl %edx, %r9d
cmovgl %r8d, %ebx
cmovgl %r9d, %edx
incq %rdi
cmpq %rdi, %rsi
jne 0xa8c3
testl %eax, %eax
movq 0x68(%rsp), %r8
jle 0xa919
movq 0x20(%r12), %rcx
movl %eax, %eax
xorl %edx, %edx
movl (%r15,%rdx,4), %esi
cmpl %ebx, %esi
je 0xa911
movslq 0x28(%r12), %rdi
movl %esi, (%rcx,%rdi,4)
movslq (%r15,%rdx,4), %rsi
movl $0x1, (%r8,%rsi,4)
incl 0x28(%r12)
incq %rdx
cmpq %rdx, %rax
jne 0xa8f0
cmpl $0x0, 0x58(%rsp)
jle 0xa981
movq 0x30(%r12), %rax
movq 0x40(%r12), %rcx
movq 0x60(%r12), %rdx
movq 0x8(%rsp), %rdi
movq 0x10(%rdi), %rsi
movq 0x18(%rdi), %rdi
movq 0x10(%rsp), %r8
movslq (%rcx,%r8,4), %r9
movslq (%rax,%r9,4), %r10
movslq (%rdx,%r10,4), %r11
leal 0x1(%r11), %ebx
movl %ebx, (%rdx,%r10,4)
movslq (%rdi,%r9,4), %r10
movl (%rsi,%r11,4), %ebx
movl %ebx, (%rsi,%r10,4)
movl %r9d, (%rsi,%r11,4)
movl %r11d, (%rdi,%r9,4)
movslq (%rsi,%r10,4), %r11
movl %r10d, (%rdi,%r11,4)
movl $0x0, (%rax,%r9,4)
incq %r8
cmpq %rbp, %r8
jl 0xa941
movq 0x48(%r12), %rax
movq 0x10(%rsp), %rcx
movslq (%rax,%rcx,4), %rdi
movslq %r13d, %rax
subl %edi, %r13d
movq 0x8(%rsp), %r9
movq 0x20(%r9), %r8
movslq %r13d, %rcx
movl (%r8,%rcx,4), %edx
leal (%rcx,%rdx), %esi
decl %esi
leaq (,%rax,4), %rdx
shlq $0x2, %rdi
subq %rdi, %rdx
leaq (%r8,%rdx), %rdi
addq $0x4, %rdi
addq 0x8(%r9), %rdx
xorl %r8d, %r8d
movl %r13d, %r9d
movq 0xa0(%rsp), %rbx
movl %r9d, (%rdx,%r8,4)
leal (%r8,%r13), %r11d
leaq (%rcx,%r8), %r10
incq %r10
cmpl %esi, %r11d
jne 0xa9fb
leaq (%r8,%r13), %r9
incq %r9
cmpq %rbx, %r10
jge 0xa9fb
leal (%r8,%r13), %esi
addl (%rdi,%r8,4), %esi
incq %r8
cmpq %rax, %r10
jl 0xa9d3
movq 0x30(%rsp), %rdx
incq %rdx
cmpq 0x70(%rsp), %rdx
jne 0xa6e5
movq 0x60(%rsp), %r13
movq 0x40(%rsp), %r8
movl 0x2c(%rsp), %r9d
movl 0x1c(%rsp), %r10d
movl 0x20(%rsp), %r11d
jmp 0xabec
movq 0x60(%rsp), %r13
movq 0x40(%rsp), %r8
movl 0x2c(%rsp), %r9d
movl 0x1c(%rsp), %r10d
movl 0x20(%rsp), %r11d
jmp 0xabef
xorl %ecx, %ecx
movb $0x1, %sil
testl %ecx, %ecx
jle 0xabff
movl %ecx, %eax
movq 0x50(%r12), %rbx
leaq (%rbx,%rax,4), %r15
movq %rax, 0x30(%rsp)
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x8a95
movq %rbx, %rdi
movq %r15, %rsi
callq 0x8b70
movq 0x50(%r12), %rax
movq %rax, 0x58(%rsp)
movq 0x48(%r12), %rcx
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x20(%r12), %rax
movq %rax, 0x48(%rsp)
movq 0x40(%r12), %rax
movq %rax, 0x70(%rsp)
xorl %edx, %edx
movq %rdi, 0x50(%rsp)
movq 0x58(%rsp), %rax
movq %rdx, 0x20(%rsp)
movl (%rax,%rdx,4), %eax
movslq %eax, %r9
movl (%rcx,%r9,4), %ebp
movl (%rdi,%r9,4), %r10d
movl %r10d, %eax
subl %ebp, %eax
movl %eax, (%rdi,%r9,4)
leal (%r9,%rax), %r11d
movl (%rcx,%r9,4), %eax
movslq %r11d, %r15
movl %eax, (%rdi,%r15,4)
movq 0x8(%rsp), %rax
incl 0x4(%rax)
movq 0x68(%rsp), %rdx
cmpl $0x1, (%rdx,%r9,4)
jne 0xab19
movslq 0x28(%r12), %rax
movq 0x48(%rsp), %rsi
movl %r15d, (%rsi,%rax,4)
jmp 0xab31
movl (%rdi,%r15,4), %eax
movslq 0x28(%r12), %rsi
cmpl (%rdi,%r9,4), %eax
jge 0xab3c
movq 0x48(%rsp), %rax
movl %r15d, (%rax,%rsi,4)
incl 0x28(%r12)
leaq (%rdx,%r15,4), %rax
jmp 0xab4e
leaq (%rdx,%r9,4), %rax
movq 0x48(%rsp), %rdx
movl %r9d, (%rdx,%rsi,4)
incl 0x28(%r12)
movl $0x1, (%rax)
cmpl $0x0, (%rcx,%r9,4)
jle 0xabb8
movq 0x8(%rsp), %rdx
movq 0x10(%rdx), %rdi
movq 0x18(%rdx), %rbx
leaq (%rdi,%r15,4), %rax
shlq $0x2, %r15
addq 0x8(%rdx), %r15
movq 0x70(%rsp), %rdx
leaq (%rdx,%r9,4), %rsi
addl %r9d, %r10d
subl %ebp, %r10d
xorl %ebp, %ebp
movslq (%rsi,%rbp,4), %rdx
movslq (%rbx,%rdx,4), %r8
movl (%rax,%rbp,4), %r13d
movl %r13d, (%rdi,%r8,4)
movl %edx, (%rax,%rbp,4)
leal (%r10,%rbp), %r13d
movl %r13d, (%rbx,%rdx,4)
movslq (%rdi,%r8,4), %rdx
movl %r8d, (%rbx,%rdx,4)
movl %r11d, (%r15,%rbp,4)
incq %rbp
movslq (%rcx,%r9,4), %rdx
cmpq %rdx, %rbp
jl 0xab85
movq 0x20(%rsp), %rdx
incq %rdx
cmpq 0x30(%rsp), %rdx
movq 0x60(%rsp), %r13
movq 0x50(%rsp), %rdi
jne 0xaac5
movq 0x10(%rsp), %rax
movl %eax, %r11d
movq 0x40(%rsp), %r8
movl 0x2c(%rsp), %r9d
movl 0x1c(%rsp), %r10d
movb $0x1, %sil
testb %sil, %sil
je 0xac1c
cmpl %r9d, %r10d
jl 0xa287
jmp 0xac13
movl %ebx, %r11d
movq 0x40(%rsp), %r8
movl 0x2c(%rsp), %r9d
movl 0x1c(%rsp), %r10d
jmp 0xabef
testb %sil, %sil
jne 0xa193
xorl %eax, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
movq 0x8(%rsp), %rsi
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xac60