// File: /workspace/github_c_makefile_star2_O1/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: GenStateCompileFunc
static sxi32 GenStateCompileFunc(
	jx9_gen_state *pGen, /* Code generator state */
	SyString *pName,     /* Function name. NULL otherwise */
	sxi32 iFlags,        /* Control flags */
	jx9_vm_func **ppFunc /* OUT: function state */
	)
{
	jx9_vm_func *pFunc;
	SyToken *pEnd;
	sxu32 nLine;
	char *zName;
	sxi32 rc;
	/* Extract line number */
	nLine = pGen->pIn->nLine;
	/* Jump the left parenthesis '(' */
	pGen->pIn++;
	/* Delimit the function signature */
	jx9DelimitNestedTokens(pGen->pIn, pGen->pEnd, JX9_TK_LPAREN /* '(' */, JX9_TK_RPAREN /* ')' */, &pEnd);
	if( pEnd >= pGen->pEnd ){
		/* Syntax error */
		rc = jx9GenCompileError(pGen, E_ERROR, nLine, "Missing ')' after function '%z' signature", pName);
		if( rc == SXERR_ABORT ){
			/* Error count limit reached, abort immediately */
			return SXERR_ABORT;
		}
		pGen->pIn = pGen->pEnd;
		return SXRET_OK;
	}
	/* Create the function state */
	pFunc = (jx9_vm_func *)SyMemBackendPoolAlloc(&pGen->pVm->sAllocator, sizeof(jx9_vm_func));
	if( pFunc == 0 ){
		goto OutOfMem;
	}
	/* function ID */
	zName = SyMemBackendStrDup(&pGen->pVm->sAllocator, pName->zString, pName->nByte);
	if( zName == 0 ){
		/* Don't worry about freeing memory, everything will be released shortly */
		goto OutOfMem;
	}
	/* Initialize the function state */
	jx9VmInitFuncState(pGen->pVm, pFunc, zName, pName->nByte, iFlags, 0);
	if( pGen->pIn < pEnd ){
		/* Collect function arguments */
		rc = GenStateCollectFuncArgs(pFunc, &(*pGen), pEnd);
		if( rc == SXERR_ABORT ){
			/* Don't worry about freeing memory, everything will be released shortly */
			return SXERR_ABORT;
		}
	}
	/* Compile function body */
	pGen->pIn = &pEnd[1];
	/* Compile the body */
	rc = GenStateCompileFuncBody(&(*pGen), pFunc);
	if( rc == SXERR_ABORT ){
		return SXERR_ABORT;
	}
	if( ppFunc ){
		*ppFunc = pFunc;
	}
	/* Finally register the function */
	rc = jx9VmInstallUserFunction(pGen->pVm, pFunc, 0);
	return rc;
	/* Fall through if something goes wrong */
OutOfMem:
	/* 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 GenStateOutOfMem(pGen);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, %r8
movq %rsi, %r12
movq %rdi, %rbx
movq 0x158(%rdi), %r14
movq 0x160(%rdi), %rax
movl 0x14(%r14), %edx
addq $0x20, %r14
movq %r14, 0x158(%rdi)
cmpq %rax, %r14
jae 0x4d22f
movl $0x1, %ecx
movl 0x10(%r14), %esi
btl $0x9, %esi
jb 0x4d224
btl $0xa, %esi
jae 0x4d226
cmpl $0x2, %ecx
jl 0x4d22f
decl %ecx
jmp 0x4d226
incl %ecx
addq $0x20, %r14
cmpq %rax, %r14
jb 0x4d20b
cmpq %rax, %r14
jae 0x4d682
movq %r8, -0x40(%rbp)
movq (%rbx), %rdi
movl $0xb0, %esi
callq 0x2e951
testq %rax, %rax
je 0x4d6c0
movq %rax, %r15
movq (%rbx), %rdi
movq (%r12), %rsi
movl 0x8(%r12), %edx
callq 0x3e425
testq %rax, %rax
je 0x4d6c0
movq %rax, %r13
movq %r15, -0x30(%rbp)
movq (%rbx), %r15
movl 0x8(%r12), %eax
movl %eax, -0x38(%rbp)
xorl %r12d, %r12d
movl $0xb0, %edx
movq -0x30(%rbp), %rdi
xorl %esi, %esi
callq 0xc360
movl $0x40, %eax
movq -0x30(%rbp), %rcx
movq %rax, 0x18(%rcx)
movq -0x30(%rbp), %rcx
movq %r15, (%rcx)
xorps %xmm0, %xmm0
movq -0x30(%rbp), %rcx
movups %xmm0, 0x8(%rcx)
movq -0x30(%rbp), %rcx
movq %r12, 0x20(%rcx)
movq -0x30(%rbp), %rcx
movq %rax, 0x40(%rcx)
movq -0x30(%rbp), %rax
movq %r15, 0x28(%rax)
movq -0x30(%rbp), %rax
movups %xmm0, 0x30(%rax)
movq -0x30(%rbp), %rax
movq %r12, 0x48(%rax)
movq -0x30(%rbp), %rax
leaq 0x60(%rax), %rdi
movq -0x30(%rbp), %rax
movq $0x18, 0x78(%rax)
movq -0x30(%rbp), %rax
movq %r15, 0x60(%rax)
movq -0x30(%rbp), %r15
movups %xmm0, 0x68(%r15)
movq %r12, 0x80(%r15)
movq %rdi, -0x98(%rbp)
movl $0x10, %esi
callq 0x49141
movl $0x0, 0x88(%r15)
movq %r12, 0xa0(%r15)
movq %r13, 0x50(%r15)
movl -0x38(%rbp), %eax
movl %eax, 0x58(%r15)
movq 0x158(%rbx), %r12
cmpq %r14, %r12
movq -0x40(%rbp), %r13
jae 0x4d72c
movq (%rbx), %rax
leaq -0xd0(%rbp), %rcx
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rcx)
movq %rax, (%rcx)
movl $0x0, 0x18(%rcx)
movaps %xmm0, -0x60(%rbp)
movaps %xmm0, -0x70(%rbp)
movaps %xmm0, -0x80(%rbp)
movaps %xmm0, -0x90(%rbp)
movq (%rbx), %rax
movabsq $0x1800000000, %rcx     # imm = 0x1800000000
movq %rcx, -0x6c(%rbp)
xorl %ecx, %ecx
movl %ecx, -0x70(%rbp)
movl %ecx, -0x64(%rbp)
movq %rax, -0x80(%rbp)
movq %rcx, -0x78(%rbp)
movq %rcx, -0x60(%rbp)
movl 0x10(%r12), %eax
testb $0xc, %al
je 0x4d410
testb $0x4, %al
je 0x4d40c
movq 0x18(%r12), %rax
testw %ax, %ax
js 0x4d3ea
btl $0x10, %eax
jb 0x4d3f3
btl $0x12, %eax
jb 0x4d3fc
btl $0x11, %eax
jb 0x4d405
movq 0x158(%rbx), %rax
movl 0x14(%rax), %edx
movq %rbx, %rdi
movl $0x2, %esi
leaq 0x2a403(%rip), %rcx     # 0x777e1
movq %r12, %r8
xorl %eax, %eax
callq 0x49434
jmp 0x4d40c
movl $0x8, -0x58(%rbp)
jmp 0x4d40c
movl $0x2, -0x58(%rbp)
jmp 0x4d40c
movl $0x1, -0x58(%rbp)
jmp 0x4d40c
movl $0x4, -0x58(%rbp)
addq $0x20, %r12
cmpq %r14, %r12
jae 0x4d6f8
testb $0x10, 0x10(%r12)
je 0x4d6e5
leaq 0x20(%r12), %rax
cmpq %r14, %rax
jae 0x4d6e5
testb $0xc, 0x30(%r12)
je 0x4d6e5
movq (%rbx), %rdi
movq 0x20(%r12), %rsi
movl 0x28(%r12), %edx
callq 0x3e425
testq %rax, %rax
je 0x4d87b
movq %rax, -0x90(%rbp)
movl 0x28(%r12), %eax
movl %eax, -0x88(%rbp)
leaq 0x40(%r12), %r15
cmpq %r14, %r15
jae 0x4d5c9
testb $0x40, 0x52(%r12)
jne 0x4d48a
movl -0x38(%rbp), %ecx
jmp 0x4d5b2
leaq 0x60(%r12), %r15
xorl %eax, %eax
movq %r15, %r13
cmpq %r14, %r15
jae 0x4d4e4
movl $0x60, %ecx
movq %r15, %r13
movl 0x10(%r13), %edx
btl $0x11, %edx
jae 0x4d4af
testl %eax, %eax
jle 0x4d4dd
movl %edx, %esi
andl $0x1480, %esi           # imm = 0x1480
negl %esi
movl $0x0, %esi
sbbl %esi, %esi
testl $0xa40, %edx            # imm = 0xA40
movl $0x1, %edx
cmovnel %edx, %esi
addl %esi, %eax
addq $0x20, %rcx
addq $0x20, %r13
cmpq %r14, %r13
jb 0x4d4a1
cmpq $0x61, %rcx
setae %al
testb %al, %al
je 0x4d585
movups 0x158(%rbx), %xmm0
movaps %xmm0, -0xb0(%rbp)
movq %r15, 0x158(%rbx)
movq %r13, 0x160(%rbx)
movq (%rbx), %rax
movq 0xf0(%rax), %r12
leaq -0x80(%rbp), %rcx
movq %rcx, 0xf0(%rax)
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4a7a9
movl %eax, -0x44(%rbp)
movq (%rbx), %rdi
xorl %edx, %edx
cmpl $-0x3, %eax
setne %dl
movl $0x1, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x493c1
movq (%rbx), %rax
leaq 0xc8(%rax), %rcx
testq %r12, %r12
cmovneq %r12, %rcx
movq %rcx, 0xf0(%rax)
movaps -0xb0(%rbp), %xmm0
movups %xmm0, 0x158(%rbx)
movl -0x44(%rbp), %eax
cmpl $-0xa, %eax
setne %r12b
cmovneq %r13, %r15
movl -0x38(%rbp), %ecx
cmovel %eax, %ecx
jmp 0x4d5a5
movl 0x74(%r12), %edx
xorl %r12d, %r12d
movq %rbx, %rdi
movl $0x1, %esi
leaq 0x2a2b2(%rip), %rcx     # 0x7784e
xorl %eax, %eax
callq 0x49434
movl %eax, %ecx
movq -0x40(%rbp), %r13
testb %r12b, %r12b
je 0x4d71a
cmpq %r14, %r15
jae 0x4d5c2
testb $0x2, 0x12(%r15)
je 0x4d8a0
movl %ecx, -0x38(%rbp)
addq $0x20, %r15
movq %r15, %r12
movl -0x58(%rbp), %eax
testl %eax, %eax
movq -0x30(%rbp), %r15
je 0x4d63b
movl $0x6e, -0x34(%rbp)
leal -0x1(%rax), %ecx
cmpl $0x7, %ecx
ja 0x4d5ff
leaq 0x271cf(%rip), %rdx     # 0x747bc
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movl $0x73, -0x34(%rbp)
jmp 0x4d626
cmpl $0x40, %eax
jne 0x4d626
movl $0x68, -0x34(%rbp)
jmp 0x4d626
movl $0x66, -0x34(%rbp)
jmp 0x4d626
movl $0x62, -0x34(%rbp)
jmp 0x4d626
movl $0x69, -0x34(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0x34(%rbp), %rsi
movl $0x1, %edx
callq 0x360ae
movq %r15, %rdi
leaq -0x90(%rbp), %rsi
callq 0x336fc
cmpq %r14, %r12
xorps %xmm0, %xmm0
jb 0x4d364
movl -0xc0(%rbp), %eax
xorl %ecx, %ecx
testl %eax, %eax
je 0x4d71a
movq -0xc8(%rbp), %rcx
movq %rcx, 0x90(%r15)
xorl %ecx, %ecx
movl %eax, 0x98(%r15)
jmp 0x4d71a
leaq 0x2a12e(%rip), %rcx     # 0x777b7
movq %rbx, %rdi
movl $0x1, %esi
movq %r12, %r8
xorl %eax, %eax
callq 0x49434
movl %eax, %ecx
movl $0xfffffff6, %eax       # imm = 0xFFFFFFF6
cmpl $-0xa, %ecx
je 0x4d7f4
movq 0x160(%rbx), %rax
movq %rax, 0x158(%rbx)
xorl %eax, %eax
jmp 0x4d7f4
leaq 0x2a087(%rip), %rcx     # 0x7774e
movq %rbx, %rdi
movl $0x1, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0x49434
movl $0xfffffff6, %eax       # imm = 0xFFFFFFF6
jmp 0x4d7f4
movq 0x158(%rbx), %rax
movl 0x14(%rax), %edx
leaq 0x2a142(%rip), %rcx     # 0x77838
jmp 0x4d709
movq 0x158(%rbx), %rax
movl 0x14(%rax), %edx
leaq 0x2a119(%rip), %rcx     # 0x77822
movq %rbx, %rdi
movl $0x1, %esi
xorl %eax, %eax
callq 0x49434
movl %eax, %ecx
movl $0xfffffff6, %eax       # imm = 0xFFFFFFF6
cmpl $-0xa, %ecx
movq -0x30(%rbp), %r15
je 0x4d7f4
addq $0x20, %r14
movq %r14, 0x158(%rbx)
movq (%rbx), %rax
movq 0xf0(%rax), %rax
movl 0x10(%rax), %edx
leaq -0x90(%rbp), %r8
movq %rbx, %rdi
movl $0xa, %esi
movq %r15, %rcx
callq 0x4cf52
movl %eax, %r12d
testl %eax, %eax
je 0x4d77f
leaq 0x29fe5(%rip), %rcx     # 0x7774e
movq %rbx, %rdi
movl $0x1, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0x49434
jmp 0x4d7ea
movq (%rbx), %rax
movq 0xf0(%rax), %r14
movq -0x98(%rbp), %rcx
movq %rcx, 0xf0(%rax)
movq %rbx, %rdi
callq 0x4d031
movq (%rbx), %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x493c1
movq (%rbx), %rax
leaq 0xc8(%rax), %rcx
testq %r14, %r14
cmovneq %r14, %rcx
movq %rcx, 0xf0(%rax)
movq 0xc8(%rbx), %rdi
testq %rdi, %rdi
je 0x4d7ea
movq 0x8(%rdi), %rax
movq %rax, 0xc8(%rbx)
callq 0x4955d
movl $0xfffffff6, %eax       # imm = 0xFFFFFFF6
testl %r12d, %r12d
je 0x4d806
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %r13, %r13
je 0x4d80f
movq %r15, (%r13)
movq (%rbx), %rax
leaq 0x308(%rax), %rbx
movl 0x58(%r15), %edx
xorl %ecx, %ecx
testl %edx, %edx
je 0x4d83b
cmpl $0x0, 0x330(%rax)
je 0x4d83b
movq 0x50(%r15), %rsi
movq %rbx, %rdi
callq 0x4573a
movq %rax, %rcx
testq %rcx, %rcx
je 0x4d858
movq 0x10(%rcx), %rdx
xorl %eax, %eax
cmpq %r15, %rdx
je 0x4d7f4
movq %rdx, 0xa8(%r15)
movq %r15, 0x10(%rcx)
jmp 0x4d7f4
movq $0x0, 0xa8(%r15)
movq 0x50(%r15), %rsi
movl 0x58(%r15), %edx
movq %rbx, %rdi
movq %r15, %rcx
callq 0x4542b
jmp 0x4d7f4
leaq 0x29ecc(%rip), %rcx     # 0x7774e
movq %rbx, %rdi
movl $0x1, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0x49434
movl $0xfffffff6, %ecx       # imm = 0xFFFFFFF6
jmp 0x4d71a
movl 0x14(%r15), %edx
leaq 0x2a3c2(%rip), %rcx     # 0x77c6d
movq %rbx, %rdi
movl $0x1, %esi
movq %r15, %r8
xorl %eax, %eax
callq 0x49434
jmp 0x4d718