// File: /workspace/github_c_makefile_star2_O3/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 $0x78, %rsp
movq %rcx, %r15
movl %edx, %ebx
movq %rsi, %r12
movq %rdi, %r13
movq 0x60(%rdi), %rax
movabsq $0x1000000000, %rcx     # imm = 0x1000000000
movq %rcx, -0x74(%rbp)
xorl %ecx, %ecx
movl %ecx, -0x78(%rbp)
movl %ecx, -0x6c(%rbp)
movq %rax, -0x88(%rbp)
movq %rcx, -0x80(%rbp)
movq %rcx, -0x68(%rbp)
testl %r8d, %r8d
jle 0x5b5a9
movl %ebx, -0x38(%rbp)
movl %r8d, %ebx
addq %r15, %rbx
movabsq $-0x6fff5ffe00000000, %rcx # imm = 0x9000A00200000000
movq %r12, -0x48(%rbp)
movzbl (%r15), %eax
cmpq $0x3f, %rax
ja 0x5b45b
btq %rax, %rcx
jae 0x5b45b
incq %r15
cmpq %rbx, %r15
jb 0x5b43e
jmp 0x5b5a6
cmpb $-0x41, %al
ja 0x5b47d
movsbq %al, %r14
callq 0xc170
movabsq $-0x6fff5ffe00000000, %rcx # imm = 0x9000A00200000000
movq (%rax), %rax
testb $0x20, 0x1(%rax,%r14,2)
jne 0x5b44e
cmpq %rbx, %r15
jae 0x5b526
movq %r15, %r12
movsbq (%r12), %r14
cmpq $-0x40, %r14
jb 0x5b4b4
incq %r12
movq %r12, %rax
movq %rax, %r12
cmpq %rbx, %rax
jae 0x5b4c6
movb (%r12), %cl
andb $-0x40, %cl
leaq 0x1(%r12), %rax
negb %cl
jo 0x5b49a
jmp 0x5b4c6
callq 0xc170
movq (%rax), %rax
testb $0x8, (%rax,%r14,2)
je 0x5b4cb
incq %r12
cmpq %rbx, %r12
jb 0x5b489
cmpq %r15, %r12
jbe 0x5b589
movq %r15, -0x60(%rbp)
movl %r12d, %eax
subl %r15d, %eax
movl %eax, -0x58(%rbp)
je 0x5b51e
movq %r13, -0x30(%rbp)
movl %eax, %ecx
xorl %r13d, %r13d
movq %rcx, -0x40(%rbp)
movsbq (%r15,%r13), %r14
cmpq $-0x41, %r14
ja 0x5b52b
callq 0xc170
movq -0x40(%rbp), %rcx
movq (%rax), %rax
testb $0x20, 0x1(%rax,%r14,2)
je 0x5b52b
incq %r13
cmpl %r13d, %ecx
jne 0x5b4f0
addq %r13, %r15
movq -0x30(%rbp), %r13
movq %r15, -0x60(%rbp)
xorl %ecx, %ecx
jmp 0x5b576
movq %r15, %r12
jmp 0x5b593
addq %r13, %r15
movq %r15, -0x60(%rbp)
subq %r13, %rcx
movl %ecx, -0x58(%rbp)
leaq -0x1(%rcx), %r13
movl %r13d, %eax
movsbq (%r15,%rax), %r14
cmpq $-0x41, %r14
ja 0x5b568
movq %rcx, -0x40(%rbp)
callq 0xc170
movq (%rax), %rax
testb $0x20, 0x1(%rax,%r14,2)
je 0x5b56e
movq %r13, %rcx
testl %r13d, %r13d
jne 0x5b538
xorl %ecx, %ecx
movq -0x30(%rbp), %r13
jmp 0x5b576
movq -0x30(%rbp), %r13
movq -0x40(%rbp), %rcx
movl %ecx, -0x58(%rbp)
leaq -0x88(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x33094
movabsq $-0x6fff5ffe00000000, %rcx # imm = 0x9000A00200000000
incq %r12
movq %r12, %r15
cmpq %rbx, %r12
movq -0x48(%rbp), %r12
jb 0x5b43e
movl -0x38(%rbp), %ebx
movq 0x8(%r13), %rdi
leaq 0x1c0be(%rip), %rsi     # 0x77672
xorl %edx, %edx
callq 0x302f6
testl %ebx, %ebx
jle 0x5b7e2
movslq %ebx, %rbx
addq %r12, %rbx
movq -0x80(%rbp), %rax
movl -0x78(%rbp), %r14d
addq $0x8, %rax
movq %rax, -0x98(%rbp)
movq %r12, %r15
movzbl (%r15), %eax
testl %eax, %eax
je 0x5b5f4
cmpl $0x3c, %eax
je 0x5b5f4
incq %r15
cmpq %rbx, %r15
jb 0x5b5df
cmpq %r12, %r15
jbe 0x5b60b
movl %r15d, %edx
subl %r12d, %edx
movq 0x8(%r13), %rdi
movq %r12, %rsi
callq 0x302f6
cmpq %rbx, %r15
jae 0x5b7e2
movl %r15d, %eax
negl %eax
leaq 0x1(%r15), %rdx
movq %r15, %rcx
movzbl (%r15), %esi
testl %esi, %esi
jne 0x5b63d
incq %r15
decl %eax
incq %rcx
incq %rdx
cmpq %rbx, %r15
jb 0x5b620
jmp 0x5b7e2
cmpl $0x3c, %esi
jne 0x5b763
movq %rdx, %rsi
cmpq %rbx, %rdx
jae 0x5b657
leaq 0x1(%rsi), %rdx
cmpb $0x3e, (%rsi)
jne 0x5b646
leaq 0x1(%rsi), %r12
cmpq %rbx, %rsi
cmovaeq %rsi, %r12
testq %r14, %r14
je 0x5b7be
movq %r14, -0x38(%rbp)
movq %rbx, -0x50(%rbp)
movq %r12, %rdx
subq %rcx, %rdx
movq %r12, -0x48(%rbp)
addl %r12d, %eax
movslq %eax, %r12
addq %r15, %r12
movq %r15, %r14
movq %rdx, -0x90(%rbp)
testl %edx, %edx
movabsq $-0x6fff800000000000, %rcx # imm = 0x9000800000000000
jle 0x5b6da
movq %r15, %r14
movzbl (%r14), %eax
cmpq $0x3f, %rax
ja 0x5b6b1
btq %rax, %rcx
jb 0x5b6d2
cmpb $-0x41, %al
ja 0x5b6da
movsbq %al, %rbx
callq 0xc170
movabsq $-0x6fff800000000000, %rcx # imm = 0x9000800000000000
movq (%rax), %rax
testb $0x20, 0x1(%rax,%rbx,2)
je 0x5b6da
incq %r14
cmpq %r12, %r14
jb 0x5b6a1
movq %r13, -0x30(%rbp)
movq %r14, %r13
cmpq %r12, %r14
jae 0x5b729
movq %r14, %r13
movsbq (%r13), %rbx
cmpq $-0x40, %rbx
jb 0x5b713
incq %r13
movq %r13, %rax
movq %rax, %r13
cmpq %r12, %rax
jae 0x5b724
movb (%r13), %cl
andb $-0x40, %cl
leaq 0x1(%r13), %rax
negb %cl
jo 0x5b6fa
jmp 0x5b724
callq 0xc170
movq (%rax), %rax
testb $0x8, (%rax,%rbx,2)
je 0x5b729
incq %r13
cmpq %r12, %r13
jb 0x5b6e9
movl %r13d, %eax
subl %r14d, %eax
je 0x5b7ae
movl %eax, %eax
movq %rax, -0x40(%rbp)
xorl %r12d, %r12d
movsbq (%r14,%r12), %rbx
cmpq $-0x40, %rbx
jae 0x5b768
testb %bl, %bl
je 0x5b758
callq 0xc170
movq (%rax), %rax
testb $0x20, 0x1(%rax,%rbx,2)
je 0x5b768
incq %r12
cmpl %r12d, -0x40(%rbp)
jne 0x5b73a
jmp 0x5b7ae
movq %r15, %r12
jmp 0x5b7be
subq %r12, -0x40(%rbp)
movl %r14d, %ebx
subl %r13d, %ebx
addq %r12, %rbx
addq %r12, %r14
movq -0x98(%rbp), %r13
movq -0x38(%rbp), %r12
movl (%r13), %eax
movl %ebx, %ecx
addl %eax, %ecx
je 0x5b791
addl %ebx, %eax
jmp 0x5b7a1
movq -0x8(%r13), %rdi
movq %r14, %rsi
movq -0x40(%rbp), %rdx
callq 0x39f3f
testl %eax, %eax
je 0x5b7c9
addq $0x10, %r13
decq %r12
jne 0x5b783
movq -0x30(%rbp), %r13
movq -0x48(%rbp), %r12
movq -0x50(%rbp), %rbx
movq -0x38(%rbp), %r14
cmpq %rbx, %r12
jb 0x5b5dc
jmp 0x5b7e2
movq -0x30(%rbp), %r13
movq 0x8(%r13), %rdi
movq %r15, %rsi
movq -0x90(%rbp), %rdx
callq 0x302f6
jmp 0x5b7b2
movq -0x88(%rbp), %rdi
testq %rdi, %rdi
je 0x5b80a
movq -0x80(%rbp), %rsi
testq %rsi, %rsi
je 0x5b80a
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3490d
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq