// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x10, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0x83e0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jge 0x8195
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x8323
jmp 0x8197
cmpl $0x22, -0x1c(%rbp)
je 0x81a2
jmp 0x82d4
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x8e70
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x81cf
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x8323
movq -0x18(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x10(%rbp), %rdi
callq 0x83e0
movl %eax, -0x1c(%rbp)
cmpl $0x22, %eax
je 0x8252
cmpl $0x0, -0x1c(%rbp)
jge 0x81f7
jmp 0x82e4
cmpl $0x5c, -0x1c(%rbp)
jne 0x821a
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x8eb0
cmpl $0x0, %eax
je 0x8218
jmp 0x830b
jmp 0x8250
cmpl $0x20, -0x1c(%rbp)
jge 0x8225
jmp 0x82f4
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x18(%rbp), %rdx
addq $0x8, %rdx
movl -0x1c(%rbp), %r8d
leaq -0x30(%rbp), %rcx
callq 0x87d0
cmpl $0x0, %eax
je 0x824c
jmp 0x830b
jmp 0x824e
jmp 0x8250
jmp 0x81db
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x18(%rbp), %rdx
addq $0x8, %rdx
leaq -0x30(%rbp), %rcx
xorl %r8d, %r8d
callq 0x87d0
cmpl $0x0, %eax
je 0x8278
jmp 0x830b
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rdi
movq -0x18(%rbp), %rcx
movq 0x8(%rcx), %rsi
callq *%rax
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x82bb
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x8323
movq -0x10(%rbp), %rdi
movl $0xc, %esi
callq 0x7d30
jmp 0x830b
movq -0x10(%rbp), %rdi
movl $0xf, %esi
callq 0x7d30
jmp 0x830b
movq -0x10(%rbp), %rdi
callq 0x8620
movq -0x10(%rbp), %rdi
movl $0x11, %esi
callq 0x7d30
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rdi
callq *%rax
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)