// File: datourat[P]IP-label-for-graph-reachability/Graph.cpp
// Function: Graph::SubComputeProLabelOut(int)
void Graph::SubComputeProLabelOut(int u){
	int edgelistsize=graph[u].outList.size();
	int v;
	int tmpi;
	int tmpvalue;
	vector<int>::iterator tmpiter;
	static vector< vector<int>::iterator > iterend;
	static vector< pair<int, vector<int>::iterator> > iterlist;
	static vector<int> label(KEYNUM);

	label.clear();
	iterend.clear();
	iterlist.clear();

	iterlist.push_back(make_pair(0, ProLabelOut[u].begin()));
	iterend.push_back(ProLabelOut[u].end());
/*
	for(int i=0; i<edgelistsize; i++){
		v=graph[u].outList[i];
		iterlist.push_back( make_pair(i+1, ProLabelOut[v].begin()) );
		iterend.push_back(ProLabelOut[v].end());
	}
*/
	int i=1;
	for(vector<int>::iterator it=graph[u].outList.begin(); it!=graph[u].outList.end(); i++, it++){
		iterlist.push_back( make_pair(i, ProLabelOut[*it].begin()) );
		iterend.push_back( ProLabelOut[*it].end() );
	}

	int k=0;
	make_heap(iterlist.begin(), iterlist.end(), PairComparePointer<int, vector<int>::iterator> ());
	tmpi=iterlist.front().first;
	tmpiter=iterlist.front().second;
	label.push_back( *(tmpiter) );
	k++;
	tmpvalue=*tmpiter;
	pop_heap(iterlist.begin(), iterlist.end(),  PairComparePointer<int, vector<int>::iterator> ());
	tmpiter++;
	if(tmpiter==iterend[tmpi]){
		iterlist.pop_back();
	}else{
		iterlist[iterlist.size()-1].second=tmpiter;
		push_heap(iterlist.begin(), iterlist.end(),  PairComparePointer<int, vector<int>::iterator> ());
	}

	while(k<KEYNUM && iterlist.empty()==false){
		tmpi=iterlist.front().first;
		tmpiter=iterlist.front().second;
		if(tmpvalue < *tmpiter){
			label.push_back( *(tmpiter) );
			k++;
			tmpvalue=*tmpiter;
		}else if(tmpvalue > *tmpiter){
			cout << "Something must be wrong! " << endl;
			quit();
		}
		pop_heap(iterlist.begin(), iterlist.end(),  PairComparePointer<int, vector<int>::iterator> ());
		tmpiter++;
		if(tmpiter==iterend[tmpi]){
			iterlist.pop_back();
		}else{
			iterlist[iterlist.size()-1].second=tmpiter;
			push_heap(iterlist.begin(), iterlist.end(),  PairComparePointer<int, vector<int>::iterator> ());
		}
	}

	ProLabelOut[u]=label;
}

// Assembly:
subq $0x178, %rsp            # imm = 0x178
movq %rdi, 0x170(%rsp)
movl %esi, 0x16c(%rsp)
movq 0x170(%rsp), %rdi
movq %rdi, 0x38(%rsp)
addq $0x48, %rdi
movslq 0x16c(%rsp), %rsi
callq 0x11d60
movq %rax, %rdi
addq $0x18, %rdi
callq 0x4c10
movl %eax, 0x168(%rsp)
leaq 0x150(%rsp), %rdi
callq 0x11f70
cmpb $0x0, 0x2884d(%rip)     # 0x35338
jne 0xcb30
leaq 0x28844(%rip), %rdi     # 0x35338
callq 0x3500
cmpl $0x0, %eax
je 0xcb30
leaq 0x2881b(%rip), %rdi     # 0x35320
callq 0x13d20
leaq 0x721f(%rip), %rdi      # 0x13d30
leaq 0x28808(%rip), %rsi     # 0x35320
leaq 0x287b1(%rip), %rdx     # 0x352d0
callq 0x3260
leaq 0x2880d(%rip), %rdi     # 0x35338
callq 0x31e0
cmpb $0x0, 0x28821(%rip)     # 0x35358
jne 0xcb7c
leaq 0x28818(%rip), %rdi     # 0x35358
callq 0x3500
cmpl $0x0, %eax
je 0xcb7c
leaq 0x287ef(%rip), %rdi     # 0x35340
callq 0x13d90
leaq 0x7243(%rip), %rdi      # 0x13da0
leaq 0x287dc(%rip), %rsi     # 0x35340
leaq 0x28765(%rip), %rdx     # 0x352d0
callq 0x3260
leaq 0x287e1(%rip), %rdi     # 0x35358
callq 0x31e0
cmpb $0x0, 0x287f5(%rip)     # 0x35378
jne 0xcc00
leaq 0x287ec(%rip), %rdi     # 0x35378
callq 0x3500
cmpl $0x0, %eax
je 0xcc00
movq 0x38(%rsp), %rax
movslq (%rax), %rax
movq %rax, 0x28(%rsp)
leaq 0x14f(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x12990
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
leaq 0x2879a(%rip), %rdi     # 0x35360
callq 0x129a0
jmp 0xcbcd
leaq 0x14f(%rsp), %rdi
callq 0x12a20
leaq 0x49bf(%rip), %rdi      # 0x115a0
leaq 0x28778(%rip), %rsi     # 0x35360
leaq 0x286e1(%rip), %rdx     # 0x352d0
callq 0x3260
leaq 0x2877d(%rip), %rdi     # 0x35378
callq 0x31e0
leaq 0x28759(%rip), %rdi     # 0x35360
callq 0x11be0
leaq 0x2870d(%rip), %rdi     # 0x35320
callq 0x13e00
leaq 0x28721(%rip), %rdi     # 0x35340
callq 0x13e20
movq 0x38(%rsp), %rdi
movl $0x0, 0x124(%rsp)
addq $0x78, %rdi
movslq 0x16c(%rsp), %rsi
callq 0x4bf0
movq %rax, %rdi
callq 0x12270
movq %rax, 0x118(%rsp)
leaq 0x124(%rsp), %rdi
leaq 0x118(%rsp), %rsi
callq 0x13e70
movl %eax, 0x128(%rsp)
movq %rdx, 0x130(%rsp)
leaq 0x286c0(%rip), %rdi     # 0x35340
leaq 0x128(%rsp), %rsi
callq 0x13e40
movq 0x38(%rsp), %rdi
addq $0x78, %rdi
movslq 0x16c(%rsp), %rsi
callq 0x4bf0
movq %rax, %rdi
callq 0x122e0
movq %rax, 0x110(%rsp)
leaq 0x28666(%rip), %rdi     # 0x35320
leaq 0x110(%rsp), %rsi
callq 0x13ea0
movq 0x38(%rsp), %rdi
movl $0x1, 0x10c(%rsp)
addq $0x48, %rdi
movslq 0x16c(%rsp), %rsi
callq 0x11d60
movq %rax, %rdi
addq $0x18, %rdi
callq 0x12270
movq %rax, 0x100(%rsp)
movq 0x38(%rsp), %rdi
addq $0x48, %rdi
movslq 0x16c(%rsp), %rsi
callq 0x11d60
movq %rax, %rdi
addq $0x18, %rdi
callq 0x122e0
movq %rax, 0xf8(%rsp)
leaq 0x100(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0x122a0
testb $0x1, %al
jne 0xcd44
jmp 0xce5f
movq 0x38(%rsp), %rax
addq $0x78, %rax
movq %rax, 0x18(%rsp)
leaq 0x100(%rsp), %rdi
callq 0x12310
movq 0x18(%rsp), %rdi
movslq (%rax), %rsi
callq 0x4bf0
movq %rax, %rdi
callq 0x12270
movq %rax, 0xe0(%rsp)
leaq 0x10c(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x13ed0
movl %eax, 0xe8(%rsp)
movq %rdx, 0xf0(%rsp)
leaq 0x28599(%rip), %rdi     # 0x35340
leaq 0xe8(%rsp), %rsi
callq 0x13e40
movq 0x38(%rsp), %rax
addq $0x78, %rax
movq %rax, 0x20(%rsp)
leaq 0x100(%rsp), %rdi
callq 0x12310
movq 0x20(%rsp), %rdi
movslq (%rax), %rsi
callq 0x4bf0
movq %rax, %rdi
callq 0x122e0
movq %rax, 0xd8(%rsp)
leaq 0x2852d(%rip), %rdi     # 0x35320
leaq 0xd8(%rsp), %rsi
callq 0x13ea0
movl 0x10c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10c(%rsp)
leaq 0x100(%rsp), %rdi
xorl %esi, %esi
callq 0x12320
movq %rax, 0xd0(%rsp)
jmp 0xccfc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
leaq 0x14f(%rsp), %rdi
callq 0x12a20
leaq 0x28523(%rip), %rdi     # 0x35378
callq 0x31d0
jmp 0xd237
movl $0x0, 0xcc(%rsp)
leaq 0x284cf(%rip), %rdi     # 0x35340
callq 0x13f50
movq %rax, 0xc0(%rsp)
leaq 0x284bb(%rip), %rdi     # 0x35340
callq 0x13f80
movq %rax, 0xb8(%rsp)
movq 0xc0(%rsp), %rdi
movq 0xb8(%rsp), %rsi
callq 0x13f00
leaq 0x28492(%rip), %rdi     # 0x35340
callq 0x13fb0
movl (%rax), %eax
movl %eax, 0x160(%rsp)
leaq 0x2847d(%rip), %rdi     # 0x35340
callq 0x13fb0
movq 0x8(%rax), %rax
movq %rax, 0x150(%rsp)
leaq 0x150(%rsp), %rdi
callq 0x12310
movq %rax, %rsi
leaq 0x28475(%rip), %rdi     # 0x35360
callq 0x12660
movl 0xcc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xcc(%rsp)
leaq 0x150(%rsp), %rdi
callq 0x12310
movl (%rax), %eax
movl %eax, 0x15c(%rsp)
leaq 0x28422(%rip), %rdi     # 0x35340
callq 0x13f50
movq %rax, 0xa8(%rsp)
leaq 0x2840e(%rip), %rdi     # 0x35340
callq 0x13f80
movq %rax, 0xa0(%rsp)
movq 0xa8(%rsp), %rdi
movq 0xa0(%rsp), %rsi
callq 0x13fe0
leaq 0x150(%rsp), %rdi
xorl %esi, %esi
callq 0x12320
movq %rax, 0x90(%rsp)
movslq 0x160(%rsp), %rsi
leaq 0x283a6(%rip), %rdi     # 0x35320
callq 0x140a0
movq %rax, %rsi
leaq 0x150(%rsp), %rdi
callq 0x14060
testb $0x1, %al
jne 0xcf95
jmp 0xcfa3
leaq 0x283a4(%rip), %rdi     # 0x35340
callq 0x140c0
jmp 0xd00b
leaq 0x28396(%rip), %rdi     # 0x35340
callq 0x14100
movq %rax, %rsi
subq $0x1, %rsi
leaq 0x28383(%rip), %rdi     # 0x35340
callq 0x140e0
movq 0x150(%rsp), %rcx
movq %rcx, 0x8(%rax)
leaq 0x2836b(%rip), %rdi     # 0x35340
callq 0x13f50
movq %rax, 0x88(%rsp)
leaq 0x28357(%rip), %rdi     # 0x35340
callq 0x13f80
movq %rax, 0x80(%rsp)
movq 0x88(%rsp), %rdi
movq 0x80(%rsp), %rsi
callq 0x14120
jmp 0xd00d
movq 0x38(%rsp), %rdx
movl 0xcc(%rsp), %ecx
xorl %eax, %eax
cmpl (%rdx), %ecx
movb %al, 0x17(%rsp)
jge 0xd03e
leaq 0x28316(%rip), %rdi     # 0x35340
callq 0x141c0
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
sete %al
movb %al, 0x17(%rsp)
movb 0x17(%rsp), %al
testb $0x1, %al
jne 0xd04b
jmp 0xd20a
leaq 0x282ee(%rip), %rdi     # 0x35340
callq 0x13fb0
movl (%rax), %eax
movl %eax, 0x160(%rsp)
leaq 0x282d9(%rip), %rdi     # 0x35340
callq 0x13fb0
movq 0x8(%rax), %rax
movq %rax, 0x150(%rsp)
movl 0x15c(%rsp), %eax
movl %eax, 0x10(%rsp)
leaq 0x150(%rsp), %rdi
callq 0x12310
movq %rax, %rcx
movl 0x10(%rsp), %eax
cmpl (%rcx), %eax
jge 0xd0e0
leaq 0x150(%rsp), %rdi
callq 0x12310
movq %rax, %rsi
leaq 0x282ae(%rip), %rdi     # 0x35360
callq 0x12660
movl 0xcc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xcc(%rsp)
leaq 0x150(%rsp), %rdi
callq 0x12310
movl (%rax), %eax
movl %eax, 0x15c(%rsp)
jmp 0xd12c
movl 0x15c(%rsp), %eax
movl %eax, 0xc(%rsp)
leaq 0x150(%rsp), %rdi
callq 0x12310
movq %rax, %rcx
movl 0xc(%rsp), %eax
cmpl (%rcx), %eax
jle 0xd12a
movq 0x27ece(%rip), %rdi     # 0x34fd8
leaq 0x1b412(%rip), %rsi     # 0x28523
callq 0x32c0
movq %rax, %rdi
movq 0x27ea8(%rip), %rsi     # 0x34fc8
callq 0x3300
callq 0x4da0
jmp 0xd12c
leaq 0x2820d(%rip), %rdi     # 0x35340
callq 0x13f50
movq %rax, 0x70(%rsp)
leaq 0x281fc(%rip), %rdi     # 0x35340
callq 0x13f80
movq %rax, 0x68(%rsp)
movq 0x70(%rsp), %rdi
movq 0x68(%rsp), %rsi
callq 0x13fe0
leaq 0x150(%rsp), %rdi
xorl %esi, %esi
callq 0x12320
movq %rax, 0x58(%rsp)
movslq 0x160(%rsp), %rsi
leaq 0x281a0(%rip), %rdi     # 0x35320
callq 0x140a0
movq %rax, %rsi
leaq 0x150(%rsp), %rdi
callq 0x14060
testb $0x1, %al
jne 0xd19b
jmp 0xd1a9
leaq 0x2819e(%rip), %rdi     # 0x35340
callq 0x140c0
jmp 0xd205
leaq 0x28190(%rip), %rdi     # 0x35340
callq 0x14100
movq %rax, %rsi
subq $0x1, %rsi
leaq 0x2817d(%rip), %rdi     # 0x35340
callq 0x140e0
movq 0x150(%rsp), %rcx
movq %rcx, 0x8(%rax)
leaq 0x28165(%rip), %rdi     # 0x35340
callq 0x13f50
movq %rax, 0x50(%rsp)
leaq 0x28154(%rip), %rdi     # 0x35340
callq 0x13f80
movq %rax, 0x48(%rsp)
movq 0x50(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0x14120
jmp 0xd00d
movq 0x38(%rsp), %rdi
addq $0x78, %rdi
movslq 0x16c(%rsp), %rsi
callq 0x4bf0
movq %rax, %rdi
leaq 0x28136(%rip), %rsi     # 0x35360
callq 0x11fb0
addq $0x178, %rsp            # imm = 0x178
retq
movq 0x140(%rsp), %rdi
callq 0x34e0
nopw %cs:(%rax,%rax)