// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: ExprExtractNode
static sxi32 ExprExtractNode(jx9_gen_state *pGen, jx9_expr_node **ppNode)
{
	jx9_expr_node *pNode;
	SyToken *pCur;
	sxi32 rc;
	/* Allocate a new node */
	pNode = (jx9_expr_node *)SyMemBackendPoolAlloc(&pGen->pVm->sAllocator, sizeof(jx9_expr_node));
	if( pNode == 0 ){
		/* If the supplied memory subsystem is so sick that we are unable to allocate
		 * a tiny chunk of memory, there is no much we can do here.
		 */
		return SXERR_MEM;
	}
	/* Zero the structure */
	SyZero(pNode, sizeof(jx9_expr_node));
	SySetInit(&pNode->aNodeArgs, &pGen->pVm->sAllocator, sizeof(jx9_expr_node **));
	/* Point to the head of the token stream */
	pCur = pNode->pStart = pGen->pIn;
	/* Start collecting tokens */
	if( pCur->nType & JX9_TK_OP ){
		/* Point to the instance that describe this operator */
		pNode->pOp = (const jx9_expr_op *)pCur->pUserData;
		/* Advance the stream cursor */
		pCur++;
	}else if( pCur->nType & JX9_TK_DOLLAR ){
		/* Isolate variable */
		pCur++; /* Jump the dollar sign */
		if( pCur >= pGen->pEnd ){
			/* Syntax error */
			rc = jx9GenCompileError(pGen, E_ERROR, pNode->pStart->nLine,"Invalid variable name");
			if( rc != SXERR_ABORT ){
				rc = SXERR_SYNTAX;
			}
			SyMemBackendPoolFree(&pGen->pVm->sAllocator, pNode);
			return rc;
		}
		pCur++; /* Jump the variable name */
		pNode->xCode = jx9CompileVariable;
	}else if( pCur->nType & JX9_TK_OCB /* '{' */ ){
		/* JSON Object, assemble tokens */
		pCur++;
		jx9DelimitNestedTokens(pCur, pGen->pEnd, JX9_TK_OCB /* '[' */, JX9_TK_CCB /* ']' */, &pCur);
		if( pCur < pGen->pEnd ){
			pCur++;
		}else{
			/* Syntax error */
			rc = jx9GenCompileError(pGen, E_ERROR, pNode->pStart->nLine,"JSON Object: Missing closing braces '}'");
			if( rc != SXERR_ABORT ){
				rc = SXERR_SYNTAX;
			}
			SyMemBackendPoolFree(&pGen->pVm->sAllocator, pNode);
			return rc;
		}
		pNode->xCode = jx9CompileJsonObject;
	}else if( pCur->nType & JX9_TK_OSB /* '[' */ && !(pCur->nType & JX9_TK_OP) ){
		/* JSON Array, assemble tokens */
		pCur++;
		jx9DelimitNestedTokens(pCur, pGen->pEnd, JX9_TK_OSB /* '[' */, JX9_TK_CSB /* ']' */, &pCur);
		if( pCur < pGen->pEnd ){
			pCur++;
		}else{
			/* Syntax error */
			rc = jx9GenCompileError(pGen, E_ERROR, pNode->pStart->nLine,"JSON Array: Missing closing square bracket ']'");
			if( rc != SXERR_ABORT ){
				rc = SXERR_SYNTAX;
			}
			SyMemBackendPoolFree(&pGen->pVm->sAllocator, pNode);
			return rc;
		}
		pNode->xCode = jx9CompileJsonArray;
	}else if( pCur->nType & JX9_TK_KEYWORD ){
		 int nKeyword = SX_PTR_TO_INT(pCur->pUserData);
		 if( nKeyword == JX9_TKWRD_FUNCTION ){
			 /* Annonymous function */
			  if( &pCur[1] >= pGen->pEnd ){
				 /* Assume a literal */
				pCur++;
				pNode->xCode = jx9CompileLiteral;
			 }else{
				 /* Assemble annonymous functions body */
				 rc = ExprAssembleAnnon(&(*pGen), &pCur, pGen->pEnd);
				 if( rc != SXRET_OK ){
					 SyMemBackendPoolFree(&pGen->pVm->sAllocator, pNode);
					 return rc; 
				 }
				 pNode->xCode = jx9CompileAnnonFunc;
			  }
		 }else if( jx9IsLangConstruct(nKeyword) && &pCur[1] < pGen->pEnd ){
			 /* Language constructs [i.e: print,die...] require special handling */
			 jx9DelimitNestedTokens(pCur, pGen->pEnd, JX9_TK_LPAREN|JX9_TK_OCB|JX9_TK_OSB, JX9_TK_RPAREN|JX9_TK_CCB|JX9_TK_CSB, &pCur);
			 pNode->xCode = jx9CompileLangConstruct;
		 }else{
			 /* Assume a literal */
			 pCur++;
			 pNode->xCode = jx9CompileLiteral;
		 }
	 }else if( pCur->nType & (JX9_TK_ID) ){
		 /* Constants, function name, namespace path, object name... */
		 pCur++;
		 pNode->xCode = jx9CompileLiteral;
	 }else{
		 if( (pCur->nType & (JX9_TK_LPAREN|JX9_TK_RPAREN|JX9_TK_COMMA|JX9_TK_CSB|JX9_TK_OCB|JX9_TK_CCB|JX9_TK_COLON)) == 0 ){
			 /* Point to the code generator routine */
			 pNode->xCode = jx9GetNodeHandler(pCur->nType);
			 if( pNode->xCode == 0 ){
				 rc = jx9GenCompileError(pGen, E_ERROR, pNode->pStart->nLine, "Syntax error: Unexpected token '%z'", &pNode->pStart->sData);
				 if( rc != SXERR_ABORT ){
					 rc = SXERR_SYNTAX;
				 }
				 SyMemBackendPoolFree(&pGen->pVm->sAllocator, pNode);
				 return rc;
			 }
		 }
		/* Advance the stream cursor */
		pCur++;
	 }
	/* Point to the end of the token stream */
	pNode->pEnd = pCur;
	/* Save the node for later processing */
	*ppNode = pNode;
	/* Synchronize cursors */
	pGen->pIn = pCur;
	return SXRET_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl $0x68, %esi
callq 0x541f0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x86058
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x8650c
movq -0x20(%rbp), %rdi
movl $0x68, %esi
callq 0x54280
movq -0x20(%rbp), %rdi
addq $0x38, %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movl $0x8, %edx
callq 0x5b470
movq -0x10(%rbp), %rax
movq 0x158(%rax), %rax
movq -0x20(%rbp), %rcx
movq %rax, 0x18(%rcx)
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x860c5
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x28(%rbp)
jmp 0x864df
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x86162
movq -0x28(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x160(%rcx), %rax
jb 0x86142
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x14(%rax), %edx
movl $0x1, %esi
leaq 0x3dd64(%rip), %rcx     # 0xc3e74
movb $0x0, %al
callq 0x7e990
movl %eax, -0x2c(%rbp)
cmpl $-0xa, -0x2c(%rbp)
je 0x86127
movl $0xfffffff4, -0x2c(%rbp) # imm = 0xFFFFFFF4
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x54490
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x8650c
movq -0x28(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
leaq -0xfe9(%rip), %rcx      # 0x85170
movq %rcx, 0x30(%rax)
jmp 0x864dd
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x86223
movq -0x28(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x160(%rax), %rsi
movl $0x40, %edx
movl $0x80, %ecx
leaq -0x28(%rbp), %r8
callq 0x841b0
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x160(%rcx), %rax
jae 0x861c2
movq -0x28(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x28(%rbp)
jmp 0x8620f
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x14(%rax), %edx
movl $0x1, %esi
leaq 0x3e06e(%rip), %rcx     # 0xc424b
movb $0x0, %al
callq 0x7e990
movl %eax, -0x2c(%rbp)
cmpl $-0xa, -0x2c(%rbp)
je 0x861f4
movl $0xfffffff4, -0x2c(%rbp) # imm = 0xFFFFFFF4
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x54490
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x8650c
movq -0x20(%rbp), %rax
leaq 0x1db6(%rip), %rcx      # 0x87fd0
movq %rcx, 0x30(%rax)
jmp 0x864db
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0x862f9
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
jne 0x862f9
movq -0x28(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x160(%rax), %rsi
movl $0x800, %edx            # imm = 0x800
movl $0x1000, %ecx           # imm = 0x1000
leaq -0x28(%rbp), %r8
callq 0x841b0
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x160(%rcx), %rax
jae 0x86298
movq -0x28(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x28(%rbp)
jmp 0x862e5
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x14(%rax), %edx
movl $0x1, %esi
leaq 0x3dfc0(%rip), %rcx     # 0xc4273
movb $0x0, %al
callq 0x7e990
movl %eax, -0x2c(%rbp)
cmpl $-0xa, -0x2c(%rbp)
je 0x862ca
movl $0xfffffff4, -0x2c(%rbp) # imm = 0xFFFFFFF4
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x54490
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x8650c
movq -0x20(%rbp), %rax
leaq 0x1f70(%rip), %rcx      # 0x88260
movq %rcx, 0x30(%rax)
jmp 0x864d9
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x86413
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movl %eax, -0x30(%rbp)
cmpl $0x6, -0x30(%rbp)
jne 0x8639c
movq -0x28(%rbp), %rax
addq $0x20, %rax
movq -0x10(%rbp), %rcx
cmpq 0x160(%rcx), %rax
jb 0x8634f
movq -0x28(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
leaq 0x2077(%rip), %rcx      # 0x883c0
movq %rcx, 0x30(%rax)
jmp 0x8639a
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x160(%rax), %rdx
leaq -0x28(%rbp), %rsi
callq 0x88740
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x8638b
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x54490
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x8650c
movq -0x20(%rbp), %rax
leaq 0x256a(%rip), %rcx      # 0x88900
movq %rcx, 0x30(%rax)
jmp 0x8640e
movl -0x30(%rbp), %edi
callq 0x81060
cmpl $0x0, %eax
je 0x863f1
movq -0x28(%rbp), %rax
addq $0x20, %rax
movq -0x10(%rbp), %rcx
cmpq 0x160(%rcx), %rax
jae 0x863f1
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x160(%rax), %rsi
movl $0xa40, %edx            # imm = 0xA40
movl $0x1480, %ecx           # imm = 0x1480
leaq -0x28(%rbp), %r8
callq 0x841b0
movq -0x20(%rbp), %rax
leaq 0x2705(%rip), %rcx      # 0x88af0
movq %rcx, 0x30(%rax)
jmp 0x8640c
movq -0x28(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
leaq 0x1fb8(%rip), %rcx      # 0x883c0
movq %rcx, 0x30(%rax)
jmp 0x8640e
jmp 0x864d7
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x86442
movq -0x28(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
leaq 0x1f87(%rip), %rcx      # 0x883c0
movq %rcx, 0x30(%rax)
jmp 0x864d5
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x1216c0, %eax         # imm = 0x1216C0
cmpl $0x0, %eax
jne 0x864c9
movq -0x28(%rbp), %rax
movl 0x10(%rax), %edi
callq 0x88d70
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x30(%rax)
jne 0x864c7
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x14(%rax), %edx
movq -0x20(%rbp), %rax
movq 0x18(%rax), %r8
movl $0x1, %esi
leaq 0x3de0a(%rip), %rcx     # 0xc42a2
movb $0x0, %al
callq 0x7e990
movl %eax, -0x2c(%rbp)
cmpl $-0xa, -0x2c(%rbp)
je 0x864af
movl $0xfffffff4, -0x2c(%rbp) # imm = 0xFFFFFFF4
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x54490
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x8650c
jmp 0x864c9
movq -0x28(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x28(%rbp)
jmp 0x864d7
jmp 0x864d9
jmp 0x864db
jmp 0x864dd
jmp 0x864df
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x158(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)