// File: /workspace/github_cpp_makefile_star2_O2/metastableB[P]Program-Dependence-Graph-Creator/./pdg.cpp
// Function: PDG::make_program_map()
bool PDG::make_program_map(){
 	if(!valid) {
 		std::cout << "INTERNAL ERROR!\n";
 		return false;
 	}

 	std::string s;
 	int line_no = 1;
 	int scope = 0;
 	Line_Type type;
 	Line *temp;
 	program_map.push_back({0,0,BEGIN});
 	while(std::getline(in,s)){
 		type = get_line_type(s);
 		temp = (Line*) malloc(sizeof(Line));
 		program_map.push_back({line_no,scope,type});
 		switch(type){
 			case Line_Type::ASSIGNMENT:
 				break;
 			case Line_Type::IF:
 				scope++;
 				break;
 			case Line_Type::ELSE:
 				scope++;
 				break;
 			case Line_Type::WHILE:
 				scope++;
 				break;
 			case Line_Type::SCOPE_CLOSE:
 				scope--;
 				(--program_map.end())->scope -= 1;
 				break;
 			default :
 				std::cout << "Unknown Line Type at L:" << line_no << "\""+s+"\""<<std::endl;
 				return false;
 		}
 		//std::cout << "L " << line_no << " scope " << (--program_map.end())->scope << " type " << type << std::endl;
 		line_no++;
 	}
 	total_lines = line_no - 1;
 	if(scope != 0){
 		std::cout << "Scopes did not close properly\n";
 		return false;
 	}
 	in.seekg(0);
 	return true;
 }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
cmpb $0x0, 0x210(%rdi)
je 0x28d1
movq %rdi, %r12
leaq 0x48(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
addq $0x218, %rdi            # imm = 0x218
leaq 0x10(%rsp), %rsi
andq $0x0, (%rsi)
movl $0x6, 0x8(%rsi)
movq %rdi, 0x30(%rsp)
callq 0x3ce2
xorl %r15d, %r15d
leaq 0x38(%rsp), %r13
movl $0x0, 0xc(%rsp)
movl %r15d, %ebp
movq %r12, %rdi
movq %r13, %rsi
callq 0x2090
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x28eb
leaq 0x78(%rsp), %rdi
movq %r13, %rsi
callq 0x22a0
movq %r13, %rbx
leal 0x1(%rbp), %r15d
leaq 0x78(%rsp), %r14
movq %r14, %rsi
callq 0x2ad0
movl %eax, %r13d
movq %r14, %rdi
callq 0x2100
movl %r15d, 0x10(%rsp)
movl 0xc(%rsp), %r14d
movl %r14d, 0x14(%rsp)
movl %r13d, 0x18(%rsp)
movq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x3ce2
cmpl $0x4, %r13d
ja 0x2923
movl %r13d, %eax
leaq 0x27b4(%rip), %rcx      # 0x505c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
incl %r14d
jmp 0x28c4
decl %r14d
movq 0x220(%r12), %rax
decl -0x8(%rax)
movq %rbx, %r13
movl %r14d, 0xc(%rsp)
jmp 0x2825
movq 0x5700(%rip), %rdi      # 0x7fd8
leaq 0x27a6(%rip), %rsi      # 0x5085
callq 0x21b0
xorl %ebp, %ebp
jmp 0x29a6
movl %ebp, 0x214(%r12)
cmpl $0x0, 0xc(%rsp)
je 0x2912
movq 0x56d7(%rip), %rdi      # 0x7fd8
leaq 0x27a8(%rip), %rsi      # 0x50b0
callq 0x21b0
jmp 0x299a
movb $0x1, %bpl
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2250
jmp 0x299c
movq 0x56ae(%rip), %rdi      # 0x7fd8
leaq 0x2765(%rip), %rsi      # 0x5096
callq 0x21b0
incl %ebp
movq %rax, %rdi
movl %ebp, %esi
callq 0x2320
movq %rax, %rbx
leaq 0x2762(%rip), %rsi      # 0x50ae
leaq 0x58(%rsp), %rdi
leaq 0x38(%rsp), %rdx
callq 0x397e
leaq 0x274c(%rip), %rdx      # 0x50ae
leaq 0x10(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x395f
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x21a0
movq %rax, %rdi
callq 0x2110
leaq 0x10(%rsp), %rdi
callq 0x2100
leaq 0x58(%rsp), %rdi
callq 0x2100
xorl %ebp, %ebp
leaq 0x38(%rsp), %rdi
callq 0x2100
movl %ebp, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x29ce
jmp 0x29e0
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2100
leaq 0x58(%rsp), %rdi
callq 0x2100
jmp 0x29e3
jmp 0x29e0
jmp 0x29e0
jmp 0x29e0
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x2330
nop