// File: datourat[P]IP-label-for-graph-reachability/Graph.cpp
// Function: Graph::PrintReOrderedGraph2(std::vector<int, std::allocator<int>> const&)
void Graph::PrintReOrderedGraph2(const vector<int>& order){
	ofstream output((name+"_ReOrdered.txt").c_str());
	if(output.is_open()==false){
		cout << name+"_ReOrdered.txt" << " cannot be opened." << endl;
		quit();
	}

	vector< vector<int> > ReOrderedGraph(vsize, vector<int>());
	int u, v;
	for(int i=0; i<vsize; i++){
		u=order[i];
		for(int j=0; j<graph[i].outList.size(); j++){
			v=order[graph[i].outList[j]];
			ReOrderedGraph[u].push_back(v);
		}
	}

	for(int u=0; u<vsize; u++){
		sort(ReOrderedGraph[u].begin(), ReOrderedGraph[u].end());
//		sort(ReOrderedGraph[u].begin(), ReOrderedGraph[u].end(),EdgeSort(u));
	}

	for(int i=0; i<vsize; i++){
		for(int j=0; j<ReOrderedGraph[i].size(); j++){
			output << i << "\t" << ReOrderedGraph[i][j] << endl;
		}
	}


	output.close();
}

// Assembly:
subq $0x348, %rsp            # imm = 0x348
movq %rdi, 0x340(%rsp)
movq %rsi, 0x338(%rsp)
movq 0x340(%rsp), %rsi
movq %rsi, 0x70(%rsp)
addq $0x10, %rsi
leaq 0x1d945(%rip), %rdx     # 0x28514
leaq 0x118(%rsp), %rdi
movq %rdi, 0x78(%rsp)
callq 0x4c30
movq 0x78(%rsp), %rdi
callq 0x3120
movq %rax, %rsi
leaq 0x138(%rsp), %rdi
movl $0x10, %edx
callq 0x3320
jmp 0xac02
leaq 0x118(%rsp), %rdi
callq 0x31b0
leaq 0x138(%rsp), %rdi
callq 0x3220
movb %al, 0x6f(%rsp)
jmp 0xac22
movb 0x6f(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0xad14
movq 0x70(%rsp), %rsi
addq $0x10, %rsi
leaq 0x1d8d0(%rip), %rdx     # 0x28514
leaq 0xe8(%rsp), %rdi
callq 0x4c30
jmp 0xac53
movq 0x2a37e(%rip), %rdi     # 0x34fd8
leaq 0xe8(%rsp), %rsi
callq 0x3270
movq %rax, 0x60(%rsp)
jmp 0xac6e
movq 0x60(%rsp), %rdi
leaq 0x1d887(%rip), %rsi     # 0x28501
callq 0x32c0
movq %rax, 0x58(%rsp)
jmp 0xac86
movq 0x58(%rsp), %rdi
movq 0x2a336(%rip), %rsi     # 0x34fc8
callq 0x3300
jmp 0xac99
leaq 0xe8(%rsp), %rdi
callq 0x31b0
callq 0x4da0
jmp 0xacad
jmp 0xad14
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x31b0
jmp 0xb104
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
jmp 0xb0f7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
leaq 0xe8(%rsp), %rdi
callq 0x31b0
jmp 0xb0f7
movq 0x70(%rsp), %rax
movslq 0xc(%rax), %rax
movq %rax, 0x40(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0xb0(%rsp)
movq $0x0, 0xc0(%rsp)
leaq 0xb0(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x11160
leaq 0xaf(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x13260
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq 0x50(%rsp), %rcx
leaq 0xd0(%rsp), %rdi
callq 0x13270
jmp 0xad7b
leaq 0xaf(%rsp), %rdi
callq 0x132f0
leaq 0xb0(%rsp), %rdi
callq 0x115a0
movl $0x0, 0xa0(%rsp)
movq 0x70(%rsp), %rcx
movl 0xa0(%rsp), %eax
cmpl 0xc(%rcx), %eax
jge 0xaf1b
movq 0x338(%rsp), %rdi
movslq 0xa0(%rsp), %rsi
callq 0x13300
movl (%rax), %eax
movl %eax, 0xa8(%rsp)
movl $0x0, 0x9c(%rsp)
movq 0x70(%rsp), %rdi
movslq 0x9c(%rsp), %rax
movq %rax, 0x38(%rsp)
addq $0x48, %rdi
movslq 0xa0(%rsp), %rsi
callq 0x11d60
movq %rax, %rdi
addq $0x18, %rdi
callq 0x4c10
movq %rax, %rcx
movq 0x38(%rsp), %rax
cmpq %rcx, %rax
jae 0xaf03
movq 0x70(%rsp), %rdi
movq 0x338(%rsp), %rax
movq %rax, 0x30(%rsp)
addq $0x48, %rdi
movslq 0xa0(%rsp), %rsi
callq 0x11d60
movq %rax, %rdi
addq $0x18, %rdi
movslq 0x9c(%rsp), %rsi
callq 0x12960
movq 0x30(%rsp), %rdi
movslq (%rax), %rsi
callq 0x13300
movl (%rax), %eax
movl %eax, 0xa4(%rsp)
movslq 0xa8(%rsp), %rsi
leaq 0xd0(%rsp), %rdi
callq 0x4bf0
movq %rax, %rdi
leaq 0xa4(%rsp), %rsi
callq 0x12660
jmp 0xae92
jmp 0xae94
movl 0x9c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x9c(%rsp)
jmp 0xadde
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
leaq 0xaf(%rsp), %rdi
callq 0x132f0
leaq 0xb0(%rsp), %rdi
callq 0x115a0
jmp 0xb0f7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x11480
jmp 0xb0f7
jmp 0xaf05
movl 0xa0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xa0(%rsp)
jmp 0xada0
movl $0x0, 0x98(%rsp)
movq 0x70(%rsp), %rcx
movl 0x98(%rsp), %eax
cmpl 0xc(%rcx), %eax
jge 0xafb2
movslq 0x98(%rsp), %rsi
leaq 0xd0(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x4bf0
movq %rax, %rdi
callq 0x12270
movq 0x28(%rsp), %rdi
movq %rax, 0x90(%rsp)
movslq 0x98(%rsp), %rsi
callq 0x4bf0
movq %rax, %rdi
callq 0x122e0
movq %rax, 0x88(%rsp)
movq 0x90(%rsp), %rdi
movq 0x88(%rsp), %rsi
callq 0x12530
jmp 0xaf9a
jmp 0xaf9c
movl 0x98(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x98(%rsp)
jmp 0xaf26
movl $0x0, 0x84(%rsp)
movq 0x70(%rsp), %rcx
movl 0x84(%rsp), %eax
cmpl 0xc(%rcx), %eax
jge 0xb0c6
movl $0x0, 0x80(%rsp)
movslq 0x80(%rsp), %rax
movq %rax, 0x20(%rsp)
movslq 0x84(%rsp), %rsi
leaq 0xd0(%rsp), %rdi
callq 0x4bf0
movq %rax, %rdi
callq 0x4c10
movq %rax, %rcx
movq 0x20(%rsp), %rax
cmpq %rcx, %rax
jae 0xb0ae
movl 0x84(%rsp), %esi
leaq 0x138(%rsp), %rdi
callq 0x34d0
movq %rax, 0x18(%rsp)
jmp 0xb033
movq 0x18(%rsp), %rdi
leaq 0x1d4b1(%rip), %rsi     # 0x284f0
callq 0x32c0
movq %rax, 0x10(%rsp)
jmp 0xb04b
movslq 0x84(%rsp), %rsi
leaq 0xd0(%rsp), %rdi
callq 0x4bf0
movq %rax, %rdi
movslq 0x80(%rsp), %rsi
callq 0x12960
movq 0x10(%rsp), %rdi
movl (%rax), %esi
callq 0x34d0
movq %rax, 0x8(%rsp)
jmp 0xb083
movq 0x8(%rsp), %rdi
movq 0x29f39(%rip), %rsi     # 0x34fc8
callq 0x3300
jmp 0xb096
jmp 0xb098
movl 0x80(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x80(%rsp)
jmp 0xafdd
jmp 0xb0b0
movl 0x84(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x84(%rsp)
jmp 0xafbd
leaq 0x138(%rsp), %rdi
callq 0x3400
jmp 0xb0d5
leaq 0xd0(%rsp), %rdi
callq 0x11480
leaq 0x138(%rsp), %rdi
callq 0x3420
addq $0x348, %rsp            # imm = 0x348
retq
leaq 0x138(%rsp), %rdi
callq 0x3420
movq 0x110(%rsp), %rdi
callq 0x34e0
nopw %cs:(%rax,%rax)