// File: /workspace/github_c_makefile_star2_O0/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
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x55e1f
movq -0x10(%rbp), %rax
cmpl $0xdead2bad, 0xf8(%rax) # imm = 0xDEAD2BAD
jne 0x55e2b
movl $0xffffffe8, -0x4(%rbp) # imm = 0xFFFFFFE8
jmp 0x55fb9
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
callq 0x55d10
movl %eax, -0x30(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x30(%rbp)
movb %al, -0x3d(%rbp)
jbe 0x55e82
movq -0x38(%rbp), %rax
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0xc0, %ecx
movb %al, -0x3d(%rbp)
jge 0x55e82
callq 0xd1f0
movq (%rax), %rax
movq -0x38(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
setne %al
movb %al, -0x3d(%rbp)
movb -0x3d(%rbp), %al
testb $0x1, %al
jne 0x55e8b
jmp 0x55ea2
movl -0x30(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x30(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x55e3f
jmp 0x55ea4
xorl %eax, %eax
cmpl $0x0, -0x30(%rbp)
movb %al, -0x3e(%rbp)
jbe 0x55ef9
movq -0x38(%rbp), %rax
movl -0x30(%rbp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movzbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0xc0, %ecx
movb %al, -0x3e(%rbp)
jge 0x55ef9
callq 0xd1f0
movq (%rax), %rax
movq -0x38(%rbp), %rcx
movl -0x30(%rbp), %edx
subl $0x1, %edx
movl %edx, %edx
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
setne %al
movb %al, -0x3e(%rbp)
movb -0x3e(%rbp), %al
testb $0x1, %al
jne 0x55f02
jmp 0x55f0d
movl -0x30(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x55ea4
cmpl $0x1, -0x30(%rbp)
jb 0x55f1a
cmpq $0x0, -0x20(%rbp)
jne 0x55f26
movl $0xfffffff7, -0x4(%rbp) # imm = 0xFFFFFFF7
jmp 0x55fb9
movq -0x10(%rbp), %rax
cmpq $0x0, 0xc0(%rax)
je 0x55f4c
movq 0x9893d(%rip), %rax     # 0xee878
movq 0x20(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0xc0(%rcx), %rdi
callq *%rax
cmpl $0x1, 0x98935(%rip)     # 0xee888
jbe 0x55f6e
movq -0x10(%rbp), %rax
cmpl $0xdead2bad, 0xf8(%rax) # imm = 0xDEAD2BAD
jne 0x55f6e
movl $0xfffffff6, -0x4(%rbp) # imm = 0xFFFFFFF6
jmp 0x55fb9
movq -0x10(%rbp), %rax
movq 0xe0(%rax), %rdi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
leaq -0x38(%rbp), %rsi
callq 0x55fd0
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0xc0(%rax)
je 0x55fb3
movq 0x988d6(%rip), %rax     # 0xee878
movq 0x30(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0xc0(%rcx), %rdi
callq *%rax
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)