// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: SyLexTokenizeInput
JX9_PRIVATE sxi32 SyLexTokenizeInput(SyLex *pLex, const char *zInput, sxu32 nLen, void *pCtxData, ProcSort xSort, ProcCmp xCmp)
{
	const unsigned char *zCur;
	SyStream *pStream;
	SyToken sToken;
	sxi32 rc;
#if defined (UNTRUST)
	if ( INVALID_LEXER(pLex) || zInput == 0 ){
		return SXERR_CORRUPT;
	}
#endif
	pStream = &pLex->sStream;
	/* Point to the head of the input */
	pStream->zText = pStream->zInput = (const unsigned char *)zInput;
	/* Point to the end of the input */
	pStream->zEnd = &pStream->zInput[nLen];
	for(;;){
		if( pStream->zText >= pStream->zEnd ){
			/* End of the input reached */
			break;
		}
		zCur = pStream->zText;
		/* Call the tokenizer callback */
		rc = pLex->xTokenizer(pStream, &sToken, pLex->pUserData, pCtxData);
		if( rc != SXRET_OK && rc != SXERR_CONTINUE ){
			/* Tokenizer callback request an operation abort */
			if( rc == SXERR_ABORT ){
				return SXERR_ABORT;
			}
			break;
		}
		if( rc == SXERR_CONTINUE ){
			/* Request to ignore this token */
			pStream->nIgn++;
		}else if( pLex->pTokenSet  ){
			/* Put the token in the set */
			rc = SySetPut(pLex->pTokenSet, (const void *)&sToken);
			if( rc != SXRET_OK ){
				break;
			}
		}
		if( zCur >= pStream->zText ){
			/* Automatic advance of the stream cursor */
			pStream->zText = &zCur[1];
		}
	}
	if( xSort &&  pLex->pTokenSet ){
		SyToken *aToken = (SyToken *)SySetBasePtr(pLex->pTokenSet);
		/* Sort the extrated tokens */
		if( xCmp == 0 ){
			/* Use a default comparison function */
			xCmp = SyMemcmp;
		}
		xSort(aToken, SySetUsed(pLex->pTokenSet), sizeof(SyToken), xCmp);
	}
	return SXRET_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, (%rax)
movq -0x48(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x48(%rbp), %rax
movq (%rax), %rcx
movl -0x1c(%rbp), %eax
addq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x48(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jb 0x805e9
jmp 0x80699
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x48(%rbp), %rdi
movq -0x10(%rbp), %rcx
movq 0x30(%rcx), %rdx
movq -0x28(%rbp), %rcx
leaq -0x68(%rbp), %rsi
callq *%rax
movl %eax, -0x6c(%rbp)
cmpl $0x0, -0x6c(%rbp)
je 0x80636
cmpl $-0x19, -0x6c(%rbp)
je 0x80636
cmpl $-0xa, -0x6c(%rbp)
jne 0x80634
movl $0xfffffff6, -0x4(%rbp) # imm = 0xFFFFFFF6
jmp 0x806f2
jmp 0x80699
cmpl $-0x19, -0x6c(%rbp)
jne 0x8064b
movq -0x48(%rbp), %rax
movl 0x1c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x1c(%rax)
jmp 0x80676
movq -0x10(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x80674
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
leaq -0x68(%rbp), %rsi
callq 0x5a7b0
movl %eax, -0x6c(%rbp)
cmpl $0x0, -0x6c(%rbp)
je 0x80672
jmp 0x80699
jmp 0x80674
jmp 0x80676
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jb 0x80694
movq -0x40(%rbp), %rcx
addq $0x1, %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0x805d2
cmpq $0x0, -0x30(%rbp)
je 0x806eb
movq -0x10(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x806eb
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x806cd
leaq -0x23309(%rip), %rax    # 0x5d3c0
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq -0x78(%rbp), %rdi
movq -0x10(%rbp), %rcx
movq 0x38(%rcx), %rcx
movl 0x10(%rcx), %esi
movq -0x38(%rbp), %rcx
movl $0x20, %edx
callq *%rax
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nop