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

	int32_t numMatching = 0;
	int32_t i, j, u, v, child;
	int32_t numNode = coloring->numNode;
	int32_t* perm = coloring->perm;
	int32_t* cellSize = coloring->cellSize;
	int32_t* adjPos1 = g1->adjPos;
	char* one1 = g1->one;

	int32_t* childSize = dag->childSize;
	int32_t* parentSize = dag->parentSize;
	int32_t* dagArr = dag->dagArr;

	memset(mapping, -1, sizeof(int32_t) * n2);
	memset(numMappedParent, 0, sizeof(int32_t) * n);
	//for each cell
	for(i = 0; i < numNode; i += cellSize[i]) {
		if( cellSize[i] != 2 ) 
			continue;

		//for each binary cell
		if( perm[i] < n ) {
			u = perm[i];
			v = perm[i + 1];
		}
		else {
			u = perm[i + 1];
			v = perm[i];
		}

		if( one1[u] == 1 ) //coreness-1 vertex
			continue;

		mapping[u] = v;
		mapping[v] = u;
		++numMatching;

		//DAG-ordering
		for(j = 0; j < childSize[u]; ++j) {
			child = dagArr[ adjPos1[u] + parentSize[u] + j ];
			++(numMappedParent[child]);
		}
	} //for(i)

	//build heap for extendable vertices
	heap->size = 0;
	for(u = 0; u < n; ++u) {
		//for each extendable vertex
		if( one1[u] == 0 && mapping[u] == -1 && numMappedParent[u] == parentSize[u] ) {
			weight[u] = computeWeight(u);
			if( weight[u] == 0 ) //isomorphism does not exist
				return -1;

			++(heap->size); //note that heap[0] have to be empty.
			heap->heap[heap->size] = u;
			heap->locate[u] = heap->size;
		}
	}
	heap->buildMinHeap(weight);

	return numMatching;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq 0x10(%rdi), %rax
movq 0x20(%rdi), %rcx
movl (%rcx), %edx
movl %edx, 0xc(%rsp)
movq 0x10(%rcx), %rdx
movq %rdx, 0x20(%rsp)
movq 0x20(%rcx), %rbp
movq 0x30(%rax), %rcx
movq %rcx, 0x10(%rsp)
movq 0x40(%rax), %r15
movq 0x40(%rdi), %rax
movq 0x10(%rax), %r13
movq 0x18(%rax), %r12
movq 0x20(%rax), %r14
movq 0x50(%rdi), %rdi
movslq 0x34(%rbx), %rdx
shlq $0x2, %rdx
movl $0xff, %esi
callq 0x20e0
movq 0x78(%rbx), %rdi
movslq 0x2c(%rbx), %rdx
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x20e0
xorl %r11d, %r11d
movq 0x10(%rsp), %r10
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
jle 0x6df1
movl %ecx, %eax
movq 0x50(%rbx), %rcx
movq %rcx, 0x18(%rsp)
movq 0x78(%rbx), %rcx
xorl %r11d, %r11d
xorl %esi, %esi
movslq %esi, %rdx
cmpl $0x2, (%rbp,%rdx,4)
jne 0x6de7
movq 0x20(%rsp), %rsi
movl (%rsi,%rdx,4), %r8d
movl 0x4(%rsi,%rdx,4), %edi
movl 0x2c(%rbx), %r9d
cmpl %r9d, %r8d
movl %edi, %esi
cmovll %r8d, %esi
movslq %esi, %rsi
cmpb $0x1, (%r10,%rsi)
je 0x6de7
cmpl %r9d, %r8d
cmovgel %r8d, %edi
movq 0x18(%rsp), %r8
movl %edi, (%r8,%rsi,4)
movslq %edi, %rdi
movl %esi, (%r8,%rdi,4)
incl %r11d
cmpl $0x0, (%r13,%rsi,4)
jle 0x6de7
xorl %edi, %edi
movl (%r15,%rsi,4), %r8d
addl (%r12,%rsi,4), %r8d
addl %edi, %r8d
movslq %r8d, %r8
movslq (%r14,%r8,4), %r8
incl (%rcx,%r8,4)
incl %edi
cmpl (%r13,%rsi,4), %edi
jl 0x6dc8
movl (%rbp,%rdx,4), %esi
addl %edx, %esi
cmpl %eax, %esi
jl 0x6d76
movq 0x68(%rbx), %rax
movl $0x0, 0x10(%rax)
cmpl $0x0, 0x2c(%rbx)
movl %r11d, %ebp
jle 0x6e73
xorl %r14d, %r14d
cmpb $0x0, (%r10,%r14)
jne 0x6e67
movq 0x50(%rbx), %rax
cmpl $-0x1, (%rax,%r14,4)
jne 0x6e67
movq 0x78(%rbx), %rax
movl (%rax,%r14,4), %eax
cmpl (%r12,%r14,4), %eax
jne 0x6e67
movq %r10, %r15
movq %rbx, %rdi
movl %r14d, %esi
callq 0x78b8
movq 0x70(%rbx), %rcx
movl %eax, (%rcx,%r14,4)
testl %eax, %eax
je 0x6e91
movq 0x68(%rbx), %rax
movslq 0x10(%rax), %rcx
leaq 0x1(%rcx), %rdx
movl %edx, 0x10(%rax)
movq (%rax), %rdx
movl %r14d, 0x4(%rdx,%rcx,4)
movl 0x10(%rax), %ecx
movq 0x8(%rax), %rax
movl %ecx, (%rax,%r14,4)
movq %r15, %r10
incq %r14
movslq 0x2c(%rbx), %rax
cmpq %rax, %r14
jl 0x6e08
movq 0x68(%rbx), %rdi
movq 0x70(%rbx), %rsi
callq 0x9226
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x6e82