// File: /workspace/github_cpp_makefile_star2_O3/datourat[P]IP-label-for-graph-reachability/Graph.cpp
// Function: Graph::PrintReOrderedGraph(std::vector<int, std::allocator<int>> const&)
void Graph::PrintReOrderedGraph(const vector<int>& order){
	ofstream output((name+"_ReOrdered.gra").c_str());
	if(output.is_open()==false){
		cout << name+"_ReOrdered.gra" << " 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());
	}

	output << "graph_for_greach" << endl;
	output << vsize << endl;
	for(int i=0; i<vsize; i++){
		output << i << ": ";
		for(int j=0; j<ReOrderedGraph[i].size(); j++){
			output << ReOrderedGraph[i][j] << " ";
		}
		output << "#" << 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 0x8297(%rip), %rsi      # 0x10552
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 0x82e6
callq 0x3260
leaq 0xb8(%rsp), %rdi
callq 0x3080
testb %al, %al
jne 0x8390
leaq 0x10(%rsp), %rdi
movq %r12, (%rdi)
movq (%rsp), %rax
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
addq %rsi, %rdx
callq 0x4834
leaq 0x8234(%rip), %rsi      # 0x10552
leaq 0x10(%rsp), %rdi
callq 0x34b0
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0xdc9f(%rip), %rdi      # 0x15fd8
callq 0x32e0
movq %rax, %r15
leaq 0x8219(%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 0x838b
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 0x83c9
callq 0x3260
movq (%rsp), %rax
movl 0xc(%rax), %ecx
testl %ecx, %ecx
jle 0x84d8
movq (%rsp), %rax
movq 0x48(%rax), %rax
xorl %r12d, %r12d
leaq 0x30(%rsp), %r15
leaq (%r12,%r12,2), %r13
shlq $0x4, %r13
movq 0x18(%rax,%r13), %rdx
cmpq %rdx, 0x20(%rax,%r13)
je 0x8466
movq (%r14), %rcx
movslq (%rcx,%r12,4), %rcx
leaq (%rcx,%rcx,2), %rbp
xorl %ebx, %ebx
movslq (%rdx,%rbx,4), %rcx
movq (%r14), %rdx
movl (%rdx,%rcx,4), %ecx
movl %ecx, 0x30(%rsp)
movq 0x10(%rsp), %rdx
leaq (%rdx,%rbp,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x8436
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x8446
movq %r15, %rdx
callq 0xdd36
movq (%rsp), %rax
movq 0x48(%rax), %rax
incq %rbx
movq 0x18(%rax,%r13), %rdx
movq 0x20(%rax,%r13), %rcx
subq %rdx, %rcx
sarq $0x2, %rcx
cmpq %rbx, %rcx
ja 0x8409
movq (%rsp), %rcx
movl 0xc(%rcx), %ecx
incq %r12
movslq %ecx, %rdx
cmpq %rdx, %r12
jl 0x83e8
testl %ecx, %ecx
jle 0x84d8
movl $0x8, %r12d
xorl %r13d, %r13d
movq 0x10(%rsp), %rax
movq -0x8(%rax,%r12), %r14
movq (%rax,%r12), %r15
cmpq %r15, %r14
je 0x84c9
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), %ecx
incq %r13
movslq %ecx, %rax
addq $0x18, %r12
cmpq %rax, %r13
jl 0x8482
leaq 0x7f4e(%rip), %rsi      # 0x1042d
leaq 0x48(%rsp), %r14
movl $0x10, %edx
movq %r14, %rdi
callq 0x32e0
movq 0x48(%rsp), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x3280
movsbl %al, %esi
leaq 0x48(%rsp), %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31d0
movq (%rsp), %rax
movl 0xc(%rax), %esi
leaq 0x48(%rsp), %r14
movq %r14, %rdi
callq 0x3440
movq %rax, %r15
movq (%rax), %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 (%rsp), %rax
cmpl $0x0, 0xc(%rax)
jle 0x8635
xorl %r15d, %r15d
leaq 0x803d(%rip), %r13      # 0x105af
leaq 0x8022(%rip), %rbp      # 0x1059b
movq %r14, %rdi
movl %r15d, %esi
callq 0x3440
movl $0x2, %edx
movq %rax, %rdi
leaq 0x7e0d(%rip), %rsi      # 0x103a0
callq 0x32e0
movq 0x10(%rsp), %rcx
leaq (%r15,%r15,2), %rbx
movq (%rcx,%rbx,8), %rax
cmpq %rax, 0x8(%rcx,%rbx,8)
je 0x85e8
xorl %r12d, %r12d
movl (%rax,%r12,4), %esi
movq %r14, %rdi
callq 0x3440
movl $0x1, %edx
movq %rax, %rdi
movq %rbp, %rsi
callq 0x32e0
incq %r12
movq 0x10(%rsp), %rcx
movq (%rcx,%rbx,8), %rax
movq 0x8(%rcx,%rbx,8), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r12, %rcx
ja 0x85af
movl $0x1, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x32e0
movq 0x48(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3280
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31d0
incq %r15
movq (%rsp), %rax
movslq 0xc(%rax), %rax
cmpq %rax, %r15
jl 0x8579
leaq 0x48(%rsp), %rdi
callq 0x3350
leaq 0x10(%rsp), %rdi
callq 0xbe3e
movq 0xd978(%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 0x8691
jmp 0x86bb
movq %rax, %rbx
jmp 0x86e4
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
jne 0x86c8
jmp 0x86e4
jmp 0x86a7
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x86ee
callq 0x3260
jmp 0x86ee
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x86e4
callq 0x3260
jmp 0x86e4
jmp 0x86d7
jmp 0x86d7
jmp 0x86d7
jmp 0x86d7
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xbe3e
leaq 0x48(%rsp), %rdi
callq 0x3380
movq %rbx, %rdi
callq 0x3460