// File: /workspace/github_c_makefile_star2_O1/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: jx9StripTagsFromString
JX9_PRIVATE sxi32 jx9StripTagsFromString(jx9_context *pCtx, const char *zIn, int nByte, const char *zTaglist, int nTaglen)
{
	const char *zEnd = &zIn[nByte];
	const char *zPtr, *zTag;
	SySet sSet;
	/* initialize the set of allowed tags */
	SySetInit(&sSet, &pCtx->pVm->sAllocator, sizeof(SyString));
	if( nTaglen > 0 ){
		/* Set of allowed tags */
		AddTag(&sSet, zTaglist, nTaglen);
	}
	/* Set the empty string */
	jx9_result_string(pCtx, "", 0);
	/* Start processing */
	for(;;){
		if(zIn >= zEnd){
			/* No more input to process */
			break;
		}
		zPtr = zIn;
		/* Find a tag */
		while( zIn < zEnd && zIn[0] != '<' && zIn[0] != 0 /* NUL byte */ ){
			zIn++;
		}
		if( zIn > zPtr ){
			/* Consume raw input */
			jx9_result_string(pCtx, zPtr, (int)(zIn-zPtr));
		}
		/* Ignore trailing null bytes */
		while( zIn < zEnd && zIn[0] == 0 ){
			zIn++;
		}
		if(zIn >= zEnd){
			/* No more input to process */
			break;
		}
		if( zIn[0] == '<' ){
			sxi32 rc;
			zTag = zIn++;
			/* Delimit the tag */
			while( zIn < zEnd && zIn[0] != '>' ){
				zIn++;
			}
			if( zIn < zEnd ){
				zIn++; /* Ignore the trailing closing tag */
			}
			/* Query the set */
			rc = FindTag(&sSet, zTag, (int)(zIn-zTag));
			if( rc == SXRET_OK ){
				/* Keep the tag */
				jx9_result_string(pCtx, zTag, (int)(zIn-zTag));
			}
		}
	}
	/* Cleanup */
	SySetRelease(&sSet);
	return SXRET_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %edx, %r14d
movq %rsi, %rbx
movq %rdi, -0x50(%rbp)
movq 0x60(%rdi), %rax
movabsq $0x1000000000, %rdx     # imm = 0x1000000000
movq %rdx, -0x74(%rbp)
xorl %edx, %edx
movl %edx, -0x78(%rbp)
movl %edx, -0x6c(%rbp)
movq %rax, -0x88(%rbp)
movq %rdx, -0x80(%rbp)
movq %rdx, -0x68(%rbp)
testl %r8d, %r8d
jle 0x5ceab
movl %r14d, -0x38(%rbp)
movq %rbx, -0x30(%rbp)
movl %r8d, %ebx
addq %rcx, %rbx
movb $0x1, %r14b
movabsq $-0x6fff5ffe00000000, %r12 # imm = 0x9000A00200000000
movzbl (%rcx), %eax
cmpq $0x3f, %rax
ja 0x5cd60
btq %rax, %r12
jae 0x5cd60
incq %rcx
cmpq %rbx, %rcx
setb %r14b
jb 0x5cd40
jmp 0x5cea3
cmpb $-0x41, %al
ja 0x5cd7e
movsbq %al, %r15
movq %rcx, %r13
callq 0xc170
movq %r13, %rcx
movq (%rax), %rax
testb $0x20, 0x1(%rax,%r15,2)
jne 0x5cd4f
testb $0x1, %r14b
je 0x5cea3
movq %rcx, %r14
movq %rcx, %r13
cmpq %rbx, %rcx
jae 0x5cdd5
movq %r13, %r14
movsbq (%r14), %r15
cmpq $-0x40, %r15
jb 0x5cdbe
incq %r14
movq %r14, %rax
movq %rax, %r14
cmpq %rbx, %rax
jae 0x5cdd0
movb (%r14), %cl
andb $-0x40, %cl
leaq 0x1(%r14), %rax
negb %cl
jo 0x5cda6
jmp 0x5cdd0
callq 0xc170
movq (%rax), %rax
testb $0x8, (%rax,%r15,2)
je 0x5cdd5
incq %r14
cmpq %rbx, %r14
jb 0x5cd96
cmpq %r13, %r14
jbe 0x5ce95
movq %r13, %rax
movq %r13, -0x60(%rbp)
movl %r14d, %r15d
subl %eax, %r15d
movl %r15d, -0x58(%rbp)
je 0x5ce35
movsbq (%rax), %r12
cmpq $-0x41, %r12
ja 0x5ce1c
movq %rax, %r13
callq 0xc170
movq (%rax), %rax
testb $0x20, 0x1(%rax,%r12,2)
je 0x5ce28
movq %r13, %rax
incq %rax
decl %r15d
jne 0x5cdf1
xorl %r15d, %r15d
movabsq $-0x6fff5ffe00000000, %r12 # imm = 0x9000A00200000000
jmp 0x5ce35
movabsq $-0x6fff5ffe00000000, %r12 # imm = 0x9000A00200000000
movq %r13, %rax
movl %r15d, -0x58(%rbp)
movq %rax, -0x60(%rbp)
testl %r15d, %r15d
je 0x5ce81
movl %r15d, %r15d
movq %rax, -0x40(%rbp)
leal -0x1(%r15), %r13d
movsbq (%rax,%r13), %r12
cmpq $-0x41, %r12
ja 0x5ce77
callq 0xc170
movq (%rax), %rax
testb $0x20, 0x1(%rax,%r12,2)
je 0x5ce77
decq %r15
testq %r13, %r13
movq -0x40(%rbp), %rax
jne 0x5ce49
xorl %r15d, %r15d
movabsq $-0x6fff5ffe00000000, %r12 # imm = 0x9000A00200000000
movl %r15d, -0x58(%rbp)
leaq -0x88(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x336fc
incq %r14
movq %r14, %rcx
cmpq %rbx, %r14
jmp 0x5cd55
movq -0x30(%rbp), %rbx
movl -0x38(%rbp), %r14d
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x1c7ad(%rip), %rsi     # 0x79667
xorl %edx, %edx
callq 0x3087c
testl %r14d, %r14d
jle 0x5d102
movslq %r14d, %r14
addq %rbx, %r14
movq %rbx, %r15
movzbl (%r15), %eax
testl %eax, %eax
je 0x5cee8
cmpl $0x3c, %eax
je 0x5cee8
incq %r15
cmpq %r14, %r15
jb 0x5ced3
cmpq %rbx, %r15
jbe 0x5cf02
movl %r15d, %edx
subl %ebx, %edx
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rdi
movq %rbx, %rsi
callq 0x3087c
cmpq %r14, %r15
setb %al
jae 0x5d102
cmpb $0x0, (%r15)
jne 0x5cf36
incq %r15
cmpq %r14, %r15
setb %al
jae 0x5d102
leaq 0x1(%r15), %rcx
cmpb $0x0, (%r15)
movq %rcx, %r15
je 0x5cf17
decq %rcx
movq %rcx, %r15
testb %al, %al
je 0x5d102
cmpb $0x3c, (%r15)
jne 0x5d06d
leaq 0x1(%r15), %rcx
movq %rcx, %rax
cmpq %r14, %rcx
jae 0x5cf5d
leaq 0x1(%rax), %rcx
cmpb $0x3e, (%rax)
jne 0x5cf4c
leaq 0x1(%rax), %rbx
cmpq %r14, %rax
cmovaeq %rax, %rbx
movl -0x78(%rbp), %r13d
testl %r13d, %r13d
je 0x5d0f9
movq %r14, -0x48(%rbp)
movq %rbx, -0x30(%rbp)
subq %r15, %rbx
movq %rbx, -0x90(%rbp)
movslq %ebx, %rax
leaq (%r15,%rax), %rbx
movq %r15, %r14
testl %eax, %eax
movabsq $-0x6fff800000000000, %rcx # imm = 0x9000800000000000
jle 0x5cfdc
movq %r15, %r14
movzbl (%r14), %eax
cmpq $0x3f, %rax
ja 0x5cfb2
btq %rax, %rcx
jb 0x5cfd4
cmpb $-0x41, %al
ja 0x5cfdc
movsbq %al, %r12
callq 0xc170
movabsq $-0x6fff800000000000, %rcx # imm = 0x9000800000000000
movq (%rax), %rax
testb $0x20, 0x1(%rax,%r12,2)
je 0x5cfdc
incq %r14
cmpq %rbx, %r14
jb 0x5cfa2
movq %r13, -0x38(%rbp)
movq %r14, %r13
cmpq %rbx, %r14
jae 0x5d02c
movq %r14, %r13
movsbq (%r13), %r12
cmpq $-0x40, %r12
jb 0x5d015
incq %r13
movq %r13, %rax
movq %rax, %r13
cmpq %rbx, %rax
jae 0x5d027
movb (%r13), %cl
andb $-0x40, %cl
leaq 0x1(%r13), %rax
negb %cl
jo 0x5cffc
jmp 0x5d027
callq 0xc170
movq (%rax), %rax
testb $0x8, (%rax,%r12,2)
je 0x5d02c
incq %r13
cmpq %rbx, %r13
jb 0x5cfeb
movl %r13d, %eax
subl %r14d, %eax
je 0x5d0f1
movl %eax, %eax
movq %rax, -0x40(%rbp)
xorl %ebx, %ebx
movsbq (%r14,%rbx), %r12
cmpq $-0x41, %r12
ja 0x5d075
testb %r12b, %r12b
je 0x5d060
callq 0xc170
movq (%rax), %rax
testb $0x20, 0x1(%rax,%r12,2)
je 0x5d075
incq %rbx
cmpl %ebx, -0x40(%rbp)
jne 0x5d040
jmp 0x5d0f1
movq %r15, %rbx
jmp 0x5d0f9
movq -0x38(%rbp), %r12
cmpl $0x1, %r12d
adcl $0x0, %r12d
movq -0x80(%rbp), %rax
movq %rax, -0x38(%rbp)
subq %rbx, -0x40(%rbp)
movl %r14d, %edx
subl %r13d, %edx
addq %rbx, %rdx
addq %rbx, %r14
shlq $0x4, %r12
xorl %ebx, %ebx
movq -0x38(%rbp), %rax
movl 0x8(%rax,%rbx), %eax
movl %edx, %ecx
addl %eax, %ecx
je 0x5d0b1
addl %edx, %eax
jmp 0x5d0cb
movq -0x38(%rbp), %rax
movq (%rax,%rbx), %rdi
movq %r14, %rsi
movq %rdx, %r13
movq -0x40(%rbp), %rdx
callq 0x3a837
movq %r13, %rdx
testl %eax, %eax
je 0x5d0da
addq $0x10, %rbx
cmpq %rbx, %r12
jne 0x5d09f
jmp 0x5d0f1
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rdi
movq %r15, %rsi
movq -0x90(%rbp), %rdx
callq 0x3087c
movq -0x30(%rbp), %rbx
movq -0x48(%rbp), %r14
cmpq %r14, %rbx
jb 0x5ced0
movq -0x88(%rbp), %rdi
testq %rdi, %rdi
je 0x5d11c
movq -0x80(%rbp), %rsi
testq %rsi, %rsi
je 0x5d11c
callq 0x3503f
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq