// File: /workspace/github_c_makefile_star2_O1/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: unqlite_create_function
int unqlite_create_function(unqlite_vm *pVm, const char *zName,int (*xFunc)(unqlite_context *,int,unqlite_value **),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);
	/* Ticket 1433-003: NULL values are not allowed */
	if( sName.nByte < 1 || xFunc == 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 function */
	 rc = jx9VmInstallForeignFunction(pVm->pJx9Vm,&sName,xFunc,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 0x2ffaa
movq %rdi, %rbx
cmpl $0xdead2bad, 0xf8(%rdi) # imm = 0xDEAD2BAD
jne 0x2ffbc
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 0x30007
leaq 0x2(%rsi), %r12
cmpb $0x0, -0x1(%r12)
je 0x2ffff
cmpb $0x0, (%r12)
je 0x30007
cmpb $0x0, 0x1(%r12)
je 0x30004
leaq 0x4(%r12), %rax
cmpb $0x0, 0x2(%r12)
movq %rax, %r12
jne 0x2ffcf
addq $-0x2, %rax
movq %rax, %r12
jmp 0x30007
decq %r12
jmp 0x30007
incq %r12
movq %rdx, -0x40(%rbp)
subl %esi, %r12d
movl %r12d, -0x30(%rbp)
movq -0x38(%rbp), %r13
movq %r15, -0x48(%rbp)
je 0x30042
movsbq (%r13), %r14
cmpq $-0x41, %r14
ja 0x30042
callq 0xc170
movq (%rax), %rax
testb $0x20, 0x1(%rax,%r14,2)
je 0x30042
incq %r13
decl %r12d
jne 0x3001c
xorl %r12d, %r12d
movl %r12d, -0x30(%rbp)
movq %r13, -0x38(%rbp)
testl %r12d, %r12d
sete %r13b
je 0x3009a
movq -0x38(%rbp), %r14
leal -0x1(%r12), %eax
movb (%r14,%rax), %r15b
cmpb $-0x41, %r15b
ja 0x3009a
callq 0xc170
movq (%rax), %rax
movsbq %r15b, %rcx
testb $0x20, 0x1(%rax,%rcx,2)
je 0x3009a
cmpl $0x1, %r12d
sete %r13b
je 0x30097
leal -0x2(%r12), %ecx
movb (%r14,%rcx), %r15b
decl %r12d
cmpb $-0x41, %r15b
jbe 0x3006e
jmp 0x3009a
xorl %r12d, %r12d
movl %r12d, -0x30(%rbp)
movl $0xfffffff7, %r12d      # imm = 0xFFFFFFF7
movq -0x40(%rbp), %rdx
testq %rdx, %rdx
je 0x2ffaa
testb $0x1, %r13b
movq -0x48(%rbp), %r14
jne 0x2ffaa
movq 0xc0(%rbx), %rdi
testq %rdi, %rdi
je 0x300d9
movq 0x666a6(%rip), %rax     # 0x96778
callq *0x20(%rax)
movq -0x40(%rbp), %rdx
cmpl $0x2, 0x666a8(%rip)     # 0x96788
jb 0x300f8
movl $0xfffffff6, %r12d      # imm = 0xFFFFFFF6
cmpl $0xdead2bad, 0xf8(%rbx) # imm = 0xDEAD2BAD
je 0x2ffaa
movq 0xe0(%rbx), %rdi
leaq -0x38(%rbp), %rsi
movq %r14, %rcx
callq 0x3012d
movl %eax, %r12d
movq 0xc0(%rbx), %rdi
testq %rdi, %rdi
je 0x2ffaa
movq 0x66653(%rip), %rax     # 0x96778
callq *0x30(%rax)
jmp 0x2ffaa