// File: /workspace/github_c_makefile_star2_O3/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 $0x38, %rsp
movq %rdx, %r12
movl %esi, %r13d
movq %rdi, -0x58(%rbp)
testl %esi, %esi
jle 0x593b5
movq (%r12), %r14
testb $0x2, 0x8(%r14)
je 0x593a6
movq %r14, %rdi
callq 0x3f362
movq (%r14), %rax
leaq -0x50(%rbp), %rdi
movq %rax, (%rdi)
callq 0xc770
testq %rax, %rax
jne 0x593af
leaq -0x50(%rbp), %rdi
callq 0xc820
leaq -0x50(%rbp), %rdi
jmp 0x593c4
leaq -0x50(%rbp), %r14
movq %r14, %rdi
callq 0xc820
movq %r14, %rdi
callq 0xc770
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), %eax
movl %eax, -0x48(%rbp)
movq -0x58(%rbp), %r14
movq %r14, %rdi
callq 0x311eb
testq %rax, %rax
je 0x59477
movq %rax, %r15
movq %r14, %rdi
callq 0x31231
testq %rax, %rax
je 0x59477
movq %rax, %r14
cmpl $0x2, %r13d
movb $0x1, %r13b
jl 0x5943e
movq 0x8(%r12), %r12
movq %r12, %rdi
callq 0x438dd
cmpl $0x0, (%r12)
sete %r13b
movq %r15, %rdi
callq 0x30465
movslq %ebx, %rax
movq %rax, (%r15)
movl $0xfffffe90, %eax       # imm = 0xFFFFFE90
andl 0x8(%r15), %eax
orl $0x2, %eax
movl %eax, 0x8(%r15)
testb %r13b, %r13b
je 0x59485
testb $0x40, 0x8(%r14)
je 0x59497
movq (%r14), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x3ef1d
jmp 0x59497
movq 0x8(%r14), %rdi
callq 0x30465
jmp 0x59707
leaq 0x1dc80(%rip), %rsi     # 0x7710c
movq %r14, %rdi
movq %r15, %rdx
callq 0x30ad3
movq %r15, %rdi
callq 0x30465
movslq -0x2c(%rbp), %rax
movq %rax, (%r15)
movl $0xfffffe90, %eax       # imm = 0xFFFFFE90
andl 0x8(%r15), %eax
orl $0x2, %eax
movl %eax, 0x8(%r15)
testb %r13b, %r13b
je 0x594d1
testb $0x40, 0x8(%r14)
je 0x594e3
movq (%r14), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x3ef1d
jmp 0x594e3
leaq 0x1dc3b(%rip), %rsi     # 0x77113
movq %r14, %rdi
movq %r15, %rdx
callq 0x30ad3
movq %r15, %rdi
callq 0x30465
movslq -0x30(%rbp), %rax
movq %rax, (%r15)
movl $0xfffffe90, %eax       # imm = 0xFFFFFE90
andl 0x8(%r15), %eax
orl $0x2, %eax
movl %eax, 0x8(%r15)
testb %r13b, %r13b
je 0x5951d
testb $0x40, 0x8(%r14)
je 0x5952f
movq (%r14), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x3ef1d
jmp 0x5952f
leaq 0x1dbf6(%rip), %rsi     # 0x7711a
movq %r14, %rdi
movq %r15, %rdx
callq 0x30ad3
movq %r15, %rdi
callq 0x30465
movslq -0x34(%rbp), %rax
movq %rax, (%r15)
movl $0xfffffe90, %eax       # imm = 0xFFFFFE90
andl 0x8(%r15), %eax
orl $0x2, %eax
movl %eax, 0x8(%r15)
testb %r13b, %r13b
je 0x59569
testb $0x40, 0x8(%r14)
je 0x5957b
movq (%r14), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x3ef1d
jmp 0x5957b
leaq 0x1dbb2(%rip), %rsi     # 0x77122
movq %r14, %rdi
movq %r15, %rdx
callq 0x30ad3
movq %r15, %rdi
callq 0x30465
movslq -0x38(%rbp), %rax
movq %rax, (%r15)
movl $0xfffffe90, %eax       # imm = 0xFFFFFE90
andl 0x8(%r15), %eax
orl $0x2, %eax
movl %eax, 0x8(%r15)
testb %r13b, %r13b
je 0x595b5
testb $0x40, 0x8(%r14)
je 0x595c7
movq (%r14), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x3ef1d
jmp 0x595c7
leaq 0x1db6e(%rip), %rsi     # 0x7712a
movq %r14, %rdi
movq %r15, %rdx
callq 0x30ad3
movq %r15, %rdi
callq 0x30465
movslq -0x3c(%rbp), %rax
movq %rax, (%r15)
movl $0xfffffe90, %eax       # imm = 0xFFFFFE90
andl 0x8(%r15), %eax
orl $0x2, %eax
movl %eax, 0x8(%r15)
testb %r13b, %r13b
je 0x59601
testb $0x40, 0x8(%r14)
je 0x59613
movq (%r14), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x3ef1d
jmp 0x59613
leaq 0x1db29(%rip), %rsi     # 0x77131
movq %r14, %rdi
movq %r15, %rdx
callq 0x30ad3
movq %r15, %rdi
callq 0x30465
movslq -0x40(%rbp), %rax
movq %rax, (%r15)
movl $0xfffffe90, %eax       # imm = 0xFFFFFE90
andl 0x8(%r15), %eax
orl $0x2, %eax
movl %eax, 0x8(%r15)
testb %r13b, %r13b
je 0x5964d
testb $0x40, 0x8(%r14)
je 0x5965f
movq (%r14), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x3ef1d
jmp 0x5965f
leaq 0x1dae5(%rip), %rsi     # 0x77139
movq %r14, %rdi
movq %r15, %rdx
callq 0x30ad3
movq %r15, %rdi
callq 0x30465
movslq -0x44(%rbp), %rax
movq %rax, (%r15)
movl $0xfffffe90, %eax       # imm = 0xFFFFFE90
andl 0x8(%r15), %eax
orl $0x2, %eax
movl %eax, 0x8(%r15)
testb %r13b, %r13b
je 0x59699
testb $0x40, 0x8(%r14)
je 0x596ab
movq (%r14), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x3ef1d
jmp 0x596ab
leaq 0x1daa1(%rip), %rsi     # 0x77141
movq %r14, %rdi
movq %r15, %rdx
callq 0x30ad3
movq %r15, %rdi
callq 0x30465
movslq -0x48(%rbp), %rax
movq %rax, (%r15)
movl $0xfffffe90, %eax       # imm = 0xFFFFFE90
andl 0x8(%r15), %eax
orl $0x2, %eax
movl %eax, 0x8(%r15)
testb %r13b, %r13b
je 0x596e5
testb $0x40, 0x8(%r14)
je 0x596f7
movq (%r14), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x3ef1d
jmp 0x596f7
leaq 0x1da5d(%rip), %rsi     # 0x77149
movq %r14, %rdi
movq %r15, %rdx
callq 0x30ad3
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rsi
movq %r14, %rdi
callq 0x3e19f
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq