// File: /workspace/github_c_makefile_star2_O1/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 $0x38, %rsp
movq 0x8(%rdi), %r13
movq 0x10(%rdi), %rax
movl $0xffffffe7, -0x30(%rbp) # imm = 0xFFFFFFE7
movq %rax, -0x38(%rbp)
cmpq %rax, %r13
setb %bl
jae 0x4a756
movq %rsi, %r15
movq %rdi, %r12
movb (%r13), %r14b
cmpb $-0x41, %r14b
ja 0x4a415
callq 0xc170
movq (%rax), %rax
incq %r13
cmpb $0xa, %r14b
je 0x4a412
movzbl %r14b, %ecx
movzwl (%rax,%rcx,2), %ecx
andl $0x2000, %ecx           # imm = 0x2000
je 0x4a412
cmpq -0x38(%rbp), %r13
je 0x4a756
setb %bl
movb (%r13), %r14b
incq %r13
cmpb $-0x41, %r14b
jbe 0x4a3e2
decq %r13
testb $0x1, %bl
je 0x4a756
movzbl (%r13), %eax
cmpl $0x27, %eax
je 0x4a42d
cmpl $0x22, %eax
jne 0x4a430
incq %r13
movzbl (%r13), %ebx
cmpq $0xbf, %rbx
ja 0x4a459
callq 0xc170
cmpq $0x5f, %rbx
je 0x4a459
movq (%rax), %rax
movzwl (%rax,%rbx,2), %eax
andl $0x8, %eax
je 0x4a756
movq %r12, -0x48(%rbp)
movq %r15, -0x60(%rbp)
movq %r13, -0x58(%rbp)
movq %r13, %r12
movq -0x38(%rbp), %r15
movq %r12, %rbx
cmpq %r15, %r12
jae 0x4a4dc
movq %r15, %r14
subq %rbx, %r14
leaq 0x1(%rbx), %r13
movq %rbx, %r12
movzbl (%r12), %r15d
cmpq $0xbf, %r15
ja 0x4a4bb
callq 0xc170
cmpq $0x5f, %r15
je 0x4a4a7
movq (%rax), %rax
movzwl (%rax,%r15,2), %eax
andl $0x8, %eax
je 0x4a4bb
incq %r12
incq %r13
decq %r14
jne 0x4a481
movq -0x38(%rbp), %r15
movq %r15, %r12
jmp 0x4a4dc
cmpb $-0x40, %r15b
movq -0x38(%rbp), %r15
jb 0x4a4dc
movq %r13, %r12
cmpq %r15, %r13
jae 0x4a4dc
movb (%r12), %al
andb $-0x40, %al
leaq 0x1(%r12), %r13
negb %al
jo 0x4a4c5
cmpq %rbx, %r12
jne 0x4a46c
movq %rbx, %r13
subq -0x58(%rbp), %r13
movzbl (%rbx), %eax
cmpl $0x27, %eax
je 0x4a4f5
cmpl $0x22, %eax
jne 0x4a4f8
incq %rbx
cmpq %r15, %rbx
setb %r12b
jae 0x4a55b
movb (%rbx), %r14b
cmpb $-0x41, %r14b
ja 0x4a55b
callq 0xc170
movq (%rax), %rax
leaq 0x1(%rbx), %rdx
notq %rbx
addq %r15, %rbx
movq %rbx, %rcx
movq %rdx, %rbx
cmpb $0xa, %r14b
je 0x4a553
movzbl %r14b, %edx
movzwl (%rax,%rdx,2), %edx
andl $0x2000, %edx           # imm = 0x2000
je 0x4a553
cmpq %r15, %rbx
setb %r12b
testq %rcx, %rcx
je 0x4a558
movb (%rbx), %r14b
incq %rbx
decq %rcx
cmpb $-0x41, %r14b
jbe 0x4a522
decq %rbx
jmp 0x4a55b
movq %r15, %rbx
testl %r13d, %r13d
sete %al
notb %r12b
orb %al, %r12b
testb $0x1, %r12b
jne 0x4a756
cmpb $0xa, (%rbx)
jne 0x4a756
movq -0x48(%rbp), %rdx
incl 0x18(%rdx)
leaq 0x1(%rbx), %r14
cmpq %r15, %r14
setb %al
jae 0x4a6fb
movq %r13, -0x38(%rbp)
movl %r13d, %ecx
movq %rcx, -0x50(%rbp)
movq %r14, %r13
cmpb $0xa, (%r13)
je 0x4a5c9
incq %r13
cmpq %r15, %r13
setb %al
jae 0x4a703
leaq 0x1(%r13), %rcx
cmpb $0xa, (%r13)
movq %rcx, %r13
jne 0x4a5a9
decq %rcx
movq %rcx, %r13
testb $0x1, %al
je 0x4a703
incl 0x18(%rdx)
leaq 0x1(%r13), %r12
movl %r15d, %eax
subl %r12d, %eax
movq -0x38(%rbp), %rdx
cmpl %edx, %eax
jb 0x4a5f6
movq -0x58(%rbp), %rdi
movq %r12, %rsi
callq 0x34ebe
testl %eax, %eax
je 0x4a60a
movq %r12, %r13
cmpq %r15, %r13
setb %al
movq -0x48(%rbp), %rdx
jb 0x4a59f
jmp 0x4a703
movq -0x50(%rbp), %rax
leaq (%r12,%rax), %rdx
cmpq %r15, %rdx
setb %sil
jae 0x4a709
movq %r14, -0x40(%rbp)
movb (%rdx), %r14b
cmpb $-0x41, %r14b
ja 0x4a67a
movb %sil, -0x30(%rbp)
callq 0xc170
movb -0x30(%rbp), %sil
movq (%rax), %rax
movq -0x50(%rbp), %rcx
leaq (%rcx,%r13), %rdx
addq $0x2, %rdx
cmpb $0xa, %r14b
je 0x4a677
movzbl %r14b, %ecx
movzwl (%rax,%rcx,2), %ecx
andl $0x2000, %ecx           # imm = 0x2000
je 0x4a677
cmpq %r15, %rdx
setb %sil
jae 0x4a768
movb (%rdx), %r14b
incq %rdx
cmpb $-0x41, %r14b
jbe 0x4a648
decq %rdx
testb $0x1, %sil
movq -0x40(%rbp), %r14
je 0x4a709
movzbl (%rdx), %eax
cmpl $0x3b, %eax
je 0x4a69e
movq %rdx, %r13
cmpl $0xa, %eax
jne 0x4a5f9
jmp 0x4a709
leaq 0x1(%rdx), %rax
movq %rdx, -0x30(%rbp)
cmpq %r15, %rax
jae 0x4a76b
movq %rax, %r13
movzbl (%rax), %r14d
cmpq $0xbf, %r14
ja 0x4a6e5
callq 0xc170
movq -0x30(%rbp), %rdx
cmpq $0xa, %r14
je 0x4a6e5
movq (%rax), %rax
movzwl (%rax,%r14,2), %ecx
andl $0x2000, %ecx           # imm = 0x2000
leaq 0x1(%r13), %rax
testw %cx, %cx
jne 0x4a6a6
cmpq %r15, %r13
movq -0x40(%rbp), %r14
jae 0x4a709
cmpb $0xa, (%r13)
jne 0x4a5f9
jmp 0x4a709
movq %r15, %rdx
movq %r14, %r12
jmp 0x4a709
movq %r15, %rdx
movq %r13, %r12
movq -0x48(%rbp), %rax
movq %rdx, 0x8(%rax)
subl %r14d, %r12d
movq -0x60(%rbp), %r13
movl $0x10000, 0x10(%r13)    # imm = 0x10000
movq %r14, (%r13)
movq %r12, %r14
movl %r12d, 0x8(%r13)
movl $0x0, -0x30(%rbp)
subq $0x1, %r14
jb 0x4a756
movsbq (%rbx,%r12), %r15
cmpq $-0x41, %r15
ja 0x4a756
callq 0xc170
movq (%rax), %rax
testb $0x20, 0x1(%rax,%r15,2)
movq %r14, %r12
jne 0x4a727
movl -0x30(%rbp), %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdx
movq -0x40(%rbp), %r14
jmp 0x4a709