// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: jx9Builtin_htmlspecialchars_decode
static int jx9Builtin_htmlspecialchars_decode(jx9_context *pCtx, int nArg, jx9_value **apArg)
{
	const char *zCur, *zIn, *zEnd;
	int iFlags = 0x01; /* ENT_COMPAT */
	int nLen, nJump;
	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;
		}
	}
	/* Perform the requested operation */
	for(;;){
		if( zIn >= zEnd ){
			break;
		}
		zCur = zIn;
		while( zIn < zEnd && zIn[0] != '&' ){
			zIn++;
		}
		if( zCur < zIn ){
			/* Append the raw string verbatim */
			jx9_result_string(pCtx, zCur, (int)(zIn-zCur));
		}
		nLen = (int)(zEnd-zIn);
		nJump = (int)sizeof(char);
		if( nLen >= (int)sizeof("&amp;")-1 && SyStrnicmp(zIn, "&amp;", sizeof("&amp;")-1) == 0 ){
			/* &amp; ==> '&' */
			jx9_result_string(pCtx, "&", (int)sizeof(char));
			nJump = (int)sizeof("&amp;")-1;
		}else if( nLen >= (int)sizeof("&lt;")-1 && SyStrnicmp(zIn, "&lt;", sizeof("&lt;")-1) == 0 ){
			/* &lt; ==> < */
			jx9_result_string(pCtx, "<", (int)sizeof(char));
			nJump = (int)sizeof("&lt;")-1; 
		}else if( nLen >= (int)sizeof("&gt;")-1 && SyStrnicmp(zIn, "&gt;", sizeof("&gt;")-1) == 0 ){
			/* &gt; ==> '>' */
			jx9_result_string(pCtx, ">", (int)sizeof(char));
			nJump = (int)sizeof("&gt;")-1; 
		}else if( nLen >= (int)sizeof("&quot;")-1 && SyStrnicmp(zIn, "&quot;", sizeof("&quot;")-1) == 0 ){
			/* &quot; ==> '"' */
			if( (iFlags & 0x04) == 0 /*ENT_NOQUOTES*/ ){
				jx9_result_string(pCtx, "\"", (int)sizeof(char));
			}else{
				/* Leave untouched */
				jx9_result_string(pCtx, "&quot;", (int)sizeof("&quot;")-1);
			}
			nJump = (int)sizeof("&quot;")-1;
		}else if( nLen >= (int)sizeof("&#039;")-1 && SyStrnicmp(zIn, "&#039;", sizeof("&#039;")-1) == 0 ){
			/* &#039; ==> ''' */
			if( iFlags & 0x02 /*ENT_QUOTES*/ ){
				/* Expand ''' */
				jx9_result_string(pCtx, "'", (int)sizeof(char));
			}else{
				/* Leave untouched */
				jx9_result_string(pCtx, "&#039;", (int)sizeof("&#039;")-1);
			}
			nJump = (int)sizeof("&#039;")-1;
		}else if( nLen >= (int)sizeof(char) ){
			/* expand '&' */
			jx9_result_string(pCtx, "&", (int)sizeof(char));
		}else{
			/* No more input to process */
			break;
		}
		zIn += nJump;
	}
	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 $0x1, -0x3c(%rbp)
cmpl $0x1, -0x14(%rbp)
jl 0x92461
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x57480
cmpl $0x0, %eax
jne 0x92476
movq -0x10(%rbp), %rdi
callq 0x57120
movl $0x0, -0x4(%rbp)
jmp 0x92712
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 0x924be
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x56c90
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jge 0x924bc
movl $0x1, -0x3c(%rbp)
jmp 0x924be
jmp 0x924c0
movq -0x30(%rbp), %rax
cmpq -0x38(%rbp), %rax
jb 0x924cf
jmp 0x9270b
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rcx
xorl %eax, %eax
cmpq -0x38(%rbp), %rcx
movb %al, -0x45(%rbp)
jae 0x924f6
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x26, %eax
setne %al
movb %al, -0x45(%rbp)
movb -0x45(%rbp), %al
testb $0x1, %al
jne 0x924ff
jmp 0x9250d
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x924d7
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x92531
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 -0x38(%rbp), %rax
movq -0x30(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x40(%rbp)
movl $0x1, -0x44(%rbp)
cmpl $0x5, -0x40(%rbp)
jl 0x92587
movq -0x30(%rbp), %rdi
leaq 0x32e7a(%rip), %rsi     # 0xc53d1
movl $0x5, %edx
callq 0x67830
cmpl $0x0, %eax
jne 0x92587
movq -0x10(%rbp), %rdi
leaq 0x31641(%rip), %rsi     # 0xc3bb2
movl $0x1, %edx
callq 0x57180
movl $0x5, -0x44(%rbp)
jmp 0x926f5
cmpl $0x4, -0x40(%rbp)
jl 0x925c8
movq -0x30(%rbp), %rdi
leaq 0x2ceb9(%rip), %rsi     # 0xbf451
movl $0x4, %edx
callq 0x67830
cmpl $0x0, %eax
jne 0x925c8
movq -0x10(%rbp), %rdi
leaq 0x315ea(%rip), %rsi     # 0xc3b9c
movl $0x1, %edx
callq 0x57180
movl $0x4, -0x44(%rbp)
jmp 0x926f3
cmpl $0x4, -0x40(%rbp)
jl 0x92609
movq -0x30(%rbp), %rdi
leaq 0x2ce7d(%rip), %rsi     # 0xbf456
movl $0x4, %edx
callq 0x67830
cmpl $0x0, %eax
jne 0x92609
movq -0x10(%rbp), %rdi
leaq 0x2cddf(%rip), %rsi     # 0xbf3d2
movl $0x1, %edx
callq 0x57180
movl $0x4, -0x44(%rbp)
jmp 0x926f1
cmpl $0x6, -0x40(%rbp)
jl 0x9266c
movq -0x30(%rbp), %rdi
leaq 0x32dc4(%rip), %rsi     # 0xc53de
movl $0x6, %edx
callq 0x67830
cmpl $0x0, %eax
jne 0x9266c
movl -0x3c(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0x9264b
movq -0x10(%rbp), %rdi
leaq 0x2d5f5(%rip), %rsi     # 0xbfc34
movl $0x1, %edx
callq 0x57180
jmp 0x92660
movq -0x10(%rbp), %rdi
leaq 0x32d88(%rip), %rsi     # 0xc53de
movl $0x6, %edx
callq 0x57180
movl $0x6, -0x44(%rbp)
jmp 0x926ef
cmpl $0x6, -0x40(%rbp)
jl 0x926cc
movq -0x30(%rbp), %rdi
leaq 0x32d5a(%rip), %rsi     # 0xc53d7
movl $0x6, %edx
callq 0x67830
cmpl $0x0, %eax
jne 0x926cc
movl -0x3c(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x926ae
movq -0x10(%rbp), %rdi
leaq 0x32185(%rip), %rsi     # 0xc4827
movl $0x1, %edx
callq 0x57180
jmp 0x926c3
movq -0x10(%rbp), %rdi
leaq 0x32d1e(%rip), %rsi     # 0xc53d7
movl $0x6, %edx
callq 0x57180
movl $0x6, -0x44(%rbp)
jmp 0x926ed
cmpl $0x1, -0x40(%rbp)
jl 0x926e9
movq -0x10(%rbp), %rdi
leaq 0x314d5(%rip), %rsi     # 0xc3bb2
movl $0x1, %edx
callq 0x57180
jmp 0x926eb
jmp 0x9270b
jmp 0x926ed
jmp 0x926ef
jmp 0x926f1
jmp 0x926f3
jmp 0x926f5
movl -0x44(%rbp), %ecx
movq -0x30(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
jmp 0x924c0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)