// File: /workspace/github_c_makefile_star2_O3/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
testl $0x120, %eax            # imm = 0x120
je 0x3f67c
leaq 0x3746d(%rip), %rsi     # 0x76adf
movq %rbx, %rdi
movl $0x4, %edx
jmp 0x3f6e5
movq %rdi, %r14
testb $0x8, %al
jne 0x3f6bc
movq %rsi, %r15
movq %r14, %rdi
callq 0x30898
movl 0x8(%r14), %ecx
testl %eax, %eax
je 0x3f6f8
testb $0x1, %cl
jne 0x3f754
leaq -0x30(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x30577
movl (%r15), %edx
movq %rbx, %rdi
movq %rax, %rsi
jmp 0x3f7db
movq %r14, %rdi
callq 0x438dd
xorl %edx, %edx
cmpl $0x0, (%r14)
sete %dl
leaq 0x325a5(%rip), %rax     # 0x71c79
leaq 0x32599(%rip), %rsi     # 0x71c74
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 0x359ad
testb $0x1, %cl
jne 0x3f754
testb $0x40, %cl
je 0x3f66b
movl $0x1, 0x8(%r15)
movq (%r14), %rax
testb $0x1, 0x40(%rax)
jne 0x3f7ef
leaq 0x3222a(%rip), %rsi     # 0x7194c
movq %rbx, %rdi
movl $0x1, %edx
callq 0x359ad
testb $0x40, 0x8(%r14)
je 0x3f748
movq (%r14), %rdi
leaq 0x1c3(%rip), %rsi       # 0x3f903
movq %r15, %rdx
callq 0x5134a
leaq 0x32204(%rip), %rsi     # 0x71953
jmp 0x3f823
leaq -0x30(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x30577
movq %rax, %r14
movslq (%r15), %r13
leaq 0x324ff(%rip), %rsi     # 0x71c6f
movq %rbx, %rdi
movl $0x1, %edx
callq 0x359ad
testq %r13, %r13
jle 0x3f7cc
addq %r14, %r13
leaq 0x31c93(%rip), %r15     # 0x7141f
leaq -0x2c(%rbp), %r12
movzbl (%r14), %eax
movsbl %al, %ecx
movl %ecx, -0x2c(%rbp)
cmpl $0x5c, %eax
je 0x3f7a4
cmpl $0x22, %eax
jne 0x3f7b4
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x359ad
incq %r14
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x359ad
cmpq %r13, %r14
jb 0x3f790
leaq 0x3249c(%rip), %rsi     # 0x71c6f
movq %rbx, %rdi
movl $0x1, %edx
callq 0x359ad
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x38aee(%rip), %rsi     # 0x782e4
movq %rbx, %rdi
movl $0x1, %edx
callq 0x359ad
testb $0x40, 0x8(%r14)
je 0x3f81c
movq (%r14), %rdi
leaq 0x1c(%rip), %rsi        # 0x3f830
movq %r15, %rdx
callq 0x5134a
leaq 0x35dd5(%rip), %rsi     # 0x755f8
movq %rbx, %rdi
movl $0x1, %edx
jmp 0x3f6e5