// File: /workspace/github_c_makefile_star2_O3/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 0x620ff
movq %rdx, %r14
movq (%rdx), %rax
testb $0x1, 0x9(%rax)
je 0x620ff
movq (%rax), %r12
testq %r12, %r12
je 0x620ff
cmpl $0xfeac14, 0x34(%r12)   # imm = 0xFEAC14
jne 0x620ff
cmpq $0x0, (%r12)
je 0x6214d
movl %esi, %r15d
movq $-0x1, %rdx
cmpl $0x1, %esi
je 0x620ca
movq 0x8(%r14), %r13
movq %r13, %rdi
callq 0x3f362
movq (%r13), %rdx
leaq -0x38(%rbp), %rsi
movq %r12, %rdi
callq 0x64ad2
testq %rax, %rax
jle 0x6211b
movq %rax, %r12
movl $0x0, -0x2c(%rbp)
cmpl $0x3, %r15d
jb 0x620f5
movq 0x10(%r14), %rdi
testb $0x1, 0x8(%rdi)
jne 0x62173
xorl %r8d, %r8d
xorl %ecx, %ecx
jmp 0x62185
movq (%rbx), %rsi
movq 0x60(%rbx), %rdi
addq $0x8, %rsi
leaq 0x155bb(%rip), %rcx     # 0x776cc
movl $0x2, %edx
callq 0x40afa
movq 0x8(%rbx), %rbx
movq %rbx, %rdi
callq 0x30465
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 0x15588(%rip), %rdx     # 0x776e3
leaq 0x155dc(%rip), %r8      # 0x7773e
movq %rbx, %rdi
movl $0x2, %esi
xorl %eax, %eax
callq 0x44ed3
jmp 0x6211b
leaq -0x2c(%rbp), %r14
movq %r14, %rsi
callq 0x30577
movq %rax, %rcx
movl (%r14), %r8d
movq -0x38(%rbp), %rsi
movq %rbx, %rdi
movl %r12d, %edx
callq 0x5b3d9
jmp 0x6213c