// File: 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:
subq $0x568, %rsp            # imm = 0x568
movq %rdi, 0x560(%rsp)
movq %rsi, 0x558(%rsp)
movq 0x560(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x558(%rsp), %rdi
callq 0x3120
movq %rax, %rsi
leaq 0x358(%rsp), %rdi
movq %rdi, 0x98(%rsp)
movl $0x10, %edx
callq 0x3320
movq 0x98(%rsp), %rdi
callq 0x3220
movb %al, 0xa3(%rsp)
jmp 0x9e77
movb 0xa3(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x9efc
movq 0x558(%rsp), %rsi
movq 0x2b141(%rip), %rdi     # 0x34fd8
callq 0x3270
movq %rax, 0x88(%rsp)
jmp 0x9ea6
movq 0x88(%rsp), %rdi
leaq 0x1e61e(%rip), %rsi     # 0x284d3
callq 0x32c0
movq %rax, 0x80(%rsp)
jmp 0x9ec4
movq 0x80(%rsp), %rdi
movq 0x2b0f5(%rip), %rsi     # 0x34fc8
callq 0x3300
jmp 0x9eda
callq 0x4da0
jmp 0x9ee1
jmp 0x9efc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
jmp 0xa55c
movq 0x90(%rsp), %rax
movslq 0xc(%rax), %rax
movq %rax, 0x70(%rsp)
movl $0x0, 0x32c(%rsp)
leaq 0x32b(%rsp), %rdi
movq %rdi, 0x78(%rsp)
callq 0x12990
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rcx
leaq 0x330(%rsp), %rdi
leaq 0x32c(%rsp), %rdx
callq 0x12bf0
jmp 0x9f4b
leaq 0x32b(%rsp), %rdi
callq 0x12a20
movl $0x0, 0x324(%rsp)
movq 0x90(%rsp), %rcx
movl 0x324(%rsp), %eax
cmpl 0xc(%rcx), %eax
jge 0x9fee
movq 0x90(%rsp), %rdi
addq $0x30, %rdi
movslq 0x324(%rsp), %rsi
callq 0x11d40
movl 0x4(%rax), %eax
subl $0x1, %eax
movl %eax, 0x6c(%rsp)
movslq 0x324(%rsp), %rsi
leaq 0x330(%rsp), %rdi
callq 0x12960
movl 0x6c(%rsp), %ecx
movl %ecx, (%rax)
movl 0x324(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x324(%rsp)
jmp 0x9f63
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
leaq 0x32b(%rsp), %rdi
callq 0x12a20
jmp 0xa55c
movq 0x90(%rsp), %rsi
addq $0x10, %rsi
leaq 0x1e4e1(%rip), %rdx     # 0x284e2
leaq 0x100(%rsp), %rdi
callq 0x4c30
jmp 0xa010
leaq 0x100(%rsp), %rdi
callq 0x3120
movq %rax, %rsi
leaq 0x120(%rsp), %rdi
movl $0x10, %edx
callq 0x3320
jmp 0xa034
leaq 0x100(%rsp), %rdi
callq 0x31b0
movl $0x0, 0xfc(%rsp)
movq 0x90(%rsp), %rcx
movl 0xfc(%rsp), %eax
cmpl 0xc(%rcx), %eax
jge 0xa142
movl 0xfc(%rsp), %esi
leaq 0x120(%rsp), %rdi
callq 0x34d0
movq %rax, 0x60(%rsp)
jmp 0xa07f
movq 0x60(%rsp), %rdi
leaq 0x1e465(%rip), %rsi     # 0x284f0
callq 0x32c0
movq %rax, 0x58(%rsp)
jmp 0xa097
movslq 0xfc(%rsp), %rsi
leaq 0x330(%rsp), %rdi
callq 0x12960
movq 0x58(%rsp), %rdi
movl (%rax), %esi
callq 0x34d0
movq %rax, 0x50(%rsp)
jmp 0xa0bf
movq 0x50(%rsp), %rdi
movq 0x2aefd(%rip), %rsi     # 0x34fc8
callq 0x3300
jmp 0xa0d2
jmp 0xa0d4
movl 0xfc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xfc(%rsp)
jmp 0xa04c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
jmp 0xa54f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
leaq 0x100(%rsp), %rdi
callq 0x31b0
jmp 0xa54f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
jmp 0xa542
leaq 0x120(%rsp), %rdi
callq 0x3400
jmp 0xa151
movq 0x90(%rsp), %rax
movslq 0xc(%rax), %rax
movq %rax, 0x38(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0xc0(%rsp)
movq $0x0, 0xd0(%rsp)
leaq 0xc0(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x11160
leaq 0xbf(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x13260
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq 0x48(%rsp), %rcx
leaq 0xe0(%rsp), %rdi
callq 0x13270
jmp 0xa1bb
leaq 0xbf(%rsp), %rdi
callq 0x132f0
leaq 0xc0(%rsp), %rdi
callq 0x115a0
movl $0x0, 0xb0(%rsp)
movq 0x90(%rsp), %rcx
movl 0xb0(%rsp), %eax
cmpl 0xc(%rcx), %eax
jge 0xa35a
movslq 0xb0(%rsp), %rsi
leaq 0x330(%rsp), %rdi
callq 0x12960
movl (%rax), %eax
movl %eax, 0xb8(%rsp)
movl $0x0, 0xac(%rsp)
movq 0x90(%rsp), %rdi
movslq 0xac(%rsp), %rax
movq %rax, 0x30(%rsp)
addq $0x48, %rdi
movslq 0xb0(%rsp), %rsi
callq 0x11d60
movq %rax, %rdi
addq $0x18, %rdi
callq 0x4c10
movq %rax, %rcx
movq 0x30(%rsp), %rax
cmpq %rcx, %rax
jae 0xa342
movq 0x90(%rsp), %rdi
addq $0x48, %rdi
movslq 0xb0(%rsp), %rsi
callq 0x11d60
movq %rax, %rdi
addq $0x18, %rdi
movslq 0xac(%rsp), %rsi
callq 0x12960
movslq (%rax), %rsi
leaq 0x330(%rsp), %rdi
callq 0x12960
movl (%rax), %eax
movl %eax, 0xb4(%rsp)
movslq 0xb8(%rsp), %rsi
leaq 0xe0(%rsp), %rdi
callq 0x4bf0
movq %rax, %rdi
leaq 0xb4(%rsp), %rsi
callq 0x12660
jmp 0xa2d1
jmp 0xa2d3
movl 0xac(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xac(%rsp)
jmp 0xa221
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
leaq 0xbf(%rsp), %rdi
callq 0x132f0
leaq 0xc0(%rsp), %rdi
callq 0x115a0
jmp 0xa542
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x11480
jmp 0xa542
jmp 0xa344
movl 0xb0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xb0(%rsp)
jmp 0xa1e0
leaq 0x1e06c(%rip), %rsi     # 0x283cd
leaq 0x358(%rsp), %rdi
callq 0x32c0
movq %rax, 0x28(%rsp)
jmp 0xa375
movq 0x28(%rsp), %rdi
movq 0x2ac47(%rip), %rsi     # 0x34fc8
callq 0x3300
jmp 0xa388
movq 0x90(%rsp), %rax
movl 0xc(%rax), %esi
leaq 0x358(%rsp), %rdi
callq 0x34d0
movq %rax, 0x20(%rsp)
jmp 0xa3a7
movq 0x20(%rsp), %rdi
movq 0x2ac15(%rip), %rsi     # 0x34fc8
callq 0x3300
jmp 0xa3ba
movl $0x0, 0xa8(%rsp)
movq 0x90(%rsp), %rcx
movl 0xa8(%rsp), %eax
cmpl 0xc(%rcx), %eax
jge 0xa4f7
movl 0xa8(%rsp), %esi
leaq 0x358(%rsp), %rdi
callq 0x34d0
movq %rax, 0x18(%rsp)
jmp 0xa3f8
movq 0x18(%rsp), %rdi
leaq 0x1dfa8(%rip), %rsi     # 0x283ac
callq 0x32c0
jmp 0xa40b
movl $0x0, 0xa4(%rsp)
movslq 0xa4(%rsp), %rax
movq %rax, 0x10(%rsp)
movslq 0xa8(%rsp), %rsi
leaq 0xe0(%rsp), %rdi
callq 0x4bf0
movq %rax, %rdi
callq 0x4c10
movq %rax, %rcx
movq 0x10(%rsp), %rax
cmpq %rcx, %rax
jae 0xa4b3
movslq 0xa8(%rsp), %rsi
leaq 0xe0(%rsp), %rdi
callq 0x4bf0
movq %rax, %rdi
movslq 0xa4(%rsp), %rsi
callq 0x12960
movl (%rax), %esi
leaq 0x358(%rsp), %rdi
callq 0x34d0
movq %rax, 0x8(%rsp)
jmp 0xa488
movq 0x8(%rsp), %rdi
leaq 0x1e0a7(%rip), %rsi     # 0x2853b
callq 0x32c0
jmp 0xa49b
jmp 0xa49d
movl 0xa4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xa4(%rsp)
jmp 0xa416
leaq 0x1e095(%rip), %rsi     # 0x2854f
leaq 0x358(%rsp), %rdi
callq 0x32c0
movq %rax, (%rsp)
jmp 0xa4cd
movq (%rsp), %rdi
movq 0x2aaf0(%rip), %rsi     # 0x34fc8
callq 0x3300
jmp 0xa4df
jmp 0xa4e1
movl 0xa8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xa8(%rsp)
jmp 0xa3c5
leaq 0x358(%rsp), %rdi
callq 0x3400
jmp 0xa506
leaq 0xe0(%rsp), %rdi
callq 0x11480
leaq 0x120(%rsp), %rdi
callq 0x3420
leaq 0x330(%rsp), %rdi
callq 0x115a0
leaq 0x358(%rsp), %rdi
callq 0x3420
addq $0x568, %rsp            # imm = 0x568
retq
leaq 0x120(%rsp), %rdi
callq 0x3420
leaq 0x330(%rsp), %rdi
callq 0x115a0
leaq 0x358(%rsp), %rdi
callq 0x3420
movq 0x350(%rsp), %rdi
callq 0x34e0
nopw %cs:(%rax,%rax)