// File: /workspace/github_cpp_makefile_star2_O2/datourat[P]IP-label-for-graph-reachability/Graph.cpp
// Function: Graph::reverseLayerSeparation()
void Graph::reverseLayerSeparation(){


	int i;
	int u,v;
	vector<int> degreezero;
	vector<int> degreezeroNext;
	vector<int> outdegreeRecord(vsize, 0);
	uint16_t layer=1;
	int vectorsize, tmpsize;

	for(i=0; i<vsize; i++){
		outdegreeRecord[i]=vl[i].outdegree;
		if(outdegreeRecord[i]==0){
			degreezero.push_back(i);
			vl[i].layer=layer;
		}
	}

	while(vectorsize=degreezero.size()){
//		output << layer << ":\t" << degreezero.size() << endl;

//		output << layer << "(" << degreezero.size() << ")\t:";

		layer++;
		for(i=0; i<vectorsize; i++){
			u=degreezero[i];
			tmpsize=graph[u].inList.size();
//			output << u << " ";
			for(int j=0;j<tmpsize;j++){
				v=graph[u].inList[j];
				outdegreeRecord[v]--;
				if(outdegreeRecord[v]==0){
					degreezeroNext.push_back(v);
					vl[v].layer=layer;
				}
			}
		}
//		output << endl;
		degreezero=degreezeroNext;
		degreezeroNext.clear();
	}
	
//	output.close();
//	output.close();

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
andq $0x0, 0x40(%rsp)
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
movslq 0xc(%rdi), %rsi
leaq 0x5c(%rsp), %rdx
andl $0x0, (%rdx)
leaq 0x60(%rsp), %rdi
leaq 0xf(%rsp), %rcx
callq 0x9b68
xorl %eax, %eax
leaq 0x30(%rsp), %r14
leaq 0x4(%rsp), %r15
movl %eax, 0x4(%rsp)
cmpl 0xc(%rbx), %eax
jge 0x5e97
cltq
movq 0x30(%rbx), %rcx
movq %rax, %rdx
shlq $0x4, %rdx
movl 0xc(%rcx,%rdx), %ecx
movq 0x60(%rsp), %rdx
movl %ecx, (%rdx,%rax,4)
movslq 0x4(%rsp), %rax
cmpl $0x0, (%rdx,%rax,4)
jne 0x5e93
movq %r14, %rdi
movq %r15, %rsi
callq 0x9a0e
movslq 0x4(%rsp), %rax
movq 0x30(%rbx), %rcx
movq %rax, %rdx
shlq $0x4, %rdx
movw $0x1, (%rcx,%rdx)
incl %eax
jmp 0x5e45
movw $0x1, %bp
leaq 0x8(%rsp), %r15
movq 0x38(%rsp), %rax
subq 0x30(%rsp), %rax
shrq $0x2, %rax
movq %rax, 0x50(%rsp)
testl %eax, %eax
je 0x5f7b
incl %ebp
xorl %eax, %eax
movl %eax, 0x4(%rsp)
cmpl 0x50(%rsp), %eax
jge 0x5f52
cltq
movq 0x30(%rsp), %rcx
movslq (%rcx,%rax,4), %rax
movq 0x48(%rbx), %rcx
imulq $0x30, %rax, %r13
movq 0x8(%rcx,%r13), %r12
subq (%rcx,%r13), %r12
shrq $0x2, %r12
testl %r12d, %r12d
movl $0x0, %eax
cmovlel %eax, %r12d
xorl %r14d, %r14d
cmpq %r14, %r12
je 0x5f47
movq 0x48(%rbx), %rax
movq (%rax,%r13), %rax
movslq (%rax,%r14,4), %rax
movl %eax, 0x8(%rsp)
movq 0x60(%rsp), %rcx
decl (%rcx,%rax,4)
movslq 0x8(%rsp), %rax
cmpl $0x0, (%rcx,%rax,4)
jne 0x5f42
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x9a0e
movslq 0x8(%rsp), %rax
movq 0x30(%rbx), %rcx
shlq $0x4, %rax
movw %bp, (%rcx,%rax)
incq %r14
jmp 0x5efc
movl 0x4(%rsp), %eax
incl %eax
jmp 0x5ebf
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x98ce
movq 0x10(%rsp), %rax
cmpq %rax, 0x18(%rsp)
je 0x5ea0
movq %rax, 0x18(%rsp)
jmp 0x5ea0
leaq 0x60(%rsp), %rdi
callq 0xa406
leaq 0x10(%rsp), %rdi
callq 0xa406
leaq 0x30(%rsp), %rdi
callq 0xa406
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x5fbe
jmp 0x5fb1
jmp 0x5fb1
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0xa406
leaq 0x10(%rsp), %rdi
callq 0xa406
leaq 0x30(%rsp), %rdi
callq 0xa406
movq %rbx, %rdi
callq 0x3430