// File: /workspace/github_cpp_makefile_star2_O2/metastableB[P]Program-Dependence-Graph-Creator/./pdg.cpp
// Function: PDG::make_variable_map()
bool PDG::make_variable_map(){
	if(!valid) { std::cout << "INTERNAL ERROR! EXITING\n"; return false;}
	std::string s;
	//std::cout << "RUNNING";
	in.clear();
	in.seekg(0,std::ios::beg);
	for(int i = 1; i <= total_lines; i++){
		/*
		 * If its an assignment statement. Update the assignment value
		 * else check any variable has been used
		 * this variable should be defined previously
		 * update dependency of this graph
		 */
		 getline(in,s);
		 //std::cout << s << std::endl;
		 auto &it = program_map[i];
		 auto variables = get_var(s,it);
		 if(variables.empty()) continue;
		 //std::cout << "got " << variables[0] << std::endl;
		 if(it.type == Line_Type::ASSIGNMENT){
		 	variable_map[variables[0]] = it.line_no;
		 	auto i = variables.begin();
		 	i++;
		 	while(i!= variables.end()) {g_ddg[it.line_no][variable_map[*i]] = 1;i++;}
		 } else {
		 	for(auto v : variables)
		 		g_ddg[it.line_no][variable_map[v]] = 1;
		 }
	}
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movb 0x210(%rdi), %al
movb %al, 0xf(%rsp)
testb %al, %al
je 0x32d3
movq %rdi, %r14
leaq 0x48(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq (%rdi), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
xorl %esi, %esi
callq 0x2310
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2280
leaq 0x230(%r14), %rax
movq %rax, 0x10(%rsp)
pushq $0x1
popq %rbx
leaq 0x38(%rsp), %r15
leaq 0x58(%rsp), %r12
movq %r14, 0x18(%rsp)
movslq 0x214(%r14), %rax
cmpq %rax, %rbx
jg 0x32e8
movq %r14, %rdi
movq %r15, %rsi
callq 0x2090
imulq $0xc, %rbx, %r13
addq 0x218(%r14), %r13
movq %r12, %rdi
movq %r15, %rsi
callq 0x22a0
movq (%r13), %rcx
movl 0x8(%r13), %r8d
leaq 0x20(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x3352
movq %r12, %rdi
callq 0x2100
movq 0x20(%rsp), %r12
movq 0x28(%rsp), %rbp
cmpq %rbp, %r12
je 0x32b2
cmpl $0x0, 0x8(%r13)
je 0x3257
cmpq %rbp, %r12
je 0x32b2
leaq 0x78(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x22a0
movq %rbx, %r15
movq 0x18(%rsp), %rax
movq 0x268(%rax), %rax
movslq (%r13), %rcx
movq (%rax,%rcx,8), %rbx
movq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x3ad8
movslq (%rax), %rax
movl $0x1, (%rbx,%rax,4)
movq %r14, %rdi
callq 0x2100
addq $0x20, %r12
movq %r15, %rbx
jmp 0x31ff
movq %rbx, %r15
movl (%r13), %ebx
movq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x3ad8
movl %ebx, (%rax)
movq 0x20(%rsp), %r12
addq $0x20, %r12
movq %r15, %rbx
cmpq 0x28(%rsp), %r12
je 0x32b2
movq 0x18(%rsp), %rax
movq 0x268(%rax), %rax
movslq (%r13), %rcx
movq (%rax,%rcx,8), %rbp
movq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x3ad8
movslq (%rax), %rax
movl $0x1, (%rbp,%rax,4)
addq $0x20, %r12
jmp 0x3279
leaq 0x20(%rsp), %rdi
callq 0x3b3e
incq %rbx
leaq 0x38(%rsp), %r15
leaq 0x58(%rsp), %r12
movq 0x18(%rsp), %r14
jmp 0x3194
movq 0x4cfe(%rip), %rdi      # 0x7fd8
leaq 0x1e5d(%rip), %rsi      # 0x513e
callq 0x21b0
jmp 0x32f2
leaq 0x38(%rsp), %rdi
callq 0x2100
movb 0xf(%rsp), %al
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x330e
jmp 0x3324
jmp 0x330e
movq %rax, %rbx
jmp 0x3340
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x2100
jmp 0x3340
jmp 0x3324
movq %rax, %rbx
jmp 0x3336
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x2100
leaq 0x20(%rsp), %rdi
callq 0x3b3e
leaq 0x38(%rsp), %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x2330