// File: /workspace/github_c_makefile_star2_O1/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, -0x40(%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 0x5a9a
cmpl $-0x1, %ebx
je 0x5ba0
testq %r15, %r15
je 0x5bbb
movslq 0xc(%r15), %rbx
movq %r15, %rdi
movl $0x1, %esi
callq 0x5831
testq %rax, %rax
je 0x5d75
movq %rbx, -0x38(%rbp)
movb $0x5b, (%rax)
incl 0xc(%r15)
movq (%r12), %r13
testq %r13, %r13
je 0x5b79
incl -0x40(%rbp)
xorl %r12d, %r12d
cmpl $0x0, -0x2c(%rbp)
sete %r12b
movl $0x2, %ebx
subl %r12d, %ebx
xorl $0x3, %r12d
movq %r13, %rdi
movl -0x40(%rbp), %esi
movl -0x2c(%rbp), %edx
movq %r15, %rcx
callq 0x4318
movq (%r15), %rdi
movl $0x0, %eax
testq %rdi, %rdi
je 0x5b34
movslq 0xc(%r15), %r14
addq %r14, %rdi
callq 0x20d0
addl %r14d, %eax
movl %eax, 0xc(%r15)
cmpq $0x0, (%r13)
je 0x5b70
movq %r15, %rdi
movl %r12d, %esi
callq 0x5831
testq %rax, %rax
je 0x5d75
movb $0x2c, (%rax)
cmpl $0x0, -0x2c(%rbp)
je 0x5b66
movb $0x20, 0x1(%rax)
addq $0x2, %rax
jmp 0x5b69
incq %rax
movb $0x0, (%rax)
addl %ebx, 0xc(%r15)
movq (%r13), %r13
testq %r13, %r13
jne 0x5b07
movq %r15, %rdi
movl $0x2, %esi
callq 0x5831
testq %rax, %rax
je 0x5d75
movw $0x5d, (%rax)
movq -0x38(%rbp), %rax
addq (%r15), %rax
jmp 0x5d77
testq %r15, %r15
je 0x5c5e
movq %r15, %rdi
movl $0x3, %esi
callq 0x5831
jmp 0x5c69
movq %r13, %rdi
callq *0x95f4(%rip)           # 0xf1b8
testq %rax, %rax
je 0x5d75
movq %rax, %r14
xorl %r15d, %r15d
movq %rax, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x2160
movq (%r12), %r12
testq %r12, %r12
movq %r14, -0x38(%rbp)
je 0x5c80
incl -0x40(%rbp)
cmpl $0x1, -0x2c(%rbp)
movl $0x3, %eax
sbbq $0x0, %rax
movq %rax, -0x48(%rbp)
movl $0x5, %r13d
movq %r12, %rdi
movl -0x40(%rbp), %esi
movl -0x2c(%rbp), %edx
xorl %ecx, %ecx
callq 0x4318
movq %rax, (%r14)
testq %rax, %rax
je 0x5c34
movq %rax, %rdi
callq 0x20d0
addl -0x48(%rbp), %r13d
addl %eax, %r13d
jmp 0x5c3a
movl $0x1, %r15d
movq (%r12), %r12
testl %r15d, %r15d
sete %al
testq %r12, %r12
je 0x5c52
addq $0x8, %r14
testl %r15d, %r15d
je 0x5c0b
movslq %r13d, %rdi
testl %r15d, %r15d
sete %r14b
jmp 0x5c8a
movl $0x3, %edi
callq *0x954f(%rip)           # 0xf1b8
testq %rax, %rax
je 0x5d77
movb $0x0, 0x2(%rax)
movw $0x5d5b, (%rax)         # imm = 0x5D5B
jmp 0x5d77
movb $0x1, %r14b
movl $0x5, %edi
movb $0x1, %al
testb %al, %al
movq -0x38(%rbp), %r12
je 0x5c9a
callq *0x9520(%rip)           # 0xf1b8
jmp 0x5c9c
xorl %eax, %eax
movq %rbx, %r15
notq %r15
testq %rax, %rax
setne %cl
testb %r14b, %cl
je 0x5d4b
movq $-0x2, %rcx
subq %rbx, %rcx
movw $0x5b, (%rax)
movq %rax, -0x48(%rbp)
leaq 0x1(%rax), %r14
movl %ecx, %eax
movq %rax, -0x40(%rbp)
cmpq $0x1, %r15
adcq $0x0, %r15
xorl %ebx, %ebx
movq (%r12,%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, -0x40(%rbp)
jne 0x5d04
movq -0x38(%rbp), %r12
jmp 0x5d24
movb $0x2c, (%r14)
cmpl $0x0, -0x2c(%rbp)
je 0x5d19
movb $0x20, 0x1(%r14)
addq $0x2, %r14
jmp 0x5d1c
incq %r14
movq -0x38(%rbp), %r12
movb $0x0, (%r14)
movq (%r12,%rbx,8), %rdi
callq *0x9492(%rip)           # 0xf1c0
incq %rbx
cmpq %rbx, %r15
jne 0x5cd8
movq %r12, %rdi
callq *0x9481(%rip)           # 0xf1c0
movw $0x5d, (%r14)
movq -0x48(%rbp), %rax
jmp 0x5d77
cmpq $0x1, %r15
adcq $0x0, %r15
xorl %ebx, %ebx
movq (%r12,%rbx,8), %rdi
testq %rdi, %rdi
je 0x5d64
callq *0x945c(%rip)           # 0xf1c0
incq %rbx
cmpq %rbx, %r15
jne 0x5d55
movq %r12, %rdi
callq *0x944b(%rip)           # 0xf1c0
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq