// File: /workspace/github_c_makefile_star2_O1/qq-smart[P]qq_sh_server/core/qq_json.c
// Function: print_string_ptr
static char *print_string_ptr(const char *str,printbuffer *p)
{
	const char *ptr;char *ptr2,*out;int len=0,flag=0;unsigned char token;
	
	for (ptr=str;*ptr;ptr++) flag|=((*ptr>0 && *ptr<32)||(*ptr=='\"')||(*ptr=='\\'))?1:0;
	if (!flag)
	{
		len=ptr-str;
		if (p) out=ensure(p,len+3);
		else		out=(char*)cJSON_malloc(len+3);
		if (!out) return 0;
		ptr2=out;*ptr2++='\"';
		strcpy(ptr2,str);
		ptr2[len]='\"';
		ptr2[len+1]=0;
		return out;
	}
	
	if (!str)
	{
		if (p)	out=ensure(p,3);
		else	out=(char*)cJSON_malloc(3);
		if (!out) return 0;
		strcpy(out,"\"\"");
		return out;
	}
	ptr=str;while ((token=*ptr) && ++len) {if (strchr("\"\\\b\f\n\r\t",token)) len++; else if (token<32) len+=5;ptr++;}
	
	if (p)	out=ensure(p,len+3);
	else	out=(char*)cJSON_malloc(len+3);
	if (!out) return 0;

	ptr2=out;ptr=str;
	*ptr2++='\"';
	while (*ptr)
	{
		if ((unsigned char)*ptr>31 && *ptr!='\"' && *ptr!='\\') *ptr2++=*ptr++;
		else
		{
			*ptr2++='\\';
			switch (token=*ptr++)
			{
				case '\\':	*ptr2++='\\';	break;
				case '\"':	*ptr2++='\"';	break;
				case '\b':	*ptr2++='b';	break;
				case '\f':	*ptr2++='f';	break;
				case '\n':	*ptr2++='n';	break;
				case '\r':	*ptr2++='r';	break;
				case '\t':	*ptr2++='t';	break;
				default: sprintf(ptr2,"u%04x",token);ptr2+=5;	break;	/* escape and print */
			}
		}
	}
	*ptr2++='\"';*ptr2++=0;
	return out;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r8
movq %rdi, %rbx
movb (%rdi), %cl
testb %cl, %cl
je 0x63bd
xorl %eax, %eax
movq %rbx, %r15
cmpb $0x20, %cl
setb %dl
cmpb $0x22, %cl
sete %sil
cmpb $0x5c, %cl
sete %cl
orb %sil, %cl
orb %dl, %cl
movzbl %cl, %ecx
orl %ecx, %eax
movb 0x1(%r15), %cl
incq %r15
testb %cl, %cl
jne 0x638e
testl %eax, %eax
sete %al
jmp 0x63c2
movb $0x1, %al
movq %rbx, %r15
testb %al, %al
je 0x63dc
subq %rbx, %r15
testq %r8, %r8
je 0x643c
leal 0x3(%r15), %esi
movq %r8, %rdi
callq 0x5831
jmp 0x6449
movb (%rbx), %al
testb %al, %al
je 0x647f
movq %r8, -0x30(%rbp)
leaq 0x1(%rbx), %r14
xorl %r12d, %r12d
movl %r12d, %r15d
incl %r15d
je 0x6487
movzbl %al, %r13d
movl $0x8, %edx
leaq 0x458f(%rip), %rdi      # 0xa99c
movl %r13d, %esi
callq 0x2210
leal 0x2(%r12), %ecx
addl $0x6, %r12d
cmpb $0x20, %r13b
cmovbl %r12d, %r15d
testq %rax, %rax
cmovnel %ecx, %r15d
movb (%r14), %al
incq %r14
movl %r15d, %r12d
testb %al, %al
jne 0x63f1
jmp 0x648a
leal 0x3(%r15), %eax
movslq %eax, %rdi
callq *0x8d6f(%rip)           # 0xf1b8
movq %rax, %r14
testq %rax, %rax
je 0x6585
leaq 0x1(%r14), %rdi
movb $0x22, %r12b
movb %r12b, (%r14)
movq %rbx, %rsi
callq 0x21e0
movslq %r15d, %rax
movb %r12b, 0x1(%r14,%rax)
incl %eax
cltq
leaq (%r14,%rax), %r12
incq %r12
jmp 0x657e
movl $0x3, %r15d
jmp 0x6492
xorl %r15d, %r15d
addl $0x3, %r15d
movq -0x30(%rbp), %r8
testq %r8, %r8
je 0x64a4
movq %r8, %rdi
movl %r15d, %esi
callq 0x5831
jmp 0x64ad
movslq %r15d, %rdi
callq *0x8d0b(%rip)           # 0xf1b8
movq %rax, %r14
testq %rax, %rax
je 0x6585
leaq 0x1(%r14), %r12
movb $0x22, (%r14)
movb (%rbx), %al
testb %al, %al
je 0x6576
incq %rbx
leaq 0x44cf(%rip), %r15      # 0xa9a4
leaq 0x445c(%rip), %r13      # 0xa938
cmpb $0x20, %al
jb 0x64ec
cmpb $0x22, %al
je 0x64ec
movzbl %al, %ecx
cmpl $0x5c, %ecx
jne 0x6521
movb $0x5c, (%r12)
movzbl -0x1(%rbx), %edx
leal -0x8(%rdx), %eax
cmpl $0x5, %eax
ja 0x650f
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
movb $0x62, 0x1(%r12)
jmp 0x6565
cmpl $0x22, %edx
je 0x655f
cmpl $0x5c, %edx
jne 0x652a
movb $0x5c, 0x1(%r12)
jmp 0x6565
movb %al, (%r12)
incq %r12
jmp 0x6569
leaq 0x1(%r12), %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x2070
addq $0x6, %r12
jmp 0x6569
movb $0x74, 0x1(%r12)
jmp 0x6565
movb $0x6e, 0x1(%r12)
jmp 0x6565
movb $0x66, 0x1(%r12)
jmp 0x6565
movb $0x72, 0x1(%r12)
jmp 0x6565
movb $0x22, 0x1(%r12)
addq $0x2, %r12
movb (%rbx), %al
incq %rbx
testb %al, %al
jne 0x64dc
movb $0x22, (%r12)
incq %r12
movb $0x0, (%r12)
jmp 0x6588
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop