// File: /workspace/github_c_makefile_star2_O1/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 0x65a4f
movq %rdx, %r14
movq (%rdx), %rax
testb $0x1, 0x9(%rax)
je 0x65a4f
movq 0x8(%r14), %rdi
testb $0x1, 0x8(%rdi)
je 0x65a4f
movq 0x10(%r14), %rcx
testb $0x40, 0x8(%rcx)
jne 0x65a9d
movq (%rbx), %rsi
movq 0x60(%rbx), %rdi
addq $0x8, %rsi
leaq 0x13eae(%rip), %rcx     # 0x7990f
movl $0x2, %edx
callq 0x4153c
movq 0x8(%rbx), %rbx
movq %rbx, %rdi
callq 0x309f2
movq $0x0, (%rbx)
movl $0xfffffe90, %eax       # imm = 0xFFFFFE90
andl 0x8(%rbx), %eax
orl $0x2, %eax
movl %eax, 0x8(%rbx)
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 0x65b82
cmpl $0xfeac14, 0x34(%r13)   # imm = 0xFEAC14
jne 0x65b82
movq (%r13), %rax
testq %rax, %rax
je 0x65b99
cmpq $0x0, 0x40(%rax)
je 0x65b99
leaq -0x2c(%rbp), %r15
movq %r15, %rsi
callq 0x30b04
cmpl $0x0, (%r15)
jle 0x65a6b
movq %rax, %r12
movq 0x10(%r14), %rax
movq (%rax), %rdi
leaq -0x58(%rbp), %rsi
movq %rsi, %r14
callq 0x5ca8b
leaq -0x68(%rbp), %r15
movq $0x0, 0x8(%r15)
movq %r13, (%r15)
movl -0x2c(%rbp), %ecx
movq %r14, %r13
movq 0x8(%r14), %r14
leaq 0xe48(%rip), %rdi       # 0x6695f
movq %rbx, %rsi
movq %r12, %rdx
movl %eax, %r8d
movq %r14, %r9
pushq $0x1
pushq %r15
callq 0x5bbf2
addq $0x10, %rsp
movq 0x8(%r15), %r15
movq 0x8(%rbx), %rbx
movq %rbx, %rdi
callq 0x309f2
movq %r15, (%rbx)
movl $0xfffffe90, %eax       # imm = 0xFFFFFE90
andl 0x8(%rbx), %eax
orl $0x2, %eax
movl %eax, 0x8(%rbx)
movq (%r13), %rdi
testq %rdi, %rdi
sete %al
testq %r14, %r14
sete %cl
orb %al, %cl
jne 0x65b6d
movq %r14, %rsi
callq 0x3503f
movq $0x0, -0x50(%rbp)
xorl %eax, %eax
movl %eax, -0x48(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x65a8c
movq (%rbx), %rsi
movq 0x60(%rbx), %rdi
addq $0x8, %rsi
leaq 0x13b2d(%rip), %rcx     # 0x796c1
jmp 0x65a61
movq (%rbx), %rcx
movq 0x8(%rcx), %rcx
testq %rax, %rax
je 0x65baa
movq (%rax), %r8
jmp 0x65bb1
leaq 0x13b82(%rip), %r8      # 0x79733
leaq 0x13b87(%rip), %rdx     # 0x7973f
movq %rbx, %rdi
movl $0x2, %esi
xorl %eax, %eax
callq 0x45d26
jmp 0x65a6b