// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: GenStateCompileCaseExpr
static sxi32 GenStateCompileCaseExpr(jx9_gen_state *pGen, jx9_case_expr *pExpr)
{
	SySet *pInstrContainer;
	SyToken *pEnd, *pTmp;
	sxi32 iNest = 0;
	sxi32 rc;
	/* Delimit the expression */
	pEnd = pGen->pIn;
	while( pEnd < pGen->pEnd ){
		if( pEnd->nType & JX9_TK_LPAREN /*(*/ ){
			/* Increment nesting level */
			iNest++;
		}else if( pEnd->nType & JX9_TK_RPAREN /*)*/ ){
			/* Decrement nesting level */
			iNest--;
		}else if( pEnd->nType & (JX9_TK_SEMI/*';'*/|JX9_TK_COLON/*;'*/) && iNest < 1 ){
			break;
		}
		pEnd++;
	}
	if( pGen->pIn >= pEnd ){
		rc = jx9GenCompileError(pGen, E_ERROR, pGen->pIn->nLine, "Empty case expression");
		if( rc == SXERR_ABORT ){
			/* Error count limit reached, abort immediately */
			return SXERR_ABORT;
		}
	}
	/* Swap token stream */
	pTmp = pGen->pEnd;
	pGen->pEnd = pEnd;
	pInstrContainer = jx9VmGetByteCodeContainer(pGen->pVm);
	jx9VmSetByteCodeContainer(pGen->pVm, &pExpr->aByteCode);
	rc = jx9CompileExpr(&(*pGen), 0, 0);
	/* Emit the done instruction */
	jx9VmEmitInstr(pGen->pVm, JX9_OP_DONE, (rc != SXERR_EMPTY ? 1 : 0), 0, 0, 0);
	jx9VmSetByteCodeContainer(pGen->pVm, pInstrContainer); 
	/* Update token stream */
	pGen->pIn  = pEnd;
	pGen->pEnd = pTmp;
	if( rc == SXERR_ABORT ){
		return SXERR_ABORT;
	}
	return SXRET_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x10(%rbp), %rax
movq 0x158(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x160(%rcx), %rax
jae 0x8556a
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x85523
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x8555c
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x8553f
movl -0x34(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x8555a
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x140000, %eax         # imm = 0x140000
cmpl $0x0, %eax
je 0x85558
cmpl $0x1, -0x34(%rbp)
jge 0x85558
jmp 0x8556a
jmp 0x8555a
jmp 0x8555c
movq -0x28(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x28(%rbp)
jmp 0x854f6
movq -0x10(%rbp), %rax
movq 0x158(%rax), %rax
cmpq -0x28(%rbp), %rax
jb 0x855b7
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x158(%rax), %rax
movl 0x14(%rax), %edx
movl $0x1, %esi
leaq 0x3ea99(%rip), %rcx     # 0xc4032
movb $0x0, %al
callq 0x7e990
movl %eax, -0x38(%rbp)
cmpl $-0xa, -0x38(%rbp)
jne 0x855b5
movl $0xfffffff6, -0x4(%rbp) # imm = 0xFFFFFFF6
jmp 0x85676
jmp 0x855b7
movq -0x10(%rbp), %rax
movq 0x160(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x160(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x85050
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x85070
movq -0x10(%rbp), %rdi
xorl %esi, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x81110
movl %eax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl -0x38(%rbp), %ecx
xorl %edx, %edx
movl $0x1, %eax
cmpl $-0x3, %ecx
cmovnel %eax, %edx
movl $0x1, %esi
xorl %ecx, %ecx
xorl %eax, %eax
movl %eax, %r9d
movq %r9, %r8
callq 0x7e8f0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x85070
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x158(%rax)
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x160(%rax)
cmpl $-0xa, -0x38(%rbp)
jne 0x8566f
movl $0xfffffff6, -0x4(%rbp) # imm = 0xFFFFFFF6
jmp 0x85676
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop