// File: /workspace/github_c_makefile_star2_O0/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
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movl 0x8(%rcx), %ecx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x7bbe8
movq -0x8(%rbp), %rdi
leaq 0x4727f(%rip), %rsi     # 0xc2e57
movl $0x5, %edx
callq 0x7ab80
movq %rax, -0x38(%rbp)
jmp 0x7bc01
movq -0x8(%rbp), %rdi
leaq 0x4726a(%rip), %rsi     # 0xc2e5d
movl $0x4, %edx
callq 0x7ab80
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x47256(%rip), %rsi     # 0xc2e62
movl $0x8, %edx
callq 0x7ab80
movq %rax, -0x40(%rbp)
jmp 0x7bc1c
movq -0x30(%rbp), %rcx
xorl %eax, %eax
cmpq -0x28(%rbp), %rcx
movb %al, -0x6d(%rbp)
jae 0x7bc4f
callq 0xd1f0
movq (%rax), %rax
movq -0x30(%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, -0x6d(%rbp)
movb -0x6d(%rbp), %al
testb $0x1, %al
jne 0x7bc58
jmp 0x7bc66
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x7bc1c
movq -0x30(%rbp), %rax
cmpq -0x28(%rbp), %rax
jb 0x7bc75
jmp 0x7be78
movq -0x30(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rcx
xorl %eax, %eax
cmpq -0x28(%rbp), %rcx
movb %al, -0x6e(%rbp)
jae 0x7bcbe
movq -0x68(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x3d, %ecx
movb %al, -0x6e(%rbp)
je 0x7bcbe
movq -0x68(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x26, %ecx
movb %al, -0x6e(%rbp)
je 0x7bcbe
movq -0x68(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3b, %eax
setne %al
movb %al, -0x6e(%rbp)
movb -0x6e(%rbp), %al
testb $0x1, %al
jne 0x7bcc7
jmp 0x7bcd5
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
jmp 0x7bc7d
movq -0x18(%rbp), %rdi
callq 0x65e00
movq -0x30(%rbp), %rdi
movq -0x68(%rbp), %rax
movq -0x30(%rbp), %rcx
subq %rcx, %rax
movl %eax, %esi
movq -0x18(%rbp), %rcx
leaq -0x1063a(%rip), %rdx    # 0x6b6c0
movl $0x1, %r8d
callq 0x7d5c0
movq -0x18(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x48(%rbp)
movq $0x0, -0x60(%rbp)
movl $0x0, -0x58(%rbp)
movq -0x68(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x7bdf9
movq -0x68(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3d, %eax
jne 0x7bdf9
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x68(%rbp), %rcx
xorl %eax, %eax
cmpq -0x28(%rbp), %rcx
movb %al, -0x6f(%rbp)
jae 0x7bd80
movq -0x68(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x26, %ecx
movb %al, -0x6f(%rbp)
je 0x7bd80
movq -0x68(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3b, %eax
setne %al
movb %al, -0x6f(%rbp)
movb -0x6f(%rbp), %al
testb $0x1, %al
jne 0x7bd89
jmp 0x7bd97
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
jmp 0x7bd50
movq -0x68(%rbp), %rax
cmpq -0x30(%rbp), %rax
jbe 0x7bdf1
movq -0x18(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x6c(%rbp)
movq -0x30(%rbp), %rdi
movq -0x68(%rbp), %rax
movq -0x30(%rbp), %rcx
subq %rcx, %rax
movl %eax, %esi
movq -0x18(%rbp), %rcx
leaq -0x10707(%rip), %rdx    # 0x6b6c0
movl $0x1, %r8d
callq 0x7d5c0
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x6c(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rax
movl 0x10(%rax), %eax
subl -0x6c(%rbp), %eax
movl %eax, -0x58(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x7be36
movq -0x38(%rbp), %rax
movl 0x8(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x7be36
movq -0x38(%rbp), %rax
movq (%rax), %rdi
movq -0x50(%rbp), %rsi
movl -0x48(%rbp), %edx
movq -0x60(%rbp), %rcx
movl -0x58(%rbp), %r8d
callq 0x7ac00
cmpq $0x0, -0x40(%rbp)
je 0x7be67
movq -0x40(%rbp), %rax
movl 0x8(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x7be67
movq -0x40(%rbp), %rax
movq (%rax), %rdi
movq -0x50(%rbp), %rsi
movl -0x48(%rbp), %edx
movq -0x60(%rbp), %rcx
movl -0x58(%rbp), %r8d
callq 0x7ac00
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x7bc1a
xorl %eax, %eax
addq $0x70, %rsp
popq %rbp
retq