// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7960
cmpl $0x0, %eax
je 0x79b3
jmp 0x7ccd
movq -0x18(%rbp), %rax
movl $0x0, 0x10(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movq -0x10(%rbp), %rdi
callq 0x7d00
cmpl $0x0, %eax
jne 0x7a68
movq -0x10(%rbp), %rax
movl 0x58(%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x7a51
movq -0x10(%rbp), %rax
movl 0x58(%rax), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x7a16
movq -0x10(%rbp), %rax
movzbl 0x57(%rax), %eax
cmpl $0x0, %eax
je 0x7a32
movq -0x10(%rbp), %rax
movl 0x58(%rax), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
jne 0x7a3e
movq -0x10(%rbp), %rax
cmpq $0x0, 0x48(%rax)
jne 0x7a3e
movl $0x0, -0x4(%rbp)
jmp 0x7ced
movq -0x10(%rbp), %rdi
movl $0xe, %esi
callq 0x7d30
jmp 0x7ccd
movq -0x10(%rbp), %rdi
callq 0x7d60
cmpl $0x0, %eax
je 0x7a64
jmp 0x7ccd
jmp 0x7a66
jmp 0x7a68
movq -0x10(%rbp), %rdi
callq 0x7e00
movl %eax, %ecx
movl %ecx, -0x1c(%rbp)
testl %eax, %eax
je 0x7a97
jmp 0x7a7c
movl -0x1c(%rbp), %eax
subl $0x1, %eax
je 0x7adb
jmp 0x7a86
movl -0x1c(%rbp), %eax
subl $0x2, %eax
je 0x7b9e
jmp 0x7cb4
movq -0x10(%rbp), %rdi
callq 0x7e80
cmpl $0x0, %eax
je 0x7aaa
jmp 0x7ccd
movq -0x10(%rbp), %rdi
callq 0x7d00
cmpl $0x0, %eax
je 0x7acf
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x7f20
cmpl $0x0, %eax
je 0x7acf
jmp 0x7ccd
movl $0x0, -0x4(%rbp)
jmp 0x7ced
movq -0x10(%rbp), %rdi
callq 0x7e80
cmpl $0x0, %eax
je 0x7aee
jmp 0x7ccd
movq -0x10(%rbp), %rax
movl 0x58(%rax), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x7b32
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rcx
movl $0x5d, %esi
movl $0x5, %edx
callq 0x8050
cmpl $0x0, %eax
je 0x7b20
jmp 0x7ccd
movq -0x10(%rbp), %rax
movl 0x58(%rax), %ecx
andl $0xfffffdff, %ecx       # imm = 0xFFFFFDFF
movl %ecx, 0x58(%rax)
jmp 0x7b55
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rcx
movl $0x5d, %esi
movl $0x5, %edx
callq 0x80d0
cmpl $0x0, %eax
je 0x7b53
jmp 0x7ccd
jmp 0x7b55
movq -0x18(%rbp), %rax
cmpl $0x5, 0x10(%rax)
jne 0x7b6b
movl $0x0, -0x4(%rbp)
jmp 0x7ced
movq -0x10(%rbp), %rdi
callq 0x7e80
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x1d(%rbp)
jne 0x7b96
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x7f20
cmpl $0x0, %eax
setne %al
movb %al, -0x1d(%rbp)
movb -0x1d(%rbp), %al
jmp 0x7cb4
movq -0x10(%rbp), %rdi
callq 0x7e80
cmpl $0x0, %eax
je 0x7bb1
jmp 0x7ccd
movq -0x10(%rbp), %rax
movl 0x58(%rax), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x7bf5
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rcx
movl $0x7d, %esi
movl $0x3, %edx
callq 0x8050
cmpl $0x0, %eax
je 0x7be3
jmp 0x7ccd
movq -0x10(%rbp), %rax
movl 0x58(%rax), %ecx
andl $0xfffffdff, %ecx       # imm = 0xFFFFFDFF
movl %ecx, 0x58(%rax)
jmp 0x7c18
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rcx
movl $0x7d, %esi
movl $0x3, %edx
callq 0x80d0
cmpl $0x0, %eax
je 0x7c16
jmp 0x7ccd
jmp 0x7c18
movq -0x18(%rbp), %rax
cmpl $0x3, 0x10(%rax)
jne 0x7c2e
movl $0x0, -0x4(%rbp)
jmp 0x7ced
movq -0x10(%rbp), %rdi
callq 0x7e80
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x1e(%rbp)
jne 0x7cb1
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x8160
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x1e(%rbp)
jne 0x7cb1
movq -0x10(%rbp), %rdi
callq 0x7e80
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x1e(%rbp)
jne 0x7cb1
movq -0x10(%rbp), %rdi
callq 0x8330
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x1e(%rbp)
jne 0x7cb1
movq -0x10(%rbp), %rdi
callq 0x7e80
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x1e(%rbp)
jne 0x7cb1
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x7f20
cmpl $0x0, %eax
setne %al
movb %al, -0x1e(%rbp)
movb -0x1e(%rbp), %al
movq -0x10(%rbp), %rdi
callq 0x7960
cmpl $0x0, %eax
je 0x7cc4
jmp 0x7ccd
movl $0x0, -0x4(%rbp)
jmp 0x7ced
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x10, %rsi
movq -0x18(%rbp), %rdx
addq $0x18, %rdx
callq 0x78f0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)