LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: print_stack_trace
static void print_stack_trace(script_t* script)
{
	fprintf(stderr, "Trace:\n");
	for(int i = script->call_records.length - 1; i >= 0; --i)
	{
		script_call_record_t* record = vec_get(&script->call_records, i);

		fprintf(stderr, "(%s, %d): ", record->file, record->line);
		
		if (record->function.is_extern)
			fprintf(stderr, "extern %s(", vec_get_value(&script->extern_names, record->function.index, char*));
		else
			fprintf(stderr, "%s(", vec_get_value(&script->function_names, record->function.index, char*));
		
		if (record->nargs > 0)
		{
			// NOTE: arguments started at exactly record->stackSize - record->nargs
			int args_start = record->stack_size - record->nargs;

			// NOTE: Print all arguments to this function
			// TODO: Have write_value take in a FILE* so we can route this
			// to stderr
			for (int i = args_start; i < args_start + record->nargs; ++i)
			{
				write_value(vec_get_value(&script->stack, i, script_value_t*), 1);
				if (i + 1 < args_start + record->nargs)
					fprintf(stderr, ", ");
			}
		}

		fprintf(stderr, ")\n");
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r12
movq 0x13c6c(%rip), %rbx     # 0x15ff0
movq (%rbx), %rcx
leaq 0xe9e6(%rip), %rdi      # 0x10d74
pushq $0x7
popq %rsi
pushq $0x1
popq %rdx
callq 0x2250
movl 0x140(%r12), %eax
decl %eax
js 0x24d2
leaq 0x130(%r12), %rcx
movq %rcx, -0x30(%rbp)
leaq 0x198(%r12), %r15
movl %eax, %eax
pushq $0x1
popq %r13
movq %r12, -0x38(%rbp)
movq -0x30(%rbp), %rdi
movq %rax, -0x48(%rbp)
movq %rax, %rsi
callq 0xdcf3
movq %rax, %r14
movq (%rbx), %rdi
movq 0x20(%rax), %rdx
movl 0x28(%rax), %ecx
leaq 0xe991(%rip), %rsi      # 0x10d7c
xorl %eax, %eax
callq 0x2180
xorl %eax, %eax
cmpb $0x0, 0x14(%r14)
sete %al
movq (%rbx), %rcx
movq %rcx, -0x40(%rbp)
movslq 0x18(%r14), %rsi
leaq 0xe979(%rip), %rbx      # 0x10d87
leaq 0xe979(%rip), %rcx      # 0x10d8e
cmoveq %rcx, %rbx
shll $0x6, %eax
leaq (%r12,%rax), %rdi
addq $0x238, %rdi            # imm = 0x238
callq 0xdcf3
movq (%rax), %rdx
movq -0x40(%rbp), %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2180
movl 0x10(%r14), %eax
testl %eax, %eax
jle 0x24a1
movl (%r14), %ecx
subl %eax, %ecx
movslq %ecx, %r12
movq %r12, %rbx
movq %r15, %rdi
movq %rbx, %rsi
callq 0xdcf3
movq (%rax), %rdi
movl %r13d, %esi
callq 0x9be7
incq %rbx
movslq 0x10(%r14), %rax
addq %r12, %rax
cmpq %rax, %rbx
jl 0x247c
cmpq %rax, %rbx
jl 0x2450
jmp 0x24a1
movq 0x13b6d(%rip), %rax     # 0x15ff0
movq (%rax), %rcx
leaq 0xe905(%rip), %rdi      # 0x10d92
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
callq 0x2250
movslq 0x10(%r14), %rax
addq %r12, %rax
jmp 0x2475
movq 0x13b48(%rip), %rbx     # 0x15ff0
movq (%rbx), %rcx
leaq 0xf278(%rip), %rdi      # 0x1172a
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
callq 0x2250
movq -0x48(%rbp), %rcx
leaq -0x1(%rcx), %rax
testq %rcx, %rcx
movq -0x38(%rbp), %r12
jg 0x23c7
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: error_defer_c
static void error_defer_c(context_t ctx, const char* fmt, ...)
{
	fprintf(stderr, "\nError (%s:%i):\n", ctx.file, ctx.line);
	
	va_list args;
	va_start(args, fmt);
	vfprintf(stderr, fmt, args);
	va_end(args);
	
	g_has_error = 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xd0, %rsp
testb %al, %al
je 0x251c
movaps %xmm0, -0xb0(%rbp)
movaps %xmm1, -0xa0(%rbp)
movaps %xmm2, -0x90(%rbp)
movaps %xmm3, -0x80(%rbp)
movaps %xmm4, -0x70(%rbp)
movaps %xmm5, -0x60(%rbp)
movaps %xmm6, -0x50(%rbp)
movaps %xmm7, -0x40(%rbp)
leaq -0xe0(%rbp), %rbx
movq %rsi, 0x8(%rbx)
movq %rdx, 0x10(%rbx)
movq %rcx, 0x18(%rbx)
movq %r8, 0x20(%rbx)
movq %r9, 0x28(%rbx)
movq 0x13ab2(%rip), %r14     # 0x15ff0
movq (%r14), %rdi
movq 0x18(%rbp), %rdx
movl 0x10(%rbp), %ecx
leaq 0xdd47(%rip), %rsi      # 0x10296
xorl %eax, %eax
callq 0x2180
leaq -0x30(%rbp), %rdx
movq %rbx, 0x10(%rdx)
leaq 0x30(%rbp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rdx)
movq (%r14), %rdi
leaq 0xef59(%rip), %rsi      # 0x114d6
callq 0x2210
movb $0x1, 0x13cc3(%rip)     # 0x1624c
addq $0xd0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/test.c
// Function: main
int main(int argc, char* argv[])
{
	if(argc < 2)
	{
		fprintf(stderr, "%s [execution amount]\n", argv[0]);
		return 1;
	}
	
	script_t script;
	
	script_init(&script);
	
	script_disable_warning(WARN_DYNAMIC_ARRAY_LITERAL, 1);
	script_disable_warning(WARN_ARRAY_DYNAMIC_TO_SPECIFIC, 1);
	
	script_load_parse_file(&script, "test.txt", "test");
	script_compile(&script);
	
	for(int i = 2; i < argc; ++i)
	{
		if(strcmp(argv[i], "-dis") == 0)
			script_dissassemble(&script, stdout);
	}
	for(int i = 0; i < strtol(argv[1], NULL, 10); ++i)
		script_run(&script);
	script_destroy(&script);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2d8, %rsp            # imm = 0x2D8
movq %rsi, %rbx
cmpl $0x1, %edi
jle 0x27ba
movl %edi, %r14d
leaq -0x300(%rbp), %r15
movq %r15, %rdi
callq 0x2852
xorl %edi, %edi
movl $0x1, %esi
callq 0x3cbe
movl $0x1, %edi
movl $0x1, %esi
callq 0x3cbe
leaq 0xc91b(%rip), %rsi      # 0xf01b
leaq 0xc91d(%rip), %rdx      # 0xf024
movq %r15, %rdi
callq 0x382f
movq %r15, %rdi
callq 0x3cd2
cmpl $0x2, %r14d
je 0x2757
movl %r14d, %r12d
movl $0x2, %r13d
leaq 0xc8fc(%rip), %r14      # 0xf029
movq (%rbx,%r13,8), %rdi
movq %r14, %rsi
callq 0x2160
testl %eax, %eax
jne 0x274f
movq 0x13884(%rip), %rax     # 0x15fc8
movq (%rax), %rsi
movq %r15, %rdi
callq 0x405f
incq %r13
cmpq %r13, %r12
jne 0x272d
movq 0x8(%rbx), %rdi
xorl %r14d, %r14d
xorl %esi, %esi
movl $0xa, %edx
callq 0x21a0
testq %rax, %rax
jle 0x2799
xorl %r12d, %r12d
leaq -0x300(%rbp), %r15
movq %r15, %rdi
callq 0x4539
incq %r12
movq 0x8(%rbx), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x21a0
cmpq %r12, %rax
jg 0x2779
leaq -0x300(%rbp), %rdi
callq 0x59a6
movl %r14d, %eax
addq $0x2d8, %rsp            # imm = 0x2D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x2290
movl $0x1, %r14d
jmp 0x27a5
nop
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: estrdup
static char* estrdup(const char* str)
{
	size_t length = strlen(str);
	char* cpy = emalloc(length + 1);
	strcpy(cpy, str);
	
	return cpy;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x20b0
leaq 0x1(%rax), %rdi
callq 0x21c0
testq %rax, %rax
je 0x2844
movq %rax, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2050
leaq 0xf44c(%rip), %rdi      # 0x11c97
xorl %eax, %eax
callq 0x388c
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: add_heap_block
static void add_heap_block(script_t* script)
{
	script_heap_block_t* block = emalloc(sizeof(script_heap_block_t));
	
	block->next = script->heap_head;
	block->num_free = SCRIPT_HEAP_BLOCK_SIZE;
	for (int i = 0; i < block->num_free; ++i)
	{
		block->free_indices[i] = block->num_free - i - 1;

		block->values[i].block = block;
		block->values[i].block_index = i;
	}

	script->heap_head = block;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x1110, %edi           # imm = 0x1110
callq 0x21c0
testq %rax, %rax
je 0x2f1e
movq 0x150(%rbx), %rcx
movq %rcx, (%rax)
movl $0x40, 0x8(%rax)
movq %rax, %rcx
addq $0x118, %rcx            # imm = 0x118
movl $0x3f, %edx
xorl %esi, %esi
movl %edx, 0xc(%rax,%rsi,4)
movq %rax, -0x8(%rcx)
movl %esi, (%rcx)
leaq 0x1(%rsi), %rdi
decl %edx
addq $0x40, %rcx
cmpq $0x3f, %rsi
movq %rdi, %rsi
jb 0x2ef3
movq %rax, 0x150(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0xed72(%rip), %rdi      # 0x11c97
xorl %eax, %eax
callq 0x388c
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: script_reset
void script_reset(script_t* script)
{	
	vec_traverse(&script->modules, destroy_module);
	vec_clear(&script->modules);
	
	destroy_all_values(script);
	
	script->heap_head = NULL;
	add_heap_block(script);

	script->in_extern = 0;
	
	script->num_objects = 0;
	script->max_objects_until_gc = INIT_GC_THRESH;
	
	script->pc = -1;
	script->fp = 0;

	script->gc_head = NULL;
	script->ret_val = NULL;

	script->indir_depth = 0;

	vec_clear(&script->globals);
	
	vec_clear(&script->stack);
	vec_clear(&script->indir);
	
	vec_clear(&script->code);
	
	vec_clear(&script->function_names);
	vec_clear(&script->function_pcs);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x2b8(%rdi), %r14
leaq 0xcf(%rip), %rsi        # 0x3016
movq %r14, %rdi
callq 0xdf70
movq %r14, %rdi
callq 0xdfab
leaq 0x150(%rbx), %r14
movq 0x150(%rbx), %rdi
testq %rdi, %rdi
je 0x2f7a
movq (%rdi), %r15
callq 0x2030
movq %r15, %rdi
testq %r15, %r15
jne 0x2f6a
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movq %rbx, %rdi
callq 0x2eb9
movb $0x0, 0x119(%rbx)
movabsq $0x4000000000, %rax     # imm = 0x4000000000
movq %rax, 0x168(%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0x11c(%rbx)
movl $0x0, 0x190(%rbx)
leaq 0x170(%rbx), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0x158(%rbx)
callq 0xdfab
leaq 0x198(%rbx), %rdi
callq 0xdfab
leaq 0x1b8(%rbx), %rdi
callq 0xdfab
leaq 0x1d8(%rbx), %rdi
callq 0xdfab
leaq 0x278(%rbx), %rdi
callq 0xdfab
addq $0x298, %rbx            # imm = 0x298
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xdfab
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: destroy_module
static void destroy_module(void* p_module)
{
	script_module_t* module = p_module;

	vec_destroy(&module->referenced_modules);

	free(module->local_path);
	free(module->name);
	free(module->source_code);

	for(int i = 0; i < module->expr_list.length; ++i)
		delete_expr(vec_get_value(&module->expr_list, i, expr_t*));
	vec_destroy(&module->expr_list);

	vec_destroy(&module->compile_time_blocks);

	vec_destroy(&module->globals);
	vec_destroy(&module->functions);

	vec_traverse(&module->all_type_tags, destroy_type_tag);

	vec_destroy(&module->all_type_tags);
	map_destroy(&module->user_type_tags);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0xdfb9
movq 0x40(%rbx), %rdi
callq 0x2030
movq 0x38(%rbx), %rdi
callq 0x2030
movq 0x30(%rbx), %rdi
callq 0x2030
leaq 0x50(%rbx), %r14
cmpq $0x0, 0x60(%rbx)
je 0x306d
xorl %r15d, %r15d
movq %r14, %rdi
movq %r15, %rsi
callq 0xdcf3
movq (%rax), %rdi
callq 0x998e
incq %r15
cmpq %r15, 0x60(%rbx)
ja 0x3051
movq %r14, %rdi
callq 0xdfb9
leaq 0x70(%rbx), %rdi
callq 0xdfb9
leaq 0x20f0(%rbx), %rdi
callq 0xdfb9
leaq 0x20d0(%rbx), %rdi
callq 0xdfb9
leaq 0x90(%rbx), %r14
leaq 0x6ab5(%rip), %rsi      # 0x9b59
movq %r14, %rdi
callq 0xdf70
movq %r14, %rdi
callq 0xdfb9
addq $0xb0, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xe39c
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: pop_value
static script_value_t* pop_value(script_t* script)
{
	if(script->stack.length == 0) error_exit_script(script, "Stack underflow\n");
	
	script_value_t* val;
	vec_pop_back(&script->stack, &val);
	
	return val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
cmpq $0x0, 0x1a8(%rdi)
je 0x3158
addq $0x198, %rdi            # imm = 0x198
leaq -0x10(%rbp), %rbx
movq %rbx, %rsi
callq 0xddc1
movq (%rbx), %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0xdbf3(%rip), %rsi      # 0x10d52
xorl %eax, %eax
callq 0x3224
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: script_push_bool
void script_push_bool(script_t* script, char bv)
{
	// NOTE: Singleton values
	// which never get gc'd
	static script_value_t true_val = { 0 };
	static script_value_t false_val = { 0 };

	true_val.type = VAL_BOOL;
	true_val.boolean = 1;
	
	false_val.type = VAL_BOOL;
	false_val.boolean = 0;

	push_value(script, bv ? &true_val : &false_val);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl $0x1, %eax
movl %eax, 0x13017(%rip)     # 0x1618c
leaq 0x13004(%rip), %rcx     # 0x16180
movb $0x1, 0x1301d(%rip)     # 0x161a0
movl %eax, 0x13043(%rip)     # 0x161cc
leaq 0x13030(%rip), %rax     # 0x161c0
movb $0x0, 0x13049(%rip)     # 0x161e0
testb %sil, %sil
cmovneq %rcx, %rax
movq %rax, %rsi
popq %rbp
jmp 0x31a4
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: script_pop_bool
char script_pop_bool(script_t* script)
{	
	script_value_t* val = pop_value(script);
	if(val->type != VAL_BOOL)
		error_exit_script(script, "Expected bool but received %s\n", g_value_types[val->type]);

	return val->boolean;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x312b
movl 0xc(%rax), %ecx
cmpq $0x1, %rcx
jne 0x3208
movb 0x20(%rax), %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x129e1(%rip), %rax     # 0x15bf0
movq (%rax,%rcx,8), %rdx
leaq 0xc4a3(%rip), %rsi      # 0xf6bd
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3224
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: error_exit_script
static void error_exit_script(script_t* script, const char* fmt, ...)
{
	fprintf(stderr, "\nError (%s:%i):\n", script->cur_file, script->cur_line);
	
	va_list args;
	va_start(args, fmt);
	vfprintf(stderr, fmt, args);
	va_end(args);
	
	fprintf(stderr, "\n");
	print_stack_trace(script);
	
	debug_script(script);

	exit(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xd0, %rsp
movq %rsi, %r14
movq %rdi, %rbx
testb %al, %al
je 0x326c
movaps %xmm0, -0xc0(%rbp)
movaps %xmm1, -0xb0(%rbp)
movaps %xmm2, -0xa0(%rbp)
movaps %xmm3, -0x90(%rbp)
movaps %xmm4, -0x80(%rbp)
movaps %xmm5, -0x70(%rbp)
movaps %xmm6, -0x60(%rbp)
movaps %xmm7, -0x50(%rbp)
leaq -0xf0(%rbp), %r15
movq %rdx, 0x10(%r15)
movq %rcx, 0x18(%r15)
movq %r8, 0x20(%r15)
movq %r9, 0x28(%r15)
movq 0x12d66(%rip), %r12     # 0x15ff0
movq (%r12), %rdi
movq 0x128(%rbx), %rdx
movl 0x124(%rbx), %ecx
leaq 0xcff4(%rip), %rsi      # 0x10296
xorl %eax, %eax
callq 0x2180
leaq -0x40(%rbp), %rdx
movq %r15, 0x10(%rdx)
leaq 0x10(%rbp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rdx)
movq (%r12), %rdi
movq %r14, %rsi
callq 0x2210
movq (%r12), %rsi
movl $0xa, %edi
callq 0x2120
movq %rbx, %rdi
callq 0x2369
movq %rbx, %rdi
callq 0x50b9
movl $0x1, %edi
callq 0x2240
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: new_value
static script_value_t* new_value(script_t* script, script_value_type_t type)
{
	if(!script->in_extern && script->num_objects >= script->max_objects_until_gc) collect_garbage(script); 
	
	script_value_t* val = get_heap_value(script);
	
	val->marked = 0;
	val->type = type;
	
	val->next = script->gc_head;
	script->gc_head = val;
	
	++script->num_objects;
	
	return val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
cmpb $0x0, 0x119(%rdi)
jne 0x3480
movl 0x168(%rbx), %eax
cmpl 0x16c(%rbx), %eax
jl 0x3480
movq 0x160(%rbx), %rdi
testq %rdi, %rdi
je 0x3366
callq 0x9e04
cmpq $0x0, 0x1a8(%rbx)
je 0x3399
leaq 0x198(%rbx), %r15
xorl %r12d, %r12d
movq %r15, %rdi
movq %r12, %rsi
callq 0xdcf3
movq (%rax), %rdi
callq 0x9e04
incq %r12
cmpq %r12, 0x1a8(%rbx)
ja 0x337a
cmpq $0x0, 0x180(%rbx)
je 0x33cc
leaq 0x170(%rbx), %r15
xorl %r12d, %r12d
movq %r15, %rdi
movq %r12, %rsi
callq 0xdcf3
movq (%rax), %rdi
callq 0x9e04
incq %r12
cmpq %r12, 0x180(%rbx)
ja 0x33ad
movq 0x158(%rbx), %r13
testq %r13, %r13
je 0x3472
leaq 0x158(%rbx), %r12
leaq 0xbc86(%rip), %r15      # 0xf070
cmpb $0x0, 0x18(%r13)
je 0x33ff
movb $0x0, 0x18(%r13)
addq $0x10, %r13
movq %r13, %r12
jmp 0x3465
movq 0x10(%r13), %rax
movq %rax, (%r12)
decl 0x168(%rbx)
movl 0xc(%r13), %eax
addl $-0x4, %eax
cmpl $0x4, %eax
ja 0x344f
movslq (%r15,%rax,4), %rax
addq %r15, %rax
jmpq *%rax
leaq 0x20(%r13), %rdi
callq 0xdfb9
jmp 0x344f
movq 0x28(%r13), %rdi
callq 0x2030
movq $0x0, 0x28(%r13)
jmp 0x344f
movq 0x30(%r13), %rax
testq %rax, %rax
je 0x344f
movq 0x20(%r13), %rdi
callq *%rax
movl 0x8(%r13), %eax
movq (%r13), %rcx
movslq 0x8(%rcx), %rdx
leal 0x1(%rdx), %esi
movl %esi, 0x8(%rcx)
movl %eax, 0xc(%rcx,%rdx,4)
movq (%r12), %r13
testq %r13, %r13
jne 0x33ea
movl 0x168(%rbx), %eax
addl %eax, %eax
movl %eax, 0x16c(%rbx)
leaq 0x150(%rbx), %r15
movq %r15, %rax
movq (%rax), %rax
testq %rax, %rax
je 0x349b
movl 0x8(%rax), %ecx
testl %ecx, %ecx
jle 0x348a
jmp 0x34a5
movq %rbx, %rdi
callq 0x2eb9
jmp 0x3487
decl %ecx
movl %ecx, 0x8(%rax)
movslq 0xc(%rax,%rcx,4), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
addq $0x110, %rax            # imm = 0x110
movb $0x0, 0x18(%rax)
movl %r14d, 0xc(%rax)
movq 0x158(%rbx), %rcx
movq %rcx, 0x10(%rax)
movq %rax, 0x158(%rbx)
incl 0x168(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: script_pop_char
char script_pop_char(script_t* script)
{
	script_value_t* val = pop_value(script);
	if(val->type != VAL_CHAR)
		error_exit_script(script, "Expected char but received %s\n", g_value_types[val->type]);

	return val->code;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x312b
movl 0xc(%rax), %ecx
cmpq $0x2, %rcx
jne 0x350c
movb 0x20(%rax), %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x126dd(%rip), %rax     # 0x15bf0
movq (%rax,%rcx,8), %rdx
leaq 0xc1be(%rip), %rsi      # 0xf6dc
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3224
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: script_pop_number
double script_pop_number(script_t* script)
{
	script_value_t* val = pop_value(script);
	if(val->type != VAL_NUMBER)
		error_exit_script(script, "Expected number but received %s\n", g_value_types[val->type]);
	
	return val->number;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x312b
movl 0xc(%rax), %ecx
cmpq $0x3, %rcx
jne 0x357e
movsd 0x20(%rax), %xmm0
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x1266b(%rip), %rax     # 0x15bf0
movq (%rax,%rcx,8), %rdx
leaq 0xc16b(%rip), %rsi      # 0xf6fb
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3224
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: script_push_cstr
void script_push_cstr(script_t* script, const char* string)
{
	script_value_t* val = new_value(script, VAL_STRING);
	val->string.length = strlen(string);
	val->string.data = emalloc(val->string.length + 1);
	strcpy(val->string.data, string);
	
	push_value(script, val);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl $0x4, %esi
callq 0x3322
movq %rax, %r15
movq %r14, %rdi
callq 0x20b0
movl %eax, 0x20(%r15)
leal 0x1(%rax), %edi
callq 0x21c0
testq %rax, %rax
je 0x35f4
movq %rax, 0x28(%r15)
movq %rax, %rdi
movq %r14, %rsi
callq 0x2050
movq %rbx, %rdi
movq %r15, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x31a4
leaq 0xe69c(%rip), %rdi      # 0x11c97
xorl %eax, %eax
callq 0x388c
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: script_push_string
void script_push_string(script_t* script, script_string_t string)
{
	script_value_t* val = new_value(script, VAL_STRING);
	val->string.length = string.length;
	val->string.data = emalloc(string.length + 1);
	strcpy(val->string.data, string.data);
	
	push_value(script, val);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r14
movl %esi, %r12d
movq %rdi, %rbx
movl $0x4, %esi
callq 0x3322
movq %rax, %r15
movl %r12d, 0x20(%rax)
incl %r12d
movq %r12, %rdi
callq 0x21c0
testq %rax, %rax
je 0x3659
movq %rax, 0x28(%r15)
movq %rax, %rdi
movq %r14, %rsi
callq 0x2050
movq %rbx, %rdi
movq %r15, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x31a4
leaq 0xe637(%rip), %rdi      # 0x11c97
xorl %eax, %eax
callq 0x388c
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: script_pop_string
script_string_t script_pop_string(script_t* script)
{
	script_value_t* val = pop_value(script);
	if (val->type != VAL_STRING)
		error_exit_script(script, "Expected string but received %s\n", g_value_types[val->type]);
	return val->string;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x312b
movl 0xc(%rax), %ecx
cmpq $0x4, %rcx
jne 0x368e
movl 0x20(%rax), %ecx
movq 0x28(%rax), %rdx
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x1255b(%rip), %rax     # 0x15bf0
movq (%rax,%rcx,8), %rdx
leaq 0xc07c(%rip), %rsi      # 0xf71c
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3224
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: script_push_array
void script_push_array(script_t* script, size_t length)
{
	script_value_t* val = new_value(script, VAL_ARRAY);
	vec_init(&val->array, sizeof(script_value_t*));
	vec_reserve(&val->array, length);
	push_value(script, val);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl $0x6, %esi
callq 0x3322
movq %rax, %r15
leaq 0x20(%rax), %r12
movl $0x8, %esi
movq %r12, %rdi
callq 0xda7c
movq %r12, %rdi
movq %rbx, %rsi
callq 0xdc77
movq %r14, %rdi
movq %r15, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x31a4
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: script_push_native
void script_push_native(script_t* script, void* value, script_native_callback_t on_mark, script_native_callback_t on_delete)
{
	script_value_t* val = new_value(script, VAL_NATIVE);
	val->nat.value = value;
	val->nat.on_mark = on_mark;
	val->nat.on_delete = on_delete;
	push_value(script, val);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movl $0x8, %esi
callq 0x3322
movq %r15, 0x20(%rax)
movq %r14, 0x28(%rax)
movq %rbx, 0x30(%rax)
movq %r12, %rdi
movq %rax, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x31a4
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: script_load_parse_file
void script_load_parse_file(script_t* script, const char* filename, const char* module_name)
{
	FILE* in = fopen(filename, "rb");
	
	if (!in)
		error_exit("Failed to open file '%s'\n", filename);
	
	script_parse_file(script, in, filename, module_name);

	fclose(in);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
leaq 0xbf34(%rip), %rsi      # 0xf77e
movq %rbx, %rdi
callq 0x2200
testq %rax, %rax
je 0x387b
movq %rax, %r12
movq %r15, %rdi
movq %rax, %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x3939
movq %r12, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x20a0
leaq 0xbeff(%rip), %rdi      # 0xf781
movq %rbx, %rsi
xorl %eax, %eax
callq 0x388c
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: error_exit
static void error_exit(const char* fmt, ...)
{
	fprintf(stderr, "\nError:\n");
	
	va_list args;
	va_start(args, fmt);
	vfprintf(stderr, fmt, args);
	va_end(args);
	
	exit(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
testb %al, %al
je 0x38cc
movaps %xmm0, -0xb0(%rbp)
movaps %xmm1, -0xa0(%rbp)
movaps %xmm2, -0x90(%rbp)
movaps %xmm3, -0x80(%rbp)
movaps %xmm4, -0x70(%rbp)
movaps %xmm5, -0x60(%rbp)
movaps %xmm6, -0x50(%rbp)
movaps %xmm7, -0x40(%rbp)
leaq -0xe0(%rbp), %r14
movq %rsi, 0x8(%r14)
movq %rdx, 0x10(%r14)
movq %rcx, 0x18(%r14)
movq %r8, 0x20(%r14)
movq %r9, 0x28(%r14)
movq 0x12702(%rip), %r15     # 0x15ff0
movq (%r15), %rcx
leaq 0xd4eb(%rip), %rdi      # 0x10de3
movl $0x8, %esi
movl $0x1, %edx
callq 0x2250
leaq -0x30(%rbp), %rdx
movq %r14, 0x10(%rdx)
leaq 0x10(%rbp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rdx)
movq (%r15), %rdi
movq %rbx, %rsi
callq 0x2210
movl $0x1, %edi
callq 0x2240
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: script_parse_file
void script_parse_file(script_t* script, FILE* in, const char* local_path, const char* module_name)
{
	fseek(in, 0, SEEK_END);
	size_t length = ftell(in);
	fseek(in, 0, SEEK_SET);
	
	char* str = emalloc(length + 1);
	fread(str, sizeof(char), length, in);
	str[length] = '\0';
	
	rewind(in);
	
	script_parse_code(script, str, local_path, module_name);
	
	free(str);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, -0x30(%rbp)
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %r15
movq %rsi, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x21d0
movq %r12, %rdi
callq 0x2190
movq %rax, %r13
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x21d0
leaq 0x1(%r13), %rdi
callq 0x21c0
testq %rax, %rax
je 0x39d3
movq %rax, %rbx
movl $0x1, %esi
movq %rax, %rdi
movq %r13, %rdx
movq %r12, %rcx
callq 0x2080
movb $0x0, (%rbx,%r13)
movq %r12, %rdi
callq 0x20e0
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq -0x30(%rbp), %rcx
callq 0x39e1
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2030
leaq 0xe2bd(%rip), %rdi      # 0x11c97
xorl %eax, %eax
callq 0x388c
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsi, %rax
movq %rdi, %rbx
movq %rdx, 0x1275b(%rip)     # 0x16158
movq %rsi, 0x1283c(%rip)     # 0x16240
movl $0x1, 0x12742(%rip)     # 0x16150
movq %rdx, %rsi
movq %rcx, %rdx
movq %rax, %rcx
callq 0x3b0a
movl %eax, %r15d
leaq 0x2b8(%rbx), %r14
movslq %eax, %rsi
movq %r14, %rdi
callq 0xdcf3
cmpb $0x0, 0x48(%rax)
jne 0x3a56
movq %rax, %r12
movl %r15d, 0x12807(%rip)    # 0x16248
movq %rax, %rsi
addq $0x50, %rsi
movq %rbx, %rdi
callq 0x3c5e
movb $0x1, 0x48(%r12)
cmpq $0x0, 0x2c8(%rbx)
je 0x3ae6
xorl %r15d, %r15d
leaq -0x40(%rbp), %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0xdcf3
cmpb $0x0, 0x48(%rax)
jne 0x3ada
movq 0x40(%rax), %rcx
movq %rcx, 0x126d1(%rip)     # 0x16158
movl $0x1, 0x126bf(%rip)     # 0x16150
movq 0x30(%rax), %rax
movq %rax, 0x127a4(%rip)     # 0x16240
movl %r15d, 0x127a5(%rip)    # 0x16248
movl $0x8, %esi
movq %r12, %rdi
callq 0xda7c
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3c5e
movq %r14, %rdi
movq %r15, %rsi
callq 0xdcf3
movups -0x40(%rbp), %xmm0
movups -0x30(%rbp), %xmm1
movups %xmm0, 0x50(%rax)
movups %xmm1, 0x60(%rax)
movb $0x1, 0x48(%rax)
incq %r15
cmpq %r15, 0x2c8(%rbx)
ja 0x3a6b
cmpb $0x0, 0x1275f(%rip)     # 0x1624c
jne 0x3afc
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xbc98(%rip), %rdi      # 0xf79b
xorl %eax, %eax
callq 0x388c
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: add_module
static int add_module(script_t* script, const char* local_path, const char* module_name, const char* code)
{
	// NOTE: This'll slow down add module a bit (but who cares, how many modules could you possibly have :)
	if (local_path)
	{
		for (int i = 0; i < script->modules.length; ++i)
		{
			script_module_t* module = vec_get(&script->modules, i);
			if (module->local_path)
			{
				if (strcmp(module->local_path, local_path) == 0)
					return i;
			}
		}
	}
	
	script_module_t module;
	
	module.start_pc = -1;
	module.end_pc = -1;
	module.name = module_name ? estrdup(module_name) : NULL;
	module.local_path = local_path ? estrdup(local_path) : NULL;
	module.source_code = estrdup(code);
	module.parsed = 0;
	module.compiled = 0;
	
	vec_init(&module.referenced_modules, sizeof(int));

	vec_init(&module.expr_list, sizeof(expr_t*));
	vec_init(&module.compile_time_blocks, sizeof(expr_t*));
	
	vec_init(&module.globals, sizeof(var_decl_t*));
	vec_init(&module.functions, sizeof(func_decl_t*));
	vec_init(&module.all_type_tags, sizeof(type_tag_t*));
	map_init(&module.user_type_tags);

	vec_push_back(&script->modules, &module);
	return script->modules.length - 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2118, %rsp           # imm = 0x2118
movq %rcx, -0x30(%rbp)
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
testq %rsi, %rsi
je 0x3b74
cmpq $0x0, 0x2c8(%rbx)
je 0x3b74
leaq 0x2b8(%rbx), %r14
xorl %r13d, %r13d
movq %r14, %rdi
movq %r13, %rsi
callq 0xdcf3
movq 0x40(%rax), %rdi
testq %rdi, %rdi
je 0x3b68
movq %r15, %rsi
callq 0x2160
testl %eax, %eax
je 0x3c49
incq %r13
cmpq %r13, 0x2c8(%rbx)
ja 0x3b44
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, -0x2120(%rbp)
testq %r12, %r12
je 0x3b8f
movq %r12, %rdi
callq 0x2817
jmp 0x3b91
xorl %eax, %eax
movq %rax, -0x2108(%rbp)
testq %r15, %r15
je 0x3ba7
movq %r15, %rdi
callq 0x2817
jmp 0x3ba9
xorl %eax, %eax
leaq -0x2140(%rbp), %r15
movq %rax, 0x40(%r15)
movq -0x30(%rbp), %rdi
callq 0x2817
movq %rax, 0x30(%r15)
movw $0x0, 0x48(%r15)
movl $0x4, %esi
movq %r15, %rdi
callq 0xda7c
leaq -0x20f0(%rbp), %rdi
movl $0x8, %esi
callq 0xda7c
leaq -0x20d0(%rbp), %rdi
movl $0x8, %esi
callq 0xda7c
leaq -0x50(%rbp), %rdi
movl $0x8, %esi
callq 0xda7c
leaq -0x70(%rbp), %rdi
movl $0x8, %esi
callq 0xda7c
leaq -0x20b0(%rbp), %rdi
movl $0x8, %esi
callq 0xda7c
leaq -0x2090(%rbp), %rdi
callq 0xdfe4
leaq 0x2b8(%rbx), %rdi
movq %r15, %rsi
callq 0xdd50
movl 0x2c8(%rbx), %r13d
decl %r13d
movl %r13d, %eax
addq $0x2118, %rsp           # imm = 0x2118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: parse_program
static void parse_program(script_t* script, vector_t* program)
{
	get_token(1);
	get_next_token();
	
	while(g_cur_tok != TOK_EOF)
	{
		expr_t* e = parse_expr(script);
		if (!e) break;
		vec_push_back(program, &e);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl $0x20, 0x124e8(%rip)    # 0x16160
xorl %edi, %edi
callq 0x9eb1
movl %eax, 0x126db(%rip)     # 0x16360
cmpl $0x32, %eax
je 0x3cb3
leaq -0x20(%rbp), %r15
movq %r14, %rdi
callq 0xaa4d
movq %rax, -0x20(%rbp)
testq %rax, %rax
je 0x3cb3
movq %rbx, %rdi
movq %r15, %rsi
callq 0xdd50
cmpl $0x32, 0x126af(%rip)    # 0x16360
jne 0x3c8e
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: script_run
void script_run(script_t* script)
{
	allocate_globals(script);
	vec_clear(&script->stack);
	
	// NOTE: making sure that compile-time externs
	// cannot be called at this point
	g_cur_module_index = -1;
	
	script->pc = 0;
	while(script->pc >= 0)
		script_execute_cycle(script);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x457f
leaq 0x198(%rbx), %rdi
callq 0xdfab
movl $0xffffffff, 0x11ceb(%rip) # imm = 0xFFFFFFFF
movl $0x0, 0x11c(%rbx)
movq %rbx, %rdi
callq 0x4601
cmpl $0x0, 0x11c(%rbx)
jns 0x4567
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: allocate_globals
static void allocate_globals(script_t* script)
{
	static script_value_t null_val;
	null_val.type = VAL_NULL;

	script_value_t* pv = &null_val;

	int num_globals = 0;
	for (int i = 0; i < script->modules.length; ++i)
	{
		script_module_t* module = vec_get(&script->modules, i);
		num_globals += module->globals.length;
	}

	vec_resize(&script->globals, num_globals, &pv);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl $0x0, 0x11ef1(%rip)     # 0x1648c
leaq 0x11ede(%rip), %rax     # 0x16480
movq %rax, -0x28(%rbp)
xorl %r14d, %r14d
cmpq $0x0, 0x2c8(%rdi)
je 0x45de
leaq 0x2b8(%rbx), %r15
xorl %r12d, %r12d
movq %r15, %rdi
movq %r12, %rsi
callq 0xdcf3
addl 0x2100(%rax), %r14d
incq %r12
cmpq %r12, 0x2c8(%rbx)
ja 0x45bd
movslq %r14d, %r14
addq $0x170, %rbx            # imm = 0x170
leaq -0x28(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xdc8d
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: script_start
void script_start(script_t* script)
{
	allocate_globals(script);
	vec_clear(&script->stack);
	
	g_cur_module_index = -1;

	script->pc = 0;

	// NOTE: All global code needs to be run at startup
	// because otherwise globals remain uninitialized
	// etc
	while (script->pc >= 0)
		script_execute_cycle(script);
	
	script->pc = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x457f
leaq 0x198(%rbx), %rdi
callq 0xdfab
movl $0xffffffff, 0x111bb(%rip) # imm = 0xFFFFFFFF
movl $0x0, 0x11c(%rbx)
movq %rbx, %rdi
callq 0x4601
cmpl $0x0, 0x11c(%rbx)
jns 0x5097
movl $0x0, 0x11c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: script_get_function_by_name
char script_get_function_by_name(script_t* script, const char* name, script_function_t* function)
{
	for(int i = 0; i < script->function_names.length; ++i)
	{
		char* func_name = vec_get_value(&script->function_names, i, char*);
		if(strcmp(name, func_name) == 0)
		{
			function->index = i;
			function->is_extern = 0;
			return 1;
		}
	}
	
	for(int i = 0; i < script->extern_names.length; ++i)
	{
		char* extern_name = vec_get_value(&script->extern_names, i, char*);
		if(strcmp(name, extern_name) == 0)
		{
			function->index = i;
			function->is_extern = 1;
			return 1;
		}
	}
	
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r12
cmpq $0x0, 0x288(%rdi)
je 0x583f
leaq 0x278(%r12), %r13
xorl %r14d, %r14d
movq %r13, %rdi
movq %r14, %rsi
callq 0xdcf3
movq (%rax), %rsi
movq %r15, %rdi
callq 0x2160
testl %eax, %eax
je 0x5880
incq %r14
cmpq %r14, 0x288(%r12)
ja 0x5818
cmpq $0x0, 0x248(%r12)
je 0x587c
leaq 0x238(%r12), %r13
xorl %r14d, %r14d
movq %r13, %rdi
movq %r14, %rsi
callq 0xdcf3
movq (%rax), %rsi
movq %r15, %rdi
callq 0x2160
testl %eax, %eax
je 0x5884
incq %r14
cmpq %r14, 0x248(%r12)
ja 0x5855
xorl %eax, %eax
jmp 0x588e
xorl %eax, %eax
jmp 0x5886
movb $0x1, %al
movl %r14d, 0x4(%rbx)
movb %al, (%rbx)
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: script_call_function
void script_call_function(script_t* script, script_function_t function, int nargs)
{
	int depth = script->indir_depth;
	push_stack_frame(script, (word)nargs);
	script->pc = vec_get_value(&script->function_pcs, function.index, int);
	
	while (script->indir_depth > depth && script->pc >= 0)
		script_execute_cycle(script);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl 0x190(%rdi), %r15d
movzbl %dl, %esi
callq 0x5911
leaq 0x298(%rbx), %rdi
sarq $0x20, %r14
movq %r14, %rsi
callq 0xdcf3
movl (%rax), %eax
movl %eax, 0x11c(%rbx)
cmpl %r15d, 0x190(%rbx)
setg %cl
testl %eax, %eax
setns %al
andb %cl, %al
cmpb $0x1, %al
jne 0x5906
movq %rbx, %rdi
callq 0x4601
cmpl %r15d, 0x190(%rbx)
jle 0x5906
cmpl $0x0, 0x11c(%rbx)
jns 0x58ec
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: push_stack_frame
static void push_stack_frame(script_t* script, word nargs)
{
	int i_nargs = (int)nargs;

	vec_push_back(&script->indir, &i_nargs);
	vec_push_back(&script->indir, &script->fp);
	vec_push_back(&script->indir, &script->pc);
	
	script->fp = script->stack.length;
	++script->indir_depth;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq -0x14(%rbp), %rax
movl %esi, (%rax)
leaq 0x1b8(%rdi), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0xdd50
leaq 0x120(%rbx), %rsi
movq %r14, %rdi
callq 0xdd50
leaq 0x11c(%rbx), %rsi
movq %r14, %rdi
callq 0xdd50
movl 0x1a8(%rbx), %eax
movl %eax, 0x120(%rbx)
incl 0x190(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: script_destroy
void script_destroy(script_t* script)
{
	vec_traverse(&script->modules, destroy_module);
	vec_destroy(&script->modules);
	
	destroy_all_values(script);
	
	vec_destroy(&script->globals);
	
	vec_destroy(&script->code);
	
	vec_destroy(&script->stack);
	vec_destroy(&script->indir);
	
	vec_destroy(&script->numbers);
	
	vec_traverse(&script->strings, destroy_string);
	vec_destroy(&script->strings);
	
	vec_traverse(&script->extern_names, destroy_cstring);
	vec_destroy(&script->extern_names);
	
	vec_destroy(&script->externs);
	
	vec_traverse(&script->function_names, destroy_cstring);
	vec_destroy(&script->function_names);
	
	vec_destroy(&script->function_pcs);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x2b8(%rdi), %r14
leaq -0x29ab(%rip), %rsi     # 0x3016
movq %r14, %rdi
callq 0xdf70
movq %r14, %rdi
callq 0xdfb9
movq 0x150(%rbx), %rdi
testq %rdi, %rdi
je 0x59ed
movq (%rdi), %r14
callq 0x2030
movq %r14, %rdi
testq %r14, %r14
jne 0x59dd
movq $0x0, 0x158(%rbx)
leaq 0x170(%rbx), %rdi
callq 0xdfb9
leaq 0x1d8(%rbx), %rdi
callq 0xdfb9
leaq 0x198(%rbx), %rdi
callq 0xdfb9
leaq 0x1b8(%rbx), %rdi
callq 0xdfb9
leaq 0x1f8(%rbx), %rdi
callq 0xdfb9
leaq 0x218(%rbx), %r14
leaq 0x70(%rip), %rsi        # 0x5ab2
movq %r14, %rdi
callq 0xdf70
movq %r14, %rdi
callq 0xdfb9
leaq 0x238(%rbx), %r14
leaq 0x71(%rip), %r15        # 0x5ad1
movq %r14, %rdi
movq %r15, %rsi
callq 0xdf70
movq %r14, %rdi
callq 0xdfb9
leaq 0x258(%rbx), %rdi
callq 0xdfb9
leaq 0x278(%rbx), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0xdf70
movq %r14, %rdi
callq 0xdfb9
addq $0x298, %rbx            # imm = 0x298
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xdfb9
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: ext_unmarshal
static void ext_unmarshal(script_t* script, vector_t* args)
{
	script_value_t* desc_val = script_get_arg(args, 0);
	script_value_t* mem_val = script_get_arg(args, 1);

	const char* desc = desc_val->string.data;
	char* mem = (char*)mem_val->nat.value;
	
	script_value_t* val = unmarshal(script, &desc, &mem);
	if (!val)
	{
		script_push_null(script);
		script_return_top(script);
	}
	else
	{
		push_value(script, val);
		script_return_top(script);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
xorl %esi, %esi
callq 0xdcf3
movq (%rax), %r15
movl $0x1, %esi
movq %r14, %rdi
callq 0xdcf3
movq (%rax), %rax
movq 0x28(%r15), %rcx
leaq -0x28(%rbp), %rsi
movq %rcx, (%rsi)
movq 0x20(%rax), %rax
leaq -0x20(%rbp), %rdx
movq %rax, (%rdx)
movq %rbx, %rdi
callq 0x7a62
testq %rax, %rax
jne 0x5b42
movl $0x0, 0x106d1(%rip)     # 0x1620c
leaq 0x106be(%rip), %rax     # 0x16200
movq %rbx, %rdi
movq %rax, %rsi
callq 0x31a4
movq %rbx, %rdi
callq 0x312b
movq %rax, 0x160(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: ext_debug_break
static void ext_debug_break(script_t* script, vector_t* args)
{
	// NOTE: HACK: pop call record off because we want to be
	// in the scope of the enclosing function
	script_call_record_t record = vec_get_value(&script->call_records, script->call_records.length - 1, script_call_record_t);
	pop_call_record(script);

	debug_script(script);
	
	vec_push_back(&script->call_records, &record);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x60, %rsp
movq %rdi, %r14
leaq 0x130(%rdi), %rbx
movq 0x140(%rdi), %rsi
decq %rsi
movq %rbx, %rdi
callq 0xdcf3
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movaps %xmm0, -0x40(%rbp)
movaps %xmm1, -0x30(%rbp)
movaps %xmm2, -0x20(%rbp)
cmpq $0x0, 0x140(%r14)
je 0x5bbb
leaq -0x70(%rbp), %rsi
movq %rbx, %rdi
callq 0xddc1
movq %r14, %rdi
callq 0x50b9
leaq -0x40(%rbp), %rsi
movq %rbx, %rdi
callq 0xdd50
addq $0x60, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: ext_add_module
static void ext_add_module(script_t* script, vector_t* args)
{
	script_value_t* name_val = script_get_arg(args, 0);
	script_value_t* code_val = script_get_arg(args, 1);
	
	const char* name = name_val->string.data;
	const char* code = code_val->string.data;
	
	script_parse_code(script, code, NULL, name);
	script_push_number(script, script->modules.length - 1);
	script_return_top(script);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
xorl %esi, %esi
callq 0xdcf3
movq (%rax), %r15
movl $0x1, %esi
movq %r14, %rdi
callq 0xdcf3
movq (%rax), %rax
movq 0x28(%r15), %rcx
movq 0x28(%rax), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x39e1
movq 0x2c8(%rbx), %rax
decq %rax
movq %rax, %xmm0
punpckldq 0x941f(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x9427(%rip), %xmm0     # 0xf060
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, -0x30(%rbp)
movq %rbx, %rdi
movl $0x3, %esi
callq 0x3322
movaps -0x30(%rbp), %xmm0
movsd %xmm0, 0x20(%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x31a4
movq %rbx, %rdi
callq 0x312b
movq %rax, 0x160(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: ext_load_module
static void ext_load_module(script_t* script, vector_t* args)
{
	script_value_t* name_val = script_get_arg(args, 0);
	script_value_t* path_val = script_get_arg(args, 1);

	const char* name = name_val->string.data;
	const char* path = path_val->string.data;

	script_load_parse_file(script, path, name);
	script_push_number(script, script->modules.length - 1);
	script_return_top(script);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
xorl %esi, %esi
callq 0xdcf3
movq (%rax), %r15
movl $0x1, %esi
movq %r14, %rdi
callq 0xdcf3
movq (%rax), %rax
movq 0x28(%r15), %rdx
movq 0x28(%rax), %rsi
movq %rbx, %rdi
callq 0x382f
movq 0x2c8(%rbx), %rax
decq %rax
movq %rax, %xmm0
punpckldq 0x9374(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x937c(%rip), %xmm0     # 0xf060
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, -0x30(%rbp)
movq %rbx, %rdi
movl $0x3, %esi
callq 0x3322
movaps -0x30(%rbp), %xmm0
movsd %xmm0, 0x20(%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x31a4
movq %rbx, %rdi
callq 0x312b
movq %rax, 0x160(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: ext_compile_module
static void ext_compile_module(script_t* script, vector_t* args)
{
	append_code(script, OP_HALT);
	
	script_value_t* idx_val = script_get_arg(args, 0);
	int module_index = (int)idx_val->number;
	
	script_module_t* module = vec_get(&script->modules, module_index);
	compile_module(script, module);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq -0x11(%rbp), %rsi
movb $0x30, (%rsi)
addq $0x1d8, %rdi            # imm = 0x1D8
callq 0xdd50
movq %rbx, %rdi
xorl %esi, %esi
callq 0xdcf3
movq (%rax), %rax
cvttsd2si 0x20(%rax), %eax
leaq 0x2b8(%r14), %rdi
movslq %eax, %rsi
callq 0xdcf3
movq %r14, %rdi
movq %rax, %rsi
callq 0x3d12
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: ext_run_module
static void ext_run_module(script_t* script, vector_t* args)
{
	script_value_t* idx_val = script_get_arg(args, 0);
	int module_index = (int)idx_val->number;
	
	script_module_t* module = vec_get(&script->modules, module_index);

	if(!module->compiled)
		error_exit_script(script, "Attempting to run an uncompiled module '%s'\n", module->name);

	int pc = script->pc;
	script->pc = module->start_pc;
	
	while (script->pc >= 0 && script->pc < module->end_pc)
		script_execute_cycle(script);

	script->pc = pc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rsi, %rdi
xorl %esi, %esi
callq 0xdcf3
movq (%rax), %rax
cvttsd2si 0x20(%rax), %eax
leaq 0x2b8(%rbx), %rdi
movslq %eax, %rsi
callq 0xdcf3
movq %rax, %r14
cmpb $0x0, 0x49(%rax)
je 0x5dff
movl 0x11c(%rbx), %r15d
movl 0x20(%r14), %eax
movl %eax, 0x11c(%rbx)
testl %eax, %eax
js 0x5ded
movl %eax, %eax
cmpq %rax, 0x28(%r14)
jbe 0x5ded
movq %rbx, %rdi
callq 0x4601
movl 0x11c(%rbx), %eax
jmp 0x5dd1
movl %r15d, 0x11c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x38(%r14), %rdx
leaq 0x9dcb(%rip), %rsi      # 0xfbd5
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3224
// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: ext_get_module_source_code
static void ext_get_module_source_code(script_t* script, vector_t* args)
{
	EXT_CHECK_IF_CT("get_module_source_code");
	
	script_value_t* val = script_get_arg(args, 0);
	int module_index = (int)val->number;
	
	script_module_t* module = vec_get(&script->modules, module_index);
	script_push_cstr(script, module->source_code);
	script_return_top(script);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, 0x103cf(%rip)     # 0x16248
js 0x5ebe
movq %rsi, %rdi
xorl %esi, %esi
callq 0xdcf3
movq (%rax), %rax
cvttsd2si 0x20(%rax), %eax
leaq 0x2b8(%rbx), %rdi
movslq %eax, %rsi
callq 0xdcf3
movq 0x30(%rax), %rsi
movq %rbx, %rdi
callq 0x359a
movq %rbx, %rdi
callq 0x312b
movq %rax, 0x160(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x9d8c(%rip), %rsi      # 0xfc51
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3224