// File: /workspace/github_c_makefile_star2_O3/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: LexExtractNowdoc
static sxi32 LexExtractNowdoc(SyStream *pStream, SyToken *pToken)
{
	const unsigned char *zIn  = pStream->zText;
	const unsigned char *zEnd = pStream->zEnd;
	const unsigned char *zPtr;
	SyString sDelim;
	SyString sStr;
	/* Jump leading white spaces */
	while( zIn < zEnd && zIn[0] < 0xc0 && SyisSpace(zIn[0]) && zIn[0] != '\n' ){
		zIn++;
	}
	if( zIn >= zEnd ){
		/* A simple symbol, return immediately */
		return SXERR_CONTINUE;
	}
	if( zIn[0] == '\'' || zIn[0] == '"' ){
		zIn++;
	}
	if( zIn[0] < 0xc0 && !SyisAlphaNum(zIn[0]) && zIn[0] != '_' ){
		/* Invalid delimiter, return immediately */
		return SXERR_CONTINUE;
	}
	/* Isolate the identifier */
	sDelim.zString = (const char *)zIn;
	for(;;){
		zPtr = zIn;
		/* Skip alphanumeric stream */
		while( zPtr < zEnd && zPtr[0] < 0xc0 && (SyisAlphaNum(zPtr[0]) || zPtr[0] == '_') ){
			zPtr++;
		}
		if( zPtr < zEnd && zPtr[0] >= 0xc0 ){
			zPtr++;
			/* UTF-8 stream */
			while( zPtr < zEnd && ((zPtr[0] & 0xc0) == 0x80) ){
				zPtr++;
			}
		}
		if( zPtr == zIn ){
			/* Not an UTF-8 or alphanumeric stream */
			break;
		}
		/* Synchronize pointers */
		zIn = zPtr;
	}
	/* Get the identifier length */
	sDelim.nByte = (sxu32)((const char *)zIn-sDelim.zString);
	if( zIn[0] == '"' || zIn[0] == '\'' ){
		/* Jump the trailing single quote */
		zIn++;
	}
	/* Jump trailing white spaces */
	while( zIn < zEnd && zIn[0] < 0xc0 && SyisSpace(zIn[0]) && zIn[0] != '\n' ){
		zIn++;
	}
	if( sDelim.nByte <= 0 || zIn >= zEnd || zIn[0] != '\n' ){
		/* Invalid syntax */
		return SXERR_CONTINUE;
	}
	pStream->nLine++; /* Increment line counter */
	zIn++;
	/* Isolate the delimited string */
	sStr.zString = (const char *)zIn;
	/* Go and found the closing delimiter */
	for(;;){
		/* Synchronize with the next line */
		while( zIn < zEnd && zIn[0] != '\n' ){
			zIn++;
		}
		if( zIn >= zEnd ){
			/* End of the input reached, break immediately */
			pStream->zText = pStream->zEnd;
			break;
		}
		pStream->nLine++; /* Increment line counter */
		zIn++;
		if( (sxu32)(zEnd - zIn) >= sDelim.nByte && SyMemcmp((const void *)sDelim.zString, (const void *)zIn, sDelim.nByte) == 0 ){
			zPtr = &zIn[sDelim.nByte];
			while( zPtr < zEnd && zPtr[0] < 0xc0 && SyisSpace(zPtr[0]) && zPtr[0] != '\n' ){
				zPtr++;
			}
			if( zPtr >= zEnd ){
				/* End of input */
				pStream->zText = zPtr;
				break;
			}
			if( zPtr[0] == ';' ){
				const unsigned char *zCur = zPtr;
				zPtr++;
				while( zPtr < zEnd && zPtr[0] < 0xc0 && SyisSpace(zPtr[0]) && zPtr[0] != '\n' ){
					zPtr++;
				}
				if( zPtr >= zEnd || zPtr[0] == '\n' ){
					/* Closing delimiter found, break immediately */
					pStream->zText = zCur; /* Keep the semi-colon */
					break;
				}
			}else if( zPtr[0] == '\n' ){
				/* Closing delimiter found, break immediately */
				pStream->zText = zPtr; /* Synchronize with the stream cursor */
				break;
			}
			/* Synchronize pointers and continue searching */
			zIn = zPtr;
		}
	} /* For(;;) */
	/* Get the delimited string length */
	sStr.nByte = (sxu32)((const char *)zIn-sStr.zString);
	/* Record token type and length */
	pToken->nType = JX9_TK_NOWDOC;
	SyStringDupPtr(&pToken->sData, &sStr);
	/* Remove trailing white spaces */
	SyStringRightTrim(&pToken->sData);
	/* All done */
	return SXRET_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq 0x8(%rdi), %r12
movq 0x10(%rdi), %rax
movq %rax, -0x38(%rbp)
cmpq %rax, %r12
jae 0x49405
movq %rsi, %rbx
movq %rdi, %r15
incq %r12
movzbl -0x1(%r12), %r14d
cmpq $0xbf, %r14
ja 0x4941e
callq 0xc170
cmpb $0xa, %r14b
je 0x4941e
movq (%rax), %rax
movzwl (%rax,%r14,2), %eax
andl $0x2000, %eax           # imm = 0x2000
je 0x4941e
leaq 0x1(%r12), %rax
cmpq -0x38(%rbp), %r12
movq %rax, %r12
jne 0x493ce
movl $0xffffffe7, -0x30(%rbp) # imm = 0xFFFFFFE7
movl -0x30(%rbp), %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x22, %r14d
je 0x4942a
cmpl $0x27, %r14d
jne 0x49437
movl $0xffffffe7, -0x30(%rbp) # imm = 0xFFFFFFE7
movb (%r12), %r14b
jmp 0x49441
movl $0xffffffe7, -0x30(%rbp) # imm = 0xFFFFFFE7
decq %r12
cmpb $-0x41, %r14b
ja 0x49462
callq 0xc170
cmpb $0x5f, %r14b
je 0x49462
movq (%rax), %rax
movzbl %r14b, %ecx
movzwl (%rax,%rcx,2), %eax
andl $0x8, %eax
je 0x4940c
movq %r15, -0x48(%rbp)
movq %rbx, -0x50(%rbp)
movq %r12, -0x68(%rbp)
movq %r12, %r14
movq -0x38(%rbp), %r15
movq %r14, %r12
cmpq %r15, %r14
jae 0x494ec
movq %r15, %rbx
subq %r12, %rbx
leaq 0x1(%r12), %r13
xorl %r14d, %r14d
movzbl (%r12,%r14), %r15d
cmpq $0xc0, %r15
jae 0x494c5
callq 0xc170
cmpq $0x5f, %r15
je 0x494b1
movq (%rax), %rax
movzwl (%rax,%r15,2), %eax
andl $0x8, %eax
je 0x494e0
incq %r14
incq %r13
cmpq %r14, %rbx
jne 0x4948b
movq -0x38(%rbp), %r15
movq %r15, %r14
jmp 0x494e7
movq -0x38(%rbp), %r15
movq %r13, %r14
cmpq %r15, %r13
jae 0x494e7
movb (%r14), %al
andb $-0x40, %al
leaq 0x1(%r14), %r13
negb %al
jo 0x494c9
jmp 0x494e7
addq %r12, %r14
movq -0x38(%rbp), %r15
cmpq %r12, %r14
jne 0x49475
movzbl (%r12), %eax
cmpl $0x27, %eax
je 0x494fe
movq %r12, %r14
cmpl $0x22, %eax
jne 0x49503
leaq 0x1(%r12), %r14
cmpq %r15, %r14
jae 0x4940c
subq -0x68(%rbp), %r12
movq %r15, %r13
subq %r14, %r13
movl %r14d, %eax
incl %eax
incq %r14
movl %eax, -0x38(%rbp)
movzbl -0x1(%r14), %ebx
cmpq $0xbf, %rbx
ja 0x4955a
callq 0xc170
cmpq $0xa, %rbx
je 0x4955a
movq (%rax), %rax
movzwl (%rax,%rbx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
je 0x4955a
movl -0x38(%rbp), %eax
incl %eax
incq %r14
decq %r13
jne 0x4951e
jmp 0x4940c
testl %r12d, %r12d
je 0x4940c
cmpb $0xa, %bl
jne 0x4940c
movq -0x48(%rbp), %rax
movl 0x18(%rax), %ebx
incl %ebx
movl %ebx, 0x18(%rax)
movq %r14, %r13
cmpq %r15, %r14
jae 0x496d7
movl %r12d, %ecx
movq %rcx, -0x60(%rbp)
leaq 0x1(%rcx), %rax
movq %rax, -0x78(%rbp)
leal -0x1(%r15), %eax
movq %rax, -0x80(%rbp)
movq %r14, %rsi
movq -0x60(%rbp), %rax
leaq (%rsi,%rax), %rdx
addq $0x2, %rdx
movq %rsi, %rax
movq %rsi, %r13
cmpb $0xa, (%r13)
je 0x495ca
incq %r13
incq %rax
incq %rdx
cmpq %r15, %r13
jb 0x495b0
jmp 0x496d7
incl %ebx
movq %rax, %rcx
movq -0x48(%rbp), %rax
movl %ebx, 0x18(%rax)
leaq 0x1(%r13), %rsi
movq -0x80(%rbp), %rax
movq %rcx, -0x58(%rbp)
subl %ecx, %eax
cmpl %r12d, %eax
jb 0x49679
movq %rdx, -0x70(%rbp)
movq -0x68(%rbp), %rdi
movq %rsi, -0x30(%rbp)
movq -0x30(%rbp), %rsi
movl %r12d, %edx
callq 0x347f1
movq -0x30(%rbp), %rsi
testl %eax, %eax
jne 0x49679
movl %ebx, -0x3c(%rbp)
movq -0x78(%rbp), %rax
addq %r13, %rax
cmpq %r15, %rax
movq -0x70(%rbp), %rcx
jae 0x49735
movq %rax, -0x30(%rbp)
movzbl (%rax), %ebx
cmpq $0xbf, %rbx
ja 0x49667
movq %rcx, %r13
callq 0xc170
movq %r13, %rcx
cmpq $0xa, %rbx
je 0x49667
movq (%rax), %rax
movzwl (%rax,%rbx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
je 0x49667
movq -0x30(%rbp), %rax
incq %rax
incq %rcx
cmpq %r15, %rax
jb 0x49624
jmp 0x49740
cmpq $0x3b, %rbx
je 0x49687
cmpl $0xa, %ebx
je 0x496c9
movq -0x30(%rbp), %rsi
movl -0x3c(%rbp), %ebx
movq %rsi, %r13
cmpq %r15, %rsi
jb 0x4959e
jmp 0x496d7
cmpq %r15, %rcx
jae 0x496c9
movq %rcx, %rsi
movzbl (%rcx), %ebx
cmpq $0xbf, %rbx
ja 0x49676
movq %rsi, %r13
callq 0xc170
movq %r13, %rsi
cmpq $0xa, %rbx
je 0x496c1
movq (%rax), %rax
movzwl (%rax,%rbx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
leaq 0x1(%rsi), %rcx
testw %ax, %ax
jne 0x49687
cmpb $0xa, %bl
movl -0x3c(%rbp), %ebx
jne 0x49679
movq -0x48(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rcx, 0x8(%rax)
jmp 0x49748
movq -0x48(%rbp), %rax
movq %r15, 0x8(%rax)
movq -0x50(%rbp), %rax
movl $0x10000, 0x10(%rax)    # imm = 0x10000
movq %r14, (%rax)
subl -0x38(%rbp), %r13d
movq %r13, %rbx
movq -0x50(%rbp), %rax
movl %r13d, 0x8(%rax)
movl $0x0, -0x30(%rbp)
subq $0x1, %rbx
jb 0x4940c
movsbq -0x1(%r14,%r13), %r15
cmpq $-0x41, %r15
ja 0x4940c
callq 0xc170
movq (%rax), %rax
testb $0x20, 0x1(%rax,%r15,2)
movq %rbx, %r13
jne 0x496f4
jmp 0x4940c
movq -0x60(%rbp), %rax
leaq (%rax,%r13), %r15
incq %r15
movq -0x48(%rbp), %rax
movq %r15, 0x8(%rax)
movq -0x58(%rbp), %r13
incq %r13
jmp 0x496df