// File: /workspace/github_c_makefile_star2_O0/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
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
cmpl $0x1, -0x14(%rbp)
jl 0xa431d
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x57480
cmpl $0x0, %eax
jne 0xa433b
movq -0x10(%rbp), %rdi
leaq 0x21823(%rip), %rsi     # 0xc5b4b
xorl %edx, %edx
callq 0x57180
movl $0x0, -0x4(%rbp)
jmp 0xa469b
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq -0x74(%rbp), %rsi
callq 0x56e20
movq %rax, -0x28(%rbp)
cmpl $0x1, -0x74(%rbp)
jge 0xa4373
movq -0x10(%rbp), %rdi
leaq 0x217eb(%rip), %rsi     # 0xc5b4b
xorl %edx, %edx
callq 0x57180
movl $0x0, -0x4(%rbp)
jmp 0xa469b
movq -0x28(%rbp), %rdi
movl -0x74(%rbp), %esi
leaq -0x68(%rbp), %rdx
callq 0xa9380
cmpl $0x1, -0x14(%rbp)
jle 0xa4506
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x57390
cmpl $0x0, %eax
je 0xa4506
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x56c90
movl %eax, -0x78(%rbp)
movl -0x78(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x90(%rbp)
subl $0x3, %eax
ja 0xa44ef
movq -0x90(%rbp), %rax
leaq 0x1ccb4(%rip), %rcx     # 0xc108c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x68(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jbe 0xa440c
movq -0x10(%rbp), %rdi
movq -0x70(%rbp), %rax
movq (%rax), %rsi
movq -0x70(%rbp), %rax
movl 0x8(%rax), %edx
callq 0x57180
jmp 0xa441e
movq -0x10(%rbp), %rdi
leaq 0x21734(%rip), %rsi     # 0xc5b4b
xorl %edx, %edx
callq 0x57180
jmp 0xa4501
leaq -0x68(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jbe 0xa4452
movq -0x10(%rbp), %rdi
movq -0x70(%rbp), %rax
movq (%rax), %rsi
movq -0x70(%rbp), %rax
movl 0x8(%rax), %edx
callq 0x57180
jmp 0xa4464
movq -0x10(%rbp), %rdi
leaq 0x216ee(%rip), %rsi     # 0xc5b4b
xorl %edx, %edx
callq 0x57180
jmp 0xa4501
leaq -0x68(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jbe 0xa4498
movq -0x10(%rbp), %rdi
movq -0x70(%rbp), %rax
movq (%rax), %rsi
movq -0x70(%rbp), %rax
movl 0x8(%rax), %edx
callq 0x57180
jmp 0xa44aa
movq -0x10(%rbp), %rdi
leaq 0x216a8(%rip), %rsi     # 0xc5b4b
xorl %edx, %edx
callq 0x57180
jmp 0xa4501
leaq -0x68(%rbp), %rax
addq $0x30, %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jbe 0xa44db
movq -0x10(%rbp), %rdi
movq -0x70(%rbp), %rax
movq (%rax), %rsi
movq -0x70(%rbp), %rax
movl 0x8(%rax), %edx
callq 0x57180
jmp 0xa44ed
movq -0x10(%rbp), %rdi
leaq 0x21665(%rip), %rsi     # 0xc5b4b
xorl %edx, %edx
callq 0x57180
jmp 0xa4501
movq -0x10(%rbp), %rdi
leaq 0x21651(%rip), %rsi     # 0xc5b4b
xorl %edx, %edx
callq 0x57180
jmp 0xa4694
movq -0x10(%rbp), %rdi
callq 0x58570
movq %rax, -0x80(%rbp)
movq -0x10(%rbp), %rdi
callq 0x58510
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x80(%rbp)
je 0xa4534
cmpq $0x0, -0x88(%rbp)
jne 0xa454b
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x57070
movl $0x0, -0x4(%rbp)
jmp 0xa469b
leaq -0x68(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jbe 0xa458e
movq -0x88(%rbp), %rdi
movq -0x70(%rbp), %rax
movq (%rax), %rsi
movq -0x70(%rbp), %rax
movl 0x8(%rax), %edx
callq 0x56950
movq -0x80(%rbp), %rdi
movq -0x88(%rbp), %rdx
leaq 0x212e1(%rip), %rsi     # 0xc586a
callq 0x579b0
movq -0x88(%rbp), %rdi
callq 0x56b80
leaq -0x68(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jbe 0xa45e1
movq -0x88(%rbp), %rdi
movq -0x70(%rbp), %rax
movq (%rax), %rsi
movq -0x70(%rbp), %rax
movl 0x8(%rax), %edx
callq 0x56950
movq -0x80(%rbp), %rdi
movq -0x88(%rbp), %rdx
leaq 0x21296(%rip), %rsi     # 0xc5872
callq 0x579b0
movq -0x88(%rbp), %rdi
callq 0x56b80
leaq -0x68(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jbe 0xa4634
movq -0x88(%rbp), %rdi
movq -0x70(%rbp), %rax
movq (%rax), %rsi
movq -0x70(%rbp), %rax
movl 0x8(%rax), %edx
callq 0x56950
movq -0x80(%rbp), %rdi
movq -0x88(%rbp), %rdx
leaq 0x214a0(%rip), %rsi     # 0xc5acf
callq 0x579b0
movq -0x88(%rbp), %rdi
callq 0x56b80
leaq -0x68(%rbp), %rax
addq $0x30, %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jbe 0xa4687
movq -0x88(%rbp), %rdi
movq -0x70(%rbp), %rax
movq (%rax), %rsi
movq -0x70(%rbp), %rax
movl 0x8(%rax), %edx
callq 0x56950
movq -0x80(%rbp), %rdi
movq -0x88(%rbp), %rdx
leaq 0x21457(%rip), %rsi     # 0xc5ad9
callq 0x579b0
movq -0x10(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0x572c0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopw (%rax,%rax)