// File: /workspace/github_c_makefile_star2_O1/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 0x7059(%rip), %rbx      # 0xfc60
callq 0x2150
cmpq %rbx, %rax
jbe 0x8c48
movq 0x7060(%rip), %rdi      # 0xfc78
movq %rax, %rsi
callq 0x2540
movq %rax, 0x7041(%rip)      # 0xfc68
testq %rax, %rax
je 0x8f5d
movq %rax, %r12
movq %r15, %rdi
callq 0x2150
movl %eax, 0x701f(%rip)      # 0xfc60
movq %r12, 0x7030(%rip)      # 0xfc78
movb (%r15), %bpl
movq %r15, 0x8(%rsp)
testb %bpl, %bpl
je 0x8c9a
callq 0x22e0
movq (%rax), %rax
movq 0x8(%rsp), %rcx
leaq 0x1(%rcx), %r15
movsbq %bpl, %rcx
testb $0x20, 0x1(%rax,%rcx,2)
je 0x8c7e
movb (%r15), %bpl
incq %r15
testb %bpl, %bpl
jne 0x8c66
jmp 0x8c97
cmpb $0x22, %bpl
jne 0x8c97
movl $0x1, 0x6fca(%rip)      # 0xfc58
movb $0x1, 0x6fc7(%rip)      # 0xfc5c
jmp 0x8cab
decq %r15
movb $0x0, 0x6fbb(%rip)      # 0xfc5c
movl $0x0, 0x6fad(%rip)      # 0xfc58
cmpb $0x0, (%r15)
je 0x8f08
movq %r13, 0x10(%rsp)
movq %r14, (%rsp)
movl $0x1, (%r14)
movq 0x6fac(%rip), %rax      # 0xfc78
movq %rax, 0x6f95(%rip)      # 0xfc68
leaq 0x2c3a(%rip), %r12      # 0xb914
leaq 0x2cb1(%rip), %r13      # 0xb992
movzbl (%r15), %ebp
cmpl $0x5c, %ebp
je 0x8d35
testl %ebp, %ebp
je 0x8f2b
movsbl %bpl, %esi
movl $0xb, %edx
movq %r13, %rdi
callq 0x2320
testq %rax, %rax
je 0x8d68
cmpb $0x22, %bpl
jne 0x8d15
xorb $0x1, 0x6f43(%rip)      # 0xfc58
movq 0x6f4c(%rip), %rax      # 0xfc68
leaq 0x1(%rax), %rcx
cmpl $0x0, 0x6f31(%rip)      # 0xfc58
movq %rcx, 0x6f3a(%rip)      # 0xfc68
jne 0x8d7a
jmp 0x8f66
leaq 0x1(%r15), %rax
movb 0x1(%r15), %cl
movzbl %cl, %edx
leal -0x6e(%rdx), %esi
cmpl $0x8, %esi
ja 0x8d8b
movslq (%r12,%rsi,4), %rdx
addq %r12, %rdx
jmpq *%rdx
movq 0x6f10(%rip), %rcx      # 0xfc68
leaq 0x1(%rcx), %rdx
movq %rdx, 0x6f05(%rip)      # 0xfc68
movb $0xa, (%rcx)
jmp 0x8d80
movq 0x6ef9(%rip), %rax      # 0xfc68
leaq 0x1(%rax), %rcx
movq %rcx, 0x6eee(%rip)      # 0xfc68
movb %bpl, (%rax)
movq %r15, %rax
incq %rax
movq %rax, %r15
jmp 0x8ce1
cmpl $0x5c, %edx
je 0x8eee
testl %edx, %edx
je 0x8fb1
movq 0x6ec5(%rip), %rdx      # 0xfc68
leaq 0x1(%rdx), %rsi
movq %rsi, 0x6eba(%rip)      # 0xfc68
movb %cl, (%rdx)
jmp 0x8d80
movq 0x6eaf(%rip), %rcx      # 0xfc68
leaq 0x1(%rcx), %rdx
movq %rdx, 0x6ea4(%rip)      # 0xfc68
movb $0x9, (%rcx)
jmp 0x8d80
movq 0x6e98(%rip), %rcx      # 0xfc68
leaq 0x1(%rcx), %rdx
movq %rdx, 0x6e8d(%rip)      # 0xfc68
movb $0xd, (%rcx)
jmp 0x8d80
leaq 0x2(%r15), %rbp
movq %rbp, %rdi
callq 0x2150
cmpq $0x3, %rax
jbe 0x8f93
movl (%rbp), %eax
movl %eax, 0x6e71(%rip)      # 0xfc70
movb $0x0, 0x6e6f(%rip)      # 0xfc75
leaq 0x6e63(%rip), %rbx      # 0xfc70
movq %rbx, %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x2460
movq %rax, %r14
andq $-0x100, %r14
movq %rbx, %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x2460
movq %rax, %rbp
movl $0x2, %ebx
cmpq $0xd800, %r14           # imm = 0xD800
jne 0x8eaa
cmpb $0x5c, 0x6(%r15)
jne 0x8f93
cmpb $0x75, 0x7(%r15)
jne 0x8f93
leaq 0x6(%r15), %rdi
callq 0x2150
cmpq $0x3, %rax
jbe 0x8f93
movl 0x8(%r15), %eax
movl %eax, 0x6df7(%rip)      # 0xfc70
leaq 0x6df0(%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, %ebx
movq 0x6db7(%rip), %r14      # 0xfc68
movl %ebp, %edi
movq %r14, %rsi
callq 0x9108
movl %eax, %eax
addq %r14, %rax
movq %rax, 0x6da1(%rip)      # 0xfc68
leaq (%r15,%rbx), %rax
addq $0x3, %rax
jmp 0x8d80
movq 0x6d8d(%rip), %rcx      # 0xfc68
leaq 0x1(%rcx), %rdx
movq %rdx, 0x6d82(%rip)      # 0xfc68
movb $0xb, (%rcx)
jmp 0x8d80
movq 0x6d73(%rip), %rcx      # 0xfc68
leaq 0x1(%rcx), %rdx
movq %rdx, 0x6d68(%rip)      # 0xfc68
movb $0x5c, (%rcx)
jmp 0x8d80
xorl %eax, %eax
cmpl $0x1, 0x6d47(%rip)      # 0xfc58
jne 0x8f26
leaq 0x268f(%rip), %rdi      # 0xb5a9
xorl %eax, %eax
callq 0x22d0
movl $0x1, %eax
movl %eax, (%r14)
jmp 0x8f9d
movq 0x6d36(%rip), %rax      # 0xfc68
movb $0x0, (%rax)
subl 0x8(%rsp), %r15d
movq 0x10(%rsp), %rax
movl %r15d, (%rax)
cmpl $0x1, 0x6d0f(%rip)      # 0xfc58
jne 0x8f80
leaq 0x2657(%rip), %rdi      # 0xb5a9
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x22d0
jmp 0x8f9f
movl $0x1, (%r14)
jmp 0x8f9d
movb $0x0, (%rax)
movzbl 0x6cec(%rip), %eax      # 0xfc5c
subl 0x8(%rsp), %r15d
addl %eax, %r15d
movq 0x10(%rsp), %rax
movl %r15d, (%rax)
movq (%rsp), %rax
movl $0x0, (%rax)
movq 0x6ce7(%rip), %rbx      # 0xfc78
jmp 0x8f9f
movq (%rsp), %rax
movl $0x1, (%rax)
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x261b(%rip), %rdi      # 0xb5d3
jmp 0x8f52