// File: /workspace/github_c_makefile_star2_O1/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: jx9Builtin_fgetss
static int jx9Builtin_fgetss(jx9_context *pCtx, int nArg, jx9_value **apArg)
{
	const jx9_io_stream *pStream;
	const char *zLine;
	io_private *pDev;
	jx9_int64 n, nLen;
	if( nArg < 1 || !jx9_value_is_resource(apArg[0]) ){
		/* Missing/Invalid arguments, return FALSE */
		jx9_context_throw_error(pCtx, JX9_CTX_WARNING, "Expecting an IO handle");
		jx9_result_bool(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_bool(pCtx, 0);
		return JX9_OK;
	}
	/* Point to the target IO stream device */
	pStream = pDev->pStream;
	if( pStream == 0  ){
		jx9_context_throw_error_format(pCtx, JX9_CTX_WARNING, 
			"IO routine(%s) not implemented in the underlying stream(%s) device, JX9 is returning FALSE", 
			jx9_function_name(pCtx), pStream ? pStream->zName : "null_stream"
			);
		jx9_result_bool(pCtx, 0);
		return JX9_OK;
	}
	nLen = -1;
	if( nArg > 1 ){
		/* Maximum data to read */
		nLen = jx9_value_to_int64(apArg[1]);
	}
	/* Perform the requested operation */
	n = StreamReadLine(pDev, &zLine, nLen);
	if( n < 1 ){
		/* EOF or IO error, return FALSE */
		jx9_result_bool(pCtx, 0);
	}else{
		const char *zTaglist = 0;
		int nTaglen = 0;
		if( nArg > 2 && jx9_value_is_string(apArg[2]) ){
			/* Allowed tag */
			zTaglist = jx9_value_to_string(apArg[2], &nTaglen);
		}
		/* Process data just read */
		jx9StripTagsFromString(pCtx, zLine, (int)n, zTaglist, nTaglen);
	}
	return JX9_OK;	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
testl %esi, %esi
jle 0x63b96
movq %rdx, %r14
movq (%rdx), %rax
testb $0x1, 0x9(%rax)
je 0x63b96
movq (%rax), %r12
testq %r12, %r12
je 0x63b96
cmpl $0xfeac14, 0x34(%r12)   # imm = 0xFEAC14
jne 0x63b96
cmpq $0x0, (%r12)
je 0x63be4
movl %esi, %r15d
movq $-0x1, %rdx
cmpl $0x1, %esi
je 0x63b64
movq 0x8(%r14), %r13
movq %r13, %rdi
callq 0x3fd5f
movq (%r13), %rdx
leaq -0x38(%rbp), %rsi
movq %r12, %rdi
callq 0x66644
testq %rax, %rax
jle 0x63bb2
movq %rax, %r12
movl $0x0, -0x2c(%rbp)
cmpl $0x3, %r15d
jl 0x63b8f
movq 0x10(%r14), %rdi
testb $0x1, 0x8(%rdi)
jne 0x63c0a
xorl %ecx, %ecx
jmp 0x63c16
movq (%rbx), %rsi
movq 0x60(%rbx), %rdi
addq $0x8, %rsi
leaq 0x15b19(%rip), %rcx     # 0x796c1
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 $0x8, %eax
movl %eax, 0x8(%rbx)
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rax
movq 0x8(%rax), %rcx
leaq 0x15ae6(%rip), %rdx     # 0x796d8
leaq 0x15b3a(%rip), %r8      # 0x79733
movq %rbx, %rdi
movl $0x2, %esi
xorl %eax, %eax
callq 0x45d26
jmp 0x63bb2
leaq -0x2c(%rbp), %rsi
callq 0x30b04
movq %rax, %rcx
movq -0x38(%rbp), %rsi
movl -0x2c(%rbp), %r8d
movq %rbx, %rdi
movl %r12d, %edx
callq 0x5ccd8
jmp 0x63bd3