// File: /workspace/github_c_makefile_star2_O2/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 0x5333
movzbl 0x58(%r14), %eax
pushq $-0x1
popq %rbp
testl %eax, %eax
je 0x532c
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
andl $0x0, 0x10(%rbx)
movups %xmm0, (%rbx)
movq 0x38(%r14), %rcx
cmpq 0x28(%r14), %rcx
jae 0x5362
btl $0xa, %eax
jb 0x537a
movq 0x48(%r14), %rax
testq %rax, %rax
je 0x53a6
movq 0x40(%r14), %rcx
addq %rcx, %rax
decq %rax
jmp 0x538d
btl $0x8, %eax
jb 0x53de
movq %r14, %rdi
callq 0x5530
testl %eax, %eax
jne 0x5315
movl 0x58(%r14), %eax
jmp 0x5347
movzbl 0x57(%r14), %eax
testq %rax, %rax
je 0x53a6
decl %eax
addq %r14, %rax
addq $0x40, %rax
movzbl (%rax), %eax
cmpl $0x2, %eax
je 0x5439
cmpl $0x1, %eax
je 0x5407
testl %eax, %eax
jne 0x54f3
movq %r14, %rdi
callq 0x5587
testl %eax, %eax
jne 0x5315
movq 0x38(%r14), %rax
xorl %ebp, %ebp
cmpq 0x28(%r14), %rax
jae 0x532c
movq %r14, %rdi
movq %rbx, %rsi
callq 0x55e5
testl %eax, %eax
jne 0x5315
jmp 0x532c
btl $0xa, %eax
jb 0x53f0
cmpq $0x0, 0x48(%r14)
jne 0x53fb
jmp 0x54fe
cmpb $0x0, 0x57(%r14)
je 0x54fe
orl $0xe, %eax
movl %eax, 0x58(%r14)
jmp 0x5315
movq %r14, %rdi
callq 0x5587
testl %eax, %eax
jne 0x5315
testb $0x2, 0x59(%r14)
jne 0x546b
pushq $0x5d
popq %rsi
pushq $0x5
popq %rdx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x5a5b
testl %eax, %eax
jne 0x5315
jmp 0x5489
movq %r14, %rdi
callq 0x5587
testl %eax, %eax
jne 0x5315
testb $0x2, 0x59(%r14)
jne 0x54a8
pushq $0x7d
popq %rsi
pushq $0x3
popq %rdx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x5a5b
testl %eax, %eax
jne 0x5315
jmp 0x54c6
pushq $0x5d
popq %rsi
pushq $0x5
popq %rdx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x5a13
testl %eax, %eax
jne 0x5315
andb $-0x3, 0x59(%r14)
cmpl $0x5, 0x10(%rbx)
je 0x54fe
movq %r14, %rdi
callq 0x5587
testl %eax, %eax
jne 0x54f3
movq %r14, %rdi
movq %rbx, %rsi
callq 0x55e5
jmp 0x54f3
pushq $0x7d
popq %rsi
pushq $0x3
popq %rdx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x5a13
testl %eax, %eax
jne 0x5315
andb $-0x3, 0x59(%r14)
cmpl $0x3, 0x10(%rbx)
je 0x54fe
movq %r14, %rdi
callq 0x5587
testl %eax, %eax
jne 0x54f3
movq %r14, %rdi
movq %rbx, %rsi
callq 0x5ab8
testl %eax, %eax
jne 0x54f3
movq %r14, %rdi
callq 0x5587
testl %eax, %eax
je 0x5505
cmpb $0x0, 0x58(%r14)
jne 0x5315
xorl %ebp, %ebp
jmp 0x532c
movq 0x20(%r14), %rcx
movq 0x38(%r14), %rax
cmpb $0x3a, (%rcx,%rax)
jne 0x551f
incq %rax
movq %rax, 0x38(%r14)
jmp 0x548f
movl 0x58(%r14), %eax
testb %al, %al
jne 0x54f3
orl $0xd, %eax
movl %eax, 0x58(%r14)
jmp 0x54f3