// File: /workspace/github_cpp_makefile_star2_O3/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 $0x68, %rsp
movq %rdi, %rbx
xorl %eax, %eax
movq %rax, 0x20(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq %rax, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movslq 0xc(%rdi), %rsi
leaq 0x4c(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0x50(%rsp), %rdi
leaq 0xf(%rsp), %rcx
callq 0xc51c
movl $0x0, 0x4(%rsp)
cmpl $0x0, 0xc(%rbx)
jle 0x7144
movq 0x30(%rbx), %rax
xorl %ecx, %ecx
leaq 0x10(%rsp), %r14
leaq 0x4(%rsp), %r15
movslq %ecx, %rcx
movq %rcx, %rdx
shlq $0x4, %rdx
movl 0xc(%rax,%rdx), %edx
movq 0x50(%rsp), %rsi
movl %edx, (%rsi,%rcx,4)
movslq 0x4(%rsp), %rcx
cmpl $0x0, (%rsi,%rcx,4)
jne 0x7027
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x7006
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x7015
movq %r14, %rdi
movq %r15, %rdx
callq 0xdd36
movq 0x30(%rbx), %rax
movslq 0x4(%rsp), %rcx
movq %rcx, %rdx
shlq $0x4, %rdx
movw $0x1, (%rax,%rdx)
incl %ecx
movl %ecx, 0x4(%rsp)
cmpl 0xc(%rbx), %ecx
jl 0x6fcc
movq 0x18(%rsp), %r13
subq 0x10(%rsp), %r13
shrq $0x2, %r13
testl %r13d, %r13d
je 0x7144
movw $0x1, %bp
incl %ebp
movl $0x0, 0x4(%rsp)
testl %r13d, %r13d
jle 0x710d
xorl %eax, %eax
movslq %eax, %rcx
movq 0x10(%rsp), %rdx
movslq (%rdx,%rcx,4), %rcx
movq 0x48(%rbx), %rdx
leaq (%rcx,%rcx,2), %r12
shlq $0x4, %r12
movq 0x8(%rdx,%r12), %r15
subq (%rdx,%r12), %r15
shrq $0x2, %r15
testl %r15d, %r15d
jle 0x70fe
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
xorl %r14d, %r14d
movq 0x48(%rbx), %rax
movq (%rax,%r12), %rax
movslq (%rax,%r14,4), %rax
movl %eax, 0x8(%rsp)
movq 0x50(%rsp), %rcx
decl (%rcx,%rax,4)
movslq 0x8(%rsp), %rax
cmpl $0x0, (%rcx,%rax,4)
jne 0x70f2
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
je 0x70d2
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x38(%rsp)
jmp 0x70e1
leaq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xdd36
movslq 0x8(%rsp), %rax
movq 0x30(%rbx), %rcx
shlq $0x4, %rax
movw %bp, (%rcx,%rax)
incq %r14
cmpq %r14, %r15
jne 0x7096
movl 0x4(%rsp), %eax
incl %eax
movl %eax, 0x4(%rsp)
cmpl %r13d, %eax
jl 0x7062
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0xc1f2
movq 0x30(%rsp), %rax
cmpq %rax, 0x38(%rsp)
je 0x712d
movq %rax, 0x38(%rsp)
movq 0x18(%rsp), %r13
subq 0x10(%rsp), %r13
shrq $0x2, %r13
testl %r13d, %r13d
jne 0x704d
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x7153
callq 0x3260
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x7162
callq 0x3260
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x7171
callq 0x3260
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x719b
jmp 0x7189
jmp 0x7189
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x719b
callq 0x3260
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x71aa
callq 0x3260
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x71b9
callq 0x3260
movq %rbx, %rdi
callq 0x3460
nop