// File: /workspace/github_cpp_makefile_star2_O1/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 0xc5cc
movl $0x0, 0x4(%rsp)
cmpl $0x0, 0xc(%rbx)
jle 0x7052
xorl %eax, %eax
leaq 0x10(%rsp), %r14
leaq 0x4(%rsp), %r15
cltq
movq 0x30(%rbx), %rcx
movq %rax, %rdx
shlq $0x4, %rdx
movl 0xc(%rcx,%rdx), %ecx
movq 0x50(%rsp), %rdx
movl %ecx, (%rdx,%rax,4)
movslq 0x4(%rsp), %rax
cmpl $0x0, (%rdx,%rax,4)
jne 0x7043
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x7025
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x7030
movq %r14, %rdi
movq %r15, %rdx
callq 0xdde8
movslq 0x4(%rsp), %rax
movq 0x30(%rbx), %rcx
shlq $0x4, %rax
movw $0x1, (%rcx,%rax)
movl 0x4(%rsp), %eax
incl %eax
movl %eax, 0x4(%rsp)
cmpl 0xc(%rbx), %eax
jl 0x6fe8
movq 0x18(%rsp), %r13
subq 0x10(%rsp), %r13
shrq $0x2, %r13
testl %r13d, %r13d
je 0x7163
movw $0x1, %bp
incl %ebp
movl $0x0, 0x4(%rsp)
testl %r13d, %r13d
jle 0x712c
xorl %eax, %eax
cltq
movq 0x10(%rsp), %rcx
movslq (%rcx,%rax,4), %rax
movq 0x48(%rbx), %rcx
leaq (%rax,%rax,2), %r12
shlq $0x4, %r12
movq 0x8(%rcx,%r12), %r15
subq (%rcx,%r12), %r15
shrq $0x2, %r15
testl %r15d, %r15d
jle 0x7119
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 0x7111
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
je 0x70f1
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x38(%rsp)
jmp 0x7100
leaq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xdde8
movslq 0x8(%rsp), %rax
movq 0x30(%rbx), %rcx
shlq $0x4, %rax
movw %bp, (%rcx,%rax)
incq %r14
cmpq %r14, %r15
jne 0x70b5
movl 0x4(%rsp), %eax
incl %eax
movl %eax, 0x4(%rsp)
cmpl %r13d, %eax
jl 0x7082
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0xc2b6
movq 0x30(%rsp), %rax
cmpq %rax, 0x38(%rsp)
je 0x714c
movq %rax, 0x38(%rsp)
movq 0x18(%rsp), %r13
subq 0x10(%rsp), %r13
shrq $0x2, %r13
testl %r13d, %r13d
jne 0x706d
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x7172
callq 0x3260
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x7181
callq 0x3260
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x7190
callq 0x3260
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x71ba
jmp 0x71a8
jmp 0x71a8
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x71ba
callq 0x3260
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x71c9
callq 0x3260
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x71d8
callq 0x3260
movq %rbx, %rdi
callq 0x3460