// File: /workspace/github_c_makefile_star2_O1/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: VmHttpSplitEncodedQuery
static sxi32 VmHttpSplitEncodedQuery(
	 jx9_vm *pVm,       /* Target VM */
	 SyString *pQuery,  /* Raw query to decode */
	 SyBlob *pWorker,   /* Working buffer */
	 int is_post        /* TRUE if we are dealing with a POST request */
	 )
 {
	 const char *zEnd = &pQuery->zString[pQuery->nByte];
	 const char *zIn = pQuery->zString;
	 jx9_value *pGet, *pRequest;
	 SyString sName, sValue;
	 const char *zPtr;
	 sxu32 nBlobOfft;
	 /* Extract superglobals */
	 if( is_post ){
		 /* $_POST superglobal */
		 pGet = VmExtractSuper(&(*pVm), "_POST", sizeof("_POST")-1);
	 }else{
		 /* $_GET superglobal */
		 pGet = VmExtractSuper(&(*pVm), "_GET", sizeof("_GET")-1);
	 }
	 pRequest = VmExtractSuper(&(*pVm), "_REQUEST", sizeof("_REQUEST")-1);
	 /* Split up the raw query */
	 for(;;){
		 /* Jump leading white spaces */
		 while(zIn < zEnd  && SyisSpace(zIn[0]) ){
			 zIn++;
		 }
		 if( zIn >= zEnd ){
			 break;
		 }
		 zPtr = zIn;
		 while( zPtr < zEnd && zPtr[0] != '=' && zPtr[0] != '&' && zPtr[0] != ';' ){
			 zPtr++;
		 }
		 /* Reset the working buffer */
		 SyBlobReset(pWorker);
		 /* Decode the entry */
		 SyUriDecode(zIn, (sxu32)(zPtr-zIn), jx9VmBlobConsumer, pWorker, TRUE);
		 /* Save the entry */
		 sName.nByte = SyBlobLength(pWorker);
		 sValue.zString = 0;
		 sValue.nByte = 0;
		 if( zPtr < zEnd && zPtr[0] == '=' ){
			 zPtr++;
			 zIn = zPtr;
			 /* Store field value */
			 while( zPtr < zEnd && zPtr[0] != '&' && zPtr[0] != ';' ){
				 zPtr++;
			 }
			 if( zPtr > zIn ){
				 /* Decode the value */
				  nBlobOfft = SyBlobLength(pWorker);
				  SyUriDecode(zIn, (sxu32)(zPtr-zIn), jx9VmBlobConsumer, pWorker, TRUE);
				  sValue.zString = (const char *)SyBlobDataAt(pWorker, nBlobOfft);
				  sValue.nByte = SyBlobLength(pWorker) - nBlobOfft;
				 
			 }
			 /* Synchronize pointers */
			 zIn = zPtr;
		 }
		 sName.zString = (const char *)SyBlobData(pWorker);
		 /* Install the decoded query in the $_GET/$_REQUEST array */
		 if( pGet && (pGet->iFlags & MEMOBJ_HASHMAP) ){
			 VmHashmapInsert((jx9_hashmap *)pGet->x.pOther, 
				 sName.zString, (int)sName.nByte, 
				 sValue.zString, (int)sValue.nByte
				 );
		 }
		 if( pRequest && (pRequest->iFlags & MEMOBJ_HASHMAP) ){
			 VmHashmapInsert((jx9_hashmap *)pRequest->x.pOther, 
				 sName.zString, (int)sName.nByte, 
				 sValue.zString, (int)sValue.nByte
					 );
		 }
		 /* Advance the pointer */
		 zIn = &zPtr[1];
	 }
	/* All done*/
	return SXRET_OK;
 }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r15
movq %rdi, %r14
movq (%rsi), %r13
movl 0x8(%rsi), %r12d
testl %ecx, %ecx
je 0x47987
leaq 0x2f001(%rip), %rsi     # 0x7697e
movq %r14, %rdi
movl $0x5, %edx
jmp 0x47996
leaq 0x2eff6(%rip), %rsi     # 0x76984
movq %r14, %rdi
movl $0x4, %edx
callq 0x47291
movq %rax, -0x30(%rbp)
leaq 0x2efe3(%rip), %rsi     # 0x76989
movq %r14, %rdi
movl $0x8, %edx
callq 0x47291
movq %rax, -0x48(%rbp)
testq %r12, %r12
setne %bl
je 0x47b7f
addq %r13, %r12
callq 0xc170
movq %rax, -0x50(%rbp)
movq %r15, -0x40(%rbp)
movq -0x50(%rbp), %rax
movq (%rax), %rax
movsbq (%r13), %rcx
testb $0x20, 0x1(%rax,%rcx,2)
je 0x47a07
incq %r13
cmpq %r12, %r13
setb %bl
jae 0x47b7f
movsbq (%r13), %rcx
incq %r13
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x479e9
decq %r13
testb $0x1, %bl
je 0x47b7f
cmpq %r12, %r13
setb %r14b
movq %r13, %rbx
jae 0x47a41
movzbl (%rbx), %eax
cmpq $0x3d, %rax
ja 0x47a35
movabsq $0x2800004000000000, %rcx # imm = 0x2800004000000000
btq %rax, %rcx
jb 0x47a41
incq %rbx
cmpq %r12, %rbx
setb %r14b
jb 0x47a1c
movl $0x0, 0x10(%r15)
movl 0x18(%r15), %eax
testb $0x4, %al
je 0x47a68
movq $0x0, 0x8(%r15)
movl $0x0, 0x14(%r15)
andl $-0x5, %eax
movl %eax, 0x18(%r15)
movl %ebx, %esi
subl %r13d, %esi
movq %r13, %rdi
leaq -0xb0f8(%rip), %rdx     # 0x3c97f
movq %r15, %rcx
callq 0x48412
movl 0x10(%r15), %r13d
testb $0x1, %r14b
je 0x47ace
cmpb $0x3d, (%rbx)
movq -0x30(%rbp), %rax
jne 0x47ad9
leaq 0x1(%rbx), %rdi
movl $0x1, %esi
movq %rdi, %r14
cmpq %r12, %rdi
jae 0x47aea
movq %r12, %rax
subq %rbx, %rax
movzbl (%rbx,%rsi), %ecx
cmpl $0x26, %ecx
je 0x47ae0
cmpl $0x3b, %ecx
je 0x47ae0
leaq (%rbx,%rsi), %rcx
incq %rcx
incq %rsi
cmpq %r12, %rcx
jb 0x47aa9
addq %rsi, %rbx
movq %rax, %rsi
jmp 0x47ae3
xorl %r8d, %r8d
xorl %ecx, %ecx
movq -0x30(%rbp), %rax
jmp 0x47b1d
xorl %r8d, %r8d
xorl %ecx, %ecx
jmp 0x47b1d
addq %rsi, %rbx
movq %rbx, %r14
movq -0x30(%rbp), %rax
cmpq $0x2, %rsi
jb 0x47b15
decl %esi
leaq -0xb17a(%rip), %rdx     # 0x3c97f
movq %r15, %rcx
callq 0x48412
movq -0x30(%rbp), %rax
movq 0x8(%r15), %rcx
addq %r13, %rcx
movl 0x10(%r15), %r8d
subl %r13d, %r8d
jmp 0x47b1a
xorl %r8d, %r8d
xorl %ecx, %ecx
movq %r14, %rbx
movq 0x8(%r15), %rsi
testq %rax, %rax
je 0x47b4f
testb $0x40, 0x8(%rax)
je 0x47b4f
movq (%rax), %rdi
movq %rsi, -0x38(%rbp)
movq -0x38(%rbp), %rsi
movl %r13d, %edx
movq %rcx, %r15
movq %r8, %r14
callq 0x472de
movq -0x38(%rbp), %rsi
movq %r15, %rcx
movq %r14, %r8
movq -0x48(%rbp), %rax
testq %rax, %rax
je 0x47b69
testb $0x40, 0x8(%rax)
je 0x47b69
movq (%rax), %rdi
movl %r13d, %edx
callq 0x472de
incq %rbx
movq %rbx, %r13
cmpq %r12, %rbx
setb %bl
movq -0x40(%rbp), %r15
jb 0x479d3
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq