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

	Graph* g1 = aG1;
	Graph* g2 = aG2;

	int32_t n = g1->numNode;
	int32_t* d1 = g1->d;
	char* one1 = g1->one;
	int32_t** neigh1 = g1->e;
	int32_t* d2 = g2->d;
	char* one2 = g2->one;
	int32_t** neigh2 = g2->e;
	int32_t numNode = aColoring->numNode;
	int32_t* perm = aColoring->perm;
	int32_t* inv = aColoring->inv;
	int32_t* cellSize = aColoring->cellSize;
	int32_t* color = aColoring->color;

	int32_t i, j, k, sc, ind, currCell, cellEnd, visitCellInd;
	int32_t u, du, v, adj, cell, splitInd, splitCountInd, count, size, endIdx, newCell;
	int32_t numDeleted = 0;

	//check if there are coreness-1 vertices.
	bool hasDegreeOne = false;
	for(i = 0; i < n; ++i) {
		if( d1[i] == 1 ){
			hasDegreeOne = true;
			break;
		}
	}
	if( hasDegreeOne == false )
		return 0;

	//now there is at least one degree one vertex

	//push cells having degree one vertices to cellStack
	stackSize = 0;
	for( i = 0; i < numNode; i += cellSize[i] ) {
		u = perm[i];
		du = (u < n) ? d1[u] : d2[u - n];
		if( du == 1 ) {
			cellStack[stackSize] = i;
			++stackSize;
		}
	}

	ind = 0;
	while( ind < stackSize ) {
		if( global_mark > INFINITY ) {
			memset(markCell, 0, sizeof(int32_t) * n);
			memset(markNode, 0, sizeof(int32_t) * n);
			global_mark = 0;
		}
		++global_mark;

		//Step 1. select a cell from cellStack and count the cell
		currCell = cellStack[ind];
		++ind;

		cellEnd = currCell + cellSize[currCell];
		visitCellInd = 0;
		for(i = currCell; i < cellEnd; ++i) {
			u = perm[i];
			if(u < n) { //g1
				adj = *(neigh1[u]); //the only neighbor of u
				if( d1[adj] != 1 ) {
					d1[u] = -1;
					one1[u] = 1;
				}

				if( markNode[adj] == global_mark ) {
					++(neighCount[adj]);
				}
				else { //adj is visited first time
					cell = color[ inv[adj] ];
					markNode[adj] = global_mark;
					neighCount[adj] = 1;
					if( markCell[cell] != global_mark ) { //cell is visited first time
						visitCell[visitCellInd] = cell;
						++visitCellInd;
						markCell[cell] = global_mark;
						visitNode[cell] = adj;
						numVisitNode[cell] = 1;
					}
					else {
						visitNode[cell + numVisitNode[cell]] = adj;
						++(numVisitNode[cell]);
					}
				}
			}
			else { //g2
				adj = *(neigh2[u - n]); //the only neighbor of u
				if( d2[adj] != 1 ) {
					d2[u - n] = -1;
					one2[u - n] = 1;
				}

				if( markNode[adj + n] == global_mark ) {
					++(neighCount[adj + n]);
				}
				else { //adj is visited first time
					cell = color[ inv[adj + n] ];
					markNode[adj + n] = global_mark;
					neighCount[adj + n] = 1;
					if( markCell[cell] != global_mark ) { //cell is visited first time
						visitCell[visitCellInd] = cell;
						++visitCellInd;
						markCell[cell] = global_mark;
						visitNode[cell] = adj + n;
						numVisitNode[cell] = 1;
					}
					else {
						visitNode[cell + numVisitNode[cell]] = adj + n;
						++(numVisitNode[cell]);
					}
				}
			} //if-else ( u < n )
		} //for (i)
		++global_mark;

		//Step 2. find out cells to split & delete edges whose degree not 1
		sort(visitCell, visitCell+visitCellInd);
		splitInd = 0;
		splitCell[0] = numNode;
		for(j = 0; j < visitCellInd; ++j) {
			cell = visitCell[j]; //for each visited cell
			//TODO: I think we have always (numVisitNode[cell] > 0).
			if( numVisitNode[cell] > 0 && numVisitNode[cell] < cellSize[cell] ) {
				splitCell[splitInd] = cell;
				++splitInd;
			}
			else {
				cellEnd = cell + cellSize[cell];
				count = neighCount[ perm[cell] ];
				for(i = cell + 1; i < cellEnd; ++i) {
					if( neighCount[ perm[i] ] != count ) {
						splitCell[splitInd] = cell;
						++splitInd;
						break;
					}
				}
				if( i == cellEnd ) { //cell does not split
					u = perm[cell];
					du = (u < n) ? d1[u] : d2[u - n];
					if( du != 1 ) {
						for(k = cell; k < cellEnd; ++k) {
							v = perm[k]; //each vertex in this cell
							deleteEdge(v, neighCount[v], g1, g2);
							numDeleted += neighCount[v];
						}
						//if degree becomes 1 after deleting edges
						du = (u < n) ? d1[u] : d2[u - n];
						if( du == 1 ) {
							cellStack[stackSize] = cell;
							++stackSize;
						}
					} //if (du != 1)
				} //if (i == cellEnd)
			} //if-else (numVisitNode[cell] < cellSize[cell])
		} //for (j)

		//Step 3. split the cells in splitCell
		if( splitInd > 0 ) {
			for(sc = 0; sc < splitInd; ++sc) { //for each cell to split
				cell = splitCell[sc];
				cellEnd = cell + cellSize[cell];

				//Step 3-1. count #vertices of each new cell
				splitCountInd = 0;
				if( numVisitNode[cell] < cellSize[cell] ) {
					splitCount[splitCountInd] = 0;
					++splitCountInd;
					splitPos[0] = cellSize[cell] - numVisitNode[cell];
				}
				endIdx = cell + numVisitNode[cell];
				for(i = cell; i < endIdx; ++i) {
					count = neighCount[ visitNode[i] ];
					//Note that markCell marks 'count' in below.
					if( markCell[count] != global_mark ) {
						markCell[count] = global_mark;
						splitCount[splitCountInd] = count;
						++splitCountInd;
						splitPos[count] = 1;
					}
					else {
						++(splitPos[count]);
					}
				} //for (i)
				++global_mark;

				sort(splitCount, splitCount + splitCountInd);
				aColoring->numCell += (splitCountInd - 1);

				//Step 3-2. compute start position of each new cell
				i = cell;
				for(k = 0; k < splitCountInd; ++k) {
					size = splitPos[ splitCount[k] ];
					cellSize[i] = size;
					splitPos[ splitCount[k] ] = i;
					i += size;
				}

				//Step 3-3. move vertices to its appropriate new cells
				endIdx = cell + numVisitNode[cell];
				for(i = cell; i < endIdx; ++i) {
					u = visitNode[i];
					deleteEdge(u, neighCount[u], g1, g2);
					numDeleted += neighCount[u];
					j = splitPos[ neighCount[u] ]; //where u goes
					++(splitPos[ neighCount[u] ]);
					k = inv[u]; //where u was

					perm[k] = perm[j];
					perm[j] = u;
					inv[u] = j;
					inv[ perm[k] ] = k;
					neighCount[u] = 0;
				}

				//Step 3-4. recolor the vertices in new cells
				newCell = cellEnd - numVisitNode[cell];
				i = newCell;
				endIdx = newCell + cellSize[newCell] - 1;
				do {
					color[i] = newCell;
					if( i == endIdx ) {
						newCell = i + 1;
						if( newCell < numNode )
							endIdx = newCell + cellSize[newCell] - 1;
					}
				} while( ++i < cellEnd );

				//Step 3-5. push the new cells to the stack
				for(i = cell, k = 0; k < splitCountInd; i += cellSize[i], ++k) {
					if( k > 0 || splitCount[0] > 0 ) {
						u = perm[i];
						du = (u < n) ? d1[u] : d2[u - n];
						if( du == 1 ) {
							cellStack[stackSize] = i;
							++stackSize;
						}
					}
				}
			} //for (sc)
		} //if( splitInd > 0 )
	} //while (ind < stackSize)

	return numDeleted;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movslq 0xc(%rdx), %r9
testq %r9, %r9
jle 0xa0a4
movq %rdi, %rbp
movq 0x20(%rdx), %r10
movq 0x30(%rdx), %rax
movq %rax, 0xa0(%rsp)
movq 0x38(%rdx), %rax
movq %rax, 0xb0(%rsp)
movq 0x20(%rcx), %r11
movq 0x30(%rcx), %rax
movq %rax, 0x98(%rsp)
movq 0x38(%rcx), %rax
movq %rax, 0xa8(%rsp)
movl (%rsi), %eax
movl %eax, 0x24(%rsp)
movslq %eax, %r14
movq 0x10(%rsi), %r15
movq 0x18(%rsi), %r12
movq 0x20(%rsi), %rax
movq %rax, 0x10(%rsp)
movq 0x8(%rsi), %rax
movq %rax, 0x60(%rsp)
xorl %eax, %eax
cmpl $0x1, (%r10,%rax,4)
je 0x98ac
incq %rax
cmpq %rax, %r9
jne 0x9898
jmp 0xa0a4
movq %rsi, 0xc8(%rsp)
movq %rdx, 0x88(%rsp)
movl $0x0, 0x28(%rbp)
cmpl $0x0, 0x24(%rsp)
jle 0x990f
movq 0x20(%rbp), %rax
xorl %r8d, %r8d
movslq %r8d, %rdx
movslq (%r15,%rdx,4), %rsi
movl %esi, %edi
subl %r9d, %edi
cmpl %r9d, %esi
leaq (%r10,%rsi,4), %rsi
movslq %edi, %rdi
leaq (%r11,%rdi,4), %rdi
cmovlq %rsi, %rdi
cmpl $0x1, (%rdi)
jne 0x98ff
movslq 0x28(%rbp), %rsi
movl %r8d, (%rax,%rsi,4)
incl 0x28(%rbp)
movq 0x10(%rsp), %rsi
addl (%rsi,%rdx,4), %r8d
cmpl 0x24(%rsp), %r8d
jl 0x98d1
cmpl $0x0, 0x28(%rbp)
jle 0xa0a4
movq %rcx, 0x80(%rsp)
leaq (,%r9,4), %rax
movq %rax, 0x90(%rsp)
movq 0x10(%rsp), %rax
addq $0x4, %rax
movq %rax, 0xb8(%rsp)
xorl %ecx, %ecx
movq %r9, 0x50(%rsp)
xorl %r13d, %r13d
movq %rbp, 0x38(%rsp)
movq %r10, 0x30(%rsp)
movq %r11, 0x28(%rsp)
movq %r12, 0x78(%rsp)
movq %r14, 0xc0(%rsp)
movq %r15, 0x48(%rsp)
cmpl $0x77359401, 0x80(%rbp) # imm = 0x77359401
movq %rcx, 0x70(%rsp)
jl 0x99bb
movq 0x70(%rbp), %rdi
xorl %esi, %esi
movq 0x90(%rsp), %rbx
movq %rbx, %rdx
callq 0x20e0
movq 0x78(%rbp), %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x20e0
movq 0x70(%rsp), %rcx
movq 0x28(%rsp), %r11
movq 0x30(%rsp), %r10
movl $0x0, 0x80(%rbp)
incl 0x80(%rbp)
movq 0x20(%rbp), %rax
movslq (%rax,%rcx,4), %rax
movq 0x10(%rsp), %rcx
movl (%rcx,%rax,4), %ecx
testl %ecx, %ecx
movl %r13d, 0x8(%rsp)
jle 0x9b8a
addl %eax, %ecx
movslq %ecx, %rcx
xorl %ebx, %ebx
movslq (%r15,%rax,4), %rsi
movq 0x50(%rsp), %rdx
cmpl %edx, %esi
jge 0x9a3c
movq 0xb0(%rsp), %rdx
movq (%rdx,%rsi,8), %rdx
movl (%rdx), %edx
movslq %edx, %rdi
cmpl $0x1, (%r10,%rdi,4)
je 0x9a1f
movl $0xffffffff, (%r10,%rsi,4) # imm = 0xFFFFFFFF
movq 0xa0(%rsp), %r8
movb $0x1, (%r8,%rsi)
movq 0x78(%rbp), %r8
movl 0x80(%rbp), %r9d
cmpl %r9d, (%r8,%rdi,4)
jne 0x9a8d
movq 0x30(%rbp), %rdx
incl (%rdx,%rdi,4)
jmp 0x9b7c
subl %edx, %esi
movslq %esi, %rsi
movq 0xa8(%rsp), %rdx
movq (%rdx,%rsi,8), %rdx
movslq (%rdx), %rdx
cmpl $0x1, (%r11,%rdx,4)
je 0x9a6b
movl $0xffffffff, (%r11,%rsi,4) # imm = 0xFFFFFFFF
movq 0x98(%rsp), %rdi
movb $0x1, (%rdi,%rsi)
movq 0x78(%rbp), %rdi
addq 0x50(%rsp), %rdx
movl 0x80(%rbp), %r8d
cmpl %r8d, (%rdi,%rdx,4)
jne 0x9ad8
movq 0x30(%rbp), %rsi
incl (%rsi,%rdx,4)
jmp 0x9b7c
movslq (%r12,%rdi,4), %rsi
movq 0x60(%rsp), %r13
movl (%r13,%rsi,4), %esi
movslq %esi, %rsi
movl %r9d, (%r8,%rdi,4)
movq 0x30(%rbp), %r8
movl $0x1, (%r8,%rdi,4)
movq 0x70(%rbp), %rdi
movl (%rdi,%rsi,4), %r8d
cmpl 0x80(%rbp), %r8d
jne 0x9b21
movq 0x40(%rbp), %rdi
movq 0x48(%rbp), %r8
movslq (%r8,%rsi,4), %r9
addq %rsi, %r9
movl %edx, (%rdi,%r9,4)
incl (%r8,%rsi,4)
jmp 0x9b4b
movslq (%r12,%rdx,4), %rsi
movq 0x60(%rsp), %r9
movl (%r9,%rsi,4), %esi
movslq %esi, %rsi
movl %r8d, (%rdi,%rdx,4)
movq 0x30(%rbp), %rdi
movl $0x1, (%rdi,%rdx,4)
movq 0x70(%rbp), %rdi
movl (%rdi,%rsi,4), %r8d
cmpl 0x80(%rbp), %r8d
jne 0x9b52
movq 0x40(%rbp), %rdi
movq 0x48(%rbp), %r8
movslq (%r8,%rsi,4), %r9
addq %rsi, %r9
movl %edx, (%rdi,%r9,4)
incl (%r8,%rsi,4)
jmp 0x9b7c
movq 0x38(%rbp), %r8
movslq %ebx, %r9
movl %esi, (%r8,%r9,4)
incl %ebx
movl 0x80(%rbp), %r8d
movl %r8d, (%rdi,%rsi,4)
movq 0x40(%rbp), %rdi
movl %edx, (%rdi,%rsi,4)
movq 0x48(%rbp), %rdx
movl $0x1, (%rdx,%rsi,4)
movl 0x8(%rsp), %r13d
jmp 0x9b7c
movq 0x38(%rbp), %r8
movslq %ebx, %rbx
movl %esi, (%r8,%rbx,4)
incl %ebx
movl 0x80(%rbp), %r8d
movl %r8d, (%rdi,%rsi,4)
movq 0x40(%rbp), %rdi
movl %edx, (%rdi,%rsi,4)
movq 0x48(%rbp), %rdx
movl $0x1, (%rdx,%rsi,4)
incq %rax
cmpq %rcx, %rax
jl 0x99e5
jmp 0x9b8c
xorl %ebx, %ebx
incl 0x80(%rbp)
testl %ebx, %ebx
je 0x9bda
movslq %ebx, %rax
movq 0x38(%rbp), %r13
leaq (,%rax,4), %r12
addq %r13, %r12
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r13, %rdi
movq %r12, %rsi
callq 0x8a95
movq %r13, %rdi
movl 0x8(%rsp), %r13d
movq %r12, %rsi
callq 0x8b70
movq 0x28(%rsp), %r11
movq 0x30(%rsp), %r10
movq 0x50(%rbp), %rax
movl 0x24(%rsp), %ecx
movl %ecx, (%rax)
testl %ebx, %ebx
movq 0x10(%rsp), %r12
jle 0x9d53
movl %ebx, %eax
movq %rax, 0x40(%rsp)
xorl %edx, %edx
xorl %r15d, %r15d
movq 0x38(%rbp), %rax
movq 0x48(%rbp), %rcx
movl (%rax,%rdx,4), %esi
movslq %esi, %rbx
movl (%rcx,%rbx,4), %eax
testl %eax, %eax
jle 0x9c2a
cmpl (%r12,%rbx,4), %eax
jge 0x9c2a
movq 0x50(%rbp), %rax
movslq %r15d, %rcx
movl %esi, (%rax,%rcx,4)
incl %r15d
jmp 0x9d43
movq %rdx, 0x18(%rsp)
movl (%r12,%rbx,4), %eax
movq %rsi, 0x58(%rsp)
leal (%rax,%rsi), %edx
movq 0x30(%rbp), %rsi
movq 0x48(%rsp), %rcx
leaq (%rcx,%rbx,4), %rcx
movslq (%rcx), %rdi
movl (%rsi,%rdi,4), %edi
movslq %edx, %r14
movl $0x1, %r8d
movq %r8, %rdx
addq %rbx, %r8
cmpq %r14, %r8
jge 0x9c83
movslq (%rcx,%rdx,4), %r9
leaq 0x1(%rdx), %r8
cmpl %edi, (%rsi,%r9,4)
je 0x9c57
movq 0x50(%rbp), %rsi
movslq %r15d, %r15
movq 0x58(%rsp), %rdi
movl %edi, (%rsi,%r15,4)
incl %r15d
cmpl %edx, %eax
jne 0x9d3e
movslq (%rcx), %rcx
leaq (%r10,%rcx,4), %rdx
subl 0x50(%rsp), %ecx
movslq %ecx, %rcx
leaq (%r11,%rcx,4), %rcx
cmovlq %rdx, %rcx
cmpl $0x1, (%rcx)
je 0x9d3e
movq %rcx, 0x68(%rsp)
movq %r15, 0x8(%rsp)
testl %eax, %eax
jle 0x9d01
movq 0x38(%rsp), %r12
movq 0x80(%rsp), %r15
movl %r13d, %ebp
movq 0x48(%rsp), %rax
movslq (%rax,%rbx,4), %r13
movq 0x30(%r12), %rax
movl (%rax,%r13,4), %edx
movl %r13d, %esi
movq 0x88(%rsp), %rcx
movq %r15, %r8
callq 0xad1e
movq 0x30(%r12), %rax
addl (%rax,%r13,4), %ebp
movl %ebp, %r13d
incq %rbx
cmpq %r14, %rbx
jl 0x9cc5
movq 0x68(%rsp), %rax
cmpl $0x1, (%rax)
jne 0x9d25
movq 0x38(%rsp), %rbp
movq 0x20(%rbp), %rax
movslq 0x28(%rbp), %rcx
movq 0x58(%rsp), %rdx
movl %edx, (%rax,%rcx,4)
incl 0x28(%rbp)
jmp 0x9d2a
movq 0x38(%rsp), %rbp
movq 0x30(%rsp), %r10
movq 0x28(%rsp), %r11
movq 0x10(%rsp), %r12
movq 0x8(%rsp), %r15
movq 0x18(%rsp), %rdx
incq %rdx
cmpq 0x40(%rsp), %rdx
jne 0x9bfd
jmp 0x9d56
xorl %r15d, %r15d
movl %r13d, 0x8(%rsp)
testl %r15d, %r15d
jle 0xa07e
movl %r15d, %eax
movq %rax, 0xd0(%rsp)
xorl %edx, %edx
movq 0x48(%rbp), %rax
movq 0x50(%rbp), %rcx
movq %rdx, 0x68(%rsp)
movl (%rcx,%rdx,4), %esi
movslq %esi, %r13
movl (%r12,%r13,4), %ecx
xorl %r14d, %r14d
movq %rcx, 0xe0(%rsp)
cmpl %ecx, (%rax,%r13,4)
jge 0x9db7
movq 0x58(%rbp), %rcx
movl $0x0, (%rcx)
movl (%r12,%r13,4), %ecx
subl (%rax,%r13,4), %ecx
movq 0x60(%rbp), %rdx
movl %ecx, (%rdx)
movl $0x1, %r14d
movl (%rax,%r13,4), %r8d
testl %r8d, %r8d
movl %esi, 0x40(%rsp)
jle 0x9e1d
addl %esi, %r8d
movq 0x30(%rbp), %rax
movq 0x40(%rbp), %rcx
movq 0x70(%rbp), %rdx
movq 0x58(%rbp), %rsi
movq 0x60(%rbp), %rdi
movslq %r8d, %r8
movq %r13, %r9
movslq (%rcx,%r9,4), %r10
movl (%rax,%r10,4), %r10d
movslq %r10d, %r10
movl 0x80(%rbp), %r11d
cmpl %r11d, (%rdx,%r10,4)
jne 0x9dff
incl (%rdi,%r10,4)
jmp 0x9e15
movl %r11d, (%rdx,%r10,4)
movslq %r14d, %r14
movl %r10d, (%rsi,%r14,4)
incl %r14d
movl $0x1, (%rdi,%r10,4)
incq %r9
cmpq %r8, %r9
jl 0x9de1
incl 0x80(%rbp)
testl %r14d, %r14d
je 0x9e56
movslq %r14d, %rax
movq 0x58(%rbp), %r15
leaq (%r15,%rax,4), %rbx
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x8a95
movq %r15, %rdi
movq %rbx, %rsi
callq 0x8b70
movq 0xc8(%rsp), %rcx
movl 0x4(%rcx), %eax
addl %r14d, %eax
decl %eax
movl %eax, 0x4(%rcx)
testl %r14d, %r14d
jle 0x9ea4
movq 0x58(%rbp), %rax
movq 0x60(%rbp), %rcx
movl %r14d, %edx
xorl %esi, %esi
movl 0x40(%rsp), %edi
movslq (%rax,%rsi,4), %r8
movslq %edi, %rdi
movl (%rcx,%r8,4), %r8d
movl %r8d, (%r12,%rdi,4)
movslq (%rax,%rsi,4), %r9
movl %edi, (%rcx,%r9,4)
addl %edi, %r8d
incq %rsi
movl %r8d, %edi
cmpq %rsi, %rdx
jne 0x9e7f
movq %r14, 0x18(%rsp)
movq 0x48(%rbp), %rax
movl (%rax,%r13,4), %eax
testl %eax, %eax
movq %r13, 0xd8(%rsp)
jle 0x9f53
addl 0x40(%rsp), %eax
cltq
movq %rax, 0x58(%rsp)
movq %r13, %rbp
movq 0x38(%rsp), %r14
movq 0x48(%rsp), %r12
movq 0x78(%rsp), %rbx
movl 0x8(%rsp), %r13d
movq 0x30(%r14), %rax
movq 0x40(%r14), %rcx
movslq (%rcx,%rbp,4), %r15
movl (%rax,%r15,4), %edx
movl %r15d, %esi
movq 0x88(%rsp), %rcx
movq 0x80(%rsp), %r8
callq 0xad1e
movq 0x30(%r14), %rax
movq 0x60(%r14), %rcx
movslq (%rax,%r15,4), %rdx
addl %edx, %r13d
movslq (%rcx,%rdx,4), %rsi
leal 0x1(%rsi), %edi
movl %edi, (%rcx,%rdx,4)
movslq (%rbx,%r15,4), %rcx
movl (%r12,%rsi,4), %edx
movl %edx, (%r12,%rcx,4)
movl %r15d, (%r12,%rsi,4)
movl %esi, (%rbx,%r15,4)
movslq (%r12,%rcx,4), %rdx
movl %ecx, (%rbx,%rdx,4)
movl $0x0, (%rax,%r15,4)
incq %rbp
cmpq 0x58(%rsp), %rbp
jl 0x9ee3
jmp 0x9f62
movq 0x38(%rsp), %r14
movq 0x48(%rsp), %r12
movl 0x8(%rsp), %r13d
movl %r13d, 0x8(%rsp)
movq 0xe0(%rsp), %r10
movq 0xd8(%rsp), %rcx
addl %ecx, %r10d
movq 0x48(%r14), %rax
movslq (%rax,%rcx,4), %rdi
movslq %r10d, %rax
subl %edi, %r10d
movslq %r10d, %rcx
movq 0x10(%rsp), %rdx
movl (%rdx,%rcx,4), %edx
leal (%rdx,%rcx), %esi
decl %esi
leaq (,%rax,4), %rdx
shlq $0x2, %rdi
subq %rdi, %rdx
movq 0xb8(%rsp), %rdi
addq %rdx, %rdi
addq 0x60(%rsp), %rdx
xorl %r8d, %r8d
movl %r10d, %r9d
movq %r14, %rbp
movq 0x50(%rsp), %r13
movq 0xc0(%rsp), %r14
movq %r12, %r15
movq %r10, %r12
movl %r9d, (%rdx,%r8,4)
leal (%r12,%r8), %r11d
leaq (%rcx,%r8), %r10
incq %r10
cmpl %esi, %r11d
jne 0x9ffb
leaq (%r12,%r8), %r9
incq %r9
cmpq %r14, %r10
jge 0x9ffb
leal (%r12,%r8), %esi
addl (%rdi,%r8,4), %esi
incq %r8
cmpq %rax, %r10
jl 0x9fd3
cmpl $0x0, 0x18(%rsp)
movq 0x30(%rsp), %r10
movq 0x28(%rsp), %r11
movq 0x10(%rsp), %r12
movl 0x40(%rsp), %r9d
jle 0xa066
movq 0x20(%rbp), %rax
movq 0x58(%rbp), %rcx
xorl %edx, %edx
movslq %r9d, %rsi
testl %edx, %edx
jne 0xa034
cmpl $0x0, (%rcx)
jle 0xa05a
movslq (%r15,%rsi,4), %rdi
leaq (%r10,%rdi,4), %r8
subl %r13d, %edi
movslq %edi, %rdi
leaq (%r11,%rdi,4), %rdi
cmovlq %r8, %rdi
cmpl $0x1, (%rdi)
jne 0xa05a
movslq 0x28(%rbp), %rdi
movl %r9d, (%rax,%rdi,4)
incl 0x28(%rbp)
addl (%r12,%rsi,4), %r9d
incl %edx
cmpl %edx, 0x18(%rsp)
jne 0xa028
movq 0x68(%rsp), %rdx
incq %rdx
cmpq 0xd0(%rsp), %rdx
jne 0x9d71
jmp 0xa083
movq 0x48(%rsp), %r15
movq 0x70(%rsp), %rcx
incq %rcx
movslq 0x28(%rbp), %rax
cmpq %rax, %rcx
movq 0x78(%rsp), %r12
movl 0x8(%rsp), %r13d
jl 0x996d
jmp 0xa0a7
xorl %r13d, %r13d
movl %r13d, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq