// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: jx9Builtin_vfprintf
static int jx9Builtin_vfprintf(jx9_context *pCtx, int nArg, jx9_value **apArg)
{
	fprintf_data sFdata;
	const char *zFormat;
	jx9_hashmap *pMap;
	io_private *pDev;
	SySet sArg;
	int n, nLen;
	if( nArg < 3 || !jx9_value_is_resource(apArg[0]) || !jx9_value_is_string(apArg[1])  || !jx9_value_is_json_array(apArg[2]) ){
		/* Missing/Invalid arguments, return zero */
		jx9_context_throw_error(pCtx, JX9_CTX_WARNING, "Invalid arguments");
		jx9_result_int(pCtx, 0);
		return JX9_OK;
	}
	/* Extract our private data */
	pDev = (io_private *)jx9_value_to_resource(apArg[0]);
	/* Make sure we are dealing with a valid io_private instance */
	if( IO_PRIVATE_INVALID(pDev) ){
		/*Expecting an IO handle */
		jx9_context_throw_error(pCtx, JX9_CTX_WARNING, "Expecting an IO handle");
		jx9_result_int(pCtx, 0);
		return JX9_OK;
	}
	/* Point to the target IO stream device */
	if( pDev->pStream == 0  || pDev->pStream->xWrite == 0 ){
		jx9_context_throw_error_format(pCtx, JX9_CTX_WARNING, 
			"IO routine(%s) not implemented in the underlying stream(%s) device", 
			jx9_function_name(pCtx), pDev->pStream ? pDev->pStream->zName : "null_stream"
			);
		jx9_result_int(pCtx, 0);
		return JX9_OK;
	}
	/* Extract the string format */
	zFormat = jx9_value_to_string(apArg[1], &nLen);
	if( nLen < 1 ){
		/* Empty string, return zero */
		jx9_result_int(pCtx, 0);
		return JX9_OK;
	}
	/* Point to hashmap */
	pMap = (jx9_hashmap *)apArg[2]->x.pOther;
	/* Extract arguments from the hashmap */
	n = jx9HashmapValuesToSet(pMap, &sArg);
	/* Prepare our private data */
	sFdata.nCount = 0;
	sFdata.pIO = pDev;
	/* Format the string */
	jx9InputFormat(fprintfConsumer, pCtx, zFormat, nLen, n, (jx9_value **)SySetBasePtr(&sArg), (void *)&sFdata, TRUE);
	/* Return total number of bytes written*/
	jx9_result_int64(pCtx, sFdata.nCount);
	SySetRelease(&sArg);
	return JX9_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
cmpl $0x3, %esi
jl 0x55972
movq %rdx, %r14
movq (%rdx), %rax
testb $0x1, 0x9(%rax)
je 0x55972
movq 0x8(%r14), %rdi
testb $0x1, 0x8(%rdi)
je 0x55972
movq 0x10(%r14), %rcx
testb $0x40, 0x8(%rcx)
jne 0x5599f
leaq 0x11f81(%rip), %rdx     # 0x678fa
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x2a0db
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2987c
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rax), %r13
testq %r13, %r13
je 0x55a44
cmpl $0xfeac14, 0x34(%r13)   # imm = 0xFEAC14
jne 0x55a44
movq (%r13), %rax
testq %rax, %rax
je 0x55a50
cmpq $0x0, 0x40(%rax)
je 0x55a59
leaq -0x2c(%rbp), %r12
movq %r12, %rsi
callq 0x297ed
cmpl $0x0, (%r12)
jle 0x55984
movq %rax, %r15
movq 0x10(%r14), %rax
movq (%rax), %rdi
leaq -0x68(%rbp), %r14
movq %r14, %rsi
callq 0x4e79d
leaq -0x40(%rbp), %r12
andq $0x0, 0x8(%r12)
movq %r13, (%r12)
movl -0x2c(%rbp), %ecx
movq 0x8(%r14), %r9
leaq 0xc44(%rip), %rdi       # 0x5665a
movq %rbx, %rsi
movq %r15, %rdx
movl %eax, %r8d
pushq $0x1
pushq %r12
callq 0x4db70
popq %rax
popq %rcx
movq 0x8(%r12), %rsi
movq %rbx, %rdi
callq 0x29897
movq %r14, %rdi
callq 0x31feb
jmp 0x5598e
leaq 0x11c61(%rip), %rdx     # 0x676ac
jmp 0x55979
leaq 0x11cc7(%rip), %r8      # 0x6771e
jmp 0x55a5c
movq (%rax), %r8
movq (%rbx), %rax
movq 0x8(%rax), %rcx
leaq 0x11cc0(%rip), %rdx     # 0x6772a
pushq $0x2
popq %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3be68
jmp 0x55984