// File: /workspace/github_c_makefile_star2_O0/oridb[P]mc/mi/match.c
// Function: genmatch
void
genmatch(Node *m, Node *val, Node ***out, size_t *nout)
{
	Node **pat, **lbl, *end, *endlbl;
	size_t npat, nlbl, i;
	Dtree *dt;

	lbl = NULL;
	nlbl = 0;

	pat = m->matchstmt.matches;
	npat = m->matchstmt.nmatches;
	for (i = 0; i < npat; i++)
		lappend(&lbl, &nlbl, genlbl(pat[i]->match.block->loc));


	endlbl = genlbl(m->loc);
	dt = gendtree(m, val, lbl, nlbl);
	genmatchcode(dt, out, nout);

	for (i = 0; i < npat; i++) {
		end = mkexpr(pat[i]->loc, Ojmp, endlbl, NULL);
		end->expr.type = mktype(end->loc, Tyvoid);
		lappend(out, nout, lbl[i]);
		lappend(out, nout, pat[i]->match.block);
		lappend(out, nout, end);
	}
	lappend(out, nout, endlbl);

	if (debugopt['m']) {
		dtreedump(stdout, dt);
		for (i = 0; i < *nout; i++)
			dumpn((*out)[i], stdout);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x48(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x48(%rbp), %rax
jae 0x461a8
movq -0x28(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x20(%rax), %rax
movq (%rax), %rdi
callq 0x2fd00
movq %rax, %rdx
leaq -0x30(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x48290
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x46168
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x2fd00
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x50(%rbp), %rcx
callq 0x449e0
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x45c70
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x48(%rbp), %rax
jae 0x46293
movq -0x28(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x40(%rbp), %rdx
movq (%rax), %rdi
movl $0x30, %esi
xorl %eax, %eax
movl %eax, %ecx
movb $0x0, %al
callq 0x2f400
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rdi
movl $0x1, %esi
callq 0x36c10
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
callq 0x48290
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x20(%rax), %rdx
callq 0x48290
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x48290
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x461ea
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x48290
leaq 0x36a55(%rip), %rax     # 0x7cd00
cmpb $0x0, 0x6d(%rax)
je 0x46307
movq 0x18d18(%rip), %rax     # 0x5efd0
movq (%rax), %rdi
movq -0x60(%rbp), %rsi
callq 0x44890
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x46305
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x18ce1(%rip), %rax     # 0x5efd0
movq (%rax), %rsi
callq 0x1de90
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x462cc
jmp 0x46307
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)