// File: /workspace/github_c_makefile_star2_O0/goodpaul6[P]generic/script.c
// Function: script_parse_code
void script_parse_code(script_t* script, const char* code, const char* local_path, const char* module_name)
{
	g_file = local_path;
	g_code = code;
	g_line = 1;
	
	// NOTE: adding the current module in and parsing it
	int current_module_index = add_module(script, local_path, module_name, code);

	script_module_t* module = vec_get(&script->modules, current_module_index);
	
	if (!module->parsed)
	{
		g_cur_module_index = current_module_index;
			
		parse_program(script, &module->expr_list);
		module->parsed = 1;
	}

	// NOTE: parse any unparsed modules
	for(int i = 0; i < script->modules.length; ++i)
	{
		script_module_t* module = vec_get(&script->modules, i);
		
		if(!module->parsed)
		{
			g_file = module->local_path;
			g_line = 1;
			g_code = module->source_code;
			g_cur_module_index = i;
			
			// NOTE: new modules *might* result
			// in a relocation of the module values (i.e a vec_realloc call could result in the 
			// vec.data being moved somewhere else leaving this "module" pointer invalid)
			
			// NOTE: this should not be 'destroyed' because
			// it is being copied into module->expr_list 
			vector_t expr_list;
			vec_init(&expr_list, sizeof(expr_t*));
			
			parse_program(script, &expr_list);
			
			// NOTE: the module pointer must be reset for above reason
			module = vec_get(&script->modules, i);
			module->expr_list = expr_list;
			module->parsed = 1;
		}
	}
	
	if(g_has_error) error_exit("Found errors in script code. Stopping compilation\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, 0x16615(%rip)     # 0x1a138
movq -0x10(%rbp), %rax
movq %rax, 0x16962(%rip)     # 0x1a490
movl $0x1, 0x165f8(%rip)     # 0x1a130
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rcx
callq 0x3ca0
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rdi
addq $0x2b8, %rdi            # imm = 0x2B8
movslq -0x24(%rbp), %rsi
callq 0x11890
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpb $0x0, 0x48(%rax)
jne 0x3b94
movl -0x24(%rbp), %eax
movl %eax, 0x1691d(%rip)     # 0x1a498
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
addq $0x50, %rsi
callq 0x3ea0
movq -0x30(%rbp), %rax
movb $0x1, 0x48(%rax)
movl $0x0, -0x34(%rbp)
movslq -0x34(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x2c8(%rcx), %rax
jae 0x3c76
movq -0x8(%rbp), %rdi
addq $0x2b8, %rdi            # imm = 0x2B8
movslq -0x34(%rbp), %rsi
callq 0x11890
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpb $0x0, 0x48(%rax)
jne 0x3c66
movq -0x40(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, 0x16553(%rip)     # 0x1a138
movl $0x1, 0x16541(%rip)     # 0x1a130
movq -0x40(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, 0x16892(%rip)     # 0x1a490
movl -0x34(%rbp), %eax
movl %eax, 0x16891(%rip)     # 0x1a498
leaq -0x60(%rbp), %rdi
movl $0x8, %esi
callq 0x114e0
movq -0x8(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x3ea0
movq -0x8(%rbp), %rdi
addq $0x2b8, %rdi            # imm = 0x2B8
movslq -0x34(%rbp), %rsi
callq 0x11890
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq -0x60(%rbp), %rcx
movq %rcx, 0x50(%rax)
movq -0x58(%rbp), %rcx
movq %rcx, 0x58(%rax)
movq -0x50(%rbp), %rcx
movq %rcx, 0x60(%rax)
movq -0x48(%rbp), %rcx
movq %rcx, 0x68(%rax)
movq -0x40(%rbp), %rax
movb $0x1, 0x48(%rax)
jmp 0x3c68
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x3b9b
cmpb $0x0, 0x1681f(%rip)     # 0x1a49c
je 0x3c8d
leaq 0xfbad(%rip), %rdi      # 0x13833
movb $0x0, %al
callq 0x3990
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)