// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: VmJsonEncode
static sxi32 VmJsonEncode(
	jx9_value *pIn,          /* Encode this value */
	json_private_data *pData /* Context data */
	){
		SyBlob *pOut = pData->pOut;
		int nByte;
		if( jx9_value_is_null(pIn) || jx9_value_is_resource(pIn)){
			/* null */
			SyBlobAppend(pOut, "null", sizeof("null")-1);
		}else if( jx9_value_is_bool(pIn) ){
			int iBool = jx9_value_to_bool(pIn);
			sxu32 iLen;
			/* true/false */
			iLen = iBool ? sizeof("true") : sizeof("false");
			SyBlobAppend(pOut, iBool ? "true" : "false", iLen-1);
		}else if(  jx9_value_is_numeric(pIn) && !jx9_value_is_string(pIn) ){
			const char *zNum;
			/* Get a string representation of the number */
			zNum = jx9_value_to_string(pIn, &nByte);
			SyBlobAppend(pOut,zNum,nByte);
		}else if( jx9_value_is_string(pIn) ){
				const char *zIn, *zEnd;
				int c;
				/* Encode the string */
				zIn = jx9_value_to_string(pIn, &nByte);
				zEnd = &zIn[nByte];
				/* Append the double quote */
				SyBlobAppend(pOut,"\"", sizeof(char));
				for(;;){
					if( zIn >= zEnd ){
						/* No more input to process */
						break;
					}
					c = zIn[0];
					/* Advance the stream cursor */
					zIn++;
					if( c == '"' || c == '\\' ){
						/* Unescape the character */
						SyBlobAppend(pOut,"\\", sizeof(char));
					}
					/* Append character verbatim */
					SyBlobAppend(pOut,(const char *)&c,sizeof(char));
				}
				/* Append the double quote */
				SyBlobAppend(pOut,"\"",sizeof(char));
		}else if( jx9_value_is_json_array(pIn) ){
			/* Encode the array/object */
			pData->isFirst = 1;
			if( jx9_value_is_json_object(pIn) ){
				/* Encode the object instance */
				pData->isFirst = 1;
				/* Append the curly braces */
				SyBlobAppend(pOut, "{",sizeof(char));
				/* Iterate throw object attribute */
				jx9_array_walk(pIn,VmJsonObjectEncode, pData);
				/* Append the closing curly braces  */
				SyBlobAppend(pOut, "}",sizeof(char));
			}else{
				/* Append the square bracket or curly braces */
				SyBlobAppend(pOut,"[",sizeof(char));
				/* Iterate throw array entries */
				jx9_array_walk(pIn, VmJsonArrayEncode, pData);
				/* Append the closing square bracket or curly braces */
				SyBlobAppend(pOut,"]",sizeof(char));
			}
		}else{
			/* Can't happen */
			SyBlobAppend(pOut,"null",sizeof("null")-1);
		}
		/* All done */
		return JX9_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq (%rsi), %rbx
movl 0x8(%rdi), %eax
testw $0x120, %ax             # imm = 0x120
je 0x3708a
leaq 0x2fa3a(%rip), %rsi     # 0x66abf
pushq $0x4
popq %rdx
jmp 0x370ee
movq %rdi, %r14
testb $0x8, %al
jne 0x370ca
movq %rsi, %r15
movq %r14, %rdi
callq 0x29a60
movl 0x8(%r14), %ecx
testl %eax, %eax
je 0x37104
testb $0x1, %cl
jne 0x3715b
leaq -0x30(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x297ed
movl (%r15), %edx
movq %rbx, %rdi
movq %rax, %rsi
jmp 0x371d0
movq %r14, %rdi
callq 0x29790
xorl %edx, %edx
testl %eax, %eax
sete %dl
leaq 0x2ab93(%rip), %rax     # 0x61c73
leaq 0x2ab87(%rip), %rsi     # 0x61c6e
cmoveq %rax, %rsi
orl $0x4, %edx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2e250
testb $0x1, %cl
jne 0x3715b
testb $0x40, %cl
je 0x3707e
movl $0x1, 0x8(%r15)
movq (%r14), %rax
testb $0x1, 0x40(%rax)
jne 0x371e4
leaq 0x2a7ee(%rip), %rsi     # 0x6191c
pushq $0x1
popq %r12
movq %rbx, %rdi
movl %r12d, %edx
callq 0x2e250
leaq 0x1a5(%rip), %rsi       # 0x372e9
movq %r14, %rdi
movq %r15, %rdx
callq 0x29c1e
leaq 0x2a7cd(%rip), %rsi     # 0x61923
jmp 0x37213
leaq -0x30(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x297ed
movq %rax, %r14
movslq (%r15), %r13
addq %rax, %r13
leaq 0x2aaef(%rip), %rsi     # 0x61c69
pushq $0x1
popq %r15
leaq -0x2c(%rbp), %r12
movq %rbx, %rdi
movl %r15d, %edx
callq 0x2e250
cmpq %r13, %r14
jae 0x371c3
movzbl (%r14), %eax
incq %r14
movsbl %al, %ecx
movl %ecx, -0x2c(%rbp)
cmpl $0x5c, %eax
je 0x371ac
movq %r12, %rsi
cmpl $0x22, %eax
jne 0x37182
movq %rbx, %rdi
leaq 0x2a23f(%rip), %rsi     # 0x613f5
movl %r15d, %edx
callq 0x2e250
movq %r12, %rsi
jmp 0x37182
leaq 0x2aa9f(%rip), %rsi     # 0x61c69
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x2e250
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x310d9(%rip), %rsi     # 0x682c4
pushq $0x1
popq %r12
movq %rbx, %rdi
movl %r12d, %edx
callq 0x2e250
leaq 0x1d(%rip), %rsi        # 0x3721e
movq %r14, %rdi
movq %r15, %rdx
callq 0x29c1e
leaq 0x2e3c5(%rip), %rsi     # 0x655d8
movq %rbx, %rdi
movl %r12d, %edx
jmp 0x370f1