// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: VmExtractOptArgValue
static void VmExtractOptArgValue(
	jx9_value *pArray,  /* getopt() return value */
	jx9_value *pWorker, /* Worker variable */
	const char *zArg,   /* Argument stream */
	const char *zArgEnd, /* End of the argument stream  */
	int need_val,       /* TRUE to fetch option argument */
	jx9_context *pCtx,  /* Call Context */
	const char *zName   /* Option name */)
{
	jx9_value_bool(pWorker, 0);
	if( !need_val ){
		/* 
		 * Option does not need arguments.
		 * Insert the option name and a boolean FALSE.
		 */
		jx9_array_add_strkey_elem(pArray, (const char *)zName, pWorker); /* Will make it's own copy */
	}else{
		const char *zCur;
		/* Extract option argument */
		zArg++;
		if( zArg < zArgEnd && zArg[0] == '=' ){
			zArg++;
		}
		while( zArg < zArgEnd && (unsigned char)zArg[0] < 0xc0 && SyisSpace(zArg[0]) ){
			zArg++;
		}
		if( zArg >= zArgEnd || zArg[0] == '-' ){
			/*
			 * Argument not found.
			 * Insert the option name and a boolean FALSE.
			 */
			jx9_array_add_strkey_elem(pArray, (const char *)zName, pWorker); /* Will make it's own copy */
			return;
		}
		/* Delimit the value */
		zCur = zArg;
		if( zArg[0] == '\'' || zArg[0] == '"' ){
			int d = zArg[0];
			/* Delimt the argument */
			zArg++;
			zCur = zArg;
			while( zArg < zArgEnd ){
				if( zArg[0] == d && zArg[-1] != '\\' ){
					/* Delimiter found, exit the loop  */
					break;
				}
				zArg++;
			}
			/* Save the value */
			jx9_value_string(pWorker, zCur, (int)(zArg-zCur));
			if( zArg < zArgEnd ){ zArg++; }
		}else{
			while( zArg < zArgEnd && !SyisSpace(zArg[0]) ){
				zArg++;
			}
			/* Save the value */
			jx9_value_string(pWorker, zCur, (int)(zArg-zCur));
		}
		/*
		 * Check if we are dealing with multiple values.
		 * If so, create an array to hold them, rather than a scalar variable.
		 */
		while( zArg < zArgEnd && (unsigned char)zArg[0] < 0xc0 && SyisSpace(zArg[0]) ){
			zArg++;
		}
		if( zArg < zArgEnd && zArg[0] != '-' ){
			jx9_value *pOptArg; /* Array of option arguments */
			pOptArg = jx9_context_new_array(pCtx);
			if( pOptArg == 0 ){
				jx9_context_throw_error(pCtx, JX9_CTX_ERR, "JX9 is running out of memory");
			}else{
				/* Insert the first value */
				jx9_array_add_elem(pOptArg, 0, pWorker); /* Will make it's own copy */
				for(;;){
					if( zArg >= zArgEnd || zArg[0] == '-' ){
						/* No more value */
						break;
					}
					/* Delimit the value */
					zCur = zArg;
					if( zArg < zArgEnd && zArg[0] == '\\' ){
						zArg++;
						zCur = zArg;
					}
					while( zArg < zArgEnd && !SyisSpace(zArg[0]) ){
						zArg++;
					}
					/* Reset the string cursor */
					jx9_value_reset_string_cursor(pWorker);
					/* Save the value */
					jx9_value_string(pWorker, zCur, (int)(zArg-zCur));
					/* Insert */
					jx9_array_add_elem(pOptArg, 0, pWorker); /* Will make it's own copy */
					/* Jump trailing white spaces */
					while( zArg < zArgEnd && (unsigned char)zArg[0] < 0xc0 && SyisSpace(zArg[0]) ){
						zArg++;
					}
				}
				/* Insert the option arg array */
				jx9_array_add_strkey_elem(pArray, (const char *)zName, pOptArg); /* Will make it's own copy */
				/* Safely release */
				jx9_context_release_value(pCtx, pOptArg);
			}
		}else{
			/* Single value */
			jx9_array_add_strkey_elem(pArray, (const char *)zName, pWorker); /* Will make it's own copy */
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq %r9, -0x30(%rbp)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x56800
cmpl $0x0, -0x24(%rbp)
jne 0x8dd8b
movq -0x8(%rbp), %rdi
movq 0x10(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x579b0
jmp 0x8e176
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x8ddb9
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3d, %eax
jne 0x8ddb9
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x8ddbb
movq -0x18(%rbp), %rcx
xorl %eax, %eax
cmpq -0x20(%rbp), %rcx
movb %al, -0x49(%rbp)
jae 0x8de02
movq -0x18(%rbp), %rax
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0xc0, %ecx
movb %al, -0x49(%rbp)
jge 0x8de02
callq 0xd1f0
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
setne %al
movb %al, -0x49(%rbp)
movb -0x49(%rbp), %al
testb $0x1, %al
jne 0x8de0b
jmp 0x8de19
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x8ddbb
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x8de2f
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x8de45
movq -0x8(%rbp), %rdi
movq 0x10(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x579b0
jmp 0x8e176
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x27, %eax
je 0x8de69
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x22, %eax
jne 0x8deec
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x3c(%rbp)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x8deba
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl -0x3c(%rbp), %eax
jne 0x8deac
movq -0x18(%rbp), %rax
movsbl -0x1(%rax), %eax
cmpl $0x5c, %eax
je 0x8deac
jmp 0x8deba
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x8de87
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x18(%rbp), %rax
movq -0x38(%rbp), %rcx
subq %rcx, %rax
movl %eax, %edx
callq 0x56950
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x8deea
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x8df54
jmp 0x8deee
movq -0x18(%rbp), %rcx
xorl %eax, %eax
cmpq -0x20(%rbp), %rcx
movb %al, -0x4a(%rbp)
jae 0x8df23
callq 0xd1f0
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0x4a(%rbp)
movb -0x4a(%rbp), %al
testb $0x1, %al
jne 0x8df2c
jmp 0x8df3a
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x8deee
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x18(%rbp), %rax
movq -0x38(%rbp), %rcx
subq %rcx, %rax
movl %eax, %edx
callq 0x56950
jmp 0x8df56
movq -0x18(%rbp), %rcx
xorl %eax, %eax
cmpq -0x20(%rbp), %rcx
movb %al, -0x4b(%rbp)
jae 0x8df9d
movq -0x18(%rbp), %rax
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0xc0, %ecx
movb %al, -0x4b(%rbp)
jge 0x8df9d
callq 0xd1f0
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
setne %al
movb %al, -0x4b(%rbp)
movb -0x4b(%rbp), %al
testb $0x1, %al
jne 0x8dfa6
jmp 0x8dfb4
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x8df56
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x8e163
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x8e163
movq -0x30(%rbp), %rdi
callq 0x58570
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x8e000
movq -0x30(%rbp), %rdi
movl $0x1, %esi
leaq 0x367bb(%rip), %rdx     # 0xc47b1
callq 0x580b0
jmp 0x8e161
movq -0x48(%rbp), %rdi
movq -0x10(%rbp), %rdx
xorl %eax, %eax
movl %eax, %esi
callq 0x57920
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x8e027
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x8e02c
jmp 0x8e143
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x8e05e
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5c, %eax
jne 0x8e05e
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x8e060
movq -0x18(%rbp), %rcx
xorl %eax, %eax
cmpq -0x20(%rbp), %rcx
movb %al, -0x4c(%rbp)
jae 0x8e095
callq 0xd1f0
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0x4c(%rbp)
movb -0x4c(%rbp), %al
testb $0x1, %al
jne 0x8e09e
jmp 0x8e0ac
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x8e060
movq -0x10(%rbp), %rdi
callq 0x56b80
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x18(%rbp), %rax
movq -0x38(%rbp), %rcx
subq %rcx, %rax
movl %eax, %edx
callq 0x56950
movq -0x48(%rbp), %rdi
movq -0x10(%rbp), %rdx
xorl %eax, %eax
movl %eax, %esi
callq 0x57920
movq -0x18(%rbp), %rcx
xorl %eax, %eax
cmpq -0x20(%rbp), %rcx
movb %al, -0x4d(%rbp)
jae 0x8e127
movq -0x18(%rbp), %rax
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0xc0, %ecx
movb %al, -0x4d(%rbp)
jge 0x8e127
callq 0xd1f0
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
setne %al
movb %al, -0x4d(%rbp)
movb -0x4d(%rbp), %al
testb $0x1, %al
jne 0x8e130
jmp 0x8e13e
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x8e0e0
jmp 0x8e011
movq -0x8(%rbp), %rdi
movq 0x10(%rbp), %rsi
movq -0x48(%rbp), %rdx
callq 0x579b0
movq -0x30(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x585e0
jmp 0x8e174
movq -0x8(%rbp), %rdi
movq 0x10(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x579b0
jmp 0x8e176
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)