// File: /workspace/github_cpp_makefile_star2_O2/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
movq %rdi, %rbx
leaq 0x10(%rdi), %r15
leaq 0x7aac(%rip), %rdx      # 0xe4f2
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x4119
movq (%r12), %rsi
leaq 0x48(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x32b0
leaq 0x8(%rsp), %rdi
callq 0x3120
leaq 0xb8(%rsp), %rdi
callq 0x3090
testb %al, %al
jne 0x6acd
leaq 0x7a69(%rip), %rdx      # 0xe4f2
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x4119
movq 0xe53b(%rip), %rdi      # 0x14fd8
leaq 0x8(%rsp), %rsi
callq 0x3220
leaq 0x7a53(%rip), %rsi      # 0xe501
movq %rax, %rdi
callq 0x3270
movq %rax, %rdi
callq 0x3140
leaq 0x8(%rsp), %rdi
callq 0x3120
callq 0x41b8
movslq 0xc(%rbx), %rsi
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %rdx
movaps %xmm0, (%rdx)
andq $0x0, 0x10(%rdx)
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rcx
callq 0x9dc4
leaq 0x30(%rsp), %r15
movq %r15, %rdi
callq 0xa406
xorl %ecx, %ecx
movslq 0xc(%rbx), %rax
cmpq %rax, %rcx
jge 0x6b66
movq (%r14), %rax
movslq (%rax,%rcx,4), %rax
movq %rcx, 0x28(%rsp)
imulq $0x30, %rcx, %r13
imulq $0x18, %rax, %rbp
xorl %r12d, %r12d
movq 0x48(%rbx), %rcx
movq 0x18(%rcx,%r13), %rax
movq 0x20(%rcx,%r13), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r12, %rcx
jbe 0x6b5c
movslq (%rax,%r12,4), %rax
movq (%r14), %rcx
movl (%rcx,%rax,4), %eax
movl %eax, 0x30(%rsp)
movq 0x8(%rsp), %rdi
addq %rbp, %rdi
movq %r15, %rsi
callq 0x9a0e
incq %r12
jmp 0x6b1f
movq 0x28(%rsp), %rcx
incq %rcx
jmp 0x6aff
pushq $0x8
popq %r14
xorl %r15d, %r15d
cltq
cmpq %rax, %r15
jge 0x6b93
movq 0x8(%rsp), %rax
movq -0x8(%rax,%r14), %rdi
movq (%rax,%r14), %rsi
callq 0xad95
incq %r15
movl 0xc(%rbx), %eax
addq $0x18, %r14
jmp 0x6b6d
leaq 0x7833(%rip), %rsi      # 0xe3cd
leaq 0x48(%rsp), %rdi
callq 0x3270
movq %rax, %rdi
callq 0x3140
movl 0xc(%rbx), %esi
leaq 0x48(%rsp), %rdi
callq 0x3420
movq %rax, %rdi
callq 0x3140
xorl %r14d, %r14d
leaq 0x48(%rsp), %r15
leaq 0x796b(%rip), %r13      # 0xe53b
movslq 0xc(%rbx), %rax
cmpq %rax, %r14
jge 0x6c4a
movq %r15, %rdi
movl %r14d, %esi
callq 0x3420
movq %rax, %rdi
leaq 0x77b2(%rip), %rsi      # 0xe3a0
callq 0x3270
imulq $0x18, %r14, %r12
xorl %ebp, %ebp
movq 0x8(%rsp), %rcx
movq (%rcx,%r12), %rax
movq 0x8(%rcx,%r12), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %rbp, %rcx
jbe 0x6c2e
movl (%rax,%rbp,4), %esi
movq %r15, %rdi
callq 0x3420
movq %rax, %rdi
movq %r13, %rsi
callq 0x3270
incq %rbp
jmp 0x6bf9
movq %r15, %rdi
leaq 0x7917(%rip), %rsi      # 0xe54f
callq 0x3270
movq %rax, %rdi
callq 0x3140
incq %r14
jmp 0x6bd0
leaq 0x48(%rsp), %rdi
callq 0x3360
leaq 0x8(%rsp), %rdi
callq 0x95d6
leaq 0x48(%rsp), %rdi
callq 0x3380
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6c7c
movq %rax, %rbx
jmp 0x6cc3
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xa406
jmp 0x6cc3
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3120
jmp 0x6ccd
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3120
jmp 0x6cc3
jmp 0x6cb6
jmp 0x6cb6
jmp 0x6cb6
jmp 0x6cb6
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x95d6
leaq 0x48(%rsp), %rdi
callq 0x3380
movq %rbx, %rdi
callq 0x3430
nop