// File: /workspace/github_c_makefile_star2_O0/ccxvii[P]mujs/./jscompile.c
// Function: cswitch
static void cswitch(JF, js_Ast *ref, js_Ast *head)
{
	js_Ast *node, *clause, *def = NULL;
	int end;

	cexp(J, F, ref);

	/* emit an if-else chain of tests for the case clause expressions */
	for (node = head; node; node = node->b) {
		clause = node->a;
		if (clause->type == STM_DEFAULT) {
			if (def)
				jsC_error(J, clause, "more than one default label in switch");
			def = clause;
		} else {
			cexp(J, F, clause->a);
			emitline(J, F, clause);
			clause->casejump = emitjump(J, F, OP_JCASE);
		}
	}
	emit(J, F, OP_POP);
	if (def) {
		emitline(J, F, def);
		def->casejump = emitjump(J, F, OP_JUMP);
		end = 0;
	} else {
		end = emitjump(J, F, OP_JUMP);
	}

	/* emit the case clause bodies */
	for (node = head; node; node = node->b) {
		clause = node->a;
		label(J, F, clause->casejump);
		if (clause->type == STM_DEFAULT)
			cstmlist(J, F, clause->a);
		else
			cstmlist(J, F, clause->b);
	}

	if (end)
		label(J, F, end);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x20220
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x21254
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x5b, (%rax)
jne 0x21200
cmpq $0x0, -0x38(%rbp)
je 0x211f6
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq 0x1b67e(%rip), %rdx     # 0x3c86d
movb $0x0, %al
callq 0x8b80
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x21241
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdx
callq 0x20220
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x1f2b0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0x44, %edx
callq 0x20dd0
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x48(%rax)
jmp 0x21243
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x211b9
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %edx, %edx
callq 0x1ef90
cmpq $0x0, -0x38(%rbp)
je 0x2129f
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x1f2b0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0x51, %edx
callq 0x20dd0
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x48(%rax)
movl $0x0, -0x3c(%rbp)
jmp 0x212b4
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0x51, %edx
callq 0x20dd0
movl %eax, -0x3c(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x21328
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rax
movl 0x48(%rax), %edx
callq 0x20e20
movq -0x30(%rbp), %rax
cmpl $0x5b, (%rax)
jne 0x21303
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdx
callq 0x1f1e0
jmp 0x21318
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rdx
callq 0x1f1e0
jmp 0x2131a
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x212bc
cmpl $0x0, -0x3c(%rbp)
je 0x2133e
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x3c(%rbp), %edx
callq 0x20e20
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)