// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: jx9Builtin_htmlspecialchars
static int jx9Builtin_htmlspecialchars(jx9_context *pCtx, int nArg, jx9_value **apArg)
{
	const char *zCur, *zIn, *zEnd;
	int iFlags = 0x01|0x40; /* ENT_COMPAT | ENT_HTML401 */
	int nLen, c;
	if( nArg < 1 || !jx9_value_is_string(apArg[0]) ){
		/* Missing/Invalid arguments, return NULL */
		jx9_result_null(pCtx);
		return JX9_OK;
	}
	/* Extract the target string */
	zIn = jx9_value_to_string(apArg[0], &nLen);
	zEnd = &zIn[nLen];
	/* Extract the flags if available */
	if( nArg > 1 ){
		iFlags = jx9_value_to_int(apArg[1]);
		if( iFlags < 0 ){
			iFlags = 0x01|0x40;
		}
	}
	/* Perform the requested operation */
	for(;;){
		if( zIn >= zEnd ){
			break;
		}
		zCur = zIn;
		while( zIn < zEnd && zIn[0] != '&' && zIn[0] != '\'' && zIn[0] != '"' && zIn[0] != '<' && zIn[0] != '>' ){
			zIn++;
		}
		if( zCur < zIn ){
			/* Append the raw string verbatim */
			jx9_result_string(pCtx, zCur, (int)(zIn-zCur));
		}
		if( zIn >= zEnd ){
			break;
		}
		c = zIn[0];
		if( c == '&' ){
			/* Expand '&amp;' */
			jx9_result_string(pCtx, "&amp;", (int)sizeof("&amp;")-1);
		}else if( c == '<' ){
			/* Expand '&lt;' */
			jx9_result_string(pCtx, "&lt;", (int)sizeof("&lt;")-1);
		}else if( c == '>' ){
			/* Expand '&gt;' */
			jx9_result_string(pCtx, "&gt;", (int)sizeof("&gt;")-1);
		}else if( c == '\'' ){
			if( iFlags & 0x02 /*ENT_QUOTES*/ ){
				/* Expand '&#039;' */
				jx9_result_string(pCtx, "&#039;", (int)sizeof("&#039;")-1);
			}else{
				/* Leave the single quote untouched */
				jx9_result_string(pCtx, "'", (int)sizeof(char));
			}
		}else if( c == '"' ){
			if( (iFlags & 0x04) == 0 /*ENT_NOQUOTES*/ ){
				/* Expand '&quot;' */
				jx9_result_string(pCtx, "&quot;", (int)sizeof("&quot;")-1);
			}else{
				/* Leave the double quote untouched */
				jx9_result_string(pCtx, "\"", (int)sizeof(char));
			}
		}
		/* Ignore the unsafe HTML character */
		zIn++;
	}
	return JX9_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x41, -0x3c(%rbp)
cmpl $0x1, -0x14(%rbp)
jl 0x921f1
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x57480
cmpl $0x0, %eax
jne 0x92206
movq -0x10(%rbp), %rdi
callq 0x57120
movl $0x0, -0x4(%rbp)
jmp 0x9241c
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq -0x40(%rbp), %rsi
callq 0x56e20
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movslq -0x40(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
cmpl $0x1, -0x14(%rbp)
jle 0x9224e
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x56c90
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jge 0x9224c
movl $0x41, -0x3c(%rbp)
jmp 0x9224e
jmp 0x92250
movq -0x30(%rbp), %rax
cmpq -0x38(%rbp), %rax
jb 0x9225f
jmp 0x92415
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rcx
xorl %eax, %eax
cmpq -0x38(%rbp), %rcx
movb %al, -0x45(%rbp)
jae 0x922ca
movq -0x30(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x26, %ecx
movb %al, -0x45(%rbp)
je 0x922ca
movq -0x30(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x27, %ecx
movb %al, -0x45(%rbp)
je 0x922ca
movq -0x30(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x22, %ecx
movb %al, -0x45(%rbp)
je 0x922ca
movq -0x30(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x3c, %ecx
movb %al, -0x45(%rbp)
je 0x922ca
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3e, %eax
setne %al
movb %al, -0x45(%rbp)
movb -0x45(%rbp), %al
testb $0x1, %al
jne 0x922d3
jmp 0x922e1
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x92267
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x92305
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
movl %eax, %edx
callq 0x57180
movq -0x30(%rbp), %rax
cmpq -0x38(%rbp), %rax
jb 0x92314
jmp 0x92415
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x44(%rbp)
cmpl $0x26, -0x44(%rbp)
jne 0x9233e
movq -0x10(%rbp), %rdi
leaq 0x330a2(%rip), %rsi     # 0xc53d1
movl $0x5, %edx
callq 0x57180
jmp 0x92404
cmpl $0x3c, -0x44(%rbp)
jne 0x9235e
movq -0x10(%rbp), %rdi
leaq 0x2d102(%rip), %rsi     # 0xbf451
movl $0x4, %edx
callq 0x57180
jmp 0x92402
cmpl $0x3e, -0x44(%rbp)
jne 0x9237e
movq -0x10(%rbp), %rdi
leaq 0x2d0e7(%rip), %rsi     # 0xbf456
movl $0x4, %edx
callq 0x57180
jmp 0x92400
cmpl $0x27, -0x44(%rbp)
jne 0x923bd
movl -0x3c(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x923a6
movq -0x10(%rbp), %rdi
leaq 0x3303d(%rip), %rsi     # 0xc53d7
movl $0x6, %edx
callq 0x57180
jmp 0x923bb
movq -0x10(%rbp), %rdi
leaq 0x32476(%rip), %rsi     # 0xc4827
movl $0x1, %edx
callq 0x57180
jmp 0x923fe
cmpl $0x22, -0x44(%rbp)
jne 0x923fc
movl -0x3c(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0x923e5
movq -0x10(%rbp), %rdi
leaq 0x33005(%rip), %rsi     # 0xc53de
movl $0x6, %edx
callq 0x57180
jmp 0x923fa
movq -0x10(%rbp), %rdi
leaq 0x2d844(%rip), %rsi     # 0xbfc34
movl $0x1, %edx
callq 0x57180
jmp 0x923fc
jmp 0x923fe
jmp 0x92400
jmp 0x92402
jmp 0x92404
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x92250
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)