// File: /workspace/github_cpp_makefile_star2_O2/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 $0xc8, %rsp
movq %rdi, %r12
movslq 0xc(%rdx), %r14
movq 0x20(%rdx), %r10
movq 0x30(%rdx), %rax
movq %rax, 0x90(%rsp)
movq %rdx, 0x70(%rsp)
movq 0x38(%rdx), %rax
movq %rax, 0xa0(%rsp)
movq 0x20(%rcx), %rax
movq %rax, 0x40(%rsp)
movq 0x30(%rcx), %rax
movq %rax, 0x88(%rsp)
movq %rcx, 0x78(%rsp)
movq 0x38(%rcx), %rax
movq %rax, 0x98(%rsp)
movl (%rsi), %eax
movl %eax, 0x54(%rsp)
cltq
movq %rax, 0xc0(%rsp)
testl %r14d, %r14d
movl $0x0, %eax
cmovgl %r14d, %eax
movq 0x10(%rsi), %rcx
movq %rcx, 0x18(%rsp)
movq 0x18(%rsi), %rcx
movq %rcx, 0x68(%rsp)
movq 0x20(%rsi), %rbx
movq %rsi, 0xb0(%rsp)
movq 0x8(%rsi), %rcx
movq %rcx, 0x58(%rsp)
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x87f2
cmpl $0x1, (%r10,%rcx,4)
leaq 0x1(%rcx), %rcx
jne 0x8788
andl $0x0, 0x28(%r12)
movq 0x20(%r12), %rcx
xorl %eax, %eax
xorl %edx, %edx
movq 0x40(%rsp), %r9
cmpl 0x54(%rsp), %edx
jge 0x87f9
movslq %edx, %rsi
movq 0x18(%rsp), %rdi
movslq (%rdi,%rsi,4), %rdi
movl %edi, %r8d
subl %r14d, %r8d
cmpl %r14d, %edi
leaq (%r10,%rdi,4), %rdi
movslq %r8d, %r8
leaq (%r9,%r8,4), %r8
cmovlq %rdi, %r8
cmpl $0x1, (%r8)
jne 0x87ed
cltq
movl %edx, (%rcx,%rax,4)
movl 0x28(%r12), %eax
incl %eax
movl %eax, 0x28(%r12)
addl (%rbx,%rsi,4), %edx
jmp 0x87ac
xorl %eax, %eax
jmp 0x8ef0
leaq (,%r14,4), %rcx
movq %rcx, 0x80(%rsp)
leaq 0x4(%rbx), %rcx
movq %rcx, 0xa8(%rsp)
xorl %r15d, %r15d
movq $0x0, 0x48(%rsp)
movq %r14, 0x28(%rsp)
movq %r10, 0x10(%rsp)
movq %rbx, 0x38(%rsp)
cltq
cmpq %rax, %r15
jge 0x8eeb
movl 0x80(%r12), %ebx
cmpl $0x77359401, %ebx       # imm = 0x77359401
movq %r15, 0x20(%rsp)
jl 0x8882
movq 0x70(%r12), %rdi
xorl %ebx, %ebx
xorl %esi, %esi
movq 0x80(%rsp), %r15
movq %r15, %rdx
callq 0x2100
movq 0x78(%r12), %rdi
xorl %esi, %esi
movq %r15, %rdx
movq 0x20(%rsp), %r15
callq 0x2100
movq 0x10(%rsp), %r10
incl %ebx
movl %ebx, 0x80(%r12)
movq 0x20(%r12), %rax
movslq (%rax,%r15,4), %rax
movq 0x38(%rsp), %rbx
movslq (%rbx,%rax,4), %rcx
addq %rax, %rcx
xorl %edx, %edx
movslq %edx, %r13
cmpq %rcx, %rax
jge 0x8a80
movq 0x18(%rsp), %rsi
movslq (%rsi,%rax,4), %rdi
cmpl %r14d, %edi
jge 0x8908
movq 0xa0(%rsp), %rsi
movq (%rsi,%rdi,8), %rsi
movl (%rsi), %esi
movslq %esi, %r8
cmpl $0x1, (%r10,%r8,4)
je 0x88e7
orl $-0x1, (%r10,%rdi,4)
movq 0x90(%rsp), %r9
movb $0x1, (%r9,%rdi)
movq 0x78(%r12), %r9
movl 0x80(%r12), %r10d
cmpl %r10d, (%r9,%r8,4)
jne 0x8963
movq 0x30(%r12), %rsi
incl (%rsi,%r8,4)
jmp 0x8a42
subl %r14d, %edi
movslq %edi, %rdi
movq 0x98(%rsp), %rsi
movq (%rsi,%rdi,8), %rsi
movslq (%rsi), %rsi
movq 0x40(%rsp), %r8
cmpl $0x1, (%r8,%rsi,4)
je 0x8940
movq 0x40(%rsp), %r8
orl $-0x1, (%r8,%rdi,4)
movq 0x88(%rsp), %r8
movb $0x1, (%r8,%rdi)
movq 0x78(%r12), %r8
addq %r14, %rsi
movl 0x80(%r12), %r9d
cmpl %r9d, (%r8,%rsi,4)
jne 0x89ba
movq 0x30(%r12), %rdi
incl (%rdi,%rsi,4)
jmp 0x8a47
movq 0x68(%rsp), %rdi
movslq (%rdi,%r8,4), %rdi
movq 0x58(%rsp), %r11
movl (%r11,%rdi,4), %edi
movslq %edi, %rdi
movl %r10d, (%r9,%r8,4)
movq 0x30(%r12), %r9
movl $0x1, (%r9,%r8,4)
movq 0x70(%r12), %r8
movl (%r8,%rdi,4), %r9d
cmpl 0x80(%r12), %r9d
jne 0x8a13
movq 0x40(%r12), %r8
movq 0x48(%r12), %r9
movslq (%r9,%rdi,4), %r10
addq %rdi, %r10
movl %esi, (%r8,%r10,4)
incl (%r9,%rdi,4)
jmp 0x8a42
movq 0x68(%rsp), %rdi
movslq (%rdi,%rsi,4), %rdi
movq 0x58(%rsp), %r11
movl (%r11,%rdi,4), %edi
movslq %edi, %rdi
movl %r9d, (%r8,%rsi,4)
movq 0x30(%r12), %r8
movl $0x1, (%r8,%rsi,4)
movq 0x70(%r12), %r8
movl (%r8,%rdi,4), %r9d
cmpl 0x80(%r12), %r9d
jne 0x8a4f
movq 0x40(%r12), %r8
movq 0x48(%r12), %r9
movslq (%r9,%rdi,4), %r10
addq %rdi, %r10
movl %esi, (%r8,%r10,4)
movq 0x10(%rsp), %r10
incl (%r9,%rdi,4)
jmp 0x8a47
movq 0x38(%r12), %rdx
movl %edi, (%rdx,%r13,4)
incl %r13d
movl 0x80(%r12), %edx
movl %edx, (%r8,%rdi,4)
movq 0x40(%r12), %rdx
movl %esi, (%rdx,%rdi,4)
movq 0x48(%r12), %rdx
movl $0x1, (%rdx,%rdi,4)
movl %r13d, %edx
movq 0x10(%rsp), %r10
incq %rax
jmp 0x88a3
movq 0x38(%r12), %rdx
movl %edi, (%rdx,%r13,4)
incl %r13d
movl 0x80(%r12), %edx
movl %edx, (%r8,%rdi,4)
movq 0x40(%r12), %rdx
movl %esi, (%rdx,%rdi,4)
movq 0x48(%r12), %rdx
movl $0x1, (%rdx,%rdi,4)
movl %r13d, %edx
jmp 0x8a47
incl 0x80(%r12)
movq 0x38(%r12), %rdi
leaq (%rdi,%r13,4), %rsi
callq 0x7839
movq 0x10(%rsp), %r10
movq 0x50(%r12), %rax
movl 0x54(%rsp), %ecx
movl %ecx, (%rax)
xorl %eax, %eax
testl %r13d, %r13d
cmovlel %eax, %r13d
movl $0x0, 0x30(%rsp)
movq %r13, 0x60(%rsp)
cmpq %r13, %rax
je 0x8c15
movq %rax, %rdx
movq 0x38(%r12), %rax
movq 0x48(%r12), %rcx
movq %rdx, 0x8(%rsp)
movl (%rax,%rdx,4), %r13d
movslq %r13d, %r15
movl (%rcx,%r15,4), %eax
testl %eax, %eax
setg %dl
movl (%rbx,%r15,4), %ecx
cmpl %ecx, %eax
setl %sil
andb %dl, %sil
movslq 0x30(%rsp), %rax
cmpb $0x1, %sil
jne 0x8b13
movq 0x50(%r12), %rcx
movl %r13d, (%rcx,%rax,4)
incl %eax
movl %eax, 0x30(%rsp)
jmp 0x8bfe
leal (%rcx,%r13), %edx
movq 0x30(%r12), %rsi
movq 0x18(%rsp), %rdi
movslq (%rdi,%r15,4), %rdi
movl (%rsi,%rdi,4), %edi
movslq %edx, %r14
decl %ecx
leaq 0x1(%r15), %r8
movl %ecx, %edx
cmpq %r14, %r8
jge 0x8b5c
movq 0x18(%rsp), %rcx
movslq (%rcx,%r8,4), %r9
leal -0x1(%rdx), %ecx
incq %r8
cmpl %edi, (%rsi,%r9,4)
je 0x8b31
movq 0x50(%r12), %rcx
movl %r13d, (%rcx,%rax,4)
incl %eax
movl %eax, 0x30(%rsp)
testl %edx, %edx
movq 0x8(%rsp), %rax
je 0x8b74
movq 0x28(%rsp), %r14
movq 0x20(%rsp), %r15
jmp 0x8c08
movq 0x18(%rsp), %rax
movslq (%rax,%r15,4), %rax
leaq (%r10,%rax,4), %rcx
subl 0x28(%rsp), %eax
cltq
movq 0x40(%rsp), %rdx
leaq (%rdx,%rax,4), %rbx
cmovlq %rcx, %rbx
cmpl $0x1, (%rbx)
je 0x8bf4
cmpq %r14, %r15
jge 0x8bdc
movq 0x18(%rsp), %rax
movslq (%rax,%r15,4), %rbp
movq 0x30(%r12), %rax
movl (%rax,%rbp,4), %edx
movl %ebp, %esi
movq 0x70(%rsp), %rcx
movq 0x78(%rsp), %r8
callq 0x9a18
movq 0x10(%rsp), %r10
movq 0x30(%r12), %rax
movq 0x48(%rsp), %rcx
addl (%rax,%rbp,4), %ecx
movq %rcx, 0x48(%rsp)
incq %r15
jmp 0x8b99
cmpl $0x1, (%rbx)
jne 0x8bf4
movq 0x20(%r12), %rax
movslq 0x28(%r12), %rcx
movl %r13d, (%rax,%rcx,4)
incl 0x28(%r12)
movq 0x28(%rsp), %r14
movq 0x38(%rsp), %rbx
movq 0x20(%rsp), %r15
movq 0x8(%rsp), %rax
incq %rax
movq 0x60(%rsp), %r13
jmp 0x8abc
movl 0x30(%rsp), %eax
testl %eax, %eax
jle 0x8ede
movl %eax, %eax
movq %rax, 0xb8(%rsp)
xorl %edx, %edx
cmpq 0xb8(%rsp), %rdx
je 0x8ed9
movq 0x48(%r12), %rcx
movq 0x50(%r12), %rax
movl (%rax,%rdx,4), %r15d
movslq %r15d, %r10
movl (%rbx,%r10,4), %r14d
movl (%rcx,%r10,4), %r9d
xorl %eax, %eax
movq 0x58(%r12), %rdi
cmpl %r14d, %r9d
movq %rdx, 0x30(%rsp)
jge 0x8c83
andl $0x0, (%rdi)
movl (%rbx,%r10,4), %eax
subl (%rcx,%r10,4), %eax
movq 0x60(%r12), %rdx
movl %eax, (%rdx)
movl (%rcx,%r10,4), %r9d
movq 0x58(%r12), %rdi
pushq $0x1
popq %rax
addl %r15d, %r14d
addl %r15d, %r9d
movq 0x30(%r12), %rcx
movq 0x40(%r12), %rdx
movq 0x70(%r12), %rsi
movq 0x60(%r12), %r8
movslq %r9d, %r9
movq %r10, 0x8(%rsp)
movslq %eax, %r13
cmpq %r9, %r10
jge 0x8cec
movslq (%rdx,%r10,4), %r11
movl (%rcx,%r11,4), %r11d
movslq %r11d, %r11
movl 0x80(%r12), %ebx
cmpl %ebx, (%rsi,%r11,4)
jne 0x8ccc
incl (%r8,%r11,4)
jmp 0x8ce2
movl %ebx, (%rsi,%r11,4)
movl %r11d, (%rdi,%r13,4)
incl %r13d
movl $0x1, (%r8,%r11,4)
movl %r13d, %eax
incq %r10
movq 0x38(%rsp), %rbx
jmp 0x8ca5
incl 0x80(%r12)
leaq (%rdi,%r13,4), %rsi
callq 0x7839
movq 0xb0(%rsp), %rcx
movl 0x4(%rcx), %eax
addl %r13d, %eax
decl %eax
movl %eax, 0x4(%rcx)
movq 0x58(%r12), %rax
movq 0x60(%r12), %rcx
testl %r13d, %r13d
movl $0x0, %edx
cmovlel %edx, %r13d
xorl %edx, %edx
movl %r15d, %esi
cmpq %rdx, %r13
je 0x8d4e
movslq (%rax,%rdx,4), %rdi
movslq %esi, %rsi
movl (%rcx,%rdi,4), %edi
movl %edi, (%rbx,%rsi,4)
movslq (%rax,%rdx,4), %r8
movl %esi, (%rcx,%r8,4)
addl %esi, %edi
incq %rdx
movl %edi, %esi
jmp 0x8d2b
movq %r14, 0x60(%rsp)
movq 0x48(%r12), %rax
movq 0x8(%rsp), %r14
movslq (%rax,%r14,4), %rbx
addq %r14, %rbx
cmpq %rbx, %r14
jge 0x8ddb
movq 0x30(%r12), %rax
movq 0x40(%r12), %rcx
movslq (%rcx,%r14,4), %rbp
movl (%rax,%rbp,4), %edx
movl %ebp, %esi
movq 0x70(%rsp), %rcx
movq 0x78(%rsp), %r8
callq 0x9a18
movq 0x30(%r12), %rax
movq 0x60(%r12), %rcx
movslq (%rax,%rbp,4), %rdx
movq 0x48(%rsp), %rsi
addl %edx, %esi
movq %rsi, 0x48(%rsp)
movslq (%rcx,%rdx,4), %rsi
leal 0x1(%rsi), %edi
movl %edi, (%rcx,%rdx,4)
movq 0x68(%rsp), %r8
movslq (%r8,%rbp,4), %rcx
movq 0x18(%rsp), %rdi
movl (%rdi,%rsi,4), %edx
movl %edx, (%rdi,%rcx,4)
movl %ebp, (%rdi,%rsi,4)
movl %esi, (%r8,%rbp,4)
movslq (%rdi,%rcx,4), %rdx
movl %ecx, (%r8,%rdx,4)
andl $0x0, (%rax,%rbp,4)
incq %r14
jmp 0x8d64
movq 0x48(%r12), %rax
movq 0x8(%rsp), %rcx
movslq (%rax,%rcx,4), %rdi
movq 0x60(%rsp), %r9
movslq %r9d, %rax
subl %edi, %r9d
movslq %r9d, %rcx
movq 0x38(%rsp), %rbx
movl (%rbx,%rcx,4), %edx
addl %ecx, %edx
decl %edx
leaq (,%rax,4), %rsi
shlq $0x2, %rdi
subq %rdi, %rsi
movq 0xa8(%rsp), %rdi
addq %rsi, %rdi
movq %rdi, 0x8(%rsp)
addq 0x58(%rsp), %rsi
xorl %r8d, %r8d
movq %r9, %rdi
movq 0x28(%rsp), %r14
movl %r9d, (%rsi,%r8,4)
leal (%rdi,%r8), %r11d
leaq (%rcx,%r8), %r10
incq %r10
cmpl %edx, %r11d
jne 0x8e60
leaq (%rdi,%r8), %r9
incq %r9
cmpq 0xc0(%rsp), %r10
jge 0x8e60
movq 0x8(%rsp), %r11
addl (%r11,%r8,4), %edx
incq %r8
cmpq %rax, %r10
jl 0x8e32
movq 0x20(%r12), %rax
movq 0x58(%r12), %rcx
xorl %edx, %edx
movq 0x10(%rsp), %r10
cmpl %edx, %r13d
je 0x8ecc
movslq %r15d, %rsi
testl %edx, %edx
jne 0x8e8a
cmpl $0x0, (%rcx)
jle 0x8ec4
movq 0x18(%rsp), %rdi
movslq (%rdi,%rsi,4), %rdi
movl %edi, %r8d
subl %r14d, %r8d
cmpl %r14d, %edi
leaq (%r10,%rdi,4), %rdi
movslq %r8d, %r8
movq 0x40(%rsp), %r9
leaq (%r9,%r8,4), %r8
cmovlq %rdi, %r8
cmpl $0x1, (%r8)
jne 0x8ec4
movslq 0x28(%r12), %rdi
movl %r15d, (%rax,%rdi,4)
incl 0x28(%r12)
addl (%rbx,%rsi,4), %r15d
incl %edx
jmp 0x8e79
movq 0x30(%rsp), %rdx
incq %rdx
jmp 0x8c2d
movq 0x20(%rsp), %r15
incq %r15
movl 0x28(%r12), %eax
jmp 0x8830
movq 0x48(%rsp), %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq