// File: datourat[P]IP-label-for-graph-reachability/Graph.cpp
// Function: Graph::SubComputeProLabelIn(int)
void Graph::SubComputeProLabelIn(int v){
	int edgelistsize=graph[v].inList.size();
	int u;
	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, ProLabelIn[v].begin()));
	iterend.push_back(ProLabelIn[v].end());
/*
	for(int i=0; i<edgelistsize; i++){
		u=graph[v].inList[i];
		iterlist.push_back( make_pair(i+1, ProLabelIn[u].begin()) );
		iterend.push_back(ProLabelIn[u].end());
	}
*/
	int i=1;
	for(vector<int>::iterator it=graph[v].inList.begin(); it!=graph[v].inList.end(); i++, it++){
		iterlist.push_back( make_pair(i, ProLabelIn[*it].begin()) );
                iterend.push_back(ProLabelIn[*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> ());
		}
	}

	ProLabelIn[v]=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
callq 0x4c10
movl %eax, 0x168(%rsp)
leaq 0x150(%rsp), %rdi
callq 0x11f70
cmpb $0x0, 0x27f01(%rip)     # 0x35398
jne 0xd4dc
leaq 0x27ef8(%rip), %rdi     # 0x35398
callq 0x3500
cmpl $0x0, %eax
je 0xd4dc
leaq 0x27ecf(%rip), %rdi     # 0x35380
callq 0x13d20
leaq 0x6873(%rip), %rdi      # 0x13d30
leaq 0x27ebc(%rip), %rsi     # 0x35380
leaq 0x27e05(%rip), %rdx     # 0x352d0
callq 0x3260
leaq 0x27ec1(%rip), %rdi     # 0x35398
callq 0x31e0
cmpb $0x0, 0x27ed5(%rip)     # 0x353b8
jne 0xd528
leaq 0x27ecc(%rip), %rdi     # 0x353b8
callq 0x3500
cmpl $0x0, %eax
je 0xd528
leaq 0x27ea3(%rip), %rdi     # 0x353a0
callq 0x13d90
leaq 0x6897(%rip), %rdi      # 0x13da0
leaq 0x27e90(%rip), %rsi     # 0x353a0
leaq 0x27db9(%rip), %rdx     # 0x352d0
callq 0x3260
leaq 0x27e95(%rip), %rdi     # 0x353b8
callq 0x31e0
cmpb $0x0, 0x27ea9(%rip)     # 0x353d8
jne 0xd5ac
leaq 0x27ea0(%rip), %rdi     # 0x353d8
callq 0x3500
cmpl $0x0, %eax
je 0xd5ac
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 0x27e4e(%rip), %rdi     # 0x353c0
callq 0x129a0
jmp 0xd579
leaq 0x14f(%rsp), %rdi
callq 0x12a20
leaq 0x4013(%rip), %rdi      # 0x115a0
leaq 0x27e2c(%rip), %rsi     # 0x353c0
leaq 0x27d35(%rip), %rdx     # 0x352d0
callq 0x3260
leaq 0x27e31(%rip), %rdi     # 0x353d8
callq 0x31e0
leaq 0x27e0d(%rip), %rdi     # 0x353c0
callq 0x11be0
leaq 0x27dc1(%rip), %rdi     # 0x35380
callq 0x13e00
leaq 0x27dd5(%rip), %rdi     # 0x353a0
callq 0x13e20
movq 0x38(%rsp), %rdi
movl $0x0, 0x124(%rsp)
addq $0x90, %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 0x27d71(%rip), %rdi     # 0x353a0
leaq 0x128(%rsp), %rsi
callq 0x13e40
movq 0x38(%rsp), %rdi
addq $0x90, %rdi
movslq 0x16c(%rsp), %rsi
callq 0x4bf0
movq %rax, %rdi
callq 0x122e0
movq %rax, 0x110(%rsp)
leaq 0x27d14(%rip), %rdi     # 0x35380
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
callq 0x12270
movq %rax, 0x100(%rsp)
movq 0x38(%rsp), %rdi
addq $0x48, %rdi
movslq 0x16c(%rsp), %rsi
callq 0x11d60
movq %rax, %rdi
callq 0x122e0
movq %rax, 0xf8(%rsp)
leaq 0x100(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0x122a0
testb $0x1, %al
jne 0xd6ee
jmp 0xd80d
movq 0x38(%rsp), %rax
addq $0x90, %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 0x27c4d(%rip), %rdi     # 0x353a0
leaq 0xe8(%rsp), %rsi
callq 0x13e40
movq 0x38(%rsp), %rax
addq $0x90, %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 0x27bdf(%rip), %rdi     # 0x35380
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 0xd6aa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
leaq 0x14f(%rsp), %rdi
callq 0x12a20
leaq 0x27bd5(%rip), %rdi     # 0x353d8
callq 0x31d0
jmp 0xdbe8
movl $0x0, 0xcc(%rsp)
leaq 0x27b81(%rip), %rdi     # 0x353a0
callq 0x13f50
movq %rax, 0xc0(%rsp)
leaq 0x27b6d(%rip), %rdi     # 0x353a0
callq 0x13f80
movq %rax, 0xb8(%rsp)
movq 0xc0(%rsp), %rdi
movq 0xb8(%rsp), %rsi
callq 0x13f00
leaq 0x27b44(%rip), %rdi     # 0x353a0
callq 0x13fb0
movl (%rax), %eax
movl %eax, 0x160(%rsp)
leaq 0x27b2f(%rip), %rdi     # 0x353a0
callq 0x13fb0
movq 0x8(%rax), %rax
movq %rax, 0x150(%rsp)
leaq 0x150(%rsp), %rdi
callq 0x12310
movq %rax, %rsi
leaq 0x27b27(%rip), %rdi     # 0x353c0
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 0x27ad4(%rip), %rdi     # 0x353a0
callq 0x13f50
movq %rax, 0xa8(%rsp)
leaq 0x27ac0(%rip), %rdi     # 0x353a0
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 0x27a58(%rip), %rdi     # 0x35380
callq 0x140a0
movq %rax, %rsi
leaq 0x150(%rsp), %rdi
callq 0x14060
testb $0x1, %al
jne 0xd943
jmp 0xd951
leaq 0x27a56(%rip), %rdi     # 0x353a0
callq 0x140c0
jmp 0xd9b9
leaq 0x27a48(%rip), %rdi     # 0x353a0
callq 0x14100
movq %rax, %rsi
subq $0x1, %rsi
leaq 0x27a35(%rip), %rdi     # 0x353a0
callq 0x140e0
movq 0x150(%rsp), %rcx
movq %rcx, 0x8(%rax)
leaq 0x27a1d(%rip), %rdi     # 0x353a0
callq 0x13f50
movq %rax, 0x88(%rsp)
leaq 0x27a09(%rip), %rdi     # 0x353a0
callq 0x13f80
movq %rax, 0x80(%rsp)
movq 0x88(%rsp), %rdi
movq 0x80(%rsp), %rsi
callq 0x14120
jmp 0xd9bb
movq 0x38(%rsp), %rdx
movl 0xcc(%rsp), %ecx
xorl %eax, %eax
cmpl (%rdx), %ecx
movb %al, 0x17(%rsp)
jge 0xd9ec
leaq 0x279c8(%rip), %rdi     # 0x353a0
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 0xd9f9
jmp 0xdbb8
leaq 0x279a0(%rip), %rdi     # 0x353a0
callq 0x13fb0
movl (%rax), %eax
movl %eax, 0x160(%rsp)
leaq 0x2798b(%rip), %rdi     # 0x353a0
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 0xda8e
leaq 0x150(%rsp), %rdi
callq 0x12310
movq %rax, %rsi
leaq 0x27960(%rip), %rdi     # 0x353c0
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 0xdada
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 0xdad8
movq 0x27520(%rip), %rdi     # 0x34fd8
leaq 0x1aa64(%rip), %rsi     # 0x28523
callq 0x32c0
movq %rax, %rdi
movq 0x274fa(%rip), %rsi     # 0x34fc8
callq 0x3300
callq 0x4da0
jmp 0xdada
leaq 0x278bf(%rip), %rdi     # 0x353a0
callq 0x13f50
movq %rax, 0x70(%rsp)
leaq 0x278ae(%rip), %rdi     # 0x353a0
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 0x27852(%rip), %rdi     # 0x35380
callq 0x140a0
movq %rax, %rsi
leaq 0x150(%rsp), %rdi
callq 0x14060
testb $0x1, %al
jne 0xdb49
jmp 0xdb57
leaq 0x27850(%rip), %rdi     # 0x353a0
callq 0x140c0
jmp 0xdbb3
leaq 0x27842(%rip), %rdi     # 0x353a0
callq 0x14100
movq %rax, %rsi
subq $0x1, %rsi
leaq 0x2782f(%rip), %rdi     # 0x353a0
callq 0x140e0
movq 0x150(%rsp), %rcx
movq %rcx, 0x8(%rax)
leaq 0x27817(%rip), %rdi     # 0x353a0
callq 0x13f50
movq %rax, 0x50(%rsp)
leaq 0x27806(%rip), %rdi     # 0x353a0
callq 0x13f80
movq %rax, 0x48(%rsp)
movq 0x50(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0x14120
jmp 0xd9bb
movq 0x38(%rsp), %rdi
addq $0x90, %rdi
movslq 0x16c(%rsp), %rsi
callq 0x4bf0
movq %rax, %rdi
leaq 0x277e5(%rip), %rsi     # 0x353c0
callq 0x11fb0
addq $0x178, %rsp            # imm = 0x178
retq
movq 0x140(%rsp), %rdi
callq 0x34e0
nopw %cs:(%rax,%rax)