// File: /workspace/github_c_makefile_star2_O3/tomka[P]cliaspora/json.c
// Function: get_string
static char *
get_string(const char *str, bool *error, int *curpos)
{
	u_short	    hs, ls;
	static int  n, quote, quoted, buflen = 0;
	const  char *start;
	static char *p, num[8], *buf = NULL;

	if (buflen < strlen(str)) {
		if ((p = realloc(buf, strlen(str))) == NULL) {
			*error = true;
			return (NULL);
		}
		buflen = strlen(str);
		buf = p;
	}
	start = str;
	while (*str != '\0' && isspace(*str))
		str++;
	if (*str == '"') {
		str++; quote = 1; quoted = 1;
	} else
		quote = quoted = 0;
	if (*str == '\0') {
		if (quote == 1) {
			warnx("Syntax error: Unterminated quoted string:");
			*error = true;
		} else
			*error = false;
		return (NULL);
	}
	*error = true;
	for (p = buf; *str != '\0'; str++) {
		if (*str == '\\') {
			if (*(str + 1) == '\0') {
				warnx("Syntax error: " \
				    "Incomplete escape sequence:");
				return (NULL);
			}
			switch (*++str) {
			case '\\':
				*p++ = '\\';
				break;
			case 'n':
				*p++ = '\n';
				break;
			case 't':
				*p++ = '\t';
				break;
			case 'v':
				*p++ = '\v';
				break;
			case 'r':
				*p++ = '\r';
				break;
			case 'u':
				if (strlen(++str) < 4) {
					*error = true;
					return (NULL);
				}
				(void)memcpy(num, str, 4); num[5] = '\0';
				if ((strtol(num, NULL, 16) >> 8) == 0xd8) {
					hs = (u_short)strtol(num, NULL, 16);
					str += 4;
					if (str[0] != '\\' || str[1] != 'u') {
						*error = true;
						return (NULL);
					}
					if (strlen(str) < 4) {
						*error = true;
						return (NULL);
					}
					str += 2;
					(void)memcpy(num, str, 4);
					ls = (u_short)strtol(num, NULL, 16);
					n = uctoutf8(utf16touc(hs, ls),
					    (u_char *)p);
				} else {
					n = uctoutf8(strtol(num, NULL, 16),
					    (u_char *)p);
				}
				p += n; str += 3;
				break;
			default:
				*p++ = *str;
			}
		} else if (strchr(",:{}[]\" \n\t", *str) != NULL) {
			if (*str == '"')
				quote ^= 1;
			if (quote == 0) {
				*p++ = '\0'; 
				if (!quoted)
					*curpos = str - start;
				else
					*curpos = str - start + 1;
				*error = false;
				return (buf);
			} else
				*p++ = *str;
		} else
			*p++ = *str;
	}
	*p = '\0'; *curpos = str - start;
	if (quote == 1) {
		warnx("Syntax error: Unterminated quoted string:");
		return (NULL);
	}
	*error = false;
	return (buf);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %r15
movslq 0x71c8(%rip), %rbx      # 0xfc60
callq 0x2150
cmpq %rbx, %rax
jbe 0x8ad9
movq 0x71cf(%rip), %rdi      # 0xfc78
movq %rax, %rsi
callq 0x2540
movq %rax, 0x71b0(%rip)      # 0xfc68
testq %rax, %rax
je 0x8b4c
movq %rax, %r12
movq %r15, %rdi
callq 0x2150
movl %eax, 0x718e(%rip)      # 0xfc60
movq %r12, 0x719f(%rip)      # 0xfc78
movb (%r15), %bpl
testb %bpl, %bpl
je 0x8b03
callq 0x22e0
movq (%rax), %rax
leaq 0x1(%r15), %rbx
movsbq %bpl, %rcx
testb $0x20, 0x1(%rax,%rcx,2)
je 0x8b1b
movb (%rbx), %bpl
incq %rbx
testb %bpl, %bpl
jne 0x8aed
movb $0x0, 0x7152(%rip)      # 0xfc5c
movl $0x0, 0x7144(%rip)      # 0xfc58
xorl %eax, %eax
movl %eax, (%r14)
jmp 0x8b53
cmpb $0x22, %bpl
jne 0x8b67
movl $0x1, 0x712d(%rip)      # 0xfc58
movb $0x1, 0x712a(%rip)      # 0xfc5c
cmpb $0x0, (%rbx)
jne 0x8b7b
leaq 0x2a4b(%rip), %rdi      # 0xb589
xorl %eax, %eax
callq 0x22d0
movl $0x1, %eax
jmp 0x8b16
movl $0x1, (%r14)
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
decq %rbx
movb $0x0, 0x70eb(%rip)      # 0xfc5c
movl $0x0, 0x70dd(%rip)      # 0xfc58
movq %r14, 0x8(%rsp)
movl $0x1, (%r14)
movq 0x70ea(%rip), %r12      # 0xfc78
movq %r12, 0x70d3(%rip)      # 0xfc68
leaq 0x2d84(%rip), %r14      # 0xb920
movq %r13, 0x10(%rsp)
movzbl (%rbx), %ebp
cmpl $0x5c, %ebp
je 0x8bf5
testl %ebp, %ebp
je 0x8db1
movsbl %bpl, %esi
movl $0xb, %edx
leaq 0x2ddd(%rip), %rdi      # 0xb99e
callq 0x2320
testq %rax, %rax
je 0x8c23
movl 0x7087(%rip), %eax      # 0xfc58
cmpb $0x22, %bpl
jne 0x8be0
xorl $0x1, %eax
movl %eax, 0x7078(%rip)      # 0xfc58
leaq 0x1(%r12), %rcx
movq %rcx, 0x707c(%rip)      # 0xfc68
testl %eax, %eax
jne 0x8c2f
jmp 0x8ddb
leaq 0x1(%rbx), %rax
movb 0x1(%rbx), %dl
movzbl %dl, %ecx
leal -0x6e(%rcx), %esi
cmpl $0x8, %esi
ja 0x8c44
movslq (%r14,%rsi,4), %rcx
addq %r14, %rcx
jmpq *%rcx
leaq 0x1(%r12), %rcx
movq %rcx, 0x704c(%rip)      # 0xfc68
movb $0xa, (%r12)
jmp 0x8c36
leaq 0x1(%r12), %rcx
movq %rcx, 0x7039(%rip)      # 0xfc68
movb %bpl, (%r12)
movq %rbx, %rax
incq %rax
movq %rcx, %r12
movq %rax, %rbx
jmp 0x8ba1
cmpl $0x5c, %ecx
je 0x8d9b
testl %ecx, %ecx
je 0x8e17
leaq 0x1(%r12), %rcx
movq %rcx, 0x7007(%rip)      # 0xfc68
movb %dl, (%r12)
jmp 0x8c36
leaq 0x1(%r12), %rcx
movq %rcx, 0x6ff5(%rip)      # 0xfc68
movb $0x9, (%r12)
jmp 0x8c36
leaq 0x1(%r12), %rcx
movq %rcx, 0x6fe2(%rip)      # 0xfc68
movb $0xd, (%r12)
jmp 0x8c36
leaq 0x2(%rbx), %rbp
movq %rbp, %rdi
callq 0x2150
cmpq $0x3, %rax
jbe 0x8e07
movl (%rbp), %eax
movl %eax, 0x6fc4(%rip)      # 0xfc70
movb $0x0, 0x6fc2(%rip)      # 0xfc75
leaq 0x6fb6(%rip), %r13      # 0xfc70
movq %r13, %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x2460
movq %rax, %r12
andq $-0x100, %r12
movq %r13, %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x2460
movq %rax, %rbp
movl $0x2, %r13d
cmpq $0xd800, %r12           # imm = 0xD800
jne 0x8d56
cmpb $0x5c, 0x6(%rbx)
jne 0x8e07
cmpb $0x75, 0x7(%rbx)
jne 0x8e07
leaq 0x6(%rbx), %rdi
callq 0x2150
cmpq $0x3, %rax
jbe 0x8e07
movl 0x8(%rbx), %eax
movl %eax, 0x6f4c(%rip)      # 0xfc70
leaq 0x6f45(%rip), %rdi      # 0xfc70
xorl %esi, %esi
movl $0x10, %edx
callq 0x2460
addl $0x2400, %eax           # imm = 0x2400
movzwl %ax, %eax
shll $0xa, %ebp
orl %eax, %ebp
addl $0x10000, %ebp          # imm = 0x10000
andl $0xfffff, %ebp          # imm = 0xFFFFF
movl $0x8, %r13d
movq 0x6f0b(%rip), %r12      # 0xfc68
movl %ebp, %edi
movq %r12, %rsi
callq 0x8f66
movl %eax, %ecx
addq %r12, %rcx
movq %rcx, 0x6ef5(%rip)      # 0xfc68
leaq (%rbx,%r13), %rax
addq $0x3, %rax
movq 0x10(%rsp), %r13
jmp 0x8c36
leaq 0x1(%r12), %rcx
movq %rcx, 0x6ed7(%rip)      # 0xfc68
movb $0xb, (%r12)
jmp 0x8c36
leaq 0x1(%r12), %rcx
movq %rcx, 0x6ec1(%rip)      # 0xfc68
movb $0x5c, (%r12)
jmp 0x8c36
movb $0x0, (%r12)
subl %r15d, %ebx
movl %ebx, (%r13)
cmpl $0x1, 0x6e94(%rip)      # 0xfc58
jne 0x8df0
leaq 0x27bc(%rip), %rdi      # 0xb589
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x22d0
jmp 0x8b55
movb $0x0, (%r12)
movzbl 0x6e75(%rip), %eax      # 0xfc5c
subl %r15d, %ebx
addl %eax, %ebx
movl %ebx, (%r13)
movq 0x8(%rsp), %rax
movl $0x0, (%rax)
movq 0x6e76(%rip), %rbx      # 0xfc78
jmp 0x8b55
movq 0x8(%rsp), %rax
movl $0x1, (%rax)
jmp 0x8b53
leaq 0x2795(%rip), %rdi      # 0xb5b3
jmp 0x8dcd