// File: /workspace/github_cpp_makefile_star2_O2/datourat[P]IP-label-for-graph-reachability/Graph.cpp
// Function: Graph::PrintMapGraph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void Graph::PrintMapGraph(const string& filename){
	ofstream output(filename.c_str());
	if(output.is_open()==false){
		cout << filename << " is not found." << endl;
		quit();
	}
	
	vector<int> indexmap(vsize, 0);
	for(int i=0; i<vsize; i++){
		indexmap[i]=vl[i].topoID-1;
	}
	ofstream indexmapout((name+"_indexmap.txt").c_str());
	for(int i=0; i<vsize; i++){
		indexmapout << i << "\t" << indexmap[i] << endl;
	}
	indexmapout.close();

	vector< vector<int> > SortedGraph(vsize, vector<int>());
	int u, v;
	for(int i=0; i<vsize; i++){
		u=indexmap[i];
		for(int j=0; j<graph[i].outList.size(); j++){
			v=indexmap[graph[i].outList[j]];
			SortedGraph[u].push_back(v);
		}
	}

	output << "graph_for_greach" << endl;
	output << vsize << endl;
	for(int i=0; i<vsize; i++){
		output << i << ": ";
		for(int j=0; j<SortedGraph[i].size(); j++){
			output << SortedGraph[i][j] << " ";
		}
		output << "#" << endl;
	}


	output.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x458, %rsp            # imm = 0x458
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rsi
leaq 0x58(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x32b0
leaq 0xc8(%rsp), %rdi
callq 0x3090
testb %al, %al
jne 0x674f
movq 0xe8ad(%rip), %rdi      # 0x14fd8
movq %r14, %rsi
callq 0x3220
leaq 0x7d99(%rip), %rsi      # 0xe4d3
movq %rax, %rdi
callq 0x3270
movq %rax, %rdi
callq 0x3140
callq 0x41b8
movslq 0xc(%rbx), %rsi
leaq 0x258(%rsp), %rdx
andl $0x0, (%rdx)
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rcx
callq 0x9b68
movq 0x30(%rbx), %rax
movq 0x28(%rsp), %rcx
addq $0x4, %rax
xorl %edx, %edx
movslq 0xc(%rbx), %rsi
cmpq %rsi, %rdx
jge 0x6795
movl (%rax), %esi
decl %esi
movl %esi, (%rcx,%rdx,4)
incq %rdx
addq $0x10, %rax
jmp 0x677c
leaq 0x10(%rbx), %rsi
leaq 0x7d42(%rip), %rdx      # 0xe4e2
leaq 0x8(%rsp), %rdi
callq 0x4119
movq 0x8(%rsp), %rsi
leaq 0x258(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x32b0
leaq 0x8(%rsp), %rdi
callq 0x3120
xorl %r14d, %r14d
leaq 0x258(%rsp), %r15
leaq 0x7d15(%rip), %r12      # 0xe4f0
movslq 0xc(%rbx), %rax
cmpq %rax, %r14
jge 0x6818
movq %r15, %rdi
movl %r14d, %esi
callq 0x3420
movq %rax, %rdi
movq %r12, %rsi
callq 0x3270
movq 0x28(%rsp), %rcx
movl (%rcx,%r14,4), %esi
movq %rax, %rdi
callq 0x3420
movq %rax, %rdi
callq 0x3140
incq %r14
jmp 0x67db
leaq 0x258(%rsp), %rdi
callq 0x3360
movslq 0xc(%rbx), %rsi
xorps %xmm0, %xmm0
leaq 0x40(%rsp), %rdx
movaps %xmm0, (%rdx)
andq $0x0, 0x10(%rdx)
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rcx
callq 0x9dc4
leaq 0x40(%rsp), %r14
movq %r14, %rdi
callq 0xa406
xorl %r15d, %r15d
movslq 0xc(%rbx), %rax
cmpq %rax, %r15
jge 0x68b8
movq 0x28(%rsp), %rax
movslq (%rax,%r15,4), %rax
imulq $0x30, %r15, %r12
imulq $0x18, %rax, %r13
xorl %ebp, %ebp
movq 0x48(%rbx), %rcx
movq 0x18(%rcx,%r12), %rax
movq 0x20(%rcx,%r12), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %rbp, %rcx
jbe 0x68b3
movslq (%rax,%rbp,4), %rax
movq 0x28(%rsp), %rcx
movl (%rcx,%rax,4), %eax
movl %eax, 0x40(%rsp)
movq 0x8(%rsp), %rdi
addq %r13, %rdi
movq %r14, %rsi
callq 0x9a0e
incq %rbp
jmp 0x6874
incq %r15
jmp 0x6858
leaq 0x7b0e(%rip), %rsi      # 0xe3cd
leaq 0x58(%rsp), %rdi
callq 0x3270
movq %rax, %rdi
callq 0x3140
movl 0xc(%rbx), %esi
leaq 0x58(%rsp), %rdi
callq 0x3420
movq %rax, %rdi
callq 0x3140
xorl %r14d, %r14d
leaq 0x58(%rsp), %r15
leaq 0x7c46(%rip), %r13      # 0xe53b
movslq 0xc(%rbx), %rax
cmpq %rax, %r14
jge 0x696f
movq %r15, %rdi
movl %r14d, %esi
callq 0x3420
movq %rax, %rdi
leaq 0x7a8d(%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 0x6953
movl (%rax,%rbp,4), %esi
movq %r15, %rdi
callq 0x3420
movq %rax, %rdi
movq %r13, %rsi
callq 0x3270
incq %rbp
jmp 0x691e
movq %r15, %rdi
leaq 0x7bf2(%rip), %rsi      # 0xe54f
callq 0x3270
movq %rax, %rdi
callq 0x3140
incq %r14
jmp 0x68f5
leaq 0x58(%rsp), %rdi
callq 0x3360
leaq 0x8(%rsp), %rdi
callq 0x95d6
leaq 0x258(%rsp), %rdi
callq 0x3380
leaq 0x28(%rsp), %rdi
callq 0xa406
leaq 0x58(%rsp), %rdi
callq 0x3380
addq $0x458, %rsp            # imm = 0x458
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0xa406
jmp 0x69fa
jmp 0x69e6
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3120
jmp 0x6a07
movq %rax, %rbx
jmp 0x6a07
jmp 0x69dd
movq %rax, %rbx
jmp 0x6a11
jmp 0x69ed
jmp 0x69ed
movq %rax, %rbx
jmp 0x69fa
jmp 0x69ed
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x95d6
leaq 0x258(%rsp), %rdi
callq 0x3380
leaq 0x28(%rsp), %rdi
callq 0xa406
leaq 0x58(%rsp), %rdi
callq 0x3380
movq %rbx, %rdi
callq 0x3430
nop