LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/TurkeyMcMac[P]ts3d/src/json-util.c
// Function: json_map_get
union json_node_data *json_map_get(struct json_node *map, const char *key,
	int kind)
{
	if (map->kind != JN_MAP) return NULL;
	void **got = table_get(&map->d.map, key);
	if (!got) return NULL;
	struct json_node *nd = *got;
	if (nd->taken) return NULL;
	if (nd->kind != (enum json_node_kind)(kind & ~TAKE_NODE)) return NULL;
	nd->taken = (kind & TAKE_NODE) != 0;
	return &nd->d;
}

// Assembly:
cmpl $0x2, (%rdi)
jne 0x4cd2
pushq %rbx
movl %edx, %ebx
addq $0x8, %rdi
callq 0xa88b
testq %rax, %rax
je 0x4cd5
movq (%rax), %rax
cmpb $0x0, 0x4(%rax)
jne 0x4cd5
movl %ebx, %ecx
andl $0xffffefff, %ecx       # imm = 0xFFFFEFFF
cmpl %ecx, (%rax)
jne 0x4cd5
shrl $0xc, %ebx
andb $0x1, %bl
movb %bl, 0x4(%rax)
addq $0x8, %rax
jmp 0x4cd7
xorl %eax, %eax
retq
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/TurkeyMcMac[P]ts3d/src/json-util.c
// Function: parse_json_tree
int parse_json_tree(const char *name, FILE *file, struct logger *log,
	struct json_node *root)
{
	json_reader rdr;
	struct json_reader_ctx ctx;
	ctx.file = file;
	ctx.log = log;
	json_alloc(&rdr, NULL, 8, xmalloc, free, xrealloc);
	json_source(&rdr, ctx.buf, sizeof(ctx.buf), &ctx, refill);
	ctx.name = name;
	ctx.line = 1;
	char *key;
	parse_node(&rdr, root, &key);
	json_free(&rdr);
	fclose(file);
	return root->kind == JN_ERROR ? -1 : 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2090, %rsp           # imm = 0x2090
movq %rcx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x70(%rsp), %r13
movq %rsi, 0x2008(%r13)
movq %rdx, 0x2018(%r13)
leaq 0x64a0(%rip), %rcx      # 0xb1ac
movq 0xc29d(%rip), %r8       # 0x10fb0
leaq 0x65ba(%rip), %r9       # 0xb2d4
leaq 0x10(%rsp), %r12
movl $0x8, %edx
movq %r12, %rdi
xorl %esi, %esi
callq 0x5518
leaq 0x60(%rip), %r8         # 0x4d95
movl $0x2000, %edx           # imm = 0x2000
movq %r12, %rdi
movq %r13, %rsi
movq %r13, %rcx
callq 0x55af
movq %r15, 0x2000(%r13)
movl $0x1, 0x2010(%r13)
leaq 0x8(%rsp), %rdx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x4e41
movq %r12, %rdi
callq 0x5679
movq %r14, %rdi
callq 0x23e0
xorl %eax, %eax
cmpl $0x7, (%rbx)
sete %al
negl %eax
addq $0x2090, %rsp           # imm = 0x2090
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/TurkeyMcMac[P]ts3d/src/json-util.c
// Function: refill
static int refill(char **buf, size_t *size, void *ctx_v)
{
	struct json_reader_ctx *ctx = ctx_v;
	size_t got = fread(*buf, 1, *size, ctx->file);
	char *left = *buf;
	while ((left = memchr(left, '\n', got - (left - *buf)))) {
		++ctx->line;
		++left;
	}
	if (got < *size) {
		*size = got;
		return feof(ctx->file) ? 0 : -JSON_ERROR_ERRNO;
	}
	return 1;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r12
movq (%rdi), %rdi
movq (%rsi), %rdx
movq 0x2008(%rbx), %rcx
movl $0x1, %esi
callq 0x22e0
movq %rax, %r15
movq (%r12), %r12
movq %r12, %rdi
movl $0xa, %esi
movq %rax, %rdx
callq 0x20d0
testq %rax, %rax
je 0x4e0d
movq %r15, %r13
addq %r12, %r13
movl 0x2010(%rbx), %ebp
incl %ebp
movl %ebp, 0x2010(%rbx)
incq %rax
movq %r13, %rdx
subq %rax, %rdx
movq %rax, %rdi
movl $0xa, %esi
callq 0x20d0
incl %ebp
testq %rax, %rax
jne 0x4dea
movl $0x1, %eax
cmpq (%r14), %r15
jae 0x4e32
movq %r15, (%r14)
movq 0x2008(%rbx), %rdi
callq 0x23d0
xorl %ecx, %ecx
testl %eax, %eax
movl $0xffffffec, %eax       # imm = 0xFFFFFFEC
cmovnel %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/TurkeyMcMac[P]ts3d/src/json-util.c
// Function: free_json_tree
void free_json_tree(struct json_node *nd)
{
	if (nd->taken) return;
	switch (nd->kind) {
		const char *k;
		void **v;
	case JN_MAP:
		TABLE_FOR_EACH(&nd->d.map, k, v) {
			free_json_pair(k, *v);
		}
		table_free(&nd->d.map);
		break;
	case JN_LIST:
		for (size_t i = 0; i < nd->d.list.n_vals; ++i) {
			free_json_tree(&nd->d.list.vals[i]);
		}
		free(nd->d.list.vals);
		break;
	case JN_STRING:
		free(nd->d.str);
		break;
	default:
		break;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
cmpb $0x0, 0x4(%rdi)
je 0x523c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rdi, %rbx
movl (%rdi), %eax
cmpl $0x2, %eax
je 0x5290
cmpl $0x4, %eax
je 0x527c
cmpl $0x3, %eax
jne 0x5230
cmpq $0x0, 0x8(%rbx)
je 0x5276
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x10(%rbx), %rdi
addq %r14, %rdi
callq 0x5222
incq %r15
addq $0x20, %r14
cmpq 0x8(%rbx), %r15
jb 0x525d
movq 0x10(%rbx), %rdi
jmp 0x5280
movq 0x8(%rbx), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2570
cmpq $0x0, 0x8(%rbx)
je 0x52cf
movl $0x8, %r15d
xorl %r12d, %r12d
movq 0x18(%rbx), %rax
movq -0x8(%rax,%r15), %rdi
movq (%rax,%r15), %r14
callq 0x2570
movq %r14, %rdi
callq 0x5222
movq %r14, %rdi
callq 0x2570
incq %r12
addq $0x10, %r15
cmpq 0x8(%rbx), %r12
jb 0x52a0
addq $0x8, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xa915
// File: /workspace/github_c_makefile_star2_O1/TurkeyMcMac[P]ts3d/src/json-util.c
// Function: parse_json_vec
int parse_json_vec(d3d_vec_s *vec, const struct json_node_data_list *list)
{
	int retval = 0;
	vec->x = vec->y = 0;
	if (list->n_vals < 1) return -1;
	if (list->vals[0].kind == JN_NUMBER) {
		vec->x = list->vals[0].d.num;
	} else {
		retval |= -1;
	}
	if (list->n_vals >= 2 && list->vals[1].kind == JN_NUMBER) {
		vec->y = list->vals[1].d.num;
	} else {
		retval |= -1;
	}
	return retval;
}

// Assembly:
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq (%rsi), %rdx
testq %rdx, %rdx
je 0x532b
movq 0x8(%rsi), %rcx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x5, (%rcx)
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
jne 0x5312
movsd 0x8(%rcx), %xmm0
movsd %xmm0, (%rdi)
xorl %esi, %esi
cmpq $0x1, %rdx
je 0x5330
cmpl $0x5, 0x20(%rcx)
jne 0x5330
movsd 0x28(%rcx), %xmm0
movsd %xmm0, 0x8(%rdi)
movl %esi, %eax
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
// File: /workspace/github_c_makefile_star2_O1/TurkeyMcMac[P]ts3d/src/json-util.c
// Function: escape_text_json
void escape_text_json(const char *text, struct string *buf, size_t *cap)
{
	while (*text) {
		switch (*text) {
		case '"':
			string_pushn(buf, cap, "\\\"", 2);
			break;
		case '\\':
			string_pushn(buf, cap, "\\\\", 2);
			break;
		case '\b':
			string_pushn(buf, cap, "\\b", 2);
			break;
		case '\f':
			string_pushn(buf, cap, "\\f", 2);
			break;
		case '\n':
			string_pushn(buf, cap, "\\n", 2);
			break;
		case '\r':
			string_pushn(buf, cap, "\\r", 2);
			break;
		case '\t':
			string_pushn(buf, cap, "\\t", 2);
			break;
		default:
			if ((unsigned char)*text < 32) {
				char *space = string_grow(buf, cap, 7);
				sprintf(space, "\\u%04X", (unsigned char)*text);
				buf->len -= 1; // Ignore NUL that was appended.
			} else {
				string_pushc(buf, cap, *text);
			}
			break;
		}
		++text;
	}
}

// Assembly:
movb (%rdi), %al
testb %al, %al
je 0x5478
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
incq %r15
leaq 0x709b(%rip), %r13      # 0xc3f4
leaq 0x70d1(%rip), %rbp      # 0xc431
leaq 0x70d0(%rip), %r12      # 0xc437
movzbl %al, %ecx
leal -0x8(%rcx), %edx
cmpl $0x5, %edx
ja 0x5393
movslq (%r13,%rdx,4), %rcx
addq %r13, %rcx
jmpq *%rcx
movl $0x2, %ecx
movq %r14, %rdi
movq %rbx, %rsi
leaq 0x70a0(%rip), %rdx      # 0xc42e
jmp 0x5445
cmpl $0x5c, %ecx
je 0x5433
cmpl $0x22, %ecx
jne 0x53b8
movl $0x2, %ecx
movq %r14, %rdi
movq %rbx, %rsi
leaq 0x7075(%rip), %rdx      # 0xc428
jmp 0x5445
cmpb $0x1f, %al
ja 0x545a
movl $0x7, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0xa665
movzbl -0x1(%r15), %edx
movq %rax, %rdi
leaq 0x705e(%rip), %rsi      # 0xc43d
xorl %eax, %eax
callq 0x2230
decq (%r14)
jmp 0x544a
movl $0x2, %ecx
movq %r14, %rdi
movq %rbx, %rsi
leaq 0x703d(%rip), %rdx      # 0xc43a
jmp 0x5445
movl $0x2, %ecx
movq %r14, %rdi
movq %rbx, %rsi
leaq 0x7023(%rip), %rdx      # 0xc434
jmp 0x5445
movl $0x2, %ecx
movq %r14, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
jmp 0x5445
movl $0x2, %ecx
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
jmp 0x5445
movl $0x2, %ecx
movq %r14, %rdi
movq %rbx, %rsi
leaq 0x6fe6(%rip), %rdx      # 0xc42b
callq 0xa68d
movb (%r15), %al
incq %r15
testb %al, %al
jne 0x5367
jmp 0x546a
movsbl %al, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0xa702
jmp 0x544a
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/TurkeyMcMac[P]ts3d/src/json-util.c
// Function: scan_json_key
int scan_json_key(json_reader *rdr, const char *key, struct json_item *item)
{
	long depth = 0;
	do {
		if (json_read_item(rdr, item)) return -1;
		if (depth == 1
		 && item->key.bytes
		 && !strcmp(key, item->key.bytes))
			return 0;
		switch (item->type) {
		case JSON_LIST:
		case JSON_MAP:
			++depth;
			break;
		case JSON_END_LIST:
		case JSON_END_MAP:
			--depth;
			break;
		case JSON_EMPTY:
			depth = 0;
			break;
		case JSON_STRING:
			free(item->val.str.bytes);
			break;
		default:
			break;
		}
		free(item->key.bytes);
	} while (depth > 0);
	item->type = JSON_EMPTY;
	item->key.len = 0;
	item->key.bytes = NULL;
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
xorl %r13d, %r13d
leaq 0x6f77(%rip), %r12      # 0xc40c
movq %r15, %rdi
movq %rbx, %rsi
callq 0x56ae
testl %eax, %eax
jne 0x5506
cmpq $0x1, %r13
jne 0x54be
movq (%rbx), %rsi
testq %rsi, %rsi
je 0x54be
movq %r14, %rdi
callq 0x2380
testl %eax, %eax
je 0x5502
movl 0x10(%rbx), %eax
cmpq $0x6, %rax
ja 0x54e8
movslq (%r12,%rax,4), %rax
addq %r12, %rax
jmpq *%rax
incq %r13
jmp 0x54e8
decq %r13
jmp 0x54e8
xorl %r13d, %r13d
jmp 0x54e8
movq 0x18(%rbx), %rdi
callq 0x2570
movq (%rbx), %rdi
callq 0x2570
testq %r13, %r13
jg 0x5495
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movl $0x0, 0x10(%rbx)
xorl %eax, %eax
jmp 0x550b
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/TurkeyMcMac[P]ts3d/src/json.c
// Function: json_alloc
int json_alloc(json_reader *reader,
	void *stack, size_t stacksiz,
	void *(*alloc)(size_t),
	void  (*dealloc)(void *),
	void *(*resize)(void *, size_t))
{
	reader->alloc = alloc ? alloc : alloc_fail;
	reader->dealloc = dealloc ? dealloc : dealloc_noop;
	reader->resize = resize ? resize : realloc_fail;
	reader->flags = 0;
	if (!stack && stacksiz <= sizeof(reader->stack.small.frames)
		/* Just in case, make sure the small size can't overflow: */
		&& (size_t)UCHAR_MAX >= sizeof(reader->stack.small.frames))
	{
		reader->flags |= SMALL_STACK;
		reader->stack.small.size = 0;
	} else {
		if (!stack && !(stack = reader->alloc(stacksiz))) return -1;
		reader->stack.big.cap = stacksiz;
		reader->stack.big.size = 0;
	}
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rdi, %rbx
testq %rcx, %rcx
leaq 0x7c(%rip), %rax        # 0x55a8
cmovneq %rcx, %rax
movq %rax, (%rdi)
testq %r8, %r8
leaq 0x6e(%rip), %rcx        # 0x55ab
cmovneq %r8, %rcx
testq %r9, %r9
leaq 0x61(%rip), %rdx        # 0x55ac
cmovneq %r9, %rdx
movq %rcx, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
movl $0x0, 0x58(%rdi)
testq %rsi, %rsi
setne %cl
cmpq $0x18, %r14
setae %dl
orb %cl, %dl
jne 0x557c
movl $0x400, 0x58(%rbx)      # imm = 0x400
movb $0x0, 0x57(%rbx)
jmp 0x5597
testq %rsi, %rsi
jne 0x558b
movq %r14, %rdi
callq *%rax
testq %rax, %rax
je 0x55a1
movq %r14, 0x50(%rbx)
movq $0x0, 0x48(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x5599
// File: /workspace/github_c_makefile_star2_O1/TurkeyMcMac[P]ts3d/src/json.c
// Function: json_source_string
void json_source_string(json_reader *reader, const char *str, size_t len)
{
	reader->ctx = NULL;
	reader->buf = (char *)str;
	reader->bufsiz = len;
	reader->head = 0;
	reader->refill = refill_dont;
	reader->flags |= SOURCE_DEPLETED;
}

// Assembly:
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rdi)
movq %rsi, 0x20(%rdi)
movq %rdx, 0x28(%rdi)
leaq -0x19(%rip), %rax       # 0x55d9
movq %rax, 0x18(%rdi)
orb $0x1, 0x59(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/TurkeyMcMac[P]ts3d/src/json.c
// Function: refill_stdio
static int refill_stdio(char **buf, size_t *size, void *ctx)
{
	FILE *file = ctx;
	size_t got = fread(*buf, 1, *size, file);
	if (got < *size) {
		*size = got;
		return feof(file) ? 0 : -JSON_ERROR_ERRNO;
	}
	return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq (%rdi), %rdi
movq (%rsi), %rdx
movl $0x1, %esi
movq %rbx, %rcx
callq 0x22e0
movq %rax, %rcx
movl $0x1, %eax
cmpq (%r14), %rcx
jae 0x5658
movq %rcx, (%r14)
movq %rbx, %rdi
callq 0x23d0
xorl %ecx, %ecx
testl %eax, %eax
movl $0xffffffec, %eax       # imm = 0xFFFFFFEC
cmovnel %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/TurkeyMcMac[P]ts3d/src/json.c
// Function: json_get_last_error
int json_get_last_error(const json_reader *reader,
	enum json_type *code, size_t *erridx)
{
	if (has_error(reader)) {
		if (erridx) *erridx = reader->head;
		if (code) *code = reader->flags & 0xFF;
		return 1;
	}
	return 0;
}

// Assembly:
movzbl 0x58(%rdi), %ecx
testl %ecx, %ecx
je 0x56ab
testq %rdx, %rdx
je 0x569e
movq 0x38(%rdi), %rax
movq %rax, (%rdx)
movl $0x1, %eax
testq %rsi, %rsi
je 0x56aa
movl %ecx, (%rsi)
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/TurkeyMcMac[P]ts3d/src/json.c
// Function: refill
static int refill(json_reader *reader)
{
	size_t newsiz = reader->bufsiz;
	/* WARNING: Must refer to &reader->buf for refill_fd to work! */
	int retval = reader->refill(&reader->buf, &newsiz, reader->ctx);
	if (retval < 0) {
		set_error(reader, -retval & 0xFF);
		return -1;
	}
	if (retval == 0) reader->flags |= SOURCE_DEPLETED;
	reader->bufsiz = newsiz;
	reader->head = 0;
	return 0;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x28(%rdi), %rax
leaq 0x8(%rsp), %rsi
movq %rax, (%rsi)
addq $0x20, %rdi
movq 0x30(%rbx), %rdx
callq *0x18(%rbx)
testl %eax, %eax
js 0x593b
jne 0x5926
orb $0x1, 0x59(%rbx)
movq 0x8(%rsp), %rax
movq %rax, 0x28(%rbx)
movq $0x0, 0x38(%rbx)
xorl %eax, %eax
jmp 0x5953
movl %eax, %ecx
movl 0x58(%rbx), %edx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testb %dl, %dl
jne 0x5953
negl %ecx
movzbl %cl, %ecx
orl %ecx, %edx
movl %edx, 0x58(%rbx)
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/TurkeyMcMac[P]ts3d/src/json.c
// Function: skip_spaces
static int skip_spaces(json_reader *reader)
{
	for (;;) {
		while (is_in_range(reader)) {
			if (!is_space(reader->buf[reader->head])) return 0;
			++reader->head;
		}
		if (reader->flags & SOURCE_DEPLETED) return 0;
		if (refill(reader)) return -1;
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movabsq $0x100002e00, %r14      # imm = 0x100002E00
movq 0x28(%rbx), %rax
movq 0x38(%rbx), %rcx
cmpq %rax, %rcx
jae 0x59a6
movq 0x20(%rbx), %rdx
negq %rax
incq %rcx
movzbl -0x1(%rdx,%rcx), %esi
cmpq $0x20, %rsi
ja 0x59bf
btq %rsi, %r14
jae 0x59bf
movq %rcx, 0x38(%rbx)
leaq (%rax,%rcx), %rsi
incq %rsi
incq %rcx
cmpq $0x1, %rsi
jne 0x5981
testb $0x1, 0x59(%rbx)
jne 0x59bf
movq %rbx, %rdi
callq 0x58fd
testl %eax, %eax
je 0x596a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x59c1
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/TurkeyMcMac[P]ts3d/src/json.c
// Function: try_compound_end
static int try_compound_end(json_reader *reader, int endch,
	enum json_type type, struct json_item *result)
{
	int ch;
	NEXT_CHAR(reader, ch, return -has_error(reader));
	if (ch == endch) {
		pop_frame(reader);
		result->type = type;
	} else {
		reexamine_char(reader);
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %rbx
movl %edx, %ebp
movl %esi, %r15d
movq %rdi, %r14
callq 0x6099
testl %eax, %eax
js 0x5ecb
cmpl %r15d, %eax
jne 0x5ed5
movq %r14, %rdi
callq 0x62e5
movl %ebp, 0x10(%rbx)
jmp 0x5ed9
xorl %eax, %eax
cmpb 0x58(%r14), %al
sbbl %eax, %eax
jmp 0x5edb
decq 0x38(%r14)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/TurkeyMcMac[P]ts3d/src/json.c
// Function: parse_after_elem
static int parse_after_elem(json_reader *reader, int endch,
	enum json_type type, struct json_item *result)
{
	int ch;
	NEXT_CHAR(reader, ch, return -has_error(reader));
	if (ch == endch) {
		pop_frame(reader);
		result->type = type;
	} else if (ch != ',') {
		set_error(reader, JSON_ERROR_BRACKETS);
		return -1;
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %r14
movl %edx, %ebp
movl %esi, %r15d
movq %rdi, %rbx
callq 0x6099
testl %eax, %eax
js 0x5f18
movl %eax, %ecx
cmpl %r15d, %eax
jne 0x5f21
movq %rbx, %rdi
callq 0x62e5
movl %ebp, 0x10(%r14)
xorl %eax, %eax
jmp 0x5f3a
xorl %eax, %eax
cmpb 0x58(%rbx), %al
sbbl %eax, %eax
jmp 0x5f3a
xorl %eax, %eax
cmpl $0x2c, %ecx
je 0x5f3a
movl 0x58(%rbx), %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testb %cl, %cl
jne 0x5f3a
orl $0xe, %ecx
movl %ecx, 0x58(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/TurkeyMcMac[P]ts3d/src/json.c
// Function: parse_string
static int parse_string(json_reader *reader, struct json_string *str)
{
	int ch;
	char *oldbytes;
	size_t cap = 16;
	NEXT_CHAR(reader, ch, return -1);
	if (ch != '"') goto error_expected_string;
	str->bytes = alloc(reader, cap);
	if (!str->bytes) return -1;
	str->len = 0;
	while ((ch = next_char(reader)) != '"') {
		if (ch < 0) goto error_unclosed_quote;
		if (ch == '\\') {
			if (escape_char(reader, str, &cap))
				goto error;
		} else if (ch < 32) {
			goto error_control_char;
		} else {
			if (push_byte(reader, &str->bytes, &str->len, &cap, ch))
				goto error;
		}
	}
	if (push_byte(reader, &str->bytes, &str->len, &cap, '\0')) goto error;
	oldbytes = str->bytes;
	str->bytes = reader->resize(str->bytes, str->len);
	if (!str->bytes) str->bytes = oldbytes;
	--str->len; /* Because of the NUL terminator */
	return 0;

error_expected_string:
	set_error(reader, JSON_ERROR_EXPECTED_STRING);
	goto error;

error_unclosed_quote:
	set_error(reader, JSON_ERROR_UNCLOSED_QUOTE);
	goto error;

error_control_char:
	reexamine_char(reader);
	set_error(reader, JSON_ERROR_CONTROL_CHAR);
	goto error;

error:
	reader->dealloc(str->bytes);
	return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq $0x10, 0x8(%rsp)
callq 0x6099
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x6046
cmpl $0x22, %eax
jne 0x5f89
movl $0x10, %edi
callq *(%r14)
testq %rax, %rax
je 0x5fa1
movq %rax, (%rbx)
jmp 0x5fbc
movl 0x58(%r14), %eax
testb %al, %al
jne 0x603f
orl $0xc, %eax
movl %eax, 0x58(%r14)
jmp 0x603f
movl 0x58(%r14), %ecx
testb %cl, %cl
jne 0x5fb0
orl $0x9, %ecx
movl %ecx, 0x58(%r14)
movq %rax, (%rbx)
testq %rax, %rax
je 0x6046
leaq 0x8(%rbx), %r15
movq $0x0, 0x8(%rbx)
movq %r14, %rdi
callq 0x6099
cmpl $0x22, %eax
je 0x6025
leaq 0x8(%rsp), %r12
testl %eax, %eax
js 0x6075
cmpl $0x5c, %eax
jne 0x5ff7
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x6309
jmp 0x6014
cmpl $0x20, %eax
jl 0x6085
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r12, %rcx
movl %eax, %r8d
callq 0x61ae
testl %eax, %eax
jne 0x603f
movq %r14, %rdi
callq 0x6099
cmpl $0x22, %eax
jne 0x5fda
leaq 0x8(%rsp), %rcx
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
xorl %r8d, %r8d
callq 0x61ae
testl %eax, %eax
je 0x6055
movq (%rbx), %rdi
callq *0x8(%r14)
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %r15
movq 0x8(%rbx), %rsi
movq %r15, %rdi
callq *0x10(%r14)
testq %rax, %rax
cmoveq %r15, %rax
movq %rax, (%rbx)
decq 0x8(%rbx)
xorl %ebp, %ebp
jmp 0x6046
movl 0x58(%r14), %eax
testb %al, %al
jne 0x603f
orl $0xf, %eax
jmp 0x5f98
decq 0x38(%r14)
movl 0x58(%r14), %eax
testb %al, %al
jne 0x603f
orl $0x11, %eax
jmp 0x5f98
// File: /workspace/github_c_makefile_star2_O1/TurkeyMcMac[P]ts3d/src/json.c
// Function: next_char
static int next_char(json_reader *reader)
{
	while (!is_in_range(reader) && (reader->flags & SOURCE_DEPLETED) == 0) {
		if (refill(reader)) return -1;
	}
	if (is_in_range(reader))
		return (unsigned char)reader->buf[reader->head++];
	return -1;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x28(%rbx), %rdx
movq 0x38(%rbx), %rcx
cmpq %rdx, %rcx
jb 0x60cd
testb $0x1, 0x59(%rbx)
jne 0x60c3
movq %rbx, %rdi
callq 0x58fd
testl %eax, %eax
je 0x609d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x60dd
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rdx, %rcx
jae 0x60dd
movq 0x20(%rbx), %rax
leaq 0x1(%rcx), %rdx
movq %rdx, 0x38(%rbx)
movzbl (%rax,%rcx), %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/TurkeyMcMac[P]ts3d/src/json.c
// Function: push_frame
static int push_frame(json_reader *reader, int frame)
{
	if (reader->flags & SMALL_STACK) {
		/* Temporary stack holding buffer: */
		char tmp[sizeof(reader->stack.small.frames)];
		if (reader->stack.small.size >= sizeof(tmp)) {
			/* The small stack must be embiggened. */
			memcpy(tmp, reader->stack.small.frames, sizeof(tmp));
			size_t size = sizeof(tmp) + 1;
			if (!(reader->stack.big.frames = reader->alloc(size))) {
				/* Failure to allocate; revert and report. */
				memcpy(reader->stack.small.frames, tmp,
					sizeof(tmp));
				reader->stack.small.size = sizeof(tmp);
				set_error(reader, JSON_ERROR_MEMORY);
				return -1;
			}
			memcpy(reader->stack.big.frames, tmp, sizeof(tmp));
			reader->stack.big.frames[size - 1] = frame;
			reader->stack.big.cap = size;
			reader->stack.big.size = size;
			reader->flags &= ~SMALL_STACK;
		} else {
			reader->stack.small.frames[reader->stack.small.size++] =
				frame;
		}
		return 0;
	} else {
		return push_byte(reader, &reader->stack.big.frames,
			&reader->stack.big.size, &reader->stack.big.cap, frame);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %esi, %ebp
movq %rdi, %rbx
testb $0x4, 0x59(%rdi)
jne 0x6115
leaq 0x40(%rbx), %rsi
leaq 0x48(%rbx), %rdx
leaq 0x50(%rbx), %rcx
movq %rbx, %rdi
movl %ebp, %r8d
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x61ae
movzbl 0x57(%rbx), %eax
cmpq $0x17, %rax
jb 0x6177
leaq 0x40(%rbx), %r14
movq 0xf(%r14), %rax
movq %rax, 0xf(%rsp)
movups (%r14), %xmm0
movaps %xmm0, (%rsp)
movl $0x18, %r15d
movl $0x18, %edi
callq *(%rbx)
movq %rax, 0x40(%rbx)
testq %rax, %rax
je 0x618d
movq 0xf(%rsp), %rcx
movq %rcx, 0xf(%rax)
movaps (%rsp), %xmm0
movups %xmm0, (%rax)
movq 0x40(%rbx), %rax
movb %bpl, 0x17(%rax)
movq %r15, 0x50(%rbx)
movq %r15, 0x48(%rbx)
movl $0xfffffbff, %eax       # imm = 0xFFFFFBFF
andl 0x58(%rbx), %eax
movl %eax, 0x58(%rbx)
jmp 0x6182
leal 0x1(%rax), %ecx
movb %cl, 0x57(%rbx)
movb %bpl, 0x40(%rbx,%rax)
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0xf(%rsp), %rax
movq %rax, 0xf(%r14)
movaps (%rsp), %xmm0
movups %xmm0, (%r14)
movb $0x17, 0x57(%rbx)
movl 0x58(%rbx), %eax
testb %al, %al
jne 0x6182
orl $0x9, %eax
jmp 0x6172
// File: /workspace/github_c_makefile_star2_O1/TurkeyMcMac[P]ts3d/src/json.c
// Function: push_byte
static int push_byte(json_reader *reader, char **bytes,
	size_t *len, size_t *cap, int ch)
{
	if (*len >= *cap) {
		size_t new_cap = *cap + *cap / 2 + 1;
		char *new_bytes = reader->resize(*bytes, new_cap);
		if (!new_bytes) {
			set_error(reader, JSON_ERROR_MEMORY);
			return -1;
		}
		*cap = new_cap;
		*bytes = new_bytes;
	}
	(*bytes)[*len] = ch;
	++*len;
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %ebx
movq %rdx, %r14
movq %rsi, %r15
movq (%rcx), %rax
cmpq %rax, (%rdx)
jb 0x620c
movq %rcx, %r13
movq %rdi, %r12
movq %rax, %rcx
shrq %rcx
leaq (%rax,%rcx), %rbp
incq %rbp
movq (%r15), %rdi
movq %rbp, %rsi
callq *0x10(%r12)
testq %rax, %rax
je 0x61f6
movq %rbp, (%r13)
movq %rax, (%r15)
jmp 0x6207
movl 0x58(%r12), %ecx
testb %cl, %cl
jne 0x6207
orl $0x9, %ecx
movl %ecx, 0x58(%r12)
testq %rax, %rax
je 0x6229
movq (%r15), %rax
movq (%r14), %rcx
movb %bl, (%rax,%rcx)
incq (%r14)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x621a
// File: /workspace/github_c_makefile_star2_O1/TurkeyMcMac[P]ts3d/src/json.c
// Function: next_chars
static long next_chars(json_reader *reader, char *buf, size_t bufsiz)
{
	if (reader->head + bufsiz <= reader->bufsiz) {
		memcpy(buf, reader->buf + reader->head, bufsiz);
		reader->head += bufsiz;
	} else {
		size_t i;
		size_t easy_copy = reader->bufsiz - reader->head;
		memcpy(buf, reader->buf + reader->head, easy_copy);
		if (refill(reader)) return -1;
		for (i = easy_copy; i < bufsiz; ++i) {
			int ch;
			NEXT_CHAR(reader, ch, return
				reader->flags & SOURCE_DEPLETED ? (long)i : -1);
			buf[i] = ch;
		}
	}
	return bufsiz;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq 0x28(%rdi), %r12
movq 0x38(%rdi), %rsi
leaq (%rsi,%rdx), %rax
cmpq %r12, %rax
jbe 0x627c
subq %rsi, %r12
addq 0x20(%r14), %rsi
movq %r15, %rdi
movq %r12, %rdx
callq 0x2500
movq %r14, %rdi
callq 0x58fd
testl %eax, %eax
je 0x6291
movq $-0x1, %r13
xorl %ecx, %ecx
jmp 0x62d1
addq 0x20(%r14), %rsi
movq %r15, %rdi
movq %rbx, %rdx
callq 0x2500
addq %rbx, 0x38(%r14)
jmp 0x62d5
cmpq %rbx, %r12
jae 0x62cf
movq %r14, %rdi
callq 0x6099
testl %eax, %eax
setns %cl
js 0x62ab
movb %al, (%r15,%r12)
jmp 0x62c1
movb 0x59(%r14), %dl
andb $0x1, %dl
cmpb $0x1, %dl
movl $0x0, %r13d
sbbq %r13, %r13
orq %r12, %r13
testl %eax, %eax
js 0x62d1
incq %r12
cmpq %rbx, %r12
jb 0x6296
jmp 0x62d1
movb $0x1, %cl
testb %cl, %cl
je 0x62d8
movq %rbx, %r13
movq %r13, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/TurkeyMcMac[P]ts3d/src/json.c
// Function: pop_frame
static int pop_frame(json_reader *reader)
{
	if (reader->flags & SMALL_STACK) {
		if (reader->stack.small.size == 0) return FRAME_EMPTY;
		return reader->stack.small.frames[--reader->stack.small.size];
	} else {
		if (reader->stack.big.size == 0) return FRAME_EMPTY;
		return reader->stack.big.frames[--reader->stack.big.size];
	}
}

// Assembly:
testb $0x4, 0x59(%rdi)
jne 0x62fc
movq 0x48(%rdi), %rax
testq %rax, %rax
je 0x62fb
decq %rax
movq %rax, 0x48(%rdi)
retq
movb 0x57(%rdi), %al
testb %al, %al
je 0x62fb
decb %al
movb %al, 0x57(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/TurkeyMcMac[P]ts3d/src/json.c
// Function: hex_short
static long hex_short(const char hex[4])
{
	long num = 0;
	unsigned shift = 0;
	long i;
	for (i = 3, shift = 0; i >= 0; --i, shift += 4) {
		int dig = to_lower(hex[i]);
		long nibble;
		if (is_digit(dig)) nibble = to_digit(dig);
		else if (dig >= 'a' && dig <= 'f') nibble = 10 + to_digit(dig);
		else return -1;
		num |= nibble << shift;
	}
	return num;
}

// Assembly:
addq $0x3, %rdi
xorl %ecx, %ecx
xorl %eax, %eax
movsbl (%rdi), %edx
orl $0x20, %edx
leal -0x30(%rdx), %esi
cmpl $0xa, %esi
jb 0x6575
leal -0x61(%rdx), %esi
cmpl $0x5, %esi
ja 0x6582
addl $-0x26, %edx
movl %edx, %esi
movslq %esi, %rdx
shlq %cl, %rdx
orq %rdx, %rax
movb $0x1, %dl
jmp 0x6584
xorl %edx, %edx
testb %dl, %dl
je 0x6596
addq $0x4, %rcx
decq %rdi
cmpq $0x10, %rcx
jne 0x655a
retq
movq $-0x1, %rax
retq
// File: /workspace/github_c_makefile_star2_O1/TurkeyMcMac[P]ts3d/src/json.c
// Function: push_bytes
static int push_bytes(json_reader *reader, char **bytes,
	size_t *len, size_t *cap, const char *buf, size_t bufsiz)
{
	if (*len + bufsiz > *cap) {
		size_t new_cap = *len + bufsiz;
		char *new_bytes;
		new_cap += new_cap / 2;
		new_bytes = reader->resize(*bytes, new_cap);
		if (!new_bytes) {
			set_error(reader, JSON_ERROR_MEMORY);
			return -1;
		}
		*cap = new_cap;
		*bytes = new_bytes;
	}
	memcpy(*bytes + *len, buf, bufsiz);
	*len += bufsiz;
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %rbx
movq %rdx, %r14
movq %rsi, %r12
movq (%rdx), %rax
addq %r9, %rax
cmpq (%rcx), %rax
jbe 0x6602
movq %rcx, %rbp
movq %rdi, %r13
movq %r8, (%rsp)
movq %rax, %r15
shrq %r15
addq %rax, %r15
movq (%r12), %rdi
movq %r15, %rsi
callq *0x10(%r13)
testq %rax, %rax
je 0x65ea
movq %r15, (%rbp)
movq %rax, (%r12)
jmp 0x65f9
movl 0x58(%r13), %ecx
testb %cl, %cl
jne 0x65f9
orl $0x9, %ecx
movl %ecx, 0x58(%r13)
testq %rax, %rax
movq (%rsp), %r8
je 0x6628
movq (%r12), %rdi
addq (%r14), %rdi
movq %r8, %rsi
movq %rbx, %rdx
callq 0x2500
addq %rbx, (%r14)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x6619
// File: /workspace/github_c_makefile_star2_O1/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:
cmpq $0x7f, %rdi
jg 0x663e
movb %dil, (%rsi)
movl $0x1, %eax
retq
movl %edi, %eax
cmpq $0x7ff, %rdi            # imm = 0x7FF
jg 0x6662
shrl $0x6, %eax
orb $-0x40, %al
movb %al, (%rsi)
andb $0x3f, %dil
orb $-0x80, %dil
movb %dil, 0x1(%rsi)
movl $0x2, %eax
retq
cmpq $0xffff, %rdi           # imm = 0xFFFF
jg 0x6690
shrl $0xc, %eax
orb $-0x20, %al
movb %al, (%rsi)
movl %edi, %eax
shrl $0x6, %eax
andb $0x3f, %al
orb $-0x80, %al
movb %al, 0x1(%rsi)
andb $0x3f, %dil
orb $-0x80, %dil
movb %dil, 0x2(%rsi)
movl $0x3, %eax
retq
shrl $0x12, %eax
orb $-0x10, %al
movb %al, (%rsi)
movl %edi, %eax
shrl $0xc, %eax
andb $0x3f, %al
orb $-0x80, %al
movb %al, 0x1(%rsi)
movl %edi, %eax
shrl $0x6, %eax
andb $0x3f, %al
orb $-0x80, %al
movb %al, 0x2(%rsi)
andb $0x3f, %dil
orb $-0x80, %dil
movb %dil, 0x3(%rsi)
movl $0x4, %eax
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x5cf3(%rip), %rdx      # 0xc5d9
movq %rsi, %rdi
movl $0x2f, %esi
callq 0xaf01
movq %rax, 0x20(%rbx)
leaq 0x8(%rbx), %rdi
movl $0x10, %esi
callq 0xa720
leaq 0x5cd6(%rip), %rdx      # 0xc5e2
movq %r14, %rdi
movl $0x2f, %esi
callq 0xaf01
movq %rax, 0x40(%rbx)
leaq 0x28(%rbx), %rdi
movl $0x10, %esi
callq 0xa720
leaq 0x5cb5(%rip), %rdx      # 0xc5e7
movq %r14, %rdi
movl $0x2f, %esi
callq 0xaf01
movq %rax, 0x60(%rbx)
leaq 0x48(%rbx), %rdi
movl $0x10, %esi
callq 0xa720
leaq 0x68(%rbx), %r14
movq %r14, %rdi
callq 0xaa68
xorl %r15d, %r15d
movq %r14, %rdi
xorl %esi, %esi
callq 0xaa82
movq %r15, 0xb0(%rbx)
movq %r15, (%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r15
movq %rdi, %r12
movq %rsp, %r14
movq $0xa, (%r14)
leaq 0x8(%rsp), %rbx
movl $0xa, %esi
movq %rbx, %rdi
callq 0xa64c
movq 0x60(%r12), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa6bb
movq %rbx, %rdi
movq %r14, %rsi
movl $0x2f, %edx
callq 0xa702
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xa6bb
leaq 0x5ce5(%rip), %rdx      # 0xc6c1
movl $0x6, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa68d
movq %rbx, %rdi
callq 0xa677
movq 0x8(%rbx), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %rax
movq %rsi, %r12
movq %rdi, %r13
leaq 0x5c85(%rip), %rdx      # 0xc6c2
movq %rax, %rdi
movl $0x2e, %esi
callq 0xaf01
movq %rax, %rbx
movq %r13, %rdi
movq %r12, %rsi
movq %rax, %rdx
movq %r15, %rcx
movq %r14, %r8
callq 0x6ae3
movq %rax, %r14
cmpq $0x0, (%r15)
jne 0x6a72
movq %rbx, %rdi
callq 0x2570
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
movq %rdx, %r15
movq %rdi, %r14
movq %rsi, %rdi
callq 0xaec0
movq %rax, %rbx
leaq 0x8(%r14), %rdi
movq 0x20(%r14), %rsi
movq 0xb0(%r14), %r8
movq %rax, %rdx
movq %r15, %rcx
callq 0x6ae3
movq %rax, %r14
cmpq $0x0, (%r15)
jne 0x6ada
movq %rbx, %rdi
callq 0x2570
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r12
movq %rcx, %r13
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
movq %rdx, %rsi
callq 0xa88b
movq %rax, %rbp
movq $0x0, (%r13)
testq %rax, %rax
jne 0x6b9d
movq %rbx, %rdi
movl $0x2f, %esi
movq %r14, %rdx
callq 0xaf01
movq %rax, %rbx
leaq 0x5905(%rip), %rsi      # 0xc438
movq %rax, %rdi
callq 0x2160
movq %rax, (%r13)
testq %rax, %rax
je 0x6b7a
leaq 0x5aea(%rip), %rdx      # 0xc635
movq %r12, %rdi
movl $0x1, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x6e97
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xa741
movq %r15, %rdi
movq %r14, %rsi
callq 0xa88b
movq %rax, %rbp
jmp 0x6b95
leaq 0x5ac0(%rip), %rdx      # 0xc641
xorl %ebp, %ebp
movq %r12, %rdi
movl $0x4, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x6e97
movq %rbx, %rdi
callq 0x2570
movq %rbp, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
movq 0xb0(%rdi), %rbx
addq $0x48, %rdi
callq 0xa911
movq %rax, %r15
leaq 0x28(%r14), %rdi
callq 0xa911
movq %rax, %r12
leaq 0x8(%r14), %rdi
callq 0xa911
movq %rax, %r13
addq $0x68, %r14
movq %r14, %rdi
callq 0xab19
movq %rax, (%rsp)
leaq 0x59bd(%rip), %rdx      # 0xc5ec
movq %rbx, %rdi
movl $0x1, %esi
movq %r15, %rcx
movq %r12, %r8
movq %r13, %r9
xorl %eax, %eax
callq 0x6e97
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/TurkeyMcMac[P]ts3d/src/loader.c
// Function: loader_free
void loader_free(struct loader *ldr)
{
	const char *key;
	void **val;
	d3d_free_texture(ldr->empty_txtr);
	TABLE_FOR_EACH(&ldr->txtrs, key, val) {
		free((char *)key);
		d3d_free_texture(*val);
	}
	table_free(&ldr->txtrs);
	free(ldr->txtrs_dir);
	TABLE_FOR_EACH(&ldr->ents, key, val) {
		free((char *)key);
		ent_type_free(*val);
	}
	table_free(&ldr->ents);
	free(ldr->ents_dir);
	TABLE_FOR_EACH(&ldr->maps, key, val) {
		free((char *)key);
		map_free(*val);
	}
	table_free(&ldr->maps);
	free(ldr->maps_dir);
	color_map_destroy(&ldr->colors);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x39c6
cmpq $0x0, 0x8(%rbx)
je 0x6cb8
movl $0x8, %r14d
xorl %r15d, %r15d
movq 0x18(%rbx), %r12
movq -0x8(%r12,%r14), %rdi
callq 0x2570
movq (%r12,%r14), %rdi
callq 0x39c6
incq %r15
addq $0x10, %r14
cmpq 0x8(%rbx), %r15
jb 0x6c94
leaq 0x8(%rbx), %rdi
callq 0xa915
movq 0x20(%rbx), %rdi
callq 0x2570
cmpq $0x0, 0x28(%rbx)
je 0x6cfe
movl $0x8, %r14d
xorl %r15d, %r15d
movq 0x38(%rbx), %r12
movq -0x8(%r12,%r14), %rdi
callq 0x2570
movq (%r12,%r14), %rdi
callq 0x47ce
incq %r15
addq $0x10, %r14
cmpq 0x28(%rbx), %r15
jb 0x6cda
leaq 0x28(%rbx), %rdi
callq 0xa915
movq 0x40(%rbx), %rdi
callq 0x2570
cmpq $0x0, 0x48(%rbx)
je 0x6d44
movl $0x8, %r14d
xorl %r15d, %r15d
movq 0x58(%rbx), %r12
movq -0x8(%r12,%r14), %rdi
callq 0x2570
movq (%r12,%r14), %rdi
callq 0x8650
incq %r15
addq $0x10, %r14
cmpq 0x48(%rbx), %r15
jb 0x6d20
leaq 0x48(%rbx), %rdi
callq 0xa915
movq 0x60(%rbx), %rdi
callq 0x2570
addq $0x68, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xab2f
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/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:
testq %rdi, %rdi
je 0x6e96
movl %esi, %eax
notl %eax
testb $0x7, %al
jne 0x6e21
movl (%rdi), %esi
movl 0x20(%rdi), %eax
movl %eax, %r8d
andl $-0x8, %r8d
movl %r8d, 0x20(%rdi)
movl %esi, %r8d
andl $-0x8, %r8d
movl %r8d, (%rdi)
movq %rdx, 0x18(%rdi)
movq %rdx, 0x10(%rdi)
movq %rdx, 0x8(%rdi)
testq %rdx, %rdx
je 0x6e96
orl $0x7, %esi
movl %esi, (%rdi)
testb %cl, %cl
je 0x6e96
orl $0x7, %eax
movl %eax, 0x20(%rdi)
retq
movl $0x1, %eax
testb $0x1, %sil
jne 0x6e42
movl $0x2, %eax
testb $0x2, %sil
jne 0x6e42
andl $0x4, %esi
shrl $0x2, %esi
leal (%rsi,%rsi,2), %eax
incl %eax
movl %eax, %r8d
notl %r8d
movl 0x20(%rdi), %esi
movl %esi, %r9d
andl %r8d, %r9d
xorl %r10d, %r10d
cmpl $0x2, %eax
sete %r10b
leaq 0x8(,%r10,8), %r10
cmpl $0x4, %eax
movl $0x18, %r11d
cmovneq %r10, %r11
movl %r9d, 0x20(%rdi)
movq %rdx, (%rdi,%r11)
movl (%rdi), %r9d
testq %rdx, %rdx
je 0x6e90
orl %eax, %r9d
movl %r9d, (%rdi)
testb %cl, %cl
je 0x6e96
orl %eax, %esi
movl %esi, 0x20(%rdi)
retq
andl %r8d, %r9d
movl %r9d, (%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r14
pushq %rbx
subq $0xd8, %rsp
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
testb %al, %al
je 0x6eeb
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
testq %rdi, %rdi
je 0x6f99
movq %rdx, %rbx
movl $0x1, %eax
testb $0x1, %sil
jne 0x6f18
movl $0x2, %eax
testb $0x2, %sil
jne 0x6f18
andl $0x4, %esi
shrl $0x2, %esi
leal (%rsi,%rsi,2), %eax
incl %eax
testl %eax, (%rdi)
je 0x6f99
xorl %ecx, %ecx
cmpl $0x2, %eax
sete %cl
leaq 0x8(,%rcx,8), %rcx
leaq 0x5726(%rip), %rdx      # 0xc659
leaq 0x5717(%rip), %rsi      # 0xc651
cmoveq %rdx, %rsi
cmpl $0x4, %eax
movl $0x18, %eax
cmovneq %rcx, %rax
movq (%rdi,%rax), %r14
leaq 0x570f(%rip), %rdi      # 0xc664
cmovneq %rsi, %rdi
movq %r14, %rsi
callq 0x2290
leaq 0x20(%rsp), %rax
movq %rsp, %rdx
movq %rax, 0x10(%rdx)
leaq 0xf0(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000018, %rax     # imm = 0x3000000018
movq %rax, (%rdx)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x21d0
movq %r14, %rdi
callq 0x2550
addq $0xd8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x7024
movq %rdi, %rbx
testb $0x1, 0x20(%rdi)
je 0x6fca
movq 0x8(%rbx), %r14
testq %r14, %r14
je 0x6fca
movq %r14, %rdi
callq 0x23e0
jmp 0x6fcd
xorl %r14d, %r14d
movl 0x20(%rbx), %eax
testb $0x2, %al
je 0x6ff1
movq 0x10(%rbx), %r15
testq %r15, %r15
je 0x6ff1
cmpq %r14, %r15
sete %cl
testb %cl, %al
jne 0x6ff4
movq %r15, %rdi
callq 0x23e0
jmp 0x6ff4
xorl %r15d, %r15d
movl 0x20(%rbx), %eax
testb $0x4, %al
je 0x7024
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x7024
cmpq %r14, %rdi
sete %cl
testb %cl, %al
jne 0x7024
cmpq %r15, %rdi
sete %cl
shrb %al
testb %cl, %al
jne 0x7024
popq %rbx
popq %r14
popq %r15
jmp 0x23e0
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x4e9e(%rip), %rbp      # 0xc52c
xorl %r12d, %r12d
leaq 0x5600(%rip), %rdi      # 0xcc98
movq %r15, %rsi
callq 0x2120
testl %eax, %eax
jne 0x76dd
movq %r14, %rdi
movq %rbx, %rsi
leaq 0x55eb(%rip), %rdx      # 0xcc9c
callq 0x7673
movq %r14, %rdi
movq %rbx, %rsi
leaq 0x55de(%rip), %rdx      # 0xcca1
callq 0x7673
testb $0x1, %r12b
movl $0x0, %eax
cmovel %eax, %r13d
movb $0x1, %r12b
movq %rbp, %r15
jmp 0x7691
leaq 0x55b8(%rip), %rdi      # 0xcc9c
movq %r15, %rsi
callq 0x2120
testl %eax, %eax
je 0x7741
leaq 0x55aa(%rip), %rdi      # 0xcca1
movq %r15, %rsi
callq 0x2120
testl %eax, %eax
je 0x7748
leaq 0x4e22(%rip), %rdi      # 0xc52c
movq %r15, %rsi
callq 0x2120
movl $0x4, %ebp
testl %eax, %eax
je 0x774d
movq 0x98c6(%rip), %rax      # 0x10fe8
movq (%rax), %rdi
leaq 0x557d(%rip), %rsi      # 0xcca9
movq %r14, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x24b0
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0x7768
movl $0x1, %ebp
jmp 0x774d
movl $0x2, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x7782
xorl %r14d, %r14d
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x6dd1
testb $0x1, %r12b
cmovnel %r13d, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2090, %rsp           # imm = 0x2090
callq 0x697a
movq %rax, %rbx
leaq 0x480c(%rip), %rsi      # 0xc438
movq %rax, %rdi
callq 0x2160
testq %rax, %rax
je 0x7cca
movq %rax, %r15
leaq 0x3565(%rip), %rcx      # 0xb1ac
movq 0x9362(%rip), %r8       # 0x10fb0
leaq 0x367f(%rip), %r9       # 0xb2d4
xorl %r14d, %r14d
leaq 0x30(%rsp), %r12
movl $0x1, %edx
movq %r12, %rdi
xorl %esi, %esi
callq 0x5518
leaq 0x90(%rsp), %rsi
movl $0x2000, %edx           # imm = 0x2000
movq %r12, %rdi
movq %r15, %rcx
callq 0x55fb
leaq 0x507d(%rip), %rsi      # 0xcd08
leaq 0x8(%rsp), %r13
movq %r12, %rdi
movq %r13, %rdx
callq 0x5479
movq %r12, %rdi
callq 0x5679
movq %r15, %rdi
callq 0x23e0
movq (%r13), %rdi
callq 0x2570
movq %rbx, %rdi
callq 0x2570
cmpl $0x6, 0x10(%r13)
jne 0x7cd5
movq 0x20(%rsp), %r14
jmp 0x7cd5
movq %rbx, %rdi
callq 0x2570
xorl %r14d, %r14d
movq %r14, %rax
addq $0x2090, %rsp           # imm = 0x2090
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq