// File: /workspace/github_c_makefile_star2_O2/qq-smart[P]qq_sh_server/core/qq_json.c
// Function: print_array
static char *print_array(cJSON *item,int depth,int fmt,printbuffer *p)
{
	char **entries;
	char *out=0,*ptr,*ret;int len=5;
	cJSON *child=item->child;
	int numentries=0,i=0,fail=0;
	size_t tmplen=0;
	
	/* How many entries in the array? */
	while (child) numentries++,child=child->next;
	/* Explicitly handle numentries==0 */
	if (!numentries)
	{
		if (p)	out=ensure(p,3);
		else	out=(char*)cJSON_malloc(3);
		if (out) strcpy(out,"[]");
		return out;
	}

	if (p)
	{
		/* Compose the output array. */
		i=p->offset;
		ptr=ensure(p,1);if (!ptr) return 0;	*ptr='[';	p->offset++;
		child=item->child;
		while (child && !fail)
		{
			print_value(child,depth+1,fmt,p);
			p->offset=update(p);
			if (child->next) {len=fmt?2:1;ptr=ensure(p,len+1);if (!ptr) return 0;*ptr++=',';if(fmt)*ptr++=' ';*ptr=0;p->offset+=len;}
			child=child->next;
		}
		ptr=ensure(p,2);if (!ptr) return 0;	*ptr++=']';*ptr=0;
		out=(p->buffer)+i;
	}
	else
	{
		/* Allocate an array to hold the values for each */
		entries=(char**)cJSON_malloc(numentries*sizeof(char*));
		if (!entries) return 0;
		memset(entries,0,numentries*sizeof(char*));
		/* Retrieve all the results: */
		child=item->child;
		while (child && !fail)
		{
			ret=print_value(child,depth+1,fmt,0);
			entries[i++]=ret;
			if (ret) len+=strlen(ret)+2+(fmt?1:0); else fail=1;
			child=child->next;
		}
		
		/* If we didn't fail, try to malloc the output string */
		if (!fail)	out=(char*)cJSON_malloc(len);
		/* If that fails, we fail. */
		if (!out) fail=1;

		/* Handle failure. */
		if (fail)
		{
			for (i=0;i<numentries;i++) if (entries[i]) cJSON_free(entries[i]);
			cJSON_free(entries);
			return 0;
		}
		
		/* Compose the output array. */
		*out='[';
		ptr=out+1;*ptr=0;
		for (i=0;i<numentries;i++)
		{
			tmplen=strlen(entries[i]);memcpy(ptr,entries[i],tmplen);ptr+=tmplen;
			if (i!=numentries-1) {*ptr++=',';if(fmt)*ptr++=' ';*ptr=0;}
			cJSON_free(entries[i]);
		}
		cJSON_free(entries);
		*ptr++=']';*ptr++=0;
	}
	return out;	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r12
movl %edx, -0x2c(%rbp)
movl %esi, -0x40(%rbp)
movq %rdi, %r15
addq $0x10, %r15
pushq $-0x8
popq %r13
xorl %ebx, %ebx
movq %r15, %rax
movq (%rax), %rax
decq %rbx
addq $0x8, %r13
testq %rax, %rax
jne 0x54fd
cmpl $-0x1, %ebx
je 0x55bc
testq %r12, %r12
je 0x55d5
movslq 0xc(%r12), %rbx
pushq $0x1
popq %rsi
movq %r12, %rdi
callq 0x5298
testq %rax, %rax
je 0x576e
movb $0x5b, (%rax)
incl 0xc(%r12)
incl -0x40(%rbp)
xorl %r13d, %r13d
cmpl $0x0, -0x2c(%rbp)
sete %r13b
pushq $0x2
popq %r14
subl %r13d, %r14d
xorl $0x3, %r13d
movq (%r15), %r15
testq %r15, %r15
je 0x5663
movq %r15, %rdi
movl -0x40(%rbp), %esi
movl -0x2c(%rbp), %edx
movq %r12, %rcx
callq 0x44b9
movq %r12, %rdi
callq 0x5ee6
movl %eax, 0xc(%r12)
cmpq $0x0, (%r15)
je 0x5558
movq %r12, %rdi
movl %r13d, %esi
callq 0x5298
testq %rax, %rax
je 0x576e
movb $0x2c, (%rax)
cmpl $0x0, -0x2c(%rbp)
je 0x55af
movb $0x20, 0x1(%rax)
addq $0x2, %rax
jmp 0x55b2
incq %rax
movb $0x0, (%rax)
addl %r14d, 0xc(%r12)
jmp 0x5558
testq %r12, %r12
je 0x572c
pushq $0x3
popq %rsi
movq %r12, %rdi
callq 0x5298
jmp 0x5735
movq %r13, %rdi
callq *0x8bda(%rip)           # 0xe1b8
testq %rax, %rax
je 0x576e
pushq $-0x2
popq %rcx
subq %rbx, %rcx
movq %rcx, -0x50(%rbp)
notq %rbx
xorl %r14d, %r14d
movq %rax, -0x38(%rbp)
movq %rax, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x2160
incl -0x40(%rbp)
cmpl $0x1, -0x2c(%rbp)
pushq $0x3
popq %rax
sbbq $0x0, %rax
movq %rax, -0x48(%rbp)
pushq $0x5
popq %r13
movb $0x1, %r12b
testb $0x1, %r12b
je 0x5688
movq (%r15), %r15
testq %r15, %r15
je 0x5688
xorl %r12d, %r12d
movq %r15, %rdi
movl -0x40(%rbp), %esi
movl -0x2c(%rbp), %edx
xorl %ecx, %ecx
callq 0x44b9
movq -0x38(%rbp), %rcx
movq %rax, (%rcx,%r14,8)
incq %r14
testq %rax, %rax
je 0x5621
movq %rax, %rdi
callq 0x20d0
addl -0x48(%rbp), %r13d
addl %eax, %r13d
jmp 0x561e
pushq $0x2
popq %rsi
movq %r12, %rdi
callq 0x5298
testq %rax, %rax
je 0x576e
movw $0x5d, (%rax)
addq (%r12), %rbx
movq %rbx, %rax
jmp 0x5770
testb $0x1, %r12b
je 0x5745
movslq %r13d, %rdi
callq *0x8b1d(%rip)           # 0xe1b8
testq %rax, %rax
setne %cl
testb %cl, %r12b
je 0x5745
movw $0x5b, (%rax)
movq %rax, -0x48(%rbp)
movq %rax, %r14
incq %r14
movl -0x50(%rbp), %eax
movq %rax, -0x40(%rbp)
xorl %r12d, %r12d
movq -0x38(%rbp), %r15
subq $0x1, %rbx
jb 0x577f
movq (%r15,%r12,8), %r15
movq %r15, %rdi
callq 0x20d0
movq %rax, %r13
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x21c0
addq %r13, %r14
cmpq %r12, -0x40(%rbp)
jne 0x56fd
movq -0x38(%rbp), %r15
jmp 0x571d
movb $0x2c, (%r14)
cmpl $0x0, -0x2c(%rbp)
je 0x5712
movb $0x20, 0x1(%r14)
addq $0x2, %r14
jmp 0x5715
incq %r14
movq -0x38(%rbp), %r15
movb $0x0, (%r14)
movq (%r15,%r12,8), %rdi
callq *0x8a99(%rip)           # 0xe1c0
incq %r12
jmp 0x56c7
pushq $0x3
popq %rdi
callq *0x8a83(%rip)           # 0xe1b8
testq %rax, %rax
je 0x576e
movb $0x0, 0x2(%rax)
movw $0x5d5b, (%rax)         # imm = 0x5D5B
jmp 0x5770
xorl %r14d, %r14d
movq -0x38(%rbp), %r15
cmpq %r14, %rbx
je 0x5765
movq (%r15,%r14,8), %rdi
testq %rdi, %rdi
je 0x5760
callq *0x8a60(%rip)           # 0xe1c0
incq %r14
jmp 0x574c
movq %r15, %rdi
callq *0x8a52(%rip)           # 0xe1c0
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
callq *0x8a38(%rip)           # 0xe1c0
movw $0x5d, (%r14)
movq -0x48(%rbp), %rax
jmp 0x5770