// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: GenStateCollectFuncArgs
static sxi32 GenStateCollectFuncArgs(jx9_vm_func *pFunc, jx9_gen_state *pGen, SyToken *pEnd)
{
	jx9_vm_func_arg sArg; /* Current processed argument */
	SyToken *pCur, *pIn;  /* Token stream */
	SyBlob sSig;         /* Function signature */
	char *zDup;          /* Copy of argument name */
	sxi32 rc;

	pIn = pGen->pIn;
	pCur = 0;
	SyBlobInit(&sSig, &pGen->pVm->sAllocator);
	/* Process arguments one after one */
	for(;;){
		if( pIn >= pEnd ){
			/* No more arguments to process */
			break;
		}
		SyZero(&sArg, sizeof(jx9_vm_func_arg));
		SySetInit(&sArg.aByteCode, &pGen->pVm->sAllocator, sizeof(VmInstr));
		if( pIn->nType & (JX9_TK_ID|JX9_TK_KEYWORD) ){
			if( pIn->nType & JX9_TK_KEYWORD ){
				sxu32 nKey = (sxu32)(SX_PTR_TO_INT(pIn->pUserData));
				if( nKey & JX9_TKWRD_BOOL ){
					sArg.nType = MEMOBJ_BOOL;
				}else if( nKey & JX9_TKWRD_INT ){
					sArg.nType = MEMOBJ_INT;
				}else if( nKey & JX9_TKWRD_STRING ){
					sArg.nType = MEMOBJ_STRING;
				}else if( nKey & JX9_TKWRD_FLOAT ){
					sArg.nType = MEMOBJ_REAL;
				}else{
					jx9GenCompileError(&(*pGen), E_WARNING, pGen->pIn->nLine, 
						"Invalid argument type '%z', Automatic cast will not be performed", 
						&pIn->sData);
				}
			}
			pIn++;
		}
		if( pIn >= pEnd ){
			rc = jx9GenCompileError(&(*pGen), E_ERROR, pGen->pIn->nLine, "Missing argument name");
			return rc;
		}
		if( pIn >= pEnd || (pIn->nType & JX9_TK_DOLLAR) == 0 || &pIn[1] >= pEnd || (pIn[1].nType & (JX9_TK_ID|JX9_TK_KEYWORD)) == 0 ){
			/* Invalid argument */ 
			rc = jx9GenCompileError(&(*pGen), E_ERROR, pGen->pIn->nLine, "Invalid argument name");
			return rc;
		}
		pIn++; /* Jump the dollar sign */
		/* Copy argument name */
		zDup = SyMemBackendStrDup(&pGen->pVm->sAllocator, SyStringData(&pIn->sData), SyStringLength(&pIn->sData));
		if( zDup == 0 ){
			return GenStateOutOfMem(pGen);
		}
		SyStringInitFromBuf(&sArg.sName, zDup, SyStringLength(&pIn->sData));
		pIn++;
		if( pIn < pEnd ){
			if( pIn->nType & JX9_TK_EQUAL ){
				SyToken *pDefend;
				sxi32 iNest = 0;
				pIn++; /* Jump the equal sign */
				pDefend = pIn;
				/* Process the default value associated with this argument */
				while( pDefend < pEnd ){
					if( (pDefend->nType & JX9_TK_COMMA) && iNest <= 0 ){
						break;
					}
					if( pDefend->nType & (JX9_TK_LPAREN/*'('*/|JX9_TK_OCB/*'{'*/|JX9_TK_OSB/*[*/) ){
						/* Increment nesting level */
						iNest++;
					}else if( pDefend->nType & (JX9_TK_RPAREN/*')'*/|JX9_TK_CCB/*'}'*/|JX9_TK_CSB/*]*/) ){
						/* Decrement nesting level */
						iNest--;
					}
					pDefend++;
				}
				if( pIn >= pDefend ){
					rc = jx9GenCompileError(&(*pGen), E_ERROR, pIn->nLine, "Missing argument default value");
					return rc;
				}
				/* Process default value */
				rc = GenStateProcessArgValue(&(*pGen), &sArg, pIn, pDefend);
				if( rc != SXRET_OK ){
					return rc;
				}
				/* Point beyond the default value */
				pIn = pDefend;
			}
			if( pIn < pEnd && (pIn->nType & JX9_TK_COMMA) == 0 ){
				rc = jx9GenCompileError(&(*pGen), E_ERROR, pIn->nLine, "Unexpected token '%z'", &pIn->sData);
				return rc;
			}
			pIn++; /* Jump the trailing comma */
		}
		/* Append argument signature */
		if( sArg.nType > 0 ){
			int c;
			c = 'n'; /* cc warning */
			/* Type leading character */
			switch(sArg.nType){
				case MEMOBJ_HASHMAP:
					/* Hashmap aka 'array' */
					c = 'h';
					break;
				case MEMOBJ_INT:
					/* Integer */
					c = 'i';
					break;
				case MEMOBJ_BOOL:
					/* Bool */
					c = 'b';
					break;
				case MEMOBJ_REAL:
					/* Float */
					c = 'f';
					break;
				case MEMOBJ_STRING:
					/* String */
					c = 's';
					break;
				default:
					break;
				}
				SyBlobAppend(&sSig, (const void *)&c, sizeof(char));
		}
		/* Save in the argument set */
		SySetPut(&pFunc->aArgs, (const void *)&sArg);
	}
	if( SyBlobLength(&sSig) > 0 ){
		/* Save function signature */
		SyStringInitFromBuf(&pFunc->sSignature, SyBlobData(&sSig), SyBlobLength(&sSig));
	}
	return SXRET_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x158(%rax), %rax
movq %rax, -0x70(%rbp)
movq $0x0, -0x68(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rsi
leaq -0x90(%rbp), %rdi
callq 0x58bb0
movq -0x70(%rbp), %rax
cmpq -0x20(%rbp), %rax
jb 0x848d0
jmp 0x84d58
leaq -0x60(%rbp), %rdi
movl $0x40, %esi
callq 0x54280
leaq -0x60(%rbp), %rdi
addq $0x10, %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movl $0x18, %edx
callq 0x5b470
movq -0x70(%rbp), %rax
movl 0x10(%rax), %eax
andl $0xc, %eax
cmpl $0x0, %eax
je 0x849cc
movq -0x70(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x849c0
movq -0x70(%rbp), %rax
movq 0x18(%rax), %rax
movl %eax, -0xa0(%rbp)
movl -0xa0(%rbp), %eax
andl $0x8000, %eax           # imm = 0x8000
cmpl $0x0, %eax
je 0x84944
movl $0x8, -0x28(%rbp)
jmp 0x849be
movl -0xa0(%rbp), %eax
andl $0x10000, %eax          # imm = 0x10000
cmpl $0x0, %eax
je 0x8495d
movl $0x2, -0x28(%rbp)
jmp 0x849bc
movl -0xa0(%rbp), %eax
andl $0x40000, %eax          # imm = 0x40000
cmpl $0x0, %eax
je 0x84976
movl $0x1, -0x28(%rbp)
jmp 0x849ba
movl -0xa0(%rbp), %eax
andl $0x20000, %eax          # imm = 0x20000
cmpl $0x0, %eax
je 0x8498f
movl $0x4, -0x28(%rbp)
jmp 0x849b8
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x158(%rax), %rax
movl 0x14(%rax), %edx
movq -0x70(%rbp), %r8
movl $0x2, %esi
leaq 0x3f31c(%rip), %rcx     # 0xc3ccd
movb $0x0, %al
callq 0x7e990
jmp 0x849ba
jmp 0x849bc
jmp 0x849be
jmp 0x849c0
movq -0x70(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x20(%rbp), %rax
jb 0x84a0f
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x158(%rax), %rax
movl 0x14(%rax), %edx
movl $0x1, %esi
leaq 0x3f31a(%rip), %rcx     # 0xc3d0e
movb $0x0, %al
callq 0x7e990
movl %eax, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x84d84
movq -0x70(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x84a45
movq -0x70(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x84a45
movq -0x70(%rbp), %rax
addq $0x20, %rax
cmpq -0x20(%rbp), %rax
jae 0x84a45
movq -0x70(%rbp), %rax
movl 0x30(%rax), %eax
andl $0xc, %eax
cmpl $0x0, %eax
jne 0x84a7e
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x158(%rax), %rax
movl 0x14(%rax), %edx
movl $0x1, %esi
leaq 0x3f2c1(%rip), %rcx     # 0xc3d24
movb $0x0, %al
callq 0x7e990
movl %eax, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x84d84
movq -0x70(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x70(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x70(%rbp), %rax
movq (%rax), %rsi
movq -0x70(%rbp), %rax
movl 0x8(%rax), %edx
callq 0x6da40
movq %rax, -0x98(%rbp)
cmpq $0x0, -0x98(%rbp)
jne 0x84ac6
movq -0x18(%rbp), %rdi
callq 0x84570
movl %eax, -0x4(%rbp)
jmp 0x84d84
movq -0x98(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x70(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x58(%rbp)
movq -0x70(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x84c98
movq -0x70(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x400000, %eax         # imm = 0x400000
cmpl $0x0, %eax
je 0x84c3b
movl $0x0, -0xac(%rbp)
movq -0x70(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x84bbc
movq -0xa8(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x20000, %eax          # imm = 0x20000
cmpl $0x0, %eax
je 0x84b5b
cmpl $0x0, -0xac(%rbp)
jg 0x84b5b
jmp 0x84bbc
movq -0xa8(%rbp), %rax
movl 0x10(%rax), %eax
andl $0xa40, %eax            # imm = 0xA40
cmpl $0x0, %eax
je 0x84b80
movl -0xac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xac(%rbp)
jmp 0x84ba5
movq -0xa8(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x1480, %eax           # imm = 0x1480
cmpl $0x0, %eax
je 0x84ba3
movl -0xac(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xac(%rbp)
jmp 0x84ba5
movq -0xa8(%rbp), %rax
addq $0x20, %rax
movq %rax, -0xa8(%rbp)
jmp 0x84b2b
movq -0x70(%rbp), %rax
cmpq -0xa8(%rbp), %rax
jb 0x84bfb
movq -0x18(%rbp), %rdi
movq -0x70(%rbp), %rax
movl 0x14(%rax), %edx
movl $0x1, %esi
leaq 0x3f15a(%rip), %rcx     # 0xc3d3a
movb $0x0, %al
callq 0x7e990
movl %eax, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x84d84
movq -0x18(%rbp), %rdi
movq -0x70(%rbp), %rdx
movq -0xa8(%rbp), %rcx
leaq -0x60(%rbp), %rsi
callq 0x84f40
movl %eax, -0x9c(%rbp)
cmpl $0x0, -0x9c(%rbp)
je 0x84c30
movl -0x9c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x84d84
movq -0xa8(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x84c8c
movq -0x70(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x20000, %eax          # imm = 0x20000
cmpl $0x0, %eax
jne 0x84c8c
movq -0x18(%rbp), %rdi
movq -0x70(%rbp), %rax
movl 0x14(%rax), %edx
movq -0x70(%rbp), %r8
movl $0x1, %esi
leaq 0x3f4e8(%rip), %rcx     # 0xc4159
movb $0x0, %al
callq 0x7e990
movl %eax, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x84d84
movq -0x70(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x70(%rbp)
cmpl $0x0, -0x28(%rbp)
jbe 0x84d46
movl $0x6e, -0xb0(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0xb4(%rbp)
subl $0x1, %eax
je 0x84d20
jmp 0x84cbc
movl -0xb4(%rbp), %eax
subl $0x2, %eax
je 0x84cfc
jmp 0x84cc9
movl -0xb4(%rbp), %eax
subl $0x4, %eax
je 0x84d14
jmp 0x84cd6
movl -0xb4(%rbp), %eax
subl $0x8, %eax
je 0x84d08
jmp 0x84ce3
movl -0xb4(%rbp), %eax
subl $0x40, %eax
jne 0x84d2c
jmp 0x84cf0
movl $0x68, -0xb0(%rbp)
jmp 0x84d2e
movl $0x69, -0xb0(%rbp)
jmp 0x84d2e
movl $0x62, -0xb0(%rbp)
jmp 0x84d2e
movl $0x66, -0xb0(%rbp)
jmp 0x84d2e
movl $0x73, -0xb0(%rbp)
jmp 0x84d2e
jmp 0x84d2e
leaq -0x90(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
movl $0x1, %edx
callq 0x5d9d0
movq -0x10(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x5a7b0
jmp 0x848c1
cmpl $0x0, -0x80(%rbp)
jbe 0x84d7d
movq -0x88(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x90(%rax)
movl -0x80(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x98(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xc0, %rsp
popq %rbp
retq