// File: /workspace/github_c_makefile_star2_O3/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: unqlite_create_constant
int unqlite_create_constant(unqlite_vm *pVm,const char *zName,void (*xExpand)(unqlite_value *, void *),void *pUserData)
{
	SyString sName;
	int rc;
	if( UNQLITE_VM_MISUSE(pVm) ){
		return UNQLITE_CORRUPT;
	}
	SyStringInitFromBuf(&sName, zName, SyStrlen(zName));
	/* Remove leading and trailing white spaces */
	SyStringFullTrim(&sName);
	if( sName.nByte < 1 ){
		/* Empty constant name */
		return UNQLITE_INVALID;
	}
	/* TICKET 1433-003: NULL pointer is harmless operation */
	if( xExpand == 0 ){
		return UNQLITE_INVALID;
	}
#if defined(UNQLITE_ENABLE_THREADS)
	 /* Acquire VM mutex */
	 SyMutexEnter(sUnqlMPGlobal.pMutexMethods, pVm->pMutex); /* NO-OP if sUnqlMPGlobal.nThreadingLevel != UNQLITE_THREAD_LEVEL_MULTI */
	 if( sUnqlMPGlobal.nThreadingLevel > UNQLITE_THREAD_LEVEL_SINGLE && 
		 UNQLITE_THRD_VM_RELEASE(pVm) ){
			 return UNQLITE_ABORT; /* Another thread have released this instance */
	 }
#endif
	 /* Install the foreign constant */
	 rc = jx9VmRegisterConstant(pVm->pJx9Vm,&sName,xExpand,pUserData);
#if defined(UNQLITE_ENABLE_THREADS)
	 /* Leave DB mutex */
	 SyMutexLeave(sUnqlMPGlobal.pMutexMethods,pVm->pMutex); /* NO-OP if sUnqlMPGlobal.nThreadingLevel != UNQLITE_THREAD_LEVEL_MULTI */
#endif
	return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl $0xffffffe8, %r12d      # imm = 0xFFFFFFE8
testq %rdi, %rdi
je 0x2ffc5
cmpl $0xdead2bad, 0xf8(%rdi) # imm = 0xDEAD2BAD
je 0x2ffc5
movq %rsi, %r13
cmpb $0x0, (%rsi)
movq %rsi, %rax
je 0x2fecf
leaq 0x2(%r13), %rax
cmpb $0x0, -0x1(%rax)
je 0x2fec7
cmpb $0x0, (%rax)
je 0x2fecf
cmpb $0x0, 0x1(%rax)
je 0x2fecc
leaq 0x4(%rax), %rsi
cmpb $0x0, 0x2(%rax)
movq %rsi, %rax
jne 0x2fea0
addq $-0x2, %rsi
movq %rsi, %rax
jmp 0x2fecf
decq %rax
jmp 0x2fecf
incq %rax
movl $0xfffffff7, %r12d      # imm = 0xFFFFFFF7
subl %r13d, %eax
je 0x2ffc5
movq %rdx, -0x40(%rbp)
movq %rcx, -0x30(%rbp)
movq %rdi, -0x38(%rbp)
movl %eax, %r14d
xorl %r15d, %r15d
movsbq (%r13,%r15), %rbx
cmpq $-0x41, %rbx
ja 0x2ff18
callq 0xc170
movq (%rax), %rax
testb $0x20, 0x1(%rax,%rbx,2)
je 0x2ff18
incq %r15
cmpl %r15d, %r14d
jne 0x2fef0
jmp 0x2ffc5
leaq (%r15,%r13), %rax
movq %rax, -0x50(%rbp)
addq %r14, %r13
decq %r13
subq %r15, %r14
movq -0x40(%rbp), %r15
movsbq (%r13), %rbx
cmpq $-0x41, %rbx
ja 0x2ff54
callq 0xc170
movq (%rax), %rax
testb $0x20, 0x1(%rax,%rbx,2)
je 0x2ff54
decq %r14
decq %r13
testq %r14, %r14
jne 0x2ff2d
jmp 0x2ffc5
movl %r14d, -0x48(%rbp)
testq %r15, %r15
movq -0x38(%rbp), %rbx
movq -0x30(%rbp), %r14
je 0x2ffc5
movq 0xc0(%rbx), %rdi
testq %rdi, %rdi
je 0x2ff7b
movq 0x64800(%rip), %rax     # 0x94778
callq *0x20(%rax)
cmpl $0x2, 0x64806(%rip)     # 0x94788
jb 0x2ff96
movl $0xfffffff6, %r12d      # imm = 0xFFFFFFF6
cmpl $0xdead2bad, 0xf8(%rbx) # imm = 0xDEAD2BAD
je 0x2ffc5
movq 0xe0(%rbx), %rdi
leaq -0x50(%rbp), %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x2ffd7
movl %eax, %r12d
movq 0xc0(%rbx), %rdi
testq %rdi, %rdi
je 0x2ffc5
movq 0x647b6(%rip), %rax     # 0x94778
callq *0x30(%rax)
movl %r12d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq