// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
cmpl $0x0, 0x1035e(%rip)     # 0x16248
js 0x60a5
movq %rsi, %r14
movq %rsi, %rdi
xorl %esi, %esi
callq 0xdcf3
movq (%rax), %r15
movl $0x1, %esi
movq %r14, %rdi
callq 0xdcf3
cvttsd2si 0x20(%r15), %ecx
movq (%rax), %rax
movb 0x20(%rax), %al
movb %al, -0x29(%rbp)
leaq 0x2b8(%rbx), %rdi
movslq %ecx, %rsi
callq 0xdcf3
movq %rax, %r14
leaq -0x98(%rbp), %rdi
movl $0x8, %esi
callq 0xda7c
movq %r14, -0x40(%rbp)
cmpq $0x0, 0x60(%r14)
je 0x6049
movq -0x40(%rbp), %rax
addq $0x50, %rax
movq %rax, -0x38(%rbp)
xorl %r12d, %r12d
leaq -0x98(%rbp), %r15
leaq -0x70(%rbp), %r14
leaq -0x48(%rbp), %r13
cmpb $0x0, -0x29(%rbp)
je 0x5ffe
movl $0x8, %esi
movq %r14, %rdi
callq 0xda7c
movq -0x38(%rbp), %rdi
movq %r12, -0x78(%rbp)
movq %r12, %rsi
callq 0xdcf3
movq (%rax), %rsi
movq %r14, %rdi
callq 0x7f46
cmpq $0x0, -0x60(%rbp)
movq %r15, %r12
je 0x5fed
xorl %r15d, %r15d
movq %rbx, %rdi
movl $0x8, %esi
callq 0x3322
movq %rax, -0x48(%rbp)
movq %r14, %rdi
movq %r15, %rsi
callq 0xdcf3
movq (%rax), %rax
movq -0x48(%rbp), %rcx
movq %rax, 0x20(%rcx)
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rcx)
movq %r12, %rdi
movq %r13, %rsi
callq 0xdd50
incq %r15
cmpq %r15, -0x60(%rbp)
ja 0x5fab
movq %r14, %rdi
callq 0xdfb9
movq %r12, %r15
movq -0x78(%rbp), %r12
jmp 0x6038
movq %rbx, %rdi
movl $0x8, %esi
callq 0x3322
movq %rax, -0x70(%rbp)
movq -0x38(%rbp), %rdi
movq %r12, %rsi
callq 0xdcf3
movq (%rax), %rax
movq -0x70(%rbp), %rcx
movq %rax, 0x20(%rcx)
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rcx)
movq %r15, %rdi
movq %r14, %rsi
callq 0xdd50
incq %r12
movq -0x40(%rbp), %rax
cmpq %r12, 0x60(%rax)
ja 0x5f6c
movups -0x98(%rbp), %xmm0
movups -0x88(%rbp), %xmm1
movaps %xmm1, -0x60(%rbp)
movaps %xmm0, -0x70(%rbp)
movq %rbx, %rdi
movl $0x6, %esi
callq 0x3322
movaps -0x70(%rbp), %xmm0
movaps -0x60(%rbp), %xmm1
movups %xmm0, 0x20(%rax)
movups %xmm1, 0x30(%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x31a4
movq %rbx, %rdi
callq 0x312b
movq %rax, 0x160(%rbx)
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9bf2(%rip), %rsi      # 0xfc9e
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3224