// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: jx9Builtin_date
static int jx9Builtin_date(jx9_context *pCtx, int nArg, jx9_value **apArg)
{
	const char *zFormat;
	int nLen;
	Sytm sTm;
	if( nArg < 1 || !jx9_value_is_string(apArg[0]) ){
		/* Missing/Invalid argument, return FALSE */
		jx9_result_bool(pCtx, 0);
		return JX9_OK;
	}
	zFormat = jx9_value_to_string(apArg[0], &nLen);
	if( nLen < 1 ){
		/* Don't bother processing return the empty string */
		jx9_result_string(pCtx, "", 0);
	}
	if( nArg < 2 ){
#ifdef __WINNT__
		SYSTEMTIME sOS;
		GetSystemTime(&sOS);
		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[1]) ){
			t = (time_t)jx9_value_to_int64(apArg[1]);
			pTm = localtime(&t);
			if( pTm == 0 ){
				time(&t);
			}
		}else{
			time(&t);
		}
		pTm = localtime(&t);
		STRUCT_TM_TO_SYTM(pTm, &sTm);
	}
	/* Format the given string */
	DateFormat(pCtx, zFormat, nLen, &sTm);
	return JX9_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
cmpl $0x1, -0x14(%rbp)
jl 0x97aed
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x57480
cmpl $0x0, %eax
jne 0x97b04
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x57070
movl $0x0, -0x4(%rbp)
jmp 0x97cc8
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x56e20
movq %rax, -0x28(%rbp)
cmpl $0x1, -0x2c(%rbp)
jge 0x97b30
movq -0x10(%rbp), %rdi
leaq 0x2e022(%rip), %rsi     # 0xc5b4b
xorl %edx, %edx
callq 0x57180
cmpl $0x2, -0x14(%rbp)
jge 0x97bc3
leaq -0x78(%rbp), %rdi
callq 0xd980
leaq -0x78(%rbp), %rdi
callq 0xd8b0
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x60(%rbp)
movq -0x70(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x64(%rbp)
movq -0x70(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x68(%rbp)
movq -0x70(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x58(%rbp)
movq -0x70(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x5c(%rbp)
movq -0x70(%rbp), %rax
movl 0x14(%rax), %eax
addl $0x76c, %eax            # imm = 0x76C
movl %eax, -0x54(%rbp)
movq -0x70(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x4c(%rbp)
movq -0x70(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x50(%rbp)
movq -0x70(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x48(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
jmp 0x97cad
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x57390
cmpl $0x0, %eax
je 0x97c0b
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x56d50
movq %rax, -0x80(%rbp)
leaq -0x80(%rbp), %rdi
callq 0xd8b0
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x88(%rbp)
jne 0x97c09
leaq -0x80(%rbp), %rdi
callq 0xd980
jmp 0x97c14
leaq -0x80(%rbp), %rdi
callq 0xd980
leaq -0x80(%rbp), %rdi
callq 0xd8b0
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x60(%rbp)
movq -0x88(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x64(%rbp)
movq -0x88(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x68(%rbp)
movq -0x88(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x58(%rbp)
movq -0x88(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x5c(%rbp)
movq -0x88(%rbp), %rax
movl 0x14(%rax), %eax
addl $0x76c, %eax            # imm = 0x76C
movl %eax, -0x54(%rbp)
movq -0x88(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x4c(%rbp)
movq -0x88(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x50(%rbp)
movq -0x88(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x48(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x2c(%rbp), %edx
leaq -0x68(%rbp), %rcx
callq 0x9d420
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)