// File: /workspace/github_c_makefile_star2_O3/TurkeyMcMac[P]ts3d/src/json.c
// Function: json_read_item
int json_read_item(json_reader *reader, struct json_item *result)
{
	if (has_error(reader)) goto error;
	result->type = JSON_EMPTY;
	result->key.len = 0;
	result->key.bytes = NULL;
	if (!is_in_range(reader)) {
		if (reader->flags & SOURCE_DEPLETED) {
			if (((reader->flags & SMALL_STACK) != 0
					&& reader->stack.small.size == 0)
				|| ((reader->flags & SMALL_STACK) == 0
					&& reader->stack.big.size == 0))
			{
				/* All brackets have been closed. */
				return 0;
			} else {
				set_error(reader, JSON_ERROR_BRACKETS);
				goto error;
			}
		} else if (refill(reader)) {
			goto error;
		}
	}
	switch (peek_frame(reader)) {
	case FRAME_EMPTY:
		if (skip_spaces(reader)) goto error;
		if (is_in_range(reader) && parse_value(reader, result))
			goto error;
		return 0;
	case FRAME_LIST:
		if (skip_spaces(reader)) goto error;
		if (reader->flags & STARTED_COMPOUND) {
			if (try_compound_end(reader, ']', JSON_END_LIST,
				result)) goto error;
			reader->flags &= ~STARTED_COMPOUND;
		} else {
			if (parse_after_elem(reader, ']', JSON_END_LIST,
				result)) goto error;
		}
		if (result->type == JSON_END_LIST) return 0;
		(void)(
			skip_spaces(reader) ||
			parse_value(reader, result)
		);
		break;
	case FRAME_MAP:
		if (skip_spaces(reader)) goto error;
		if (reader->flags & STARTED_COMPOUND) {
			if (try_compound_end(reader, '}', JSON_END_MAP,result))
				goto error;
			reader->flags &= ~STARTED_COMPOUND;
		} else {
			if (parse_after_elem(reader, '}', JSON_END_MAP, result))
				goto error;
		}
		if (result->type == JSON_END_MAP) return 0;
		(void)(
			skip_spaces(reader) ||
			parse_string(reader, &result->key) ||
			skip_spaces(reader) ||
			parse_colon(reader) ||
			skip_spaces(reader) ||
			parse_value(reader, result)
		);
		break;
	}
	if (has_error(reader)) goto error;
	return 0;

error:
	json_get_last_error(reader, &result->type, &result->val.erridx);
	return -1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl 0x58(%rdi), %eax
testb %al, %al
je 0x56f8
movzbl 0x58(%r14), %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
je 0x56f1
movq 0x38(%r14), %rcx
movq %rcx, 0x18(%rbx)
movl %eax, 0x10(%rbx)
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movl $0x0, 0x10(%rbx)
movq 0x38(%r14), %rcx
cmpq 0x28(%r14), %rcx
jae 0x572a
btl $0xa, %eax
jb 0x5742
movq 0x48(%r14), %rax
testq %rax, %rax
je 0x576e
movq 0x40(%r14), %rcx
addq %rcx, %rax
decq %rax
jmp 0x5755
btl $0x8, %eax
jb 0x57a6
movq %r14, %rdi
callq 0x5908
testl %eax, %eax
jne 0x56d8
movl 0x58(%r14), %eax
jmp 0x570f
movzbl 0x57(%r14), %eax
testq %rax, %rax
je 0x576e
decl %eax
addq %r14, %rax
addq $0x40, %rax
movzbl (%rax), %eax
cmpl $0x2, %eax
je 0x5805
cmpl $0x1, %eax
je 0x57cf
testl %eax, %eax
jne 0x58cb
movq %r14, %rdi
callq 0x5964
testl %eax, %eax
jne 0x56d8
movq 0x38(%r14), %rax
xorl %ebp, %ebp
cmpq 0x28(%r14), %rax
jae 0x56f1
movq %r14, %rdi
movq %rbx, %rsi
callq 0x59d4
testl %eax, %eax
jne 0x56d8
jmp 0x56f1
btl $0xa, %eax
jb 0x57b8
cmpq $0x0, 0x48(%r14)
jne 0x57c3
jmp 0x58d6
cmpb $0x0, 0x57(%r14)
je 0x58d6
orl $0xe, %eax
movl %eax, 0x58(%r14)
jmp 0x56d8
movq %r14, %rdi
callq 0x5964
testl %eax, %eax
jne 0x56d8
testb $0x2, 0x59(%r14)
jne 0x583b
movq %r14, %rdi
movl $0x5d, %esi
movl $0x5, %edx
movq %rbx, %rcx
callq 0x5eaf
testl %eax, %eax
jne 0x56d8
jmp 0x585d
movq %r14, %rdi
callq 0x5964
testl %eax, %eax
jne 0x56d8
testb $0x2, 0x59(%r14)
jne 0x587c
movq %r14, %rdi
movl $0x7d, %esi
movl $0x3, %edx
movq %rbx, %rcx
callq 0x5eaf
testl %eax, %eax
jne 0x56d8
jmp 0x589e
movq %r14, %rdi
movl $0x5d, %esi
movl $0x5, %edx
movq %rbx, %rcx
callq 0x5e67
testl %eax, %eax
jne 0x56d8
andb $-0x3, 0x59(%r14)
cmpl $0x5, 0x10(%rbx)
je 0x58d6
movq %r14, %rdi
callq 0x5964
testl %eax, %eax
jne 0x58cb
movq %r14, %rdi
movq %rbx, %rsi
callq 0x59d4
jmp 0x58cb
movq %r14, %rdi
movl $0x7d, %esi
movl $0x3, %edx
movq %rbx, %rcx
callq 0x5e67
testl %eax, %eax
jne 0x56d8
andb $-0x3, 0x59(%r14)
cmpl $0x3, 0x10(%rbx)
je 0x58d6
movq %r14, %rdi
callq 0x5964
testl %eax, %eax
jne 0x58cb
movq %r14, %rdi
movq %rbx, %rsi
callq 0x5f0e
testl %eax, %eax
jne 0x58cb
movq %r14, %rdi
callq 0x5964
testl %eax, %eax
je 0x58dd
cmpb $0x0, 0x58(%r14)
jne 0x56d8
xorl %ebp, %ebp
jmp 0x56f1
movq 0x20(%r14), %rcx
movq 0x38(%r14), %rax
cmpb $0x3a, (%rcx,%rax)
jne 0x58f7
incq %rax
movq %rax, 0x38(%r14)
jmp 0x5863
movl 0x58(%r14), %eax
testb %al, %al
jne 0x58cb
orl $0xd, %eax
movl %eax, 0x58(%r14)
jmp 0x58cb