// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: jx9Builtin_localtime
static int jx9Builtin_localtime(jx9_context *pCtx, int nArg, jx9_value **apArg)
{
	jx9_value *pValue, *pArray;
	int isAssoc = 0;
	Sytm sTm;
	if( nArg < 1 ){
#ifdef __WINNT__
		SYSTEMTIME sOS;
		GetSystemTime(&sOS); /* TODO(chems): GMT not local */
		SYSTEMTIME_TO_SYTM(&sOS, &sTm);
#else
		struct tm *pTm;
		time_t t;
		time(&t);
		pTm = localtime(&t);
		STRUCT_TM_TO_SYTM(pTm, &sTm);
#endif
	}else{
		/* Use the given timestamp */
		time_t t;
		struct tm *pTm;
		if( jx9_value_is_int(apArg[0]) ){
			t = (time_t)jx9_value_to_int64(apArg[0]);
			pTm = localtime(&t);
			if( pTm == 0 ){
				time(&t);
			}
		}else{
			time(&t);
		}
		pTm = localtime(&t);
		STRUCT_TM_TO_SYTM(pTm, &sTm);
	}
	/* Element value */
	pValue = jx9_context_new_scalar(pCtx);
	if( pValue == 0 ){
		/* Return NULL */
		jx9_result_null(pCtx);
		return JX9_OK;
	}
	/* Create a new array */
	pArray = jx9_context_new_array(pCtx);
	if( pArray == 0 ){
		/* Return NULL */
		jx9_result_null(pCtx);
		return JX9_OK;
	}
	if( nArg > 1 ){
		isAssoc = jx9_value_to_bool(apArg[1]); 
	}
	/* Fill the array */
	/* Seconds */
	jx9_value_int(pValue, sTm.tm_sec);
	if( isAssoc ){
		jx9_array_add_strkey_elem(pArray, "tm_sec", pValue);
	}else{
		jx9_array_add_elem(pArray, 0/* Automatic index */, pValue);
	}
	/* Minutes */
	jx9_value_int(pValue, sTm.tm_min);
	if( isAssoc ){
		jx9_array_add_strkey_elem(pArray, "tm_min", pValue);
	}else{
		jx9_array_add_elem(pArray, 0/* Automatic index */, pValue);
	}
	/* Hours */
	jx9_value_int(pValue, sTm.tm_hour);
	if( isAssoc ){
		jx9_array_add_strkey_elem(pArray, "tm_hour", pValue);
	}else{
		jx9_array_add_elem(pArray, 0/* Automatic index */, pValue);
	}
	/* mday */
	jx9_value_int(pValue, sTm.tm_mday);
	if( isAssoc ){
		jx9_array_add_strkey_elem(pArray, "tm_mday", pValue);
	}else{
		jx9_array_add_elem(pArray, 0/* Automatic index */, pValue);
	}
	/* mon */
	jx9_value_int(pValue, sTm.tm_mon);
	if( isAssoc ){
		jx9_array_add_strkey_elem(pArray, "tm_mon", pValue);
	}else{
		jx9_array_add_elem(pArray, 0/* Automatic index */, pValue);
	}
	/* year since 1900 */
	jx9_value_int(pValue, sTm.tm_year-1900);
	if( isAssoc ){
		jx9_array_add_strkey_elem(pArray, "tm_year", pValue);
	}else{
		jx9_array_add_elem(pArray, 0/* Automatic index */, pValue);
	}
	/* wday */
	jx9_value_int(pValue, sTm.tm_wday);
	if( isAssoc ){
		jx9_array_add_strkey_elem(pArray, "tm_wday", pValue);
	}else{
		jx9_array_add_elem(pArray, 0/* Automatic index */, pValue);
	}
	/* yday */
	jx9_value_int(pValue, sTm.tm_yday);
	if( isAssoc ){
		jx9_array_add_strkey_elem(pArray, "tm_yday", pValue);
	}else{
		jx9_array_add_elem(pArray, 0/* Automatic index */, pValue);
	}
	/* isdst */
#ifdef __WINNT__
#ifdef _MSC_VER
#ifndef _WIN32_WCE
			_get_daylight(&sTm.tm_isdst);
#endif
#endif
#endif
	jx9_value_int(pValue, sTm.tm_isdst);
	if( isAssoc ){
		jx9_array_add_strkey_elem(pArray, "tm_isdst", pValue);
	}else{
		jx9_array_add_elem(pArray, 0/* Automatic index */, pValue);
	}
	/* Return the array */
	jx9_result_value(pCtx, pArray);
	return JX9_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %esi, %r14d
movq %rdi, %r13
testl %esi, %esi
movq %rdx, -0x68(%rbp)
jle 0x4ceef
movq (%rdx), %rdi
testb $0x2, 0x8(%rdi)
je 0x4cee0
callq 0x297ae
leaq -0x50(%rbp), %rdi
movq %rax, (%rdi)
callq 0xc7a0
testq %rax, %rax
jne 0x4cee9
leaq -0x50(%rbp), %rdi
callq 0xc850
leaq -0x50(%rbp), %rdi
jmp 0x4cefe
leaq -0x50(%rbp), %rbx
movq %rbx, %rdi
callq 0xc850
movq %rbx, %rdi
callq 0xc7a0
movl 0x8(%rax), %ecx
movl %ecx, -0x30(%rbp)
movl (%rax), %ebx
movl 0x4(%rax), %ecx
movl %ecx, -0x2c(%rbp)
movl 0x10(%rax), %ecx
movl %ecx, -0x38(%rbp)
movl 0xc(%rax), %ecx
movl %ecx, -0x34(%rbp)
movl 0x14(%rax), %ecx
movl %ecx, -0x3c(%rbp)
movl 0x1c(%rax), %ecx
movl %ecx, -0x44(%rbp)
movl 0x18(%rax), %ecx
movl %ecx, -0x40(%rbp)
movl 0x20(%rax), %r15d
movq %r13, %rdi
callq 0x2a26a
testq %rax, %rax
je 0x4cf95
movq %rax, %r12
movl %r15d, -0x54(%rbp)
movq %r13, %rdi
callq 0x2a2b0
testq %rax, %rax
je 0x4cf95
movq %rax, %r15
movq %r13, -0x60(%rbp)
movb $0x1, %r13b
cmpl $0x2, %r14d
jl 0x4cf77
movq -0x68(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x29790
testl %eax, %eax
sete %r13b
movq %r12, %rdi
movl %ebx, %esi
callq 0x29489
testb %r13b, %r13b
je 0x4cfa2
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x29c4b
jmp 0x4cfb4
movq %r13, %rdi
callq 0x298e8
jmp 0x4d148
leaq 0x1a143(%rip), %rsi     # 0x670ec
movq %r15, %rdi
movq %r12, %rdx
callq 0x29c6c
movq %r12, %rdi
movl -0x2c(%rbp), %esi
callq 0x29489
testb %r13b, %r13b
je 0x4cfd3
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x29c4b
jmp 0x4cfe5
leaq 0x1a119(%rip), %rsi     # 0x670f3
movq %r15, %rdi
movq %r12, %rdx
callq 0x29c6c
movq %r12, %rdi
movl -0x30(%rbp), %esi
callq 0x29489
testb %r13b, %r13b
je 0x4d004
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x29c4b
jmp 0x4d016
leaq 0x1a0ef(%rip), %rsi     # 0x670fa
movq %r15, %rdi
movq %r12, %rdx
callq 0x29c6c
movq %r12, %rdi
movl -0x34(%rbp), %esi
callq 0x29489
testb %r13b, %r13b
je 0x4d035
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x29c4b
jmp 0x4d047
leaq 0x1a0c6(%rip), %rsi     # 0x67102
movq %r15, %rdi
movq %r12, %rdx
callq 0x29c6c
movq %r12, %rdi
movl -0x38(%rbp), %esi
callq 0x29489
testb %r13b, %r13b
je 0x4d066
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x29c4b
jmp 0x4d078
leaq 0x1a09d(%rip), %rsi     # 0x6710a
movq %r15, %rdi
movq %r12, %rdx
callq 0x29c6c
movq %r12, %rdi
movl -0x3c(%rbp), %esi
callq 0x29489
testb %r13b, %r13b
je 0x4d097
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x29c4b
jmp 0x4d0a9
leaq 0x1a073(%rip), %rsi     # 0x67111
movq %r15, %rdi
movq %r12, %rdx
callq 0x29c6c
movq %r12, %rdi
movl -0x40(%rbp), %esi
callq 0x29489
testb %r13b, %r13b
je 0x4d0c8
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x29c4b
jmp 0x4d0da
leaq 0x1a04a(%rip), %rsi     # 0x67119
movq %r15, %rdi
movq %r12, %rdx
callq 0x29c6c
movq %r12, %rdi
movl -0x44(%rbp), %esi
callq 0x29489
testb %r13b, %r13b
je 0x4d0f9
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x29c4b
jmp 0x4d10b
leaq 0x1a021(%rip), %rsi     # 0x67121
movq %r15, %rdi
movq %r12, %rdx
callq 0x29c6c
movq %r12, %rdi
movl -0x54(%rbp), %esi
callq 0x29489
testb %r13b, %r13b
je 0x4d12a
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x29c4b
jmp 0x4d13c
leaq 0x19ff8(%rip), %rsi     # 0x67129
movq %r15, %rdi
movq %r12, %rdx
callq 0x29c6c
movq -0x60(%rbp), %rdi
movq %r15, %rsi
callq 0x299d3
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq