// File: /workspace/github_cpp_makefile_star2_O2/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
movq %rdi, %rbx
leaq 0x10(%rdi), %r15
leaq 0x781c(%rip), %rdx      # 0xe514
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 0x6d7f
leaq 0x77d9(%rip), %rdx      # 0xe514
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x4119
movq 0xe289(%rip), %rdi      # 0x14fd8
leaq 0x8(%rsp), %rsi
callq 0x3220
leaq 0x77a1(%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 0x6e18
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 0x6e0e
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 0x6dd1
movq 0x28(%rsp), %rcx
incq %rcx
jmp 0x6db1
pushq $0x8
popq %r14
xorl %r15d, %r15d
movslq %eax, %rcx
cmpq %rcx, %r15
jge 0x6e46
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 0x6e1f
xorl %r14d, %r14d
leaq 0x48(%rsp), %r15
leaq 0x769b(%rip), %r12      # 0xe4f0
cltq
cmpq %rax, %r14
jge 0x6eb8
imulq $0x18, %r14, %r13
xorl %ebp, %ebp
movq 0x8(%rsp), %rax
movq 0x8(%rax,%r13), %rcx
subq (%rax,%r13), %rcx
sarq $0x2, %rcx
cmpq %rbp, %rcx
jbe 0x6eb0
movq %r15, %rdi
movl %r14d, %esi
callq 0x3420
movq %rax, %rdi
movq %r12, %rsi
callq 0x3270
movq 0x8(%rsp), %rcx
movq (%rcx,%r13), %rcx
movl (%rcx,%rbp,4), %esi
movq %rax, %rdi
callq 0x3420
movq %rax, %rdi
callq 0x3140
incq %rbp
jmp 0x6e62
incq %r14
movl 0xc(%rbx), %eax
jmp 0x6e55
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 0x6eea
movq %rax, %rbx
jmp 0x6f2f
jmp 0x6f22
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xa406
jmp 0x6f2f
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3120
jmp 0x6f39
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3120
jmp 0x6f2f
jmp 0x6f22
jmp 0x6f22
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x95d6
leaq 0x48(%rsp), %rdi
callq 0x3380
movq %rbx, %rdi
callq 0x3430
nop