// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1e8, %rsp            # imm = 0x1E8
movq %rsi, %rcx
movq %rdi, %r12
leaq 0x48(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x38(%rsp), %rsi
movq %rcx, 0x30(%rsp)
movq %rcx, %rdi
callq 0x3060
leaq 0x38(%rsp), %rsi
callq 0x4b1c
leaq 0x9da6(%rip), %rsi      # 0xe3cd
leaq 0x38(%rsp), %rdi
callq 0x97b4
testb %al, %al
je 0x4650
movq 0x1099c(%rip), %rdi     # 0x14fd8
leaq 0x9d9b(%rip), %rsi      # 0xe3de
callq 0x3270
movq %rax, %rdi
callq 0x3140
leaq 0x38(%rsp), %rsi
movq 0x30(%rsp), %rdi
callq 0x3060
leaq 0x60(%rsp), %rdi
leaq 0x38(%rsp), %rsi
pushq $0x8
popq %rdx
callq 0x3410
leaq 0x60(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0x3180
leaq 0x60(%rsp), %rdi
callq 0x3130
movslq 0xc(%rsp), %rsi
movl %esi, 0xc(%r12)
leaq 0x10(%rsp), %rdx
andw $0x0, (%rdx)
andl $0x0, 0xc(%rdx)
andq $0x0, 0x4(%rdx)
leaq 0x60(%rsp), %rdi
leaq 0xb(%rsp), %rcx
callq 0x97be
leaq 0x30(%r12), %r14
leaq 0x60(%rsp), %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0xa5fc
movq %rbx, %rdi
callq 0xa4e4
movslq 0xc(%rsp), %rsi
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rbx)
movaps %xmm0, 0x10(%rbx)
movaps %xmm0, (%rbx)
leaq 0x10(%rsp), %rdi
leaq 0x60(%rsp), %rdx
leaq 0xb(%rsp), %rcx
callq 0x956a
movq %r12, %r15
leaq 0x48(%r12), %rdi
leaq 0x10(%rsp), %rbx
movq %rdi, 0x58(%rsp)
movq %rbx, %rsi
callq 0xa5aa
movq %rbx, %rdi
callq 0x94f6
leaq 0x60(%rsp), %rdi
callq 0x95c0
andq $0x0, 0x10(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rbx)
leaq 0x38(%rsp), %r12
movq 0x30(%rsp), %rdi
movq %r12, %rsi
callq 0x3060
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4892
movq %r12, %rdi
leaq 0x9c91(%rip), %rsi      # 0xe3ef
xorl %edx, %edx
callq 0x34b0
movq %rax, %rbx
movq %r12, %rdi
leaq 0x9ddd(%rip), %rsi      # 0xe54f
pushq $-0x1
popq %rdx
callq 0x3250
movq %rax, %rbp
movslq %ebx, %rcx
leaq 0x60(%rsp), %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x3290
movq %rbx, %r13
shlq $0x20, %r13
movabsq $0x200000000, %rax      # imm = 0x200000000
addq %rax, %r13
movq 0x60(%rsp), %rdi
callq 0x33a0
movl %eax, %r12d
leaq 0x60(%rsp), %rdi
callq 0x3120
sarq $0x20, %r13
subl %ebx, %ebp
addl $-0x2, %ebp
movslq %ebp, %rcx
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
leaq 0x38(%rsp), %rbp
movq %rbp, %rsi
movq %r13, %rdx
callq 0x3290
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x3300
movq %rbx, %rdi
callq 0x3120
movq %rbp, %rdi
pushq $0x20
popq %rsi
leaq 0x10(%rsp), %rdx
callq 0x4b96
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
shrq $0x5, %rax
movslq %r12d, %rcx
movq (%r14), %rdx
imulq $0x30, %rcx, %rsi
shlq $0x4, %rcx
movl %eax, 0xc(%rdx,%rcx)
movq 0x58(%rsp), %rcx
movq (%rcx), %rcx
leaq (%rcx,%rsi), %rdi
addq $0x18, %rdi
movslq %eax, %rsi
callq 0x9814
xorl %ebx, %ebx
xorl %r13d, %r13d
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq %r13, %rcx
jbe 0x4883
movq (%rax,%rbx), %rdi
callq 0x33a0
movl %eax, %ebp
movq %r15, %rdi
movl %r12d, %esi
movl %eax, %edx
callq 0x4c60
movslq %ebp, %rax
movq (%r14), %rcx
shlq $0x4, %rax
incl 0x8(%rcx,%rax)
incq %r13
addq $0x20, %rbx
jmp 0x483e
leaq 0x10(%rsp), %rdi
callq 0x98a4
jmp 0x4730
leaq 0x10(%rsp), %rdi
callq 0x98ac
leaq 0x38(%rsp), %rdi
callq 0x3120
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x95c0
jmp 0x48f4
jmp 0x48dc
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x3130
jmp 0x48f4
jmp 0x48dc
jmp 0x48dc
movq %rax, %rbx
jmp 0x48f4
jmp 0x48e7
jmp 0x48e7
jmp 0x48e7
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x98ac
leaq 0x38(%rsp), %rdi
callq 0x3120
movq %rbx, %rdi
callq 0x3430