// File: /workspace/github_c_makefile_star2_O2/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, %r12
movq %rdi, %rbp
movslq 0x78dd(%rip), %rbx      # 0xfc70
callq 0x2150
cmpq %rbx, %rax
jbe 0x83d4
movq 0x78e4(%rip), %rdi      # 0xfc88
movq %rax, %rsi
callq 0x2550
movq %rax, 0x78c5(%rip)      # 0xfc78
testq %rax, %rax
je 0x8693
movq %rax, %r14
movq %rbp, %rdi
callq 0x2150
movl %eax, 0x78a3(%rip)      # 0xfc70
movq %r14, 0x78b4(%rip)      # 0xfc88
leaq 0x1(%rbp), %r15
movsbq -0x1(%r15), %rbx
testq %rbx, %rbx
je 0x83f6
callq 0x22f0
movq (%rax), %rax
testb $0x20, 0x1(%rax,%rbx,2)
je 0x840f
incq %r15
jmp 0x83d8
movb $0x0, 0x786f(%rip)      # 0xfc6c
andl $0x0, 0x7864(%rip)      # 0xfc68
xorl %eax, %eax
movl %eax, (%r12)
jmp 0x8700
cmpb $0x22, %bl
jne 0x843e
movl $0x1, 0x784a(%rip)      # 0xfc68
movb $0x1, 0x7847(%rip)      # 0xfc6c
cmpb $0x0, (%r15)
jne 0x844f
leaq 0x3157(%rip), %rdi      # 0xb589
xorl %eax, %eax
callq 0x22e0
pushq $0x1
popq %rax
jmp 0x8406
decq %r15
movb $0x0, 0x7824(%rip)      # 0xfc6c
andl $0x0, 0x7819(%rip)      # 0xfc68
movq %rbp, 0x8(%rsp)
movq %r13, 0x10(%rsp)
movq %r12, (%rsp)
movl $0x1, (%r12)
movq 0x781c(%rip), %r12      # 0xfc88
movq %r12, 0x7805(%rip)      # 0xfc78
leaq 0x347a(%rip), %rbx      # 0xb8f4
leaq 0x77ff(%rip), %r13      # 0xfc80
pushq $0xb
popq %r14
movzbl (%r15), %ebp
cmpl $0x5c, %ebp
je 0x84d8
testl %ebp, %ebp
je 0x869d
movsbl %bpl, %esi
leaq 0x34f1(%rip), %rdi      # 0xb992
movq %r14, %rdx
callq 0x2330
testq %rax, %rax
je 0x8507
movl 0x77b4(%rip), %eax      # 0xfc68
cmpb $0x22, %bpl
jne 0x84c3
xorl $0x1, %eax
movl %eax, 0x77a5(%rip)      # 0xfc68
leaq 0x1(%r12), %rcx
movq %rcx, 0x77a9(%rip)      # 0xfc78
testl %eax, %eax
jne 0x8513
jmp 0x86ca
leaq 0x1(%r15), %rax
movb 0x1(%r15), %dl
movzbl %dl, %ecx
leal -0x6e(%rcx), %esi
cmpl $0x8, %esi
ja 0x8528
movslq (%rbx,%rsi,4), %rcx
addq %rbx, %rcx
jmpq *%rcx
leaq 0x1(%r12), %rcx
movq %rcx, 0x7778(%rip)      # 0xfc78
movb $0xa, (%r12)
jmp 0x851a
leaq 0x1(%r12), %rcx
movq %rcx, 0x7765(%rip)      # 0xfc78
movb %bpl, (%r12)
movq %r15, %rax
incq %rax
movq %rcx, %r12
movq %rax, %r15
jmp 0x8485
cmpl $0x5c, %ecx
je 0x8647
testl %ecx, %ecx
je 0x8714
leaq 0x1(%r12), %rcx
movq %rcx, 0x7733(%rip)      # 0xfc78
movb %dl, (%r12)
jmp 0x851a
leaq 0x1(%r12), %rcx
movq %rcx, 0x7721(%rip)      # 0xfc78
movb $0x9, (%r12)
jmp 0x851a
leaq 0x1(%r12), %rcx
movq %rcx, 0x770e(%rip)      # 0xfc78
movb $0xd, (%r12)
jmp 0x851a
leaq 0x2(%r15), %r12
movq %r12, %rdi
callq 0x2150
cmpq $0x3, %rax
jbe 0x86f6
movl (%r12), %eax
movl %eax, 0x76ef(%rip)      # 0xfc80
movb $0x0, 0x76ed(%rip)      # 0xfc85
movq %r13, %rdi
xorl %esi, %esi
pushq $0x10
popq %r12
movl %r12d, %edx
callq 0x2470
movq %rax, %rbp
andq $-0x100, %rbp
movq %r13, %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0x2470
movq %rax, %r12
cmpq $0xd800, %rbp           # imm = 0xD800
jne 0x865d
cmpb $0x5c, 0x6(%r15)
jne 0x86f6
cmpb $0x75, 0x7(%r15)
jne 0x86f6
leaq 0x6(%r15), %rdi
callq 0x2150
cmpq $0x3, %rax
jbe 0x86f6
movl 0x8(%r15), %eax
movl %eax, 0x767d(%rip)      # 0xfc80
movq %r13, %rdi
xorl %esi, %esi
pushq $0x10
popq %rdx
callq 0x2470
addl $0x2400, %eax           # imm = 0x2400
movzwl %ax, %eax
shll $0xa, %r12d
orl %eax, %r12d
addl $0x10000, %r12d         # imm = 0x10000
andl $0xfffff, %r12d         # imm = 0xFFFFF
pushq $0x8
jmp 0x865f
leaq 0x1(%r12), %rcx
movq %rcx, 0x763b(%rip)      # 0xfc78
movb $0xb, (%r12)
jmp 0x851a
leaq 0x1(%r12), %rcx
movq %rcx, 0x7625(%rip)      # 0xfc78
movb $0x5c, (%r12)
jmp 0x851a
pushq $0x2
popq %r13
movq 0x7610(%rip), %rbp      # 0xfc78
movl %r12d, %edi
movq %rbp, %rsi
callq 0x8833
movl %eax, %ecx
addq %rbp, %rcx
movq %rcx, 0x75f9(%rip)      # 0xfc78
leaq (%r15,%r13), %rax
addq $0x3, %rax
leaq 0x75f2(%rip), %r13      # 0xfc80
jmp 0x851a
movl $0x1, (%r12)
jmp 0x8700
movb $0x0, (%r12)
subl 0x8(%rsp), %r15d
movq 0x10(%rsp), %rax
movl %r15d, (%rax)
cmpl $0x1, 0x75b2(%rip)      # 0xfc68
jne 0x86e6
leaq 0x2eca(%rip), %rdi      # 0xb589
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x22e0
jmp 0x8702
movb $0x0, (%r12)
movzbl 0x7596(%rip), %eax      # 0xfc6c
subl 0x8(%rsp), %r15d
addl %eax, %r15d
movq 0x10(%rsp), %rax
movl %r15d, (%rax)
movq (%rsp), %rax
andl $0x0, (%rax)
movq 0x7594(%rip), %rbx      # 0xfc88
jmp 0x8702
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 0x2e98(%rip), %rdi      # 0xb5b3
jmp 0x86bf