// File: /workspace/github_c_makefile_star2_O1/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 0x303d8
movq %rdi, %rbx
cmpl $0xdead2bad, 0xf8(%rdi) # imm = 0xDEAD2BAD
jne 0x303ea
movl %r12d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rcx, %r15
movq %rsi, -0x38(%rbp)
cmpb $0x0, (%rsi)
movq %rsi, %r12
je 0x30435
leaq 0x2(%rsi), %r12
cmpb $0x0, -0x1(%r12)
je 0x3042d
cmpb $0x0, (%r12)
je 0x30435
cmpb $0x0, 0x1(%r12)
je 0x30432
leaq 0x4(%r12), %rax
cmpb $0x0, 0x2(%r12)
movq %rax, %r12
jne 0x303fd
addq $-0x2, %rax
movq %rax, %r12
jmp 0x30435
decq %r12
jmp 0x30435
incq %r12
movq %rdx, -0x40(%rbp)
subl %esi, %r12d
movl %r12d, -0x30(%rbp)
movq -0x38(%rbp), %r13
movq %r15, -0x48(%rbp)
je 0x30470
movsbq (%r13), %r14
cmpq $-0x41, %r14
ja 0x30470
callq 0xc170
movq (%rax), %rax
testb $0x20, 0x1(%rax,%r14,2)
je 0x30470
incq %r13
decl %r12d
jne 0x3044a
xorl %r12d, %r12d
movl %r12d, -0x30(%rbp)
movq %r13, -0x38(%rbp)
testl %r12d, %r12d
sete %r13b
je 0x304c8
movq -0x38(%rbp), %r14
leal -0x1(%r12), %eax
movb (%r14,%rax), %r15b
cmpb $-0x41, %r15b
ja 0x304c8
callq 0xc170
movq (%rax), %rax
movsbq %r15b, %rcx
testb $0x20, 0x1(%rax,%rcx,2)
je 0x304c8
cmpl $0x1, %r12d
sete %r13b
je 0x304c5
leal -0x2(%r12), %ecx
movb (%r14,%rcx), %r15b
decl %r12d
cmpb $-0x41, %r15b
jbe 0x3049c
jmp 0x304c8
xorl %r12d, %r12d
movl %r12d, -0x30(%rbp)
movl $0xfffffff7, %r12d      # imm = 0xFFFFFFF7
movq -0x40(%rbp), %rdx
testq %rdx, %rdx
je 0x303d8
testb $0x1, %r13b
movq -0x48(%rbp), %r14
jne 0x303d8
movq 0xc0(%rbx), %rdi
testq %rdi, %rdi
je 0x30507
movq 0x66278(%rip), %rax     # 0x96778
callq *0x20(%rax)
movq -0x40(%rbp), %rdx
cmpl $0x2, 0x6627a(%rip)     # 0x96788
jb 0x30526
movl $0xfffffff6, %r12d      # imm = 0xFFFFFFF6
cmpl $0xdead2bad, 0xf8(%rbx) # imm = 0xDEAD2BAD
je 0x303d8
movq 0xe0(%rbx), %rdi
leaq -0x38(%rbp), %rsi
movq %r14, %rcx
callq 0x3055b
movl %eax, %r12d
movq 0xc0(%rbx), %rdi
testq %rdi, %rdi
je 0x303d8
movq 0x66225(%rip), %rax     # 0x96778
callq *0x30(%rax)
jmp 0x303d8