// File: /workspace/github_c_makefile_star2_O0/oridb[P]mc/mi/match.c
// Function: addrec
static void
addrec(Frontier *fs, Node *pat, Node *val, Path *path)
{
	size_t i, n;
	Type *ty, *mty;
	Node *memb, *name, *tagid, *p, *v, *lit, *dcl, *asn, *deref;
	Ucon *uc;
	char *s;
	Frontier *next;

	pat = fold(pat, 1);
	switch (exprop(pat)) {
	case Olor:
		next = frontierdup(fs);
		next->next = fs->next;
		next->hasorpat = 1;
		fs->next = next;
		fs->hasorpat = 1;
		addrec(fs, pat->expr.args[0], val, path);
		addrec(next, pat->expr.args[1], val, path);
		break;
	case Ogap:
		lappend(&fs->slot, &fs->nslot, mkslot(path, pat, val));
		break;
	case Ovar:
		dcl = decls[pat->expr.did];
		if (dcl->decl.isconst) {
			ty = decltype(dcl);
			if (ty->type == Tyfunc || ty->type == Tycode || ty->type == Tyvalist)
				fatal(dcl, "bad pattern %s:%s: unmatchable type", declname(dcl), tystr(ty));
			if (!dcl->decl.init)
				fatal(dcl, "bad pattern %s:%s: missing initializer", declname(dcl), tystr(ty));
			addrec(fs, dcl->decl.init, val, mkpath(path, 0));
		} else {
			asn = mkexpr(pat->loc, Oasn, pat, val, NULL);
			asn->expr.type = exprtype(pat);
			lappend(&fs->cap, &fs->ncap, asn);

			lappend(&fs->slot, &fs->nslot, mkslot(path, pat, val));
		}
		break;
	case Olit:
		if (pat->expr.args[0]->lit.littype == Lstr) {
			lit = pat->expr.args[0];
			n = lit->lit.strval.len;
			s = lit->lit.strval.buf;

			ty = mktype(pat->loc, Tyuint64);
			p = mkintlit(lit->loc, n);
			p ->expr.type = ty;
			v = structmemb(val, mkname(pat->loc, "len"), ty);

			addrec(fs, p, v, mkpath(path, 0));

			ty = mktype(pat->loc, Tybyte);
			for (i = 0; i < n; i++) {
				p = mkintlit(lit->loc, s[i]);
				p->expr.type = ty;
				v = arrayelt(val, i);
				addrec(fs, p, v, mkpath(path, 1+i));
			}
		} else {
			lappend(&fs->slot, &fs->nslot, mkslot(path, pat, val));
		}
		break;
	case Oaddr:
		deref = mkexpr(val->loc, Oderef, val, NULL);
		deref->expr.type = exprtype(pat->expr.args[0]);
		addrec(fs, pat->expr.args[0], deref, mkpath(path, 0));
		break;
	case Oucon:
		uc = finducon(tybase(exprtype(pat)), pat->expr.args[0]);
		tagid = mkintlit(pat->loc, uc->id);
		tagid->expr.type = mktype(pat->loc, Tyint32);
		addrec(fs, tagid, utag(val), mkpath(path, 0));
		if (uc->etype)
			addrec(fs, pat->expr.args[1], uvalue(val, uc->etype), mkpath(path, 1));
		break;
	case Otup:
		for (i = 0; i < pat->expr.nargs; i++) {
			addrec(fs, pat->expr.args[i], tupelt(val, i), mkpath(path, i));
		}
		break;
	case Oarr:
		for (i = 0; i < pat->expr.nargs; i++) {
			addrec(fs, pat->expr.args[i], arrayelt(val, i), mkpath(path, i));
		}
		break;
	case Ostruct:
		ty = tybase(exprtype(pat));
		for (i = 0; i < ty->nmemb; i++) {
			mty = decltype(ty->sdecls[i]);
			name = ty->sdecls[i]->decl.name;
			memb = findmemb(pat, name);
			if (!memb) {
				memb = mkexpr(ty->sdecls[i]->loc, Ogap, NULL);
				memb->expr.type = mty;
			}
			addrec(fs, memb, structmemb(val, name, mty), mkpath(path, i));
		}
		break;
	default:
		fatal(pat, "unsupported pattern %s of type %s", opstr[exprop(pat)], tystr(exprtype(pat)));
		break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1f0, %rsp            # imm = 0x1F0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x1f390
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2f210
addl $-0x12, %eax
movl %eax, %ecx
movq %rcx, -0xa8(%rbp)
subl $0x27, %eax
ja 0x46c84
movq -0xa8(%rbp), %rax
leaq 0xed6b(%rip), %rcx      # 0x55144
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rdi
callq 0x46e50
movq %rax, -0xa0(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rcx
movq -0xa0(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0xa0(%rbp), %rax
movl $0x1, 0x38(%rax)
movq -0xa0(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x8(%rbp), %rax
movl $0x1, 0x38(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x46380
movq -0xa0(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq 0x8(%rax), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x46380
jmp 0x46cde
movq -0x8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0xb8(%rbp)
movq -0x8(%rbp), %rax
addq $0x18, %rax
movq %rax, -0xb0(%rbp)
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x46ef0
movq -0xb8(%rbp), %rdi
movq -0xb0(%rbp), %rsi
movq %rax, %rdx
callq 0x48290
jmp 0x46cde
leaq 0x36fc9(%rip), %rax     # 0x7d488
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x38(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
cmpb $0x0, 0x72(%rax)
je 0x465eb
movq -0x78(%rbp), %rdi
callq 0x30260
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpl $0x13, (%rax)
je 0x46508
movq -0x38(%rbp), %rax
cmpl $0x1e, (%rax)
je 0x46508
movq -0x38(%rbp), %rax
cmpl $0x11, (%rax)
jne 0x4654b
movq -0x78(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x78(%rbp), %rdi
callq 0x30200
movq %rax, -0xc0(%rbp)
movq -0x38(%rbp), %rdi
callq 0x38a10
movq -0xc8(%rbp), %rdi
movq -0xc0(%rbp), %rdx
movq %rax, %rcx
leaq 0xefc1(%rip), %rsi      # 0x55505
movb $0x0, %al
callq 0x1dfe0
movq -0x78(%rbp), %rax
cmpq $0x0, 0x30(%rax)
jne 0x46599
movq -0x78(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x78(%rbp), %rdi
callq 0x30200
movq %rax, -0xd0(%rbp)
movq -0x38(%rbp), %rdi
callq 0x38a10
movq -0xd8(%rbp), %rdi
movq -0xd0(%rbp), %rdx
movq %rax, %rcx
leaq 0xef97(%rip), %rsi      # 0x55529
movb $0x0, %al
callq 0x1dfe0
movq -0x8(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0x78(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0xe8(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0x46cf0
movq -0xf0(%rbp), %rdi
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rdx
movq %rax, %rcx
callq 0x46380
jmp 0x46681
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq (%rax), %rdi
movl $0x1d, %esi
xorl %eax, %eax
movl %eax, %r8d
movb $0x0, %al
callq 0x2f400
movq %rax, -0x80(%rbp)
movq -0x10(%rbp), %rdi
callq 0x30340
movq %rax, %rcx
movq -0x80(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rdi
addq $0x20, %rdi
movq -0x8(%rbp), %rsi
addq $0x28, %rsi
movq -0x80(%rbp), %rdx
callq 0x48290
movq -0x8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x100(%rbp)
movq -0x8(%rbp), %rax
addq $0x18, %rax
movq %rax, -0xf8(%rbp)
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x46ef0
movq -0x100(%rbp), %rdi
movq -0xf8(%rbp), %rsi
movq %rax, %rdx
callq 0x48290
jmp 0x46cde
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq (%rax), %rax
cmpl $0x4, 0x18(%rax)
jne 0x46844
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq (%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x70(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl $0xe, %esi
callq 0x36c10
movq %rax, -0x38(%rbp)
movq -0x70(%rbp), %rax
movq -0x30(%rbp), %rsi
movq (%rax), %rdi
callq 0x2f3c0
movq %rax, -0x60(%rbp)
movq -0x38(%rbp), %rcx
movq -0x60(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0xe865(%rip), %rsi      # 0x54f78
callq 0x2f540
movq -0x120(%rbp), %rdi
movq %rax, %rsi
movq -0x38(%rbp), %rdx
callq 0x46f70
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0x46cf0
movq -0x118(%rbp), %rdi
movq -0x110(%rbp), %rsi
movq -0x108(%rbp), %rdx
movq %rax, %rcx
callq 0x46380
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl $0x9, %esi
callq 0x36c10
movq %rax, -0x38(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x46842
movq -0x70(%rbp), %rax
movq -0x98(%rbp), %rcx
movq -0x28(%rbp), %rdx
movsbq (%rcx,%rdx), %rsi
movq (%rax), %rdi
callq 0x2f3c0
movq %rax, -0x60(%rbp)
movq -0x38(%rbp), %rcx
movq -0x60(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x46fc0
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x130(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x128(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
addq $0x1, %rax
movl %eax, %esi
callq 0x46cf0
movq -0x138(%rbp), %rdi
movq -0x130(%rbp), %rsi
movq -0x128(%rbp), %rdx
movq %rax, %rcx
callq 0x46380
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x46795
jmp 0x46889
movq -0x8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x148(%rbp)
movq -0x8(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x140(%rbp)
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x46ef0
movq -0x148(%rbp), %rdi
movq -0x140(%rbp), %rsi
movq %rax, %rdx
callq 0x48290
jmp 0x46cde
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rdx
movq (%rax), %rdi
movl $0x13, %esi
xorl %eax, %eax
movl %eax, %ecx
movb $0x0, %al
callq 0x2f400
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq (%rax), %rdi
callq 0x30340
movq %rax, %rcx
movq -0x88(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq %rax, -0x160(%rbp)
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq (%rax), %rax
movq %rax, -0x158(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x150(%rbp)
movq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0x46cf0
movq -0x160(%rbp), %rdi
movq -0x158(%rbp), %rsi
movq -0x150(%rbp), %rdx
movq %rax, %rcx
callq 0x46380
jmp 0x46cde
movq -0x10(%rbp), %rdi
callq 0x30340
movq %rax, %rdi
callq 0x36a30
movq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq (%rax), %rsi
callq 0x377a0
movq %rax, -0x90(%rbp)
movq -0x10(%rbp), %rax
movq -0x90(%rbp), %rcx
movq 0x8(%rcx), %rsi
movq (%rax), %rdi
callq 0x2f3c0
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl $0x7, %esi
callq 0x36c10
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x170(%rbp)
movq -0x18(%rbp), %rdi
callq 0x47050
movq %rax, -0x168(%rbp)
movq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0x46cf0
movq -0x178(%rbp), %rdi
movq -0x170(%rbp), %rsi
movq -0x168(%rbp), %rdx
movq %rax, %rcx
callq 0x46380
movq -0x90(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x46a48
movq -0x8(%rbp), %rax
movq %rax, -0x190(%rbp)
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x188(%rbp)
movq -0x18(%rbp), %rdi
movq -0x90(%rbp), %rax
movq 0x28(%rax), %rsi
callq 0x470b0
movq %rax, -0x180(%rbp)
movq -0x20(%rbp), %rdi
movl $0x1, %esi
callq 0x46cf0
movq -0x190(%rbp), %rdi
movq -0x188(%rbp), %rsi
movq -0x180(%rbp), %rdx
movq %rax, %rcx
callq 0x46380
jmp 0x46cde
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x40(%rcx), %rax
jae 0x46ad3
movq -0x8(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x1a0(%rbp)
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x47100
movq %rax, -0x198(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movl %eax, %esi
callq 0x46cf0
movq -0x1a8(%rbp), %rdi
movq -0x1a0(%rbp), %rsi
movq -0x198(%rbp), %rdx
movq %rax, %rcx
callq 0x46380
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x46a55
jmp 0x46cde
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x40(%rcx), %rax
jae 0x46b5e
movq -0x8(%rbp), %rax
movq %rax, -0x1c0(%rbp)
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x1b8(%rbp)
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x46fc0
movq %rax, -0x1b0(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movl %eax, %esi
callq 0x46cf0
movq -0x1c0(%rbp), %rdi
movq -0x1b8(%rbp), %rsi
movq -0x1b0(%rbp), %rdx
movq %rax, %rcx
callq 0x46380
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x46ae0
jmp 0x46cde
movq -0x10(%rbp), %rdi
callq 0x30340
movq %rax, %rdi
callq 0x36a30
movq %rax, -0x38(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x38(%rbp), %rcx
cmpq 0x78(%rcx), %rax
jae 0x46c82
movq -0x38(%rbp), %rax
movq 0x88(%rax), %rax
movq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x30260
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq 0x88(%rax), %rax
movq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x20(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x471a0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x46c17
movq -0x38(%rbp), %rax
movq 0x88(%rax), %rax
movq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rdi
movl $0x34, %esi
xorl %eax, %eax
movl %eax, %edx
movb $0x0, %al
callq 0x2f400
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq %rax, -0x1d8(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x1d0(%rbp)
movq -0x18(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x46f70
movq %rax, -0x1c8(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movl %eax, %esi
callq 0x46cf0
movq -0x1d8(%rbp), %rdi
movq -0x1d0(%rbp), %rsi
movq -0x1c8(%rbp), %rdx
movq %rax, %rcx
callq 0x46380
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x46b80
jmp 0x46cde
movq -0x10(%rbp), %rax
movq %rax, -0x1e8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2f210
movl %eax, %eax
movl %eax, %ecx
leaq 0x3521d(%rip), %rax     # 0x7bec0
movq (%rax,%rcx,8), %rax
movq %rax, -0x1e0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x30340
movq %rax, %rdi
callq 0x38a10
movq -0x1e8(%rbp), %rdi
movq -0x1e0(%rbp), %rdx
movq %rax, %rcx
leaq 0xe879(%rip), %rsi      # 0x55550
movb $0x0, %al
callq 0x1dfe0
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbp
retq
nopw (%rax,%rax)