// File: /workspace/github_cpp_makefile_star2_O3/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 $0x88, %rsp
movb 0x210(%rdi), %bl
testb %bl, %bl
je 0x3a2b
movq %rdi, %r14
movb %bl, 0x7(%rsp)
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq (%rdi), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
xorl %esi, %esi
callq 0x22e0
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2270
cmpl $0x0, 0x214(%r14)
jle 0x3a45
leaq 0x70(%rsp), %r12
leaq 0x230(%r14), %r15
movl $0x1, %ebx
leaq 0x60(%rsp), %r13
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %edx
movq %r14, %rdi
leaq 0x8(%rsp), %rsi
callq 0x2330
leaq (%rbx,%rbx,2), %rbp
shlq $0x2, %rbp
addq 0x218(%r14), %rbp
movq %r12, 0x60(%rsp)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x4c3c
movq (%rbp), %rcx
movl 0x8(%rbp), %r8d
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x3afa
movq %rbx, 0x80(%rsp)
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x3927
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x21b0
movq 0x28(%rsp), %r12
movq 0x30(%rsp), %r13
cmpq %r13, %r12
leaq 0x40(%rsp), %rbx
je 0x39b1
cmpl $0x0, 0x8(%rbp)
je 0x39e3
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x4c3c
movq %rbx, %rsi
movq 0x268(%r14), %rax
movslq (%rbp), %rcx
movq (%rax,%rcx,8), %rbx
movq %r15, %rdi
callq 0x4a3e
movslq (%rax), %rax
movl $0x1, (%rbx,%rax,4)
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x39a3
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x21b0
addq $0x20, %r12
cmpq %r13, %r12
leaq 0x40(%rsp), %rbx
jne 0x3945
leaq 0x28(%rsp), %rdi
callq 0x4aba
movq 0x80(%rsp), %rdx
leaq 0x1(%rdx), %rbx
movslq 0x214(%r14), %rcx
cmpq %rcx, %rdx
leaq 0x70(%rsp), %r12
leaq 0x60(%rsp), %r13
jl 0x38a3
jmp 0x3a45
movl (%rbp), %ebx
movq %r15, %rdi
movq %r12, %rsi
callq 0x4a3e
movl %ebx, (%rax)
movq 0x28(%rsp), %r12
addq $0x20, %r12
cmpq 0x30(%rsp), %r12
je 0x39b1
movq 0x268(%r14), %rax
movslq (%rbp), %rcx
movq (%rax,%rcx,8), %r13
movq %r15, %rdi
movq %r12, %rsi
callq 0x4a3e
movslq (%rax), %rax
movl $0x1, (%r13,%rax,4)
jmp 0x39f8
movq 0x55a6(%rip), %rdi      # 0x8fd8
leaq 0x2705(%rip), %rsi      # 0x613e
movl $0x18, %edx
callq 0x2200
jmp 0x3a65
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3a61
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
movb 0x7(%rsp), %bl
movl %ebx, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3a9b
jmp 0x3ac8
jmp 0x3a9b
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x3a9e
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x21b0
jmp 0x3a9e
movq %rax, %rbx
leaq 0x18(%rsp), %r14
jmp 0x3ada
jmp 0x3ac8
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x3acb
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x21b0
jmp 0x3acb
movq %rax, %rbx
leaq 0x18(%rsp), %r14
leaq 0x28(%rsp), %rdi
callq 0x4aba
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x3af1
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
movq %rbx, %rdi
callq 0x2310
nop