// File: /workspace/github_c_makefile_star2_O3/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, %r15
movl %edx, -0x2c(%rbp)
movl %esi, -0x38(%rbp)
movq %rdi, %r12
addq $0x10, %r12
movq $-0x8, %r13
xorl %ebx, %ebx
movq %r12, %rax
movq (%rax), %rax
decq %rbx
addq $0x8, %r13
testq %rax, %rax
jne 0x59aa
cmpl $-0x1, %ebx
je 0x5ab0
testq %r15, %r15
je 0x5acb
movslq 0xc(%r15), %rbx
movq %r15, %rdi
movl $0x1, %esi
callq 0x5741
testq %rax, %rax
je 0x5c58
movq %rbx, -0x40(%rbp)
movb $0x5b, (%rax)
incl 0xc(%r15)
movq (%r12), %r13
testq %r13, %r13
je 0x5a89
incl -0x38(%rbp)
xorl %r12d, %r12d
cmpl $0x0, -0x2c(%rbp)
sete %r12b
movl $0x2, %ebx
subl %r12d, %ebx
xorl $0x3, %r12d
movq %r13, %rdi
movl -0x38(%rbp), %esi
movl -0x2c(%rbp), %edx
movq %r15, %rcx
callq 0x433a
movq (%r15), %rdi
movl $0x0, %eax
testq %rdi, %rdi
je 0x5a44
movslq 0xc(%r15), %r14
addq %r14, %rdi
callq 0x20d0
addl %r14d, %eax
movl %eax, 0xc(%r15)
cmpq $0x0, (%r13)
je 0x5a89
movq %r15, %rdi
movl %r12d, %esi
callq 0x5741
testq %rax, %rax
je 0x5c58
movb $0x2c, (%rax)
cmpl $0x0, -0x2c(%rbp)
je 0x5a76
movb $0x20, 0x1(%rax)
addq $0x2, %rax
jmp 0x5a79
incq %rax
movb $0x0, (%rax)
addl %ebx, 0xc(%r15)
movq (%r13), %r13
testq %r13, %r13
jne 0x5a17
movq %r15, %rdi
movl $0x2, %esi
callq 0x5741
testq %rax, %rax
je 0x5c58
movw $0x5d, (%rax)
movq -0x40(%rbp), %rax
addq (%r15), %rax
jmp 0x5c5a
testq %r15, %r15
je 0x5b67
movq %r15, %rdi
movl $0x3, %esi
callq 0x5741
jmp 0x5b72
movq %r13, %rdi
callq *0x96e4(%rip)           # 0xf1b8
testq %rax, %rax
je 0x5c58
movq %rax, %r15
movq %rbx, %rax
notq %rax
movq %rax, -0x40(%rbp)
movq %r15, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x2160
movq (%r12), %r12
testq %r12, %r12
movq %r15, -0x50(%rbp)
je 0x5b89
incl -0x38(%rbp)
cmpl $0x1, -0x2c(%rbp)
movl $0x3, %eax
sbbq $0x0, %rax
movq %rax, -0x48(%rbp)
movl $0x5, %r14d
movq %r12, %rdi
movl -0x38(%rbp), %esi
movl -0x2c(%rbp), %edx
xorl %ecx, %ecx
callq 0x433a
movq %rax, (%r15)
testq %rax, %rax
je 0x5c2d
movq %rax, %r13
movq %rax, %rdi
callq 0x20d0
addl -0x48(%rbp), %r14d
addl %eax, %r14d
testq %r13, %r13
je 0x5b62
addq $0x8, %r15
movq (%r12), %r12
testq %r12, %r12
jne 0x5b22
movslq %r14d, %rdi
jmp 0x5b8e
movl $0x3, %edi
callq *0x9646(%rip)           # 0xf1b8
testq %rax, %rax
je 0x5c58
movb $0x0, 0x2(%rax)
movw $0x5d5b, (%rax)         # imm = 0x5D5B
jmp 0x5c5a
movl $0x5, %edi
callq *0x9624(%rip)           # 0xf1b8
testq %rax, %rax
je 0x5c2d
movq %rax, %r14
movq $-0x2, %rax
subq %rbx, %rax
movw $0x5b, (%r14)
movq %r14, -0x48(%rbp)
incq %r14
movl %eax, %eax
movq %rax, -0x38(%rbp)
xorl %ebx, %ebx
movq -0x50(%rbp), %r15
movq (%r15,%rbx,8), %r12
movq %r12, %rdi
callq 0x20d0
movq %rax, %r13
movq %r14, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x21c0
addq %r13, %r14
cmpq %rbx, -0x38(%rbp)
je 0x5c05
movb $0x2c, (%r14)
cmpl $0x0, -0x2c(%rbp)
je 0x5bfe
movb $0x20, 0x1(%r14)
addq $0x2, %r14
jmp 0x5c01
incq %r14
movb $0x0, (%r14)
movq (%r15,%rbx,8), %rdi
callq *0x95b1(%rip)           # 0xf1c0
incq %rbx
cmpq %rbx, -0x40(%rbp)
jne 0x5bc3
movq %r15, %rdi
callq *0x959f(%rip)           # 0xf1c0
movw $0x5d, (%r14)
movq -0x48(%rbp), %rax
jmp 0x5c5a
movq -0x50(%rbp), %r14
movq %r14, %rbx
movq -0x40(%rbp), %r15
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x5c46
callq *0x957a(%rip)           # 0xf1c0
addq $0x8, %rbx
decq %r15
jne 0x5c38
movq %r14, %rdi
callq *0x9568(%rip)           # 0xf1c0
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq