LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/json.c
// Function: codepoint_to_utf8
static size_t codepoint_to_utf8(long cp, char buf[4])
{
	if (cp <= 0x7F) {
		buf[0] = cp;
		return 1;
	} else if (cp <= 0x7FF) {
		buf[0] = 0xC0 | (cp >> 6);
		buf[1] = 0x80 | (cp & 0x3F);
		return 2;
	} else if (cp <= 0xFFFF) {
		buf[0] = 0xE0 | (cp >> 12);
		buf[1] = 0x80 | ((cp >> 6) & 0x3F);
		buf[2] = 0x80 | (cp & 0x3F);
		return 3;
	} else {
		buf[0] = 0xF0 | (cp >> 18);
		buf[1] = 0x80 | ((cp >> 12) & 0x3F);
		buf[2] = 0x80 | ((cp >> 6) & 0x3F);
		buf[3] = 0x80 | (cp & 0x3F);
		return 4;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x7f, -0x10(%rbp)
jg 0x94ac
movq -0x10(%rbp), %rax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, (%rax)
movq $0x1, -0x8(%rbp)
jmp 0x95b7
cmpq $0x7ff, -0x10(%rbp)     # imm = 0x7FF
jg 0x94f0
movq -0x10(%rbp), %rax
sarq $0x6, %rax
orq $0xc0, %rax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, (%rax)
movq -0x10(%rbp), %rax
andq $0x3f, %rax
orq $0x80, %rax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x1(%rax)
movq $0x2, -0x8(%rbp)
jmp 0x95b7
cmpq $0xffff, -0x10(%rbp)    # imm = 0xFFFF
jg 0x954c
movq -0x10(%rbp), %rax
sarq $0xc, %rax
orq $0xe0, %rax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, (%rax)
movq -0x10(%rbp), %rax
sarq $0x6, %rax
andq $0x3f, %rax
orq $0x80, %rax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x1(%rax)
movq -0x10(%rbp), %rax
andq $0x3f, %rax
orq $0x80, %rax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x2(%rax)
movq $0x3, -0x8(%rbp)
jmp 0x95b7
movq -0x10(%rbp), %rax
sarq $0x12, %rax
orq $0xf0, %rax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, (%rax)
movq -0x10(%rbp), %rax
sarq $0xc, %rax
andq $0x3f, %rax
orq $0x80, %rax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x1(%rax)
movq -0x10(%rbp), %rax
sarq $0x6, %rax
andq $0x3f, %rax
orq $0x80, %rax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x2(%rax)
movq -0x10(%rbp), %rax
andq $0x3f, %rax
orq $0x80, %rax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x3(%rax)
movq $0x4, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/loader.c
// Function: loader_init
void loader_init(struct loader *ldr, const char *root)
{
	ldr->txtrs_dir = mid_cat(root, DIRSEP, "textures");
	table_init(&ldr->txtrs, 16);
	ldr->ents_dir = mid_cat(root, DIRSEP, "ents");
	table_init(&ldr->ents, 16);
	ldr->maps_dir = mid_cat(root, DIRSEP, "maps");
	table_init(&ldr->maps, 16);
	color_map_init(&ldr->colors);
	// Default background pixel:
	color_map_add_pair(&ldr->colors, pixel(PC_BLACK, PC_BLACK));
	ldr->log = NULL;
	ldr->empty_txtr = NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movl $0x2f, %esi
leaq 0x7e09(%rip), %rdx      # 0x116d9
callq 0x10760
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
movl $0x10, %esi
callq 0xf990
movq -0x10(%rbp), %rdi
movl $0x2f, %esi
leaq 0x7de0(%rip), %rdx      # 0x116e2
callq 0x10760
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
movl $0x10, %esi
callq 0xf990
movq -0x10(%rbp), %rdi
movl $0x2f, %esi
leaq 0x7db3(%rip), %rdx      # 0x116e7
callq 0x10760
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x8(%rbp), %rdi
addq $0x48, %rdi
movl $0x10, %esi
callq 0xf990
movq -0x8(%rbp), %rdi
addq $0x68, %rdi
callq 0xfee0
movq -0x8(%rbp), %rdi
addq $0x68, %rdi
xorl %esi, %esi
callq 0xff10
movq -0x8(%rbp), %rax
movq $0x0, 0xb0(%rax)
movq -0x8(%rbp), %rax
movq $0x0, (%rax)
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/loader.c
// Function: loader_map_path
char *loader_map_path(const struct loader *ldr, const char *name)
{
	size_t cap = 10;
	struct string buf;
	string_init(&buf, cap);
	string_pushz(&buf, &cap, ldr->maps_dir);
	string_pushc(&buf, &cap, DIRSEP);
	string_pushz(&buf, &cap, name);
	string_pushn(&buf, &cap, ".json", 6);
	string_shrink_to_fit(&buf);
	return buf.text;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0xa, -0x18(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0xf7f0
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rdx
leaq -0x28(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0xf900
leaq -0x28(%rbp), %rdi
leaq -0x18(%rbp), %rsi
movl $0x2f, %edx
callq 0xf950
movq -0x10(%rbp), %rdx
leaq -0x28(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0xf900
leaq -0x28(%rbp), %rdi
leaq -0x18(%rbp), %rsi
leaq 0x7e64(%rip), %rdx      # 0x11870
movl $0x6, %ecx
callq 0xf8b0
leaq -0x28(%rbp), %rdi
callq 0xf870
movq -0x20(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/loader.c
// Function: loadj
static void **loadj(table *tab, const char *root, const char *name, FILE **file,
	struct logger *log)
{
	char *fname = mid_cat(name, '.', "json");
	void **loaded = load(tab, root, fname, file, log);
	if (!*file) free(fname);
	return loaded;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x18(%rbp), %rdi
movl $0x2e, %esi
leaq 0x7dc5(%rip), %rdx      # 0x11871
callq 0x10760
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
callq 0x9bb0
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x9ae5
movq -0x30(%rbp), %rdi
callq 0x2580
movq -0x38(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/loader.c
// Function: loader_texture
d3d_texture **loader_texture(struct loader *ldr, const char *name, FILE **file)
{
	char *fname = str_dup(name);
	d3d_texture **loaded = (d3d_texture **)load(&ldr->txtrs, ldr->txtrs_dir,
		fname, file, ldr->log);
	if (!*file) free(fname);
	return loaded;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x106a0
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x20(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0xb0(%rax), %r8
callq 0x9bb0
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x9ba0
movq -0x20(%rbp), %rdi
callq 0x2580
movq -0x28(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/loader.c
// Function: load
static void **load(table *tab, const char *root, const char *name, FILE **file,
	struct logger *log)
{
	void **item = table_get(tab, name);
	*file = NULL;
	if (!item) {
		char *path = mid_cat(root, DIRSEP, name);
		*file = fopen(path, "r");
		if (*file) {
			logger_printf(log, LOGGER_INFO, "Loading %s\n", path);
			table_add(tab, name, NULL);
			item = table_get(tab, name);
		} else {
			logger_printf(log, LOGGER_ERROR,
				"Cannot load %s\n", path);
		}
		free(path);
	}
	return item;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xfbe0
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
cmpq $0x0, -0x30(%rbp)
jne 0x9c90
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x2f, %esi
callq 0x10760
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
leaq 0x77e4(%rip), %rsi      # 0x113f8
callq 0x2160
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
je 0x9c6c
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rcx
movl $0x1, %esi
leaq 0x7af4(%rip), %rdx      # 0x11735
movb $0x0, %al
callq 0xa260
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0xf9e0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xfbe0
movq %rax, -0x30(%rbp)
jmp 0x9c87
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rcx
movl $0x4, %esi
leaq 0x7ac1(%rip), %rdx      # 0x11741
movb $0x0, %al
callq 0xa260
movq -0x38(%rbp), %rdi
callq 0x2580
movq -0x30(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/loader.c
// Function: loader_print_summary
void loader_print_summary(struct loader *ldr)
{
	logger_printf(ldr->log, LOGGER_INFO,
		"Load summary: %lu maps, %lu entity types, %lu textures, "
		"%lu color pairs\n",
		(unsigned long)table_count(&ldr->maps),
		(unsigned long)table_count(&ldr->ents),
		(unsigned long)table_count(&ldr->txtrs),
		(unsigned long)color_map_count_pairs(&ldr->colors));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0xb0(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
addq $0x48, %rdi
callq 0xfcc0
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
callq 0xfcc0
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
callq 0xfcc0
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
addq $0x68, %rdi
callq 0x10060
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %r8
movq -0x10(%rbp), %r9
movl $0x1, %esi
leaq 0x7985(%rip), %rdx      # 0x116ec
movq %rax, (%rsp)
movb $0x0, %al
callq 0xa260
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/logger.c
// Function: logger_init
void logger_init(struct logger *log)
{
	if (!log) return;
	log->flags = 0;
	log->info = log->warning = log->error = NULL;
	log->do_free = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0xa001
jmp 0xa03a
movq -0x8(%rbp), %rax
movl $0x0, (%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x20(%rax)
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/logger.c
// Function: get_filep
static FILE **get_filep(struct logger *log, int mode)
{
	switch (mode) {
	default:
	case LOGGER_INFO:
		return &log->info;
	case LOGGER_WARNING:
		return &log->warning;
	case LOGGER_ERROR:
		return &log->error;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x18(%rbp)
subl $0x1, %eax
je 0xa0be
jmp 0xa0a8
movl -0x18(%rbp), %eax
subl $0x2, %eax
je 0xa0cc
jmp 0xa0b2
movl -0x18(%rbp), %eax
subl $0x4, %eax
je 0xa0da
jmp 0xa0bc
jmp 0xa0be
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x8(%rbp)
jmp 0xa0e6
movq -0x10(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x8(%rbp)
jmp 0xa0e6
movq -0x10(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/logger.c
// Function: get_mode
static int get_mode(int flags)
{
	if (flags & LOGGER_INFO) {
		return LOGGER_INFO;
	} else if (flags & LOGGER_WARNING) {
		return LOGGER_WARNING;
	} else if (flags & LOGGER_ERROR) {
		return LOGGER_ERROR;
	}
	return LOGGER_INFO;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x8(%rbp)
movl -0x8(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xa10b
movl $0x1, -0x4(%rbp)
jmp 0xa13e
movl -0x8(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0xa11f
movl $0x2, -0x4(%rbp)
jmp 0xa13e
movl -0x8(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0xa133
movl $0x4, -0x4(%rbp)
jmp 0xa13e
jmp 0xa135
jmp 0xa137
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/logger.c
// Function: logger_set_output
void logger_set_output(struct logger *log, int which, FILE *dest, bool do_free)
{
	if (!log) return;
	if ((which & LOGGER_ALL) == LOGGER_ALL) {
		log->do_free &= ~LOGGER_ALL;
		log->flags &= ~LOGGER_ALL;
		log->info = log->warning = log->error = dest;
		if (dest) {
			log->flags |= LOGGER_ALL;
			if (do_free) log->do_free |= LOGGER_ALL;
		}
	} else {
		int mode = get_mode(which);
		log->do_free &= ~mode;
		*get_filep(log, mode) = dest;
		if (dest) {
			log->flags |= mode;
			if (do_free) log->do_free |= mode;
		} else {
			log->flags &= ~mode;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movb %cl, %al
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
andb $0x1, %al
movb %al, -0x19(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0xa176
jmp 0xa24b
movl -0xc(%rbp), %eax
andl $0x7, %eax
cmpl $0x7, %eax
jne 0xa1de
movq -0x8(%rbp), %rax
movl 0x20(%rax), %ecx
andl $-0x8, %ecx
movl %ecx, 0x20(%rax)
movq -0x8(%rbp), %rax
movl (%rax), %ecx
andl $-0x8, %ecx
movl %ecx, (%rax)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
cmpq $0x0, -0x18(%rbp)
je 0xa1dc
movq -0x8(%rbp), %rax
movl (%rax), %ecx
orl $0x7, %ecx
movl %ecx, (%rax)
testb $0x1, -0x19(%rbp)
je 0xa1da
movq -0x8(%rbp), %rax
movl 0x20(%rax), %ecx
orl $0x7, %ecx
movl %ecx, 0x20(%rax)
jmp 0xa1dc
jmp 0xa24b
movl -0xc(%rbp), %edi
callq 0xa0f0
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %ecx
xorl $-0x1, %ecx
movq -0x8(%rbp), %rax
andl 0x20(%rax), %ecx
movl %ecx, 0x20(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl -0x20(%rbp), %esi
callq 0xa090
movq -0x28(%rbp), %rcx
movq %rcx, (%rax)
cmpq $0x0, -0x18(%rbp)
je 0xa23b
movl -0x20(%rbp), %ecx
movq -0x8(%rbp), %rax
orl (%rax), %ecx
movl %ecx, (%rax)
testb $0x1, -0x19(%rbp)
je 0xa239
movl -0x20(%rbp), %ecx
movq -0x8(%rbp), %rax
orl 0x20(%rax), %ecx
movl %ecx, 0x20(%rax)
jmp 0xa249
movl -0x20(%rbp), %ecx
xorl $-0x1, %ecx
movq -0x8(%rbp), %rax
andl (%rax), %ecx
movl %ecx, (%rax)
jmp 0xa24b
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/logger.c
// Function: logger_printf
void logger_printf(struct logger *log, int flags, const char *format, ...)
{
	if (!log) return;
	int mode = get_mode(flags);
	if (!(log->flags & mode)) return;
	FILE *file = *get_filep(log, mode);
	fputs(get_prefix(log, mode), file);
	va_list args;
	va_start(args, format);
	vfprintf(file, format, args);
	va_end(args);
	fflush(file);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
testb %al, %al
je 0xa29b
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)
movq %r9, -0xc8(%rbp)
movq %r8, -0xd0(%rbp)
movq %rcx, -0xd8(%rbp)
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0xa2c7
jmp 0xa34f
movl -0xc(%rbp), %edi
callq 0xa0f0
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
andl -0x1c(%rbp), %eax
cmpl $0x0, %eax
jne 0xa2e2
jmp 0xa34f
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0xa090
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0xa360
movq %rax, %rdi
movq -0x28(%rbp), %rsi
callq 0x2290
leaq -0x40(%rbp), %rax
leaq -0xf0(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x18, (%rax)
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x21d0
leaq -0x40(%rbp), %rax
movq -0x28(%rbp), %rdi
callq 0x2560
addq $0xf0, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/logger.c
// Function: get_prefix
static const char *get_prefix(struct logger *log, int mode)
{
	(void)log;
	switch (mode) {
	default:
	case LOGGER_INFO:
		return "[INFO] ";
	case LOGGER_WARNING:
		return "[WARNING] ";
	case LOGGER_ERROR:
		return "[ERROR] ";
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x18(%rbp)
subl $0x1, %eax
je 0xa38e
jmp 0xa378
movl -0x18(%rbp), %eax
subl $0x2, %eax
je 0xa39b
jmp 0xa382
movl -0x18(%rbp), %eax
subl $0x4, %eax
je 0xa3a8
jmp 0xa38c
jmp 0xa38e
leaq 0x73bc(%rip), %rax      # 0x11751
movq %rax, -0x8(%rbp)
jmp 0xa3b3
leaq 0x73b7(%rip), %rax      # 0x11759
movq %rax, -0x8(%rbp)
jmp 0xa3b3
leaq 0x73b5(%rip), %rax      # 0x11764
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/logger.c
// Function: logger_free
void logger_free(struct logger *log)
{
	if (!log) return;
	// Make sure no files are closed twice.
	FILE *filei = NULL, *filew = NULL, *filee = NULL;
	if ((log->do_free & LOGGER_INFO)
	 && (filei = *get_filep(log, LOGGER_INFO)))
		fclose(filei);
	if ((log->do_free & LOGGER_WARNING)
	 && (filew = *get_filep(log, LOGGER_WARNING))
	 && !(filew == filei && log->do_free & LOGGER_INFO))
		fclose(filew);
	if ((log->do_free & LOGGER_ERROR)
	 && (filee = *get_filep(log, LOGGER_ERROR))
	 && !(filee == filei && log->do_free & LOGGER_INFO)
	 && !(filee == filew && log->do_free & LOGGER_WARNING))
		fclose(filee);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0xa3d8
jmp 0xa4d4
movq $0x0, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xa423
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0xa090
movq (%rax), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0xa423
movq -0x10(%rbp), %rdi
callq 0x23f0
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0xa46f
movq -0x8(%rbp), %rdi
movl $0x2, %esi
callq 0xa090
movq (%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0xa46f
movq -0x18(%rbp), %rax
cmpq -0x10(%rbp), %rax
jne 0xa466
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0xa46f
movq -0x18(%rbp), %rdi
callq 0x23f0
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0xa4d4
movq -0x8(%rbp), %rdi
movl $0x4, %esi
callq 0xa090
movq (%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0xa4d4
movq -0x20(%rbp), %rax
cmpq -0x10(%rbp), %rax
jne 0xa4b2
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0xa4d4
movq -0x20(%rbp), %rax
cmpq -0x18(%rbp), %rax
jne 0xa4cb
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0xa4d4
movq -0x20(%rbp), %rdi
callq 0x23f0
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/main.c
// Function: remove_log_dest
static int remove_log_dest(const char *progname, struct logger *log,
	const char *arg)
{
	int which;
	if (!strcasecmp("all", arg)) {
		remove_log_dest(progname, log, "info");
		remove_log_dest(progname, log, "warning");
		remove_log_dest(progname, log, "error");
		return 0;
	} else if (!strcasecmp("info", arg)) {
		which = LOGGER_INFO;
	} else if (!strcasecmp("warning", arg)) {
		which = LOGGER_WARNING;
	} else if (!strcasecmp("error", arg)) {
		which = LOGGER_ERROR;
	} else {
		fprintf(stderr, "%s: Invalid log name: %s\n", progname, arg);
		return -1;
	}
	close_old_file(log, which);
	logger_set_output(log, which, NULL, false);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x20(%rbp), %rsi
leaq 0x7248(%rip), %rdi      # 0x11e47
callq 0x2120
cmpl $0x0, %eax
jne 0xac51
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq 0x7233(%rip), %rdx      # 0x11e4b
callq 0xabe0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq 0x7224(%rip), %rdx      # 0x11e50
callq 0xabe0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq 0x68ac(%rip), %rdx      # 0x114ec
callq 0xabe0
movl $0x0, -0x4(%rbp)
jmp 0xacff
movq -0x20(%rbp), %rsi
leaq 0x71ef(%rip), %rdi      # 0x11e4b
callq 0x2120
cmpl $0x0, %eax
jne 0xac6f
movl $0x1, -0x24(%rbp)
jmp 0xacd8
movq -0x20(%rbp), %rsi
leaq 0x71d6(%rip), %rdi      # 0x11e50
callq 0x2120
cmpl $0x0, %eax
jne 0xac8d
movl $0x2, -0x24(%rbp)
jmp 0xacd6
movq -0x20(%rbp), %rsi
leaq 0x6854(%rip), %rdi      # 0x114ec
callq 0x2120
cmpl $0x0, %eax
jne 0xacab
movl $0x4, -0x24(%rbp)
jmp 0xacd4
movq 0xb336(%rip), %rax      # 0x15fe8
movq (%rax), %rdi
movq -0x10(%rbp), %rdx
movq -0x20(%rbp), %rcx
leaq 0x7194(%rip), %rsi      # 0x11e58
movb $0x0, %al
callq 0x24c0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xacff
jmp 0xacd6
jmp 0xacd8
jmp 0xacda
movq -0x18(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0xad70
movq -0x18(%rbp), %rdi
movl -0x24(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0xa150
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/map.c
// Function: get_wall_ck
static uint8_t get_wall_ck(const struct map *map, long lx, long ly)
{
	size_t x = (size_t)lx, y = (size_t)ly;
	if (x < d3d_board_width(map->board) && y < d3d_board_height(map->board))
	{
		return *get_wall((struct map *)map, x, y);
	} else {
		return 0;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x3d20
movq %rax, %rcx
movq -0x38(%rbp), %rax
cmpq %rcx, %rax
jae 0xb5fe
movq -0x30(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x3d40
movq %rax, %rcx
movq -0x40(%rbp), %rax
cmpq %rcx, %rax
jae 0xb5fe
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0xc550
movb (%rax), %al
movb %al, -0x1(%rbp)
jmp 0xb602
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/map.c
// Function: map_prereq
char *map_prereq(struct loader *ldr, const char *name)
{
	char *path = loader_map_path(ldr, name);
	FILE *file = fopen(path, "r");
	if (!file) {
		free(path);
		return NULL;
	}
	json_reader rdr;
	json_alloc(&rdr, NULL, 1, xmalloc, free, xrealloc);
	char buf[BUFSIZ];
	json_source_file(&rdr, buf, sizeof(buf), file);
	struct json_item item;
	scan_json_key(&rdr, "prereq", &item);
	json_free(&rdr);
	fclose(file);
	free(item.key.bytes);
	free(path);
	return item.type == JSON_STRING ? item.val.str.bytes : NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20c0, %rsp           # imm = 0x20C0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x99a0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
leaq 0x5db9(%rip), %rsi      # 0x113f8
callq 0x2160
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xb665
movq -0x20(%rbp), %rdi
callq 0x2580
movq $0x0, -0x8(%rbp)
jmp 0xb71e
leaq -0x88(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %edx
leaq 0x5504(%rip), %rcx      # 0x10b80
movq 0xa92d(%rip), %r8       # 0x15fb0
leaq 0x5676(%rip), %r9       # 0x10d00
callq 0x7510
leaq -0x2090(%rbp), %rsi
movq -0x28(%rbp), %rcx
leaq -0x88(%rbp), %rdi
movl $0x2000, %edx           # imm = 0x2000
callq 0x7770
leaq -0x88(%rbp), %rdi
leaq 0x67ef(%rip), %rsi      # 0x11ea8
leaq -0x20b8(%rbp), %rdx
callq 0x7230
leaq -0x88(%rbp), %rdi
callq 0x78b0
movq -0x28(%rbp), %rdi
callq 0x23f0
movq -0x20b8(%rbp), %rdi
callq 0x2580
movq -0x20(%rbp), %rdi
callq 0x2580
cmpl $0x6, -0x20a8(%rbp)
jne 0xb708
movq -0x20a0(%rbp), %rax
movq %rax, -0x20c0(%rbp)
jmp 0xb713
xorl %eax, %eax
movq %rax, -0x20c0(%rbp)
jmp 0xb713
movq -0x20c0(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20c0, %rsp           # imm = 0x20C0
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/map.c
// Function: parse_ent_start
static int parse_ent_start(struct map_ent_start *start, struct loader *ldr,
	struct json_node *root)
{
	union json_node_data *got;
	start->frame = 0;
	if ((got = json_map_get(root, "kind", JN_STRING))) {
		struct ent_type *kind = load_ent_type(ldr, got->str);
		if (!kind) goto error_kind;
		start->type = kind;
	} else {
		goto error_kind;
	}
	start->team = TEAM_UNALIGNED;
	if (start->type->team_override != TEAM_INVALID) {
		start->team = start->type->team_override;
	} else if ((got = json_map_get(root, "team", JN_STRING))) {
		enum team team = team_from_str(got->str);
		if (team == TEAM_INVALID) {
			logger_printf(loader_logger(ldr), LOGGER_WARNING,
				"Invalid entity team: \"%s\"\n", got->str);
		} else {
			start->team = team;
		}
	}
	start->pos.x = start->pos.y = 0;
	if ((got = json_map_get(root, "pos", JN_LIST)))
		parse_json_vec(&start->pos, &got->list);
	return 0;

error_kind:
	logger_printf(loader_logger(ldr), LOGGER_ERROR,
		"Entity start specification has no \"kind\" attribute\n");
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x20(%rbp), %rdi
leaq 0x5d69(%rip), %rsi      # 0x11f34
movl $0x4, %edx
callq 0x6820
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0xc20d
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rsi
callq 0x5870
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0xc1ff
jmp 0xc2f5
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0xc212
jmp 0xc2f5
movq -0x10(%rbp), %rax
movl $0x1, 0x18(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
cmpl $-0x1, 0x5c(%rax)
je 0xc23f
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x5c(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x18(%rax)
jmp 0xc2a9
movq -0x20(%rbp), %rdi
leaq 0x5cef(%rip), %rsi      # 0x11f39
movl $0x4, %edx
callq 0x6820
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0xc2a7
movq -0x28(%rbp), %rax
movq (%rax), %rdi
callq 0xfd00
movl %eax, -0x34(%rbp)
cmpl $-0x1, -0x34(%rbp)
jne 0xc29b
movq -0x18(%rbp), %rdi
callq 0x9da0
movq %rax, %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rcx
movl $0x2, %esi
leaq 0x5cac(%rip), %rdx      # 0x11f3e
movb $0x0, %al
callq 0xa260
jmp 0xc2a5
movl -0x34(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x18(%rax)
jmp 0xc2a7
jmp 0xc2a9
movq -0x10(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x8(%rax)
movq -0x10(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movq -0x20(%rbp), %rdi
leaq 0x5c8e(%rip), %rsi      # 0x11f59
movl $0x3, %edx
callq 0x6820
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0xc2ec
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x6fb0
movl $0x0, -0x4(%rbp)
jmp 0xc31b
movq -0x18(%rbp), %rdi
callq 0x9da0
movq %rax, %rdi
movl $0x4, %esi
leaq 0x5c50(%rip), %rdx      # 0x11f5d
movb $0x0, %al
callq 0xa260
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/map.c
// Function: normalize_wall
static uint8_t normalize_wall(const struct map *map, size_t x, size_t y)
{
	uint8_t here = map->walls[y * d3d_board_width(map->board) + x];
	d3d_direction dirs[] = {D3D_DNEGY, D3D_DPOSY, D3D_DNEGX, D3D_DPOSX};
	for (size_t i = 0; i < ARRSIZE(dirs); ++i) {
		d3d_direction dir = dirs[i];
		uint8_t bit = 1 << dir;
		if (here & bit) break;
		size_t there_x = x, there_y = y;
		move_direction(dir, &there_x, &there_y);
		if (d3d_board_get(map->board, there_x, there_y)) {
			uint8_t there =
				map->walls[there_y * d3d_board_width(map->board)
				+ there_x];
			if (bitat(there, flip_direction(dir))) here |= bit;
		} else {
			here |= bit;
		}
	}
	return here;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x3d20
movq -0x68(%rbp), %rcx
movq %rax, %rdx
movq -0x60(%rbp), %rax
imulq %rdx, %rcx
addq -0x10(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x19(%rbp)
movq 0x59e8(%rip), %rax      # 0x11ff0
movq %rax, -0x30(%rbp)
movq 0x59e5(%rip), %rax      # 0x11ff8
movq %rax, -0x28(%rbp)
movq $0x0, -0x38(%rbp)
cmpq $0x4, -0x38(%rbp)
jae 0xc718
movq -0x38(%rbp), %rax
movl -0x30(%rbp,%rax,4), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
movb %al, -0x3d(%rbp)
movzbl -0x19(%rbp), %eax
movzbl -0x3d(%rbp), %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0xc656
jmp 0xc718
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
movl -0x3c(%rbp), %edi
leaq -0x48(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq 0x10a70
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x48(%rbp), %rsi
movq -0x50(%rbp), %rdx
callq 0x3d60
cmpq $0x0, %rax
je 0xc6f8
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x3d20
movq -0x80(%rbp), %rcx
movq %rax, %rdx
movq -0x78(%rbp), %rax
imulq %rdx, %rcx
addq -0x48(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x51(%rbp)
movzbl -0x51(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x3c(%rbp), %edi
callq 0x106f0
movl %eax, %ecx
movl -0x6c(%rbp), %eax
sarl %cl, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xc6f6
movzbl -0x3d(%rbp), %ecx
movzbl -0x19(%rbp), %eax
orl %ecx, %eax
movb %al, -0x19(%rbp)
jmp 0xc705
movzbl -0x3d(%rbp), %ecx
movzbl -0x19(%rbp), %eax
orl %ecx, %eax
movb %al, -0x19(%rbp)
jmp 0xc707
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0xc61f
movb -0x19(%rbp), %al
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/map.c
// Function: map_free
void map_free(struct map *map)
{
	if (!map) return;
	free(map->name);
	free(map->prereq);
	d3d_free_board(map->board);
	free(map->walls);
	free(map->blocks);
	free(map->ents);
	free(map);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0xc745
jmp 0xc79b
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x2580
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2580
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x3dd0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x2580
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x2580
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x2580
movq -0x8(%rbp), %rdi
callq 0x2580
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/menu.c
// Function: menu_init
int menu_init(struct menu *menu, const char *root_dir, struct screen_area *area,
	struct logger *log)
{
	char *fname = mid_cat(root_dir, DIRSEP, "menu.json");
	FILE *file = fopen(fname, "r");
	if (!file) {
		logger_printf(log, LOGGER_ERROR,
			"Menu file \"%s\" could not be opened\n", fname);
		goto error_fopen;
	}
	struct json_node jtree;
	if (parse_json_tree("menu", file, log, &jtree)) goto error_json_parse;
	menu->root = xmalloc(sizeof(*menu->root));
	if (construct(menu->root, NULL, &jtree, log)) goto error_json_format;
	menu->area = area;
	menu->current = menu->root;
	menu->root_dir = root_dir;
	menu->msg = "";
	menu->lines = NULL;
	menu->n_lines = 0;
	menu->needs_redraw = true;
	free_json_tree(&jtree);
	free(fname);
	return 0;

error_json_format:
	free(menu->root);
	free_json_tree(&jtree);
error_json_parse:
error_fopen:
	free(fname);
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x18(%rbp), %rdi
movl $0x2f, %esi
leaq 0x5838(%rip), %rdx      # 0x12010
callq 0x10760
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
leaq 0x4c0c(%rip), %rsi      # 0x113f8
callq 0x2160
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0xc81c
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rcx
movl $0x4, %esi
leaq 0x580a(%rip), %rdx      # 0x1201a
movb $0x0, %al
callq 0xa260
jmp 0xc8f9
movq -0x38(%rbp), %rsi
movq -0x28(%rbp), %rdx
leaq 0x5813(%rip), %rdi      # 0x1203e
leaq -0x58(%rbp), %rcx
callq 0x68e0
cmpl $0x0, %eax
je 0xc83e
jmp 0xc8f7
movl $0x38, %edi
callq 0x10b80
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rcx
xorl %eax, %eax
movl %eax, %esi
leaq -0x58(%rbp), %rdx
callq 0xc920
cmpl $0x0, %eax
je 0xc871
jmp 0xc8e2
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0x4ac5(%rip), %rcx      # 0x11368
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x30(%rax)
movq -0x10(%rbp), %rax
movb $0x1, 0x38(%rax)
leaq -0x58(%rbp), %rdi
callq 0x6e30
movq -0x30(%rbp), %rdi
callq 0x2580
movl $0x0, -0x4(%rbp)
jmp 0xc909
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x2580
leaq -0x58(%rbp), %rdi
callq 0x6e30
jmp 0xc8f9
movq -0x30(%rbp), %rdi
callq 0x2580
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/menu.c
// Function: menu_get_selected
struct menu_item *menu_get_selected(struct menu *menu)
{
	if (!menu->current
	 || menu->current->kind != ITEM_LINKS
	 || (size_t)menu->current->place >= menu->current->n_items)
		return NULL;
	return &menu->current->items[menu->current->place];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0xcc0b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x1, 0x10(%rax)
jne 0xcc0b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq 0x30(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
cmpq 0x28(%rcx), %rax
jb 0xcc15
movq $0x0, -0x8(%rbp)
jmp 0xcc38
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
movslq 0x30(%rcx), %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/menu.c
// Function: menu_scroll
int menu_scroll(struct menu *menu, int amount)
{
	struct menu_item *current = menu->current;
	if (current->kind == ITEM_TEXT) text_n_items(menu, current);
	if (current->n_items <= 0) return 0;
	int last_place = current->place;
	current->place =
		CLAMP(current->place + amount, 0, (int)current->n_items - 1);
	if (current->kind == ITEM_LINKS) {
		int height = menu->area->height - 2;
		if ((int)current->n_items < height) {
			current->frame = 0;
		} else {
			current->frame = CLAMP(current->frame,
				current->place - height + 1, current->place);
		}
	}
	menu->needs_redraw = menu->needs_redraw || current->place != last_place;
	return current->place - last_place;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x2, 0x10(%rax)
jne 0xcc72
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xcdd0
movq -0x20(%rbp), %rax
cmpq $0x0, 0x28(%rax)
ja 0xcc89
movl $0x0, -0x4(%rbp)
jmp 0xcdc3
movq -0x20(%rbp), %rax
movl 0x30(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rax
movl 0x30(%rax), %eax
addl -0x14(%rbp), %eax
cmpl $0x0, %eax
jge 0xcca9
xorl %eax, %eax
movl %eax, -0x2c(%rbp)
jmp 0xcce5
movq -0x20(%rbp), %rax
movl 0x30(%rax), %eax
addl -0x14(%rbp), %eax
movq -0x20(%rbp), %rcx
movq 0x28(%rcx), %rcx
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0xccd2
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
subl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xccdf
movq -0x20(%rbp), %rax
movl 0x30(%rax), %eax
addl -0x14(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x20(%rbp), %rax
cmpl $0x1, 0x10(%rax)
jne 0xcd8a
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl 0xc(%rax), %eax
subl $0x2, %eax
movl %eax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
cmpl -0x28(%rbp), %eax
jge 0xcd28
movq -0x20(%rbp), %rax
movl $0x0, 0x34(%rax)
jmp 0xcd88
movq -0x20(%rbp), %rax
movl 0x34(%rax), %eax
movq -0x20(%rbp), %rcx
movl 0x30(%rcx), %ecx
subl -0x28(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0xcd52
movq -0x20(%rbp), %rax
movl 0x30(%rax), %eax
subl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xcd7e
movq -0x20(%rbp), %rax
movl 0x34(%rax), %eax
movq -0x20(%rbp), %rcx
cmpl 0x30(%rcx), %eax
jle 0xcd6e
movq -0x20(%rbp), %rax
movl 0x30(%rax), %eax
movl %eax, -0x38(%rbp)
jmp 0xcd78
movq -0x20(%rbp), %rax
movl 0x34(%rax), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x34(%rax)
jmp 0xcd8a
movq -0x10(%rbp), %rcx
movb $0x1, %al
testb $0x1, 0x38(%rcx)
movb %al, -0x39(%rbp)
jne 0xcda9
movq -0x20(%rbp), %rax
movl 0x30(%rax), %eax
cmpl -0x24(%rbp), %eax
setne %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %cl
movq -0x10(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x38(%rax)
movq -0x20(%rbp), %rax
movl 0x30(%rax), %eax
subl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/menu.c
// Function: text_n_items
static void text_n_items(struct menu *menu, struct menu_item *text)
{
	size_t lines = (size_t)menu->area->height - 3;
	if (menu->n_lines > lines) {
		text->n_items = menu->n_lines - lines;
	} else {
		text->n_items = 1;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq 0xc(%rax), %rax
subq $0x3, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
cmpq -0x18(%rbp), %rax
jbe 0xce14
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rcx
subq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
jmp 0xce20
movq -0x10(%rbp), %rax
movq $0x1, 0x28(%rax)
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/menu.c
// Function: menu_enter
enum menu_action menu_enter(struct menu *menu)
{
	struct menu_item *current = menu->current;
	if (!has_items(current)) return ACTION_BLOCKED;
	struct menu_item *into = &current->items[current->place];
	switch (into->kind) {
		FILE *txtfile;
		char *fname;
	case ITEM_INERT:
		return ACTION_BLOCKED;
	case ITEM_LINKS:
		enter(menu, into);
		return ACTION_WENT;
	case ITEM_TEXT:
		fname = mid_cat(menu->root_dir, DIRSEP, into->tag);
		if (!(txtfile = fopen(fname, "r"))
		 || !(menu->lines = read_lines(txtfile, &menu->n_lines))) {
			free(fname);
			menu_set_message(menu, "Failed to read file");
			return ACTION_BLOCKED;
		}
		free(fname);
		text_n_items(menu, into);
		enter(menu, into);
		return ACTION_WENT;
	case ITEM_TAG:
		menu->needs_redraw = true;
		return ACTION_TAG;
	}
	return ACTION_BLOCKED;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0xcf90
testb $0x1, %al
jne 0xce61
movl $0x0, -0x4(%rbp)
jmp 0xcf83
movq -0x18(%rbp), %rcx
movq 0x20(%rcx), %rax
movslq 0x30(%rcx), %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl 0x10(%rax), %eax
movq %rax, -0x38(%rbp)
subq $0x3, %rax
ja 0xcf7c
movq -0x38(%rbp), %rax
leaq 0x5168(%rip), %rcx      # 0x12000
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x0, -0x4(%rbp)
jmp 0xcf83
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xcfc0
movl $0x1, -0x4(%rbp)
jmp 0xcf83
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rdx
movl $0x2f, %esi
callq 0x10760
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
leaq 0x4509(%rip), %rsi      # 0x113f8
callq 0x2160
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0xcf1d
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x30, %rsi
callq 0xef70
movq -0x10(%rbp), %rcx
movq %rax, 0x28(%rcx)
cmpq $0x0, %rax
jne 0xcf3f
movq -0x30(%rbp), %rdi
callq 0x2580
movq -0x10(%rbp), %rdi
leaq 0x5112(%rip), %rsi      # 0x12043
callq 0xcff0
movl $0x0, -0x4(%rbp)
jmp 0xcf83
movq -0x30(%rbp), %rdi
callq 0x2580
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xcdd0
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xcfc0
movl $0x1, -0x4(%rbp)
jmp 0xcf83
movq -0x10(%rbp), %rax
movb $0x1, 0x38(%rax)
movl $0x2, -0x4(%rbp)
jmp 0xcf83
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/menu.c
// Function: menu_escape
bool menu_escape(struct menu *menu)
{
	if (menu->lines) {
		for (size_t i = 0; i < menu->n_lines; ++i) {
			free(menu->lines[i].text);
		}
		free(menu->lines);
		menu->lines = NULL;
	}
	if (!menu->current->parent) return false;
	menu->needs_redraw = true;
	menu->current = menu->current->parent;
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0xd090
movq $0x0, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jae 0xd077
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x18(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
callq 0x2580
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0xd03f
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x2580
movq -0x10(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpq $0x0, (%rax)
jne 0xd0a4
movb $0x0, -0x1(%rbp)
jmp 0xd0c3
movq -0x10(%rbp), %rax
movb $0x1, 0x38(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/menu.c
// Function: menu_destroy
void menu_destroy(struct menu *menu)
{
	destroy_item(menu->root);
	free(menu->root);
	if (menu->lines) {
		for (size_t i = 0; i < menu->n_lines; ++i) {
			free(menu->lines[i].text);
		}
		free(menu->lines);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0xd4d0
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x2580
movq -0x8(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0xd4bc
movq $0x0, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jae 0xd4af
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x10(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
callq 0x2580
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0xd477
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x2580
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/menu.c
// Function: destroy_item
static void destroy_item(struct menu_item *item)
{
	if (has_items(item)) {
		for (size_t i = 0; i < item->n_items; ++i) {
			destroy_item(&item->items[i]);
		}
	}
	free(item->items);
	free(item->title);
	free(item->tag);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0xcf90
testb $0x1, %al
jne 0xd4eb
jmp 0xd526
movq $0x0, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x28(%rcx), %rax
jae 0xd524
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
imulq $0x38, -0x10(%rbp), %rax
addq %rax, %rdi
callq 0xd4d0
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0xd4f3
jmp 0xd526
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x2580
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2580
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x2580
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/play-level.c
// Function: init_entities
static void init_entities(struct ents *ents, struct map *map)
{
	ents_init(ents, map->n_ents * 2);
	for (size_t i = 0; i < map->n_ents; ++i) {
		ent_id e = ents_add(ents, map->ents[i].type, map->ents[i].team,
			&map->ents[i].pos);
		*ents_worth(ents, e) = map->ents[i].team == TEAM_ENEMY;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
shlq %rsi
callq 0x5fd0
movq $0x0, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x28(%rcx), %rax
jae 0xe2e4
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
imulq $0x28, -0x18(%rbp), %rcx
addq %rcx, %rax
movq 0x10(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
imulq $0x28, -0x18(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %edx
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rcx
imulq $0x28, -0x18(%rbp), %rax
addq %rax, %rcx
callq 0x60c0
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
imulq $0x28, -0x18(%rbp), %rcx
addq %rcx, %rax
cmpl $0x4, 0x18(%rax)
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x65e0
movl -0x24(%rbp), %ecx
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0xe24c
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/play-level.c
// Function: get_remaining
static int get_remaining(struct ents *ents)
{
	int remaining = 0;
	ENTS_FOR_EACH(ents, e) {
		remaining += *ents_worth(ents, e);
	}
	return remaining;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jae 0xe33c
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x65e0
movl (%rax), %eax
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0xe30b
movl -0xc(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)