// File: /workspace/github_c_makefile_star2_O1/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 0x5ab35
movq (%r12), %r14
testb $0x2, 0x8(%r14)
je 0x5ab26
movq %r14, %rdi
callq 0x3fd5f
movq (%r14), %rax
leaq -0x50(%rbp), %rdi
movq %rax, (%rdi)
callq 0xc770
testq %rax, %rax
jne 0x5ab2f
leaq -0x50(%rbp), %rdi
callq 0xc820
leaq -0x50(%rbp), %rdi
jmp 0x5ab44
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 0x317a5
testq %rax, %rax
je 0x5abf7
movq %rax, %r15
movq %r14, %rdi
callq 0x317eb
testq %rax, %rax
je 0x5abf7
movq %rax, %r14
cmpl $0x2, %r13d
movb $0x1, %r13b
jl 0x5abbe
movq 0x8(%r12), %r12
movq %r12, %rdi
callq 0x446ef
cmpl $0x0, (%r12)
sete %r13b
movq %r15, %rdi
callq 0x309f2
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 0x5ac05
testb $0x40, 0x8(%r14)
je 0x5ac17
movq (%r14), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x3f924
jmp 0x5ac17
movq 0x8(%r14), %rdi
callq 0x309f2
jmp 0x5ae87
leaq 0x1e4f5(%rip), %rsi     # 0x79101
movq %r14, %rdi
movq %r15, %rdx
callq 0x3106a
movq %r15, %rdi
callq 0x309f2
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 0x5ac51
testb $0x40, 0x8(%r14)
je 0x5ac63
movq (%r14), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x3f924
jmp 0x5ac63
leaq 0x1e4b0(%rip), %rsi     # 0x79108
movq %r14, %rdi
movq %r15, %rdx
callq 0x3106a
movq %r15, %rdi
callq 0x309f2
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 0x5ac9d
testb $0x40, 0x8(%r14)
je 0x5acaf
movq (%r14), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x3f924
jmp 0x5acaf
leaq 0x1e46b(%rip), %rsi     # 0x7910f
movq %r14, %rdi
movq %r15, %rdx
callq 0x3106a
movq %r15, %rdi
callq 0x309f2
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 0x5ace9
testb $0x40, 0x8(%r14)
je 0x5acfb
movq (%r14), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x3f924
jmp 0x5acfb
leaq 0x1e427(%rip), %rsi     # 0x79117
movq %r14, %rdi
movq %r15, %rdx
callq 0x3106a
movq %r15, %rdi
callq 0x309f2
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 0x5ad35
testb $0x40, 0x8(%r14)
je 0x5ad47
movq (%r14), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x3f924
jmp 0x5ad47
leaq 0x1e3e3(%rip), %rsi     # 0x7911f
movq %r14, %rdi
movq %r15, %rdx
callq 0x3106a
movq %r15, %rdi
callq 0x309f2
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 0x5ad81
testb $0x40, 0x8(%r14)
je 0x5ad93
movq (%r14), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x3f924
jmp 0x5ad93
leaq 0x1e39e(%rip), %rsi     # 0x79126
movq %r14, %rdi
movq %r15, %rdx
callq 0x3106a
movq %r15, %rdi
callq 0x309f2
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 0x5adcd
testb $0x40, 0x8(%r14)
je 0x5addf
movq (%r14), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x3f924
jmp 0x5addf
leaq 0x1e35a(%rip), %rsi     # 0x7912e
movq %r14, %rdi
movq %r15, %rdx
callq 0x3106a
movq %r15, %rdi
callq 0x309f2
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 0x5ae19
testb $0x40, 0x8(%r14)
je 0x5ae2b
movq (%r14), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x3f924
jmp 0x5ae2b
leaq 0x1e316(%rip), %rsi     # 0x79136
movq %r14, %rdi
movq %r15, %rdx
callq 0x3106a
movq %r15, %rdi
callq 0x309f2
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 0x5ae65
testb $0x40, 0x8(%r14)
je 0x5ae77
movq (%r14), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x3f924
jmp 0x5ae77
leaq 0x1e2d2(%rip), %rsi     # 0x7913e
movq %r14, %rdi
movq %r15, %rdx
callq 0x3106a
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rsi
movq %r14, %rdi
callq 0x3ebc8
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq