// File: /workspace/github_c_makefile_star2_O0/goodpaul6[P]generic/script.c
// Function: ext_get_module_expr_list
static void ext_get_module_expr_list(script_t* script, vector_t* args)
{
	EXT_CHECK_IF_CT("get_module_expr_list");
	
	script_value_t* val = script_get_arg(args, 0);
	script_value_t* flatten_val = script_get_arg(args, 1);

	int module_index = (int)val->number;
	char flatten = flatten_val->boolean;

	script_module_t* module = vec_get(&script->modules, module_index);
	vector_t expr_list;

	vec_init(&expr_list, sizeof(script_value_t*));	

	for(int i = 0; i < module->expr_list.length; ++i)
	{
		if (flatten)
		{
			vector_t flat;
			vec_init(&flat, sizeof(expr_t*));

			flatten_expr(&flat, vec_get_value(&module->expr_list, i, expr_t*));

			for (int i = 0; i < flat.length; ++i)
			{
				script_value_t* exp_val = new_value(script, VAL_NATIVE);

				exp_val->nat.value = vec_get_value(&flat, i, expr_t*);
				exp_val->nat.on_mark = exp_val->nat.on_delete = NULL;

				vec_push_back(&expr_list, &exp_val);
			}

			vec_destroy(&flat);
		}
		else
		{
			// TODO: make script_create_native, et al and use those instead
			script_value_t* exp_val = new_value(script, VAL_NATIVE);

			exp_val->nat.value = vec_get_value(&module->expr_list, i, expr_t*);
			exp_val->nat.on_mark = exp_val->nat.on_delete = NULL;

			vec_push_back(&expr_list, &exp_val);
		}
	}

	script_push_premade_array(script, expr_list);
	script_return_top(script);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x0, 0x1360e(%rip)     # 0x1a498
jge 0x6e9e
movq -0x8(%rbp), %rdi
leaq 0xced1(%rip), %rsi      # 0x13d68
movb $0x0, %al
callq 0x3200
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x3890
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x3890
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
cvttsd2si 0x20(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rax
movb 0x20(%rax), %al
movb %al, -0x25(%rbp)
movq -0x8(%rbp), %rdi
addq $0x2b8, %rdi            # imm = 0x2B8
movslq -0x24(%rbp), %rsi
callq 0x11890
movq %rax, -0x30(%rbp)
leaq -0x50(%rbp), %rdi
movl $0x8, %esi
callq 0x114e0
movl $0x0, -0x54(%rbp)
movslq -0x54(%rbp), %rax
movq -0x30(%rbp), %rcx
cmpq 0x60(%rcx), %rax
jae 0x7040
cmpb $0x0, -0x25(%rbp)
je 0x6fce
leaq -0x78(%rbp), %rdi
movl $0x8, %esi
callq 0x114e0
movq -0x30(%rbp), %rdi
addq $0x50, %rdi
movslq -0x54(%rbp), %rsi
callq 0x11890
movq (%rax), %rsi
leaq -0x78(%rbp), %rdi
callq 0x94b0
movl $0x0, -0x7c(%rbp)
movslq -0x7c(%rbp), %rax
cmpq -0x68(%rbp), %rax
jae 0x6fc3
movq -0x8(%rbp), %rdi
movl $0x8, %esi
callq 0x3350
movq %rax, -0x88(%rbp)
movslq -0x7c(%rbp), %rsi
leaq -0x78(%rbp), %rdi
callq 0x11890
movq (%rax), %rcx
movq -0x88(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x88(%rbp), %rax
movq $0x0, 0x30(%rax)
movq -0x88(%rbp), %rax
movq $0x0, 0x28(%rax)
leaq -0x50(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x11960
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x6f50
leaq -0x78(%rbp), %rdi
callq 0x11dc0
jmp 0x7030
movq -0x8(%rbp), %rdi
movl $0x8, %esi
callq 0x3350
movq %rax, -0x90(%rbp)
movq -0x30(%rbp), %rdi
addq $0x50, %rdi
movslq -0x54(%rbp), %rsi
callq 0x11890
movq (%rax), %rcx
movq -0x90(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x90(%rbp), %rax
movq $0x0, 0x30(%rax)
movq -0x90(%rbp), %rax
movq $0x0, 0x28(%rax)
leaq -0x50(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x11960
jmp 0x7032
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x6f02
movq -0x8(%rbp), %rdi
leaq -0x50(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rcx
movq %rcx, 0x10(%rsp)
movq 0x18(%rax), %rax
movq %rax, 0x18(%rsp)
callq 0x3700
movq -0x8(%rbp), %rdi
callq 0x38f0
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)