// File: /workspace/github_c_makefile_star2_O1/michaelforney[P]cproc/qbe.c
// Function: casesearch
static void
casesearch(struct func *f, int class, struct value *v, struct switchcase *c, struct block *defaultlabel)
{
	struct value *res, *key;
	struct block *label[3];

	if (!c) {
		funcjmp(f, defaultlabel);
		return;
	}
	label[0] = mkblock("switch_ne");
	label[1] = mkblock("switch_lt");
	label[2] = mkblock("switch_gt");

	/* XXX: linear search if c->node.height < 4 */
	key = mkintconst(c->node.key);
	res = funcinst(f, class == 'w' ? ICEQW : ICEQL, 'w', v, key);
	funcjnz(f, res, NULL, c->body, label[0]);
	funclabel(f, label[0]);
	res = funcinst(f, class == 'w' ? ICULTW : ICULTL, 'w', v, key);
	funcjnz(f, res, NULL, label[1], label[2]);
	funclabel(f, label[1]);
	casesearch(f, class, v, c->node.child[0], defaultlabel);
	funclabel(f, label[2]);
	casesearch(f, class, v, c->node.child[1], defaultlabel);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, 0x8(%rsp)
movq %rcx, %r14
movl %esi, 0x4(%rsp)
movq %rdi, %r12
movq %rdx, 0x10(%rsp)
movq %rdi, 0x20(%rsp)
testq %r14, %r14
je 0x109b5
movl $0x88, %edi
callq 0xe13e
movq %rax, %r15
movl $0x7, %ebp
movl %ebp, (%rax)
leaq 0x5736(%rip), %rax      # 0x15f15
movq %rax, 0x8(%r15)
movl 0xb957(%rip), %eax      # 0x1c140
incl %eax
movl %eax, 0xb94f(%rip)      # 0x1c140
movl %eax, 0x4(%r15)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r15)
xorl %r12d, %r12d
movq %r12, 0x20(%r15)
movl %r12d, 0x60(%r15)
movl %r12d, 0x50(%r15)
movq %r12, 0x80(%r15)
movl $0x88, %edi
callq 0xe13e
movq %rax, %r13
movl %ebp, (%rax)
leaq 0x56f6(%rip), %rax      # 0x15f1f
movq %rax, 0x8(%r13)
movl 0xb90d(%rip), %eax      # 0x1c140
incl %eax
movl %eax, 0xb905(%rip)      # 0x1c140
movl %eax, 0x4(%r13)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r13)
movq %r12, 0x20(%r13)
movl %r12d, 0x60(%r13)
movl %r12d, 0x50(%r13)
movq %r12, 0x80(%r13)
movl $0x88, %edi
callq 0xe13e
movq %rax, %rbx
movl %ebp, (%rax)
leaq 0x56b9(%rip), %rax      # 0x15f29
movq %rax, 0x8(%rbx)
movl 0xb8c6(%rip), %eax      # 0x1c140
incl %eax
movl %eax, 0xb8be(%rip)      # 0x1c140
movl %eax, 0x4(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movq %r12, 0x20(%rbx)
movl %r12d, 0x60(%rbx)
movl %r12d, 0x50(%rbx)
movq %r12, 0x80(%rbx)
movq %r14, 0x18(%rsp)
movq (%r14), %r14
movl $0x10, %edi
callq 0xe13e
movq %rax, %rbp
movl $0x2, (%rax)
movq %r14, 0x8(%rax)
cmpl $0x77, 0x4(%rsp)
movl $0x2a, %esi
movl $0x20, %eax
cmovel %eax, %esi
movq 0x20(%rsp), %r14
movq %r14, %rdi
movl $0x77, %edx
movq 0x10(%rsp), %rcx
movq %rbp, %r8
callq 0x101fd
movq %r14, %rdi
movq 0x30(%r14), %rcx
cmpl %r12d, 0x60(%rcx)
jne 0x10913
movq 0x18(%rsp), %rdx
movq 0x20(%rdx), %rdx
movl $0x2, 0x60(%rcx)
movq %rax, 0x68(%rcx)
movq %rdx, 0x70(%rcx)
movq %r15, 0x78(%rcx)
movl 0x4(%rsp), %r14d
cmpl $0x77, %r14d
movq 0x30(%rdi), %rax
movq %r15, 0x80(%rax)
movq %r15, 0x30(%rdi)
movl $0x31, %esi
movl $0x27, %eax
cmovel %eax, %esi
movq %rdi, %r12
movl $0x77, %edx
movq 0x10(%rsp), %r15
movq %r15, %rcx
movq %rbp, %r8
callq 0x101fd
movq 0x30(%r12), %rcx
cmpl $0x0, 0x60(%rcx)
movl %r14d, %esi
jne 0x10971
movl $0x2, 0x60(%rcx)
movq %rax, 0x68(%rcx)
movq %r13, 0x70(%rcx)
movq %rbx, 0x78(%rcx)
movq 0x30(%r12), %rax
movq %r13, 0x80(%rax)
movq %r13, 0x30(%r12)
movq 0x18(%rsp), %r14
movq 0x8(%r14), %rcx
movq %r12, %rdi
movq %r15, %rdx
movq 0x8(%rsp), %r8
callq 0x10794
movq 0x30(%r12), %rax
movq %rbx, 0x80(%rax)
movq %rbx, 0x30(%r12)
movq 0x10(%r14), %r14
jmp 0x107bb
movq 0x30(%r12), %rax
cmpl $0x0, 0x60(%rax)
jne 0x109d0
movl $0x1, 0x60(%rax)
movq 0x8(%rsp), %rcx
movq %rcx, 0x70(%rax)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq