// File: /workspace/github_c_makefile_star2_O3/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: jx9Builtin_pathinfo
static int jx9Builtin_pathinfo(jx9_context *pCtx, int nArg, jx9_value **apArg)
{
	const char *zPath;
	path_info sInfo;
	SyString *pComp;
	int iLen;
	if( nArg < 1 || !jx9_value_is_string(apArg[0]) ){
		/* Missing/Invalid argument, return the empty string */
		jx9_result_string(pCtx, "", 0);
		return JX9_OK;
	}
	/* Point to the target path */
	zPath = jx9_value_to_string(apArg[0], &iLen);
	if( iLen < 1 ){
		/* Empty string */
		jx9_result_string(pCtx, "", 0);
		return JX9_OK;
	}
	/* Extract path info */
	ExtractPathInfo(zPath, iLen, &sInfo);
	if( nArg > 1 && jx9_value_is_int(apArg[1]) ){
		/* Return path component */
		int nComp = jx9_value_to_int(apArg[1]);
		switch(nComp){
		case 1: /* PATHINFO_DIRNAME */
			pComp = &sInfo.sDir;
			if( pComp->nByte > 0 ){
				jx9_result_string(pCtx, pComp->zString, (int)pComp->nByte);
			}else{
				/* Expand the empty string */
				jx9_result_string(pCtx, "", 0);
			}
			break;
		case 2: /*PATHINFO_BASENAME*/
			pComp = &sInfo.sBasename;
			if( pComp->nByte > 0 ){
				jx9_result_string(pCtx, pComp->zString, (int)pComp->nByte);
			}else{
				/* Expand the empty string */
				jx9_result_string(pCtx, "", 0);
			}
			break;
		case 3: /*PATHINFO_EXTENSION*/
			pComp = &sInfo.sExtension;
			if( pComp->nByte > 0 ){
				jx9_result_string(pCtx, pComp->zString, (int)pComp->nByte);
			}else{
				/* Expand the empty string */
				jx9_result_string(pCtx, "", 0);
			}
			break;
		case 4: /*PATHINFO_FILENAME*/
			pComp = &sInfo.sFilename;
			if( pComp->nByte > 0 ){
				jx9_result_string(pCtx, pComp->zString, (int)pComp->nByte);
			}else{
				/* Expand the empty string */
				jx9_result_string(pCtx, "", 0);
			}
			break;
		default:
			/* Expand the empty string */
			jx9_result_string(pCtx, "", 0);
			break;
		}
	}else{
		/* Return an associative array */
		jx9_value *pArray, *pValue;
		pArray = jx9_context_new_array(pCtx);
		pValue = jx9_context_new_scalar(pCtx);
		if( pArray == 0 || pValue == 0 ){
			/* Out of mem, return NULL */
			jx9_result_bool(pCtx, 0);
			return JX9_OK;
		}
		/* dirname */
		pComp = &sInfo.sDir;
		if( pComp->nByte > 0 ){
			jx9_value_string(pValue, pComp->zString, (int)pComp->nByte);
			/* Perform the insertion */
			jx9_array_add_strkey_elem(pArray, "dirname", pValue); /* Will make it's own copy */
		}
		/* Reset the string cursor */
		jx9_value_reset_string_cursor(pValue);
		/* basername */
		pComp = &sInfo.sBasename;
		if( pComp->nByte > 0 ){
			jx9_value_string(pValue, pComp->zString, (int)pComp->nByte);
			/* Perform the insertion */
			jx9_array_add_strkey_elem(pArray, "basename", pValue); /* Will make it's own copy */
		}
		/* Reset the string cursor */
		jx9_value_reset_string_cursor(pValue);
		/* extension */
		pComp = &sInfo.sExtension;
		if( pComp->nByte > 0 ){
			jx9_value_string(pValue, pComp->zString, (int)pComp->nByte);
			/* Perform the insertion */
			jx9_array_add_strkey_elem(pArray, "extension", pValue); /* Will make it's own copy */
		}
		/* Reset the string cursor */
		jx9_value_reset_string_cursor(pValue);
		/* filename */
		pComp = &sInfo.sFilename;
		if( pComp->nByte > 0 ){
			jx9_value_string(pValue, pComp->zString, (int)pComp->nByte);
			/* Perform the insertion */
			jx9_array_add_strkey_elem(pArray, "filename", pValue); /* Will make it's own copy */
		}
		/* Return the created array */
		jx9_result_value(pCtx, pArray);
		/* Don't worry about freeing memory, everything will be released
		 * automatically as soon we return from this foreign function.
		 */
	}
	return JX9_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %r15
testl %esi, %esi
jle 0x6060b
movq %rdx, %r12
movq (%rdx), %rdi
testb $0x1, 0x8(%rdi)
je 0x6060b
movl %esi, %ebx
leaq -0x5c(%rbp), %r14
movq %r14, %rsi
callq 0x30577
movslq (%r14), %rcx
testq %rcx, %rcx
jle 0x6060b
movq %r15, -0x38(%rbp)
cmpl $0x1, %ecx
jne 0x6062e
cmpb $0x2f, (%rax)
jne 0x6062e
movq %r12, %rdx
leaq 0x18fc1(%rip), %rax     # 0x795ac
movq %rax, -0x48(%rbp)
movl $0x1, %r13d
xorl %r15d, %r15d
xorl %r12d, %r12d
movq $0x0, -0x40(%rbp)
xorl %r14d, %r14d
jmp 0x606d1
movq 0x8(%r15), %rdi
leaq 0x1705c(%rip), %rsi     # 0x77672
xorl %edx, %edx
callq 0x302f6
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq (%rax,%rcx), %r15
leaq (%rcx,%rax), %rdx
decq %rdx
cmpq %rax, %rdx
jbe 0x60650
leaq -0x1(%rdx), %r14
cmpb $0x2f, (%rdx)
movq %r14, %rdx
jne 0x60639
addq $0x2, %r14
jmp 0x60653
movq %rax, %r14
movq %r14, %r13
subq %rax, %r13
cmpl $0x2, %r13d
jb 0x60682
movl %r13d, %edx
decl %edx
cmpb $0x2f, (%rax,%rdx)
jne 0x606a5
movq %rdx, %rsi
subq $0x1, %rsi
jb 0x606a2
decl %r13d
cmpb $0x2f, -0x1(%rax,%rdx)
movq %rsi, %rdx
je 0x6066d
jmp 0x606a5
cmpb $0x2f, (%rax)
movl $0x1, %edx
cmovnel %r13d, %edx
leaq 0x18f17(%rip), %rsi     # 0x795ac
cmovneq %rax, %rsi
movq %rsi, -0x48(%rbp)
movl %edx, %r13d
jmp 0x606a9
xorl %r13d, %r13d
movq %rax, -0x48(%rbp)
subl %r14d, %r15d
je 0x606c0
cmpb $0x2f, (%r14)
jne 0x608be
incq %r14
decl %r15d
jne 0x606ae
movq %r12, %rdx
xorl %r15d, %r15d
xorl %r12d, %r12d
movq $0x0, -0x40(%rbp)
movl $0x0, -0x2c(%rbp)
cmpl $0x1, %ebx
je 0x606eb
movq 0x8(%rdx), %rbx
testb $0x2, 0x8(%rbx)
jne 0x6087c
movq %r12, -0x58(%rbp)
movq -0x38(%rbp), %r12
movq %r12, %rdi
callq 0x31231
movq %rax, %rbx
movq %r12, %rdi
callq 0x311eb
movq %rbx, -0x50(%rbp)
testq %rbx, %rbx
setne %dl
testq %rax, %rax
setne %cl
testb %cl, %dl
je 0x60852
testl %r13d, %r13d
movq %rax, %rbx
je 0x6074b
movq %rbx, %rdi
movq -0x48(%rbp), %rsi
movl %r13d, %edx
callq 0x302f6
leaq 0x16c55(%rip), %rsi     # 0x77391
movq -0x50(%rbp), %rdi
movq %rbx, %rdx
callq 0x30ad3
movq %rbx, %rax
movl $0x0, 0x28(%rax)
movl 0x30(%rax), %ecx
testb $0x4, %cl
movq -0x40(%rbp), %rdx
movq -0x58(%rbp), %r12
je 0x60777
movq $0x0, 0x20(%rax)
movl $0x0, 0x2c(%rax)
andl $-0x5, %ecx
movl %ecx, 0x30(%rax)
movq -0x50(%rbp), %r13
testl %r15d, %r15d
je 0x607ae
movq %rbx, %rdi
movq %r14, %rsi
movq %rdx, -0x40(%rbp)
movl %r15d, %edx
callq 0x302f6
leaq 0x16c00(%rip), %rsi     # 0x77399
movq %r13, %rdi
movq %rbx, %rdx
callq 0x30ad3
movq -0x40(%rbp), %rdx
movq %rbx, %rax
movl 0x30(%rbx), %ecx
movl $0x0, 0x28(%rax)
testb $0x4, %cl
je 0x607cf
movq $0x0, 0x20(%rax)
movl $0x0, 0x2c(%rax)
andl $-0x5, %ecx
movl %ecx, 0x30(%rax)
movq -0x38(%rbp), %r15
testl %edx, %edx
je 0x607fa
movq %rbx, %rdi
movq %r12, %rsi
callq 0x302f6
leaq 0x16e0d(%rip), %rsi     # 0x775f6
movq %r13, %rdi
movq %rbx, %rdx
callq 0x30ad3
movq %rbx, %rax
movl 0x30(%rbx), %ecx
movl $0x0, 0x28(%rax)
testb $0x4, %cl
je 0x6081b
movq $0x0, 0x20(%rax)
movl $0x0, 0x2c(%rax)
andl $-0x5, %ecx
movl %ecx, 0x30(%rax)
movl -0x2c(%rbp), %edx
testl %edx, %edx
je 0x60842
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
callq 0x302f6
leaq 0x16dc9(%rip), %rsi     # 0x77600
movq %r13, %rdi
movq %rbx, %rdx
callq 0x30ad3
movq %r15, %rdi
movq %r13, %rsi
callq 0x307f4
jmp 0x6061d
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rbx
movq %rbx, %rdi
callq 0x30465
movq $0x0, (%rbx)
movl $0xfffffe90, %eax       # imm = 0xFFFFFE90
andl 0x8(%rbx), %eax
orl $0x8, %eax
movl %eax, 0x8(%rbx)
jmp 0x6061d
movq %rbx, %rdi
callq 0x3f362
movl (%rbx), %eax
decl %eax
cmpl $0x3, %eax
ja 0x60960
leaq 0x122d4(%rip), %rcx     # 0x72b6c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdi
testl %r13d, %r13d
je 0x6060f
movq -0x48(%rbp), %rsi
movl %r13d, %edx
jmp 0x60618
movq %r12, %rdx
addq %rax, %rcx
decq %rcx
movq $0x0, -0x40(%rbp)
xorl %eax, %eax
cmpq %r14, %rcx
jbe 0x60901
leaq -0x1(%rcx), %r12
incl %eax
cmpb $0x2e, (%rcx)
movq %r12, %rcx
jne 0x608d1
leal -0x1(%rax), %ecx
addq $0x2, %r12
movq %rcx, -0x40(%rbp)
cmpl %ecx, %r15d
jbe 0x60904
movl %r15d, %ecx
subl %eax, %ecx
movl %ecx, -0x2c(%rbp)
jmp 0x606d8
xorl %r12d, %r12d
movl %r15d, -0x2c(%rbp)
jmp 0x606d8
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x40(%rbp), %rdx
testl %edx, %edx
je 0x6060f
movq %r12, %rsi
jmp 0x60618
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0x2c(%rbp), %edx
testl %edx, %edx
je 0x6060f
movq %r14, %rsi
jmp 0x60618
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdi
testl %r15d, %r15d
je 0x6060f
movq %r14, %rsi
movl %r15d, %edx
jmp 0x60618
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdi
jmp 0x6060f