// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x248, %rsp            # imm = 0x248
movq %rsi, %r14
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x10(%rdi), %rsi
movq %rdi, (%rsp)
movq 0x18(%rdi), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x4834
leaq 0x7e3d(%rip), %rsi      # 0x10574
movq %r15, %rdi
callq 0x34b0
movq 0x10(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x10, %edx
callq 0x32c0
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x8762
callq 0x3260
leaq 0xb8(%rsp), %rdi
callq 0x3080
testb %al, %al
jne 0x880c
leaq 0x10(%rsp), %rdi
movq %r12, (%rdi)
movq (%rsp), %rax
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
addq %rsi, %rdx
callq 0x4834
leaq 0x7dda(%rip), %rsi      # 0x10574
leaq 0x10(%rsp), %rdi
callq 0x34b0
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0xd823(%rip), %rdi      # 0x15fd8
callq 0x32e0
movq %rax, %r15
leaq 0x7d9d(%rip), %rsi      # 0x10561
movl $0x12, %edx
movq %rax, %rdi
callq 0x32e0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3280
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31d0
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x8807
callq 0x3260
callq 0x4948
movq (%rsp), %rax
movslq 0xc(%rax), %rsi
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %rdx
movaps %xmm0, (%rdx)
movq $0x0, 0x10(%rdx)
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rcx
callq 0xc828
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x8845
callq 0x3260
movq (%rsp), %rax
movl 0xc(%rax), %eax
testl %eax, %eax
jle 0x8a10
movq (%rsp), %rcx
movq 0x48(%rcx), %rcx
xorl %r12d, %r12d
leaq 0x30(%rsp), %r15
leaq (%r12,%r12,2), %rbx
shlq $0x4, %rbx
movq 0x18(%rcx,%rbx), %rdx
cmpq %rdx, 0x20(%rcx,%rbx)
je 0x88e2
movq (%r14), %rax
movslq (%rax,%r12,4), %rax
leaq (%rax,%rax,2), %r13
xorl %ebp, %ebp
movslq (%rdx,%rbp,4), %rax
movq (%r14), %rdx
movl (%rdx,%rax,4), %eax
movl %eax, 0x30(%rsp)
movq 0x10(%rsp), %rdx
leaq (%rdx,%r13,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x88b2
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x88c2
movq %r15, %rdx
callq 0xdd36
movq (%rsp), %rax
movq 0x48(%rax), %rcx
incq %rbp
movq 0x18(%rcx,%rbx), %rdx
movq 0x20(%rcx,%rbx), %rax
subq %rdx, %rax
sarq $0x2, %rax
cmpq %rbp, %rax
ja 0x8885
movq (%rsp), %rax
movl 0xc(%rax), %eax
incq %r12
movslq %eax, %rdx
cmpq %rdx, %r12
jl 0x8864
testl %eax, %eax
jle 0x8a10
movl $0x8, %ebx
xorl %r12d, %r12d
movq 0x10(%rsp), %rcx
movq -0x8(%rcx,%rbx), %r14
movq (%rcx,%rbx), %r15
cmpq %r15, %r14
je 0x8948
movq %r15, %rax
subq %r14, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0xd6a1
movq %r14, %rdi
movq %r15, %rsi
callq 0xd784
movq (%rsp), %rax
movl 0xc(%rax), %eax
incq %r12
movslq %eax, %rcx
addq $0x18, %rbx
cmpq %rcx, %r12
jl 0x8901
testl %eax, %eax
jle 0x8a10
movq 0x10(%rsp), %rcx
xorl %r14d, %r14d
leaq 0x48(%rsp), %r15
leaq 0x7bdd(%rip), %r12      # 0x10550
leaq (%r14,%r14,2), %rbp
movq 0x8(%rcx,%rbp,8), %rdx
cmpq (%rcx,%rbp,8), %rdx
je 0x8a01
xorl %ebx, %ebx
movq %r15, %rdi
movl %r14d, %esi
callq 0x3440
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x32e0
movq 0x10(%rsp), %rax
movq (%rax,%rbp,8), %rax
movl (%rax,%rbx,4), %esi
movq %r13, %rdi
callq 0x3440
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3280
movsbl %al, %esi
movq %r13, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31d0
incq %rbx
movq 0x10(%rsp), %rcx
movq 0x8(%rcx,%rbp,8), %rax
subq (%rcx,%rbp,8), %rax
sarq $0x2, %rax
cmpq %rbx, %rax
ja 0x8984
movq (%rsp), %rax
movl 0xc(%rax), %eax
incq %r14
movslq %eax, %rdx
cmpq %rdx, %r14
jl 0x8973
leaq 0x48(%rsp), %rdi
callq 0x3350
leaq 0x10(%rsp), %rdi
callq 0xbe3e
movq 0xd59d(%rip), %rax      # 0x15fc8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x50(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x48(%rsp,%rcx)
callq 0x3220
leaq 0x140(%rsp), %rdi
callq 0x30e0
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8a6c
jmp 0x8a98
movq %rax, %rbx
jmp 0x8abd
jmp 0x8ab0
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
jne 0x8aa5
jmp 0x8abd
jmp 0x8a84
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x8ac7
callq 0x3260
jmp 0x8ac7
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x8abd
callq 0x3260
jmp 0x8abd
jmp 0x8ab0
jmp 0x8ab0
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xbe3e
leaq 0x48(%rsp), %rdi
callq 0x3380
movq %rbx, %rdi
callq 0x3460
nop