// File: datourat[P]IP-label-for-graph-reachability/Graph.cpp
// Function: Graph::readGraph(std::istream&)
void Graph::readGraph(istream& in) {
	string buf;
	getline(in, buf);

	strTrimRight(buf);
	if (buf != "graph_for_greach") {
		cout << "BAD FILE FORMAT!" << endl;
	//	exit(0);
	}
	
	int n;
	getline(in, buf);
	istringstream(buf) >> n;
	// initialize
	vsize = n;
	vl = VertexList(n, Vertex());
	graph = GRA(n, In_OutList());	
/*
	for (int i = 0; i < n; i++)
		addVertex(i);
*/
//	for(int i=0; i<vsize; i++)
//		vl[i].id=i;

	int begin, end;
	int sid, tid;
	vector<string> neighbors;
	while (getline(in, buf)) {
//		istringstream(buf) >> sid;
		begin = buf.find(":");
		end = buf.find_last_of("#");
		sid = atoi((buf.substr(0, begin)).c_str());
		buf = buf.substr(begin+2,end-begin-2);
		split(buf, ' ', neighbors);
		vl[sid].outdegree=neighbors.size();
		graph[sid].outList.reserve(vl[sid].outdegree);
		for (int i = 0; i < neighbors.size(); i++) {
			tid = atoi(neighbors[i].c_str());
			addEdge(sid,tid);
			vl[tid].indegree++;
		}
		neighbors.clear();
	}
}

// Assembly:
subq $0x358, %rsp            # imm = 0x358
movq %rdi, 0x350(%rsp)
movq %rsi, 0x348(%rsp)
movq 0x350(%rsp), %rax
movq %rax, 0x98(%rsp)
leaq 0x328(%rsp), %rdi
movq %rdi, 0xa0(%rsp)
callq 0x33e0
movq 0xa0(%rsp), %rsi
movq 0x348(%rsp), %rdi
callq 0x3070
jmp 0x5543
movq 0x98(%rsp), %rdi
leaq 0x328(%rsp), %rsi
callq 0x5f20
jmp 0x555a
leaq 0x22e6c(%rip), %rsi     # 0x283cd
leaq 0x328(%rsp), %rdi
callq 0x11c00
movb %al, 0x97(%rsp)
jmp 0x5577
movb 0x97(%rsp), %al
testb $0x1, %al
jne 0x5584
jmp 0x55d2
movq 0x2fa4d(%rip), %rdi     # 0x34fd8
leaq 0x22e4c(%rip), %rsi     # 0x283de
callq 0x32c0
movq %rax, 0x88(%rsp)
jmp 0x55a1
movq 0x88(%rsp), %rdi
movq 0x2fa18(%rip), %rsi     # 0x34fc8
callq 0x3300
jmp 0x55b7
jmp 0x55d2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x320(%rsp)
movl %eax, 0x31c(%rsp)
jmp 0x5acc
movq 0x348(%rsp), %rdi
leaq 0x328(%rsp), %rsi
callq 0x3070
jmp 0x55e9
leaq 0x198(%rsp), %rdi
leaq 0x328(%rsp), %rsi
movl $0x8, %edx
callq 0x34b0
jmp 0x5605
leaq 0x198(%rsp), %rdi
leaq 0x318(%rsp), %rsi
callq 0x11c30
jmp 0x561c
leaq 0x198(%rsp), %rdi
callq 0x3150
movq 0x98(%rsp), %rax
movl 0x318(%rsp), %ecx
movl %ecx, 0xc(%rax)
movslq 0x318(%rsp), %rax
movq %rax, 0x80(%rsp)
leaq 0x170(%rsp), %rdi
callq 0x11c60
jmp 0x565a
leaq 0x16f(%rsp), %rdi
movq %rdi, 0x78(%rsp)
callq 0x112e0
movq 0x80(%rsp), %rsi
movq 0x78(%rsp), %rcx
leaq 0x180(%rsp), %rdi
leaq 0x170(%rsp), %rdx
callq 0x11c90
jmp 0x5690
movq 0x98(%rsp), %rdi
addq $0x30, %rdi
leaq 0x180(%rsp), %rsi
movq %rsi, 0x58(%rsp)
callq 0x11240
movq 0x58(%rsp), %rdi
callq 0x11280
leaq 0x16f(%rsp), %rdi
callq 0x11370
movslq 0x318(%rsp), %rax
movq %rax, 0x60(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x140(%rsp)
movaps %xmm0, 0x130(%rsp)
movaps %xmm0, 0x120(%rsp)
leaq 0x120(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq 0x11380
leaq 0x11f(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq 0x113b0
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq 0x70(%rsp), %rcx
leaq 0x150(%rsp), %rdi
callq 0x113c0
jmp 0x572f
movq 0x98(%rsp), %rdi
addq $0x48, %rdi
leaq 0x150(%rsp), %rsi
callq 0x111a0
leaq 0x150(%rsp), %rdi
callq 0x111e0
leaq 0x11f(%rsp), %rdi
callq 0x11440
leaq 0x120(%rsp), %rdi
callq 0x11450
leaq 0xf0(%rsp), %rdi
callq 0x11d10
movq 0x348(%rsp), %rdi
leaq 0x328(%rsp), %rsi
callq 0x3070
movq %rax, 0x50(%rsp)
jmp 0x5798
movq 0x50(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x3380
movb %al, 0x4f(%rsp)
jmp 0x57b2
movb 0x4f(%rsp), %al
testb $0x1, %al
jne 0x57bf
jmp 0x5aaa
leaq 0x22c29(%rip), %rsi     # 0x283ef
xorl %eax, %eax
movl %eax, %edx
movq %rdx, 0x40(%rsp)
leaq 0x328(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x3580
movq 0x38(%rsp), %rdi
movl %eax, 0x118(%rsp)
leaq 0x22d5b(%rip), %rsi     # 0x2854f
movq $-0x1, %rdx
callq 0x32a0
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
movl %eax, 0x114(%rsp)
movslq 0x118(%rsp), %rcx
leaq 0xd0(%rsp), %rdi
callq 0x32e0
jmp 0x5828
leaq 0xd0(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x3120
movq %rax, %rdi
callq 0x3440
movq 0x30(%rsp), %rdi
movl %eax, 0x110(%rsp)
callq 0x31b0
movl 0x118(%rsp), %ecx
movl %ecx, %eax
addl $0x2, %eax
movslq %eax, %rdx
movl 0x114(%rsp), %eax
subl %ecx, %eax
addl $-0x2, %eax
movslq %eax, %rcx
leaq 0xb0(%rsp), %rdi
leaq 0x328(%rsp), %rsi
callq 0x32e0
jmp 0x5888
leaq 0x328(%rsp), %rdi
movq %rdi, 0x28(%rsp)
leaq 0xb0(%rsp), %rsi
movq %rsi, 0x20(%rsp)
callq 0x3370
movq 0x20(%rsp), %rdi
callq 0x31b0
movq 0x28(%rsp), %rdi
movl $0x20, %esi
leaq 0xf0(%rsp), %rdx
callq 0x6000
jmp 0x58ca
leaq 0xf0(%rsp), %rdi
callq 0x11d20
movq 0x98(%rsp), %rdi
movl %eax, 0xc(%rsp)
addq $0x30, %rdi
movq %rdi, 0x10(%rsp)
movslq 0x110(%rsp), %rsi
callq 0x11d40
movl 0xc(%rsp), %ecx
movq 0x98(%rsp), %rdi
movl %ecx, 0xc(%rax)
addq $0x48, %rdi
movslq 0x110(%rsp), %rsi
callq 0x11d60
movq 0x10(%rsp), %rdi
addq $0x18, %rax
movq %rax, 0x18(%rsp)
movslq 0x110(%rsp), %rsi
callq 0x11d40
movq 0x18(%rsp), %rdi
movslq 0xc(%rax), %rsi
callq 0x11d80
jmp 0x5944
movl $0x0, 0xac(%rsp)
movslq 0xac(%rsp), %rax
movq %rax, (%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x11d20
movq %rax, %rcx
movq (%rsp), %rax
cmpq %rcx, %rax
jae 0x5a98
movslq 0xac(%rsp), %rsi
leaq 0xf0(%rsp), %rdi
callq 0x11e90
movq %rax, %rdi
callq 0x3120
movq %rax, %rdi
callq 0x3440
movq 0x98(%rsp), %rdi
movl %eax, 0x10c(%rsp)
movl 0x110(%rsp), %esi
movl 0x10c(%rsp), %edx
callq 0x61a0
jmp 0x59c1
movq 0x98(%rsp), %rdi
addq $0x30, %rdi
movslq 0x10c(%rsp), %rsi
callq 0x11d40
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
movl 0xac(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xac(%rsp)
jmp 0x594f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x320(%rsp)
movl %eax, 0x31c(%rsp)
leaq 0x198(%rsp), %rdi
callq 0x3150
jmp 0x5acc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x320(%rsp)
movl %eax, 0x31c(%rsp)
leaq 0x16f(%rsp), %rdi
callq 0x11370
jmp 0x5acc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x320(%rsp)
movl %eax, 0x31c(%rsp)
leaq 0x11f(%rsp), %rdi
callq 0x11440
leaq 0x120(%rsp), %rdi
callq 0x11450
jmp 0x5acc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x320(%rsp)
movl %eax, 0x31c(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x11ed0
jmp 0x5acc
leaq 0xf0(%rsp), %rdi
callq 0x11eb0
jmp 0x577c
leaq 0xf0(%rsp), %rdi
callq 0x11ed0
leaq 0x328(%rsp), %rdi
callq 0x31b0
addq $0x358, %rsp            # imm = 0x358
retq
leaq 0x328(%rsp), %rdi
callq 0x31b0
movq 0x320(%rsp), %rdi
callq 0x34e0
nopw %cs:(%rax,%rax)