// File: mehrangoli[P]Static-Data-Extractor/SCmain.cpp
// Function: ScMain::find_scmain(std::basic_ifstream<char, std::char_traits<char>>&)
bool ScMain::find_scmain (ifstream &debugSymbol){
	string line;
	bool finish = 0;
	unsigned int line_num = 0;
	
	if (debugSymbol.is_open()){
    	while (getline (debugSymbol,line)){
			line_num++;
			if (string_finder(line, BLOCK) && string_finder(line, SCMAIN)){
				cout << "\033[1;32mStarting sc_main() variables extraction...\033[0m\n";
				finish = find_scmain_elements (debugSymbol, line_num);
				if (finish){
					cout << "\033[1;32msc_main() variables extraction is dine!\033[0m\n";
					cout << "\033[1;32mStarting module extraction...\033[0m\n";
					find_module (debugSymbol, line_num);
					cout << "\033[1;32mModule extraction is done!\033[0m\n";
					GotoLine(debugSymbol, 0);  //-------start from begining of file
					cout << "\033[1;32mStarting local variables extraction...\033[0m\n";
					set_func_localVar(debugSymbol);
					cout << "\033[1;32mLocal variables extraction is done!\033[0m\n";
					return 1;
				}
				else{
					cout << "\033[1;31mCould not find sc_main() function\033[0m\n";
					return 0;
				}
			}
    	}
	}
	else{
		cout << "\033[1;31mUnable to open Debug Symbol file\033[0m\n"; 
		return 0;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xf8(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x3340
movb $0x0, -0x39(%rbp)
movl $0x0, -0x40(%rbp)
movq -0x18(%rbp), %rdi
callq 0x33c0
movb %al, -0xe9(%rbp)
jmp 0xba63
movb -0xe9(%rbp), %al
testb $0x1, %al
jne 0xba72
jmp 0xbe13
jmp 0xba74
movq -0x18(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x3070
movq %rax, -0x100(%rbp)
jmp 0xba8a
movq -0x100(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x32f0
movb %al, -0x101(%rbp)
jmp 0xbaa8
movb -0x101(%rbp), %al
testb $0x1, %al
jne 0xbab7
jmp 0xbe11
movl -0x40(%rbp), %eax
incl %eax
movl %eax, -0x40(%rbp)
movb $0x0, -0xb9(%rbp)
movb $0x0, -0xe2(%rbp)
movb $0x0, -0xe3(%rbp)
leaq -0x70(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x3120
jmp 0xbae3
leaq -0x91(%rbp), %rdi
movq %rdi, -0x110(%rbp)
callq 0x3430
movq -0x110(%rbp), %rdx
leaq 0xb7f6(%rip), %rsi      # 0x172fa
leaq -0x90(%rbp), %rdi
callq 0x6100
jmp 0xbb12
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x10e10
movb %al, -0x111(%rbp)
jmp 0xbb2a
movb -0x111(%rbp), %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x112(%rbp)
jne 0xbb3f
jmp 0xbbbe
leaq -0xb8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x3120
jmp 0xbb51
movb $0x1, -0xb9(%rbp)
leaq -0xe1(%rbp), %rdi
movq %rdi, -0x120(%rbp)
callq 0x3430
movq -0x120(%rbp), %rdx
movb $0x1, -0xe2(%rbp)
leaq 0xb786(%rip), %rsi      # 0x17306
leaq -0xe0(%rbp), %rdi
callq 0x6100
jmp 0xbb8e
movb $0x1, -0xe3(%rbp)
leaq -0xb8(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x10e10
movb %al, -0x121(%rbp)
jmp 0xbbb0
movb -0x121(%rbp), %al
movb %al, -0x112(%rbp)
jmp 0xbbbe
movb -0x112(%rbp), %al
movb %al, -0x122(%rbp)
testb $0x1, -0xe3(%rbp)
jne 0xbbd5
jmp 0xbbe1
leaq -0xe0(%rbp), %rdi
callq 0x3190
testb $0x1, -0xe2(%rbp)
jne 0xbbec
jmp 0xbbf8
leaq -0xe1(%rbp), %rdi
callq 0x32a0
testb $0x1, -0xb9(%rbp)
jne 0xbc03
jmp 0xbc0f
leaq -0xb8(%rbp), %rdi
callq 0x3190
leaq -0x90(%rbp), %rdi
callq 0x3190
leaq -0x91(%rbp), %rdi
callq 0x32a0
leaq -0x70(%rbp), %rdi
callq 0x3190
movb -0x122(%rbp), %al
testb $0x1, %al
jne 0xbc3f
jmp 0xbe0c
movq 0x1338a(%rip), %rdi     # 0x1efd0
leaq 0xb6ca(%rip), %rsi      # 0x17317
callq 0x3240
jmp 0xbc54
movq -0xf8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x40(%rbp), %edx
callq 0xab20
movb %al, -0x123(%rbp)
jmp 0xbc6f
movb -0x123(%rbp), %al
andb $0x1, %al
movb %al, -0x39(%rbp)
testb $0x1, -0x39(%rbp)
je 0xbde7
movq 0x13345(%rip), %rdi     # 0x1efd0
leaq 0xb6bc(%rip), %rsi      # 0x1734e
callq 0x3240
jmp 0xbc99
movq 0x13330(%rip), %rdi     # 0x1efd0
leaq 0xb6db(%rip), %rsi      # 0x17382
callq 0x3240
jmp 0xbcae
movq -0xf8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x40(%rbp), %edx
callq 0xbe70
jmp 0xbcc3
movq 0x13306(%rip), %rdi     # 0x1efd0
leaq 0xb6db(%rip), %rsi      # 0x173ac
callq 0x3240
jmp 0xbcd8
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x10e50
jmp 0xbce5
movq 0x132e4(%rip), %rdi     # 0x1efd0
leaq 0xb6e0(%rip), %rsi      # 0x173d3
callq 0x3240
jmp 0xbcfa
movq -0xf8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x82a0
jmp 0xbd0c
movq 0x132bd(%rip), %rdi     # 0x1efd0
leaq 0xb6ec(%rip), %rsi      # 0x17406
callq 0x3240
jmp 0xbd21
movb $0x1, -0x1(%rbp)
movl $0x1, -0xe8(%rbp)
jmp 0xbe3a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xbe51
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xbdd0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xbdc4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xbd94
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
testb $0x1, -0xe3(%rbp)
jne 0xbd86
jmp 0xbd92
leaq -0xe0(%rbp), %rdi
callq 0x3190
jmp 0xbd94
testb $0x1, -0xe2(%rbp)
jne 0xbd9f
jmp 0xbdab
leaq -0xe1(%rbp), %rdi
callq 0x32a0
testb $0x1, -0xb9(%rbp)
jne 0xbdb6
jmp 0xbdc2
leaq -0xb8(%rbp), %rdi
callq 0x3190
jmp 0xbdc4
leaq -0x90(%rbp), %rdi
callq 0x3190
leaq -0x91(%rbp), %rdi
callq 0x32a0
leaq -0x70(%rbp), %rdi
callq 0x3190
jmp 0xbe51
movq 0x131e2(%rip), %rdi     # 0x1efd0
leaq 0xb641(%rip), %rsi      # 0x17436
callq 0x3240
jmp 0xbdfc
movb $0x0, -0x1(%rbp)
movl $0x1, -0xe8(%rbp)
jmp 0xbe3a
jmp 0xba74
jmp 0xbe38
movq 0x131b6(%rip), %rdi     # 0x1efd0
leaq 0xb46a(%rip), %rsi      # 0x1728b
callq 0x3240
jmp 0xbe28
movb $0x0, -0x1(%rbp)
movl $0x1, -0xe8(%rbp)
jmp 0xbe3a
ud2
leaq -0x38(%rbp), %rdi
callq 0x3190
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
leaq -0x38(%rbp), %rdi
callq 0x3190
movq -0x48(%rbp), %rdi
callq 0x3420
nopw %cs:(%rax,%rax)