// File: /workspace/github_c_makefile_star2_O0/oridb[P]mc/mi/match.c
// Function: project
static Frontier *
project(Node *pat, Path *pi, Node *val, Frontier *fs)
{
	Frontier *out;
	Slot *c, **slot;
	size_t i, nslot;

	assert (fs->nslot > 0);

	/*
	 * copy a new set of slots from fs without the slot at the path pi.
	 * c points to the slot at the path pi.
	 */
	c = NULL;
	slot = NULL;
	nslot = 0;
	for (i = 0; i < fs->nslot; i++) {
		if (patheq(pi, fs->slot[i]->path)) {
			c = fs->slot[i];
			continue;
		}
		lappend(&slot, &nslot, fs->slot[i]);
	}

	out = zalloc(sizeof(Frontier));
	out->i = fs->i;
	out->lbl = fs->lbl;
	out->slot = slot;
	out->nslot = nslot;
	out->cap = fs->cap;
	out->ncap = fs->ncap;
	out->final = fs->final;

	/*
	 * if the sub-term at pi is not in the frontier,
	 * then we do not reduce the frontier.
	 */
	if (c == NULL)
		return out;

	switch (exprop(c->pat)) {
	case Ovar:
	case Ogap:
		/*
		 * if the pattern at the sub-term pi of this frontier is not a constructor,
		 * then we do not reduce the frontier.
		 */
		return out;
	default:
		break;
	}

	/*
	 * if constructor at the path pi is not the constructor we want to project,
	 * then return null.
	 */
	if (!pateq(pat, c->pat))
		return NULL;

	return out;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jbe 0x47365
jmp 0x47384
leaq 0xe34b(%rip), %rdi      # 0x556b7
leaq 0xe142(%rip), %rsi      # 0x554b5
movl $0x247, %edx            # imm = 0x247
leaq 0xe352(%rip), %rcx      # 0x556d1
callq 0x6160
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jae 0x47414
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rsi
callq 0x47220
cmpl $0x0, %eax
je 0x473e9
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
jmp 0x47406
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
leaq -0x40(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x48290
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x473a4
movl $0x48, %edi
callq 0x48160
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x40(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x50(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x28(%rbp), %rax
movq 0x30(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x30(%rax)
cmpq $0x0, -0x38(%rbp)
jne 0x47497
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x474e2
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2f210
addl $-0x33, %eax
subl $0x1, %eax
ja 0x474b8
jmp 0x474ae
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x474e2
jmp 0x474ba
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x472a0
cmpl $0x0, %eax
jne 0x474da
movq $0x0, -0x8(%rbp)
jmp 0x474e2
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)