// File: /workspace/github_c_makefile_star2_O1/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: jx9Vfs_putenv
static int jx9Vfs_putenv(jx9_context *pCtx, int nArg, jx9_value **apArg)
{
	const char *zName, *zValue;
	char *zSettings, *zEnd;
	jx9_vfs *pVfs;
	int iLen, rc;
	if( nArg < 1 || !jx9_value_is_string(apArg[0]) ){
		/* Missing/Invalid argument, return FALSE */
		jx9_result_bool(pCtx, 0);
		return JX9_OK;
	}
	/* Extract the setting variable */
	zSettings = (char *)jx9_value_to_string(apArg[0], &iLen);
	if( iLen < 1 ){
		/* Empty string, return FALSE */
		jx9_result_bool(pCtx, 0);
		return JX9_OK;
	}
	/* Parse the setting */
	zEnd = &zSettings[iLen];
	zValue = 0;
	zName = zSettings;
	while( zSettings < zEnd ){
		if( zSettings[0] == '=' ){
			/* Null terminate the name */
			zSettings[0] = 0;
			zValue = &zSettings[1];
			break;
		}
		zSettings++;
	}
	/* Install the environment variable in the $_Env array */
	if( zValue == 0 || zName[0] == 0 || zValue >= zEnd || zName >= zValue ){
		/* Invalid settings, retun FALSE */
		jx9_result_bool(pCtx, 0);
		if( zSettings  < zEnd ){
			zSettings[0] = '=';
		}
		return JX9_OK;
	}
	jx9_vm_config(pCtx->pVm, JX9_VM_CONFIG_ENV_ATTR, zName, zValue, (int)(zEnd-zValue));
	/* Point to the underlying vfs */
	pVfs = (jx9_vfs *)jx9_context_user_data(pCtx);
	if( pVfs == 0 || pVfs->xSetenv == 0 ){
		/* IO routine not implemented, return NULL */
		jx9_context_throw_error_format(pCtx, JX9_CTX_WARNING, 
			"IO routine(%s) not implemented in the underlying VFS, JX9 is returning FALSE", 
			jx9_function_name(pCtx)
			);
		jx9_result_bool(pCtx, 0);
		zSettings[0] = '=';
		return JX9_OK;
	}
	/* Perform the requested operation */
	rc = pVfs->xSetenv(zName, zValue);
	jx9_result_bool(pCtx, rc == JX9_OK );
	zSettings[0] = '=';
	return JX9_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
testl %esi, %esi
jle 0x616dc
movq (%rdx), %rdi
testb $0x1, 0x8(%rdi)
je 0x616dc
leaq -0x2c(%rbp), %r15
movq %r15, %rsi
callq 0x30b04
movslq (%r15), %r8
testq %r8, %r8
jle 0x616dc
movq %rax, %r14
addq %rax, %r8
movb $0x1, %r13b
cmpb $0x3d, (%rax)
movq %rax, %r12
je 0x61652
leaq 0x1(%r14), %r12
xorl %r15d, %r15d
cmpq %r8, %r12
setb %r13b
jae 0x6165c
leaq 0x1(%r12), %rax
cmpb $0x3d, (%r12)
movq %rax, %r12
jne 0x61634
decq %rax
movq %rax, %r12
movb $0x0, (%r12)
leaq 0x1(%r12), %r15
testq %r15, %r15
je 0x6170e
cmpb $0x0, (%r14)
setne %al
cmpq %r8, %r15
setb %cl
cmpq %r15, %r14
setb %dl
andb %cl, %dl
testb %al, %dl
je 0x6170e
movq 0x60(%rbx), %rdi
subl %r15d, %r8d
movl $0x9, %esi
movq %r14, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x47850
movq (%rbx), %rax
movq 0x20(%rax), %rcx
testq %rcx, %rcx
je 0x61736
movq 0xf8(%rcx), %rcx
testq %rcx, %rcx
je 0x61736
movq %r14, %rdi
movq %r15, %rsi
callq *%rcx
xorl %r14d, %r14d
testl %eax, %eax
sete %r14b
movq 0x8(%rbx), %rbx
movq %rbx, %rdi
callq 0x309f2
movq %r14, (%rbx)
jmp 0x61763
movq 0x8(%rbx), %rbx
movq %rbx, %rdi
callq 0x309f2
movq $0x0, (%rbx)
movl $0xfffffe90, %eax       # imm = 0xFFFFFE90
andl 0x8(%rbx), %eax
orl $0x8, %eax
movl %eax, 0x8(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rbx), %rbx
movq %rbx, %rdi
callq 0x309f2
movq $0x0, (%rbx)
movl $0xfffffe90, %eax       # imm = 0xFFFFFE90
andl 0x8(%rbx), %eax
orl $0x8, %eax
movl %eax, 0x8(%rbx)
testb %r13b, %r13b
je 0x616fd
jmp 0x61771
movq 0x8(%rax), %rcx
leaq 0x17e11(%rip), %rdx     # 0x79552
movq %rbx, %rdi
movl $0x2, %esi
xorl %eax, %eax
callq 0x45d26
movq 0x8(%rbx), %rbx
movq %rbx, %rdi
callq 0x309f2
movq $0x0, (%rbx)
movl $0xfffffe90, %eax       # imm = 0xFFFFFE90
andl 0x8(%rbx), %eax
orl $0x8, %eax
movl %eax, 0x8(%rbx)
movb $0x3d, (%r12)
jmp 0x616fd