// File: /workspace/github_cpp_makefile_star2_O3/metastableB[P]Program-Dependence-Graph-Creator/./pdg.cpp
// Function: PDG::get_var(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, Line)
std::vector<std::string>
PDG::get_var(std::string s, struct Line it) {
	std::vector<std::string> var;
	/*
	 * If an assignment statement,
	 * the string to the left of an = is a variable.
	 * else search for existing variables in the string
	 * make sure they are not substrings and add tit */
	 s= " " + s + " ";
	 int pos = -1;
	 if(it.type == Line_Type::SCOPE_CLOSE) return var;
	 else if(it.type == Line_Type::ASSIGNMENT){
	 	//std::cout << "s" << s <<std::endl;
	 	int m = s.find("=");
	 	pos = m;
	 	m -= 1;
	 	int cnt = 0;
	 	while(m>=0 && std::isspace(s[m])) m--;
	 	while(m>=0 && std::isalnum(s[m])) {m--;cnt++;}
	 	if(m < 0){ 
	 		std::cout << "ERROR Extracting variable " << 
	 	 			"from assignment L : " << it.line_no << std::endl;
	 	 	return var;
	 	 }
	 	 var.push_back(s.substr(++m,cnt));
	 } 
	 for(auto v:variable_map){
	 	while((pos = s.find(v.first,pos+1)) != std::string::npos) {
	 		/*
	 		 * we might have a match. This can be a
	 		 * false positive as well.
	 		 */
	 		 if(!std::isalnum(s[pos-1]) && !std::isalnum(s[pos+v.first.length()])){
	 		 	/* WE have a variable people! */
	 		 	var.push_back(v.first);
	 		 	break;
	 		 }
	 	}
	 }
	 return var;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %r8d, %r15d
movq %rcx, %r13
movq %rdx, %r14
movq %rsi, 0x38(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq %rdi, 0x30(%rsp)
movq $0x0, 0x10(%rdi)
leaq 0x25da(%rip), %rsi      # 0x610a
leaq 0x48(%rsp), %rdi
callq 0x49b5
leaq 0x25c9(%rip), %rsi      # 0x610a
leaq 0x48(%rsp), %rdi
callq 0x2340
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3b73
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x3b7b
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq 0x8(%rsp), %rbx
movq %rdx, 0x8(%rbx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2240
movq (%rbx), %rdi
cmpq %r12, %rdi
je 0x3bb7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3bd2
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x21b0
testl %r15d, %r15d
je 0x3d16
movq $-0x1, %rbp
cmpl $0x4, %r15d
je 0x3df3
movq 0x38(%rsp), %rax
movq 0x248(%rax), %rbx
addq $0x238, %rax            # imm = 0x238
movq %rax, 0x38(%rsp)
cmpq %rax, %rbx
je 0x3df3
movabsq $-0x100000000, %r15     # imm = 0xFFFFFFFF00000000
movq %r12, 0x8(%rsp)
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x4c3c
movq %rbx, 0x40(%rsp)
movl 0x40(%rbx), %eax
movl %eax, 0x28(%rsp)
shlq $0x20, %rbp
movabsq $0x100000000, %rax      # imm = 0x100000000
addq %rax, %rbp
sarq $0x20, %rbp
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rcx
movq %r14, %rdi
movq %rbp, %rdx
callq 0x2300
movq %rax, %rbp
movq %rax, %r12
shlq $0x20, %r12
cmpq %r15, %r12
je 0x3cdd
leaq (%r12,%r15), %rax
sarq $0x20, %rax
movq (%r14), %r13
movsbl (%r13,%rax), %edi
callq 0x21c0
movq 0x10(%rsp), %rbx
testl %eax, %eax
jne 0x3ca9
sarq $0x20, %r12
addq %r12, %r13
movsbl (%rbx,%r13), %edi
callq 0x21c0
testl %eax, %eax
je 0x3cce
shlq $0x20, %rbp
movabsq $0x100000000, %rax      # imm = 0x100000000
addq %rax, %rbp
sarq $0x20, %rbp
movq 0x8(%rsp), %rsi
movq %r14, %rdi
movq %rbp, %rdx
movq %rbx, %rcx
jmp 0x3c61
movq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x4b18
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %r12
cmpq %r12, %rdi
je 0x3cf9
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
movq 0x40(%rsp), %rdi
callq 0x2130
movq %rax, %rbx
cmpq 0x38(%rsp), %rax
jne 0x3c16
jmp 0x3df3
movq %r13, 0x40(%rsp)
leaq 0x23bb(%rip), %rsi      # 0x60dd
movl $0x1, %ecx
movq %r14, %rdi
xorl %edx, %edx
callq 0x2300
movq %rax, %rbp
movl %ebp, %r13d
testl %r13d, %r13d
jle 0x3d88
decq %r13
movl %r13d, %eax
movq (%r14), %rcx
movsbl (%rcx,%rax), %edi
callq 0x2070
testl %eax, %eax
jne 0x3d37
movq (%r14), %rbx
movl %r13d, %r12d
movl %r13d, %r15d
sarl $0x1f, %r15d
notl %r15d
andl %r13d, %r15d
incl %r15d
xorl %r13d, %r13d
movsbl (%rbx,%r12), %edi
callq 0x21c0
testl %eax, %eax
je 0x3e07
decq %r12
incq %r13
cmpl %r13d, %r15d
jne 0x3d6b
movq 0x5249(%rip), %rdi      # 0x8fd8
leaq 0x23c1(%rip), %rsi      # 0x6157
movl $0x1a, %edx
callq 0x2200
movq 0x5231(%rip), %rdi      # 0x8fd8
leaq 0x23c4(%rip), %rsi      # 0x6172
movl $0x14, %edx
callq 0x2200
movq 0x5219(%rip), %rdi      # 0x8fd8
movq 0x40(%rsp), %rsi
callq 0x22f0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
movq 0x30(%rsp), %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
incl %r12d
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x21d0
leaq 0x8(%rsp), %rsi
movq 0x30(%rsp), %rdi
leaq 0x18(%rsp), %r12
callq 0x519e
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x3bec
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
jmp 0x3bec
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
jne 0x3e8e
jmp 0x3ea2
jmp 0x3e9f
movq %rax, %r14
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3ea2
movq 0x58(%rsp), %rsi
jmp 0x3e93
jmp 0x3e9f
movq %rax, %r14
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3ea2
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
jmp 0x3ea2
jmp 0x3e9f
movq %rax, %r14
movq 0x30(%rsp), %rdi
callq 0x4aba
movq %r14, %rdi
callq 0x2310