// File: /workspace/github_c_makefile_star2_O0/pwelke[P]GraphMiningTools/minhashing.c
// Function: fullEmbeddingProjectionApproximationForTrees
int* fullEmbeddingProjectionApproximationForTrees(struct Graph* g, struct EvaluationPlan p, int* projection, int projectionSize, struct GraphPool* gp) {

	int nEvaluations = 0;
	cleanEvaluationPlan(p);

	for (int i=0; i<projectionSize; ++i) {
		// if we don't know the value we need to compute it.
		int currentGraphNumber = projection[i];
		if (!embeddingValueKnown(p.poset->vertices[currentGraphNumber])) {
			// evaluate the embedding operator
			struct Graph* currentGraph = (struct Graph*)(p.poset->vertices[currentGraphNumber]->label);
			char match = isSubtree(g, currentGraph, gp);
			++nEvaluations;
			updateEvaluationPlan(p, currentGraphNumber, match);
		}
	}

	int* approximateEmbedding = malloc((p.poset->n - 1) * sizeof(int));
	if (!approximateEmbedding) {
		fprintf(stderr, "Could not allocate memory for sketch. This is a bad thing.\n");
		return NULL;
	}

	for (int i=1; i<p.poset->n; ++i) {
		approximateEmbedding[i-1] = p.poset->vertices[i]->visited; // init sketch values to 'infty'
	}

	fprintf(stderr, "%i\n", nEvaluations);
	return approximateEmbedding;

}

// Assembly:
subq $0x98, %rsp
leaq 0xa0(%rsp), %rax
movq %rax, 0x38(%rsp)
movq %rdi, 0x88(%rsp)
movq %rsi, 0x80(%rsp)
movl %edx, 0x7c(%rsp)
movq %rcx, 0x70(%rsp)
movl $0x0, 0x6c(%rsp)
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movq %rsp, %rax
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x21020
movl $0x0, 0x68(%rsp)
movl 0x68(%rsp), %eax
cmpl 0x7c(%rsp), %eax
jge 0x2267f
movq 0x38(%rsp), %rax
movq 0x80(%rsp), %rcx
movslq 0x68(%rsp), %rdx
movl (%rcx,%rdx,4), %ecx
movl %ecx, 0x64(%rsp)
movq (%rax), %rax
movq 0x10(%rax), %rax
movslq 0x64(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x21090
cmpl $0x0, %eax
jne 0x2266d
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movslq 0x64(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movq %rax, 0x58(%rsp)
movq 0x88(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq 0x70(%rsp), %rdx
callq 0xfbd0
movq 0x38(%rsp), %rcx
movb %al, 0x57(%rsp)
movl 0x6c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x6c(%rsp)
movl 0x64(%rsp), %edi
movb 0x57(%rsp), %al
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups 0x20(%rcx), %xmm2
movq %rsp, %rcx
movups %xmm2, 0x20(%rcx)
movups %xmm1, 0x10(%rcx)
movups %xmm0, (%rcx)
movsbl %al, %esi
callq 0x210d0
jmp 0x2266f
movl 0x68(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x68(%rsp)
jmp 0x225bb
movq 0x38(%rsp), %rax
movq (%rax), %rax
movl (%rax), %eax
subl $0x1, %eax
movslq %eax, %rdi
shlq $0x2, %rdi
callq 0x1170
movq %rax, 0x48(%rsp)
cmpq $0x0, 0x48(%rsp)
jne 0x226cb
movq 0x1b94c(%rip), %rax     # 0x3dff8
movq (%rax), %rdi
leaq 0x1355e(%rip), %rsi     # 0x35c14
movb $0x0, %al
callq 0x1140
movq $0x0, 0x90(%rsp)
jmp 0x22743
movl $0x1, 0x44(%rsp)
movq 0x38(%rsp), %rcx
movl 0x44(%rsp), %eax
movq (%rcx), %rcx
cmpl (%rcx), %eax
jge 0x2271a
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movslq 0x44(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x1c(%rax), %edx
movq 0x48(%rsp), %rax
movl 0x44(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl 0x44(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x44(%rsp)
jmp 0x226d3
movq 0x1b8d7(%rip), %rax     # 0x3dff8
movq (%rax), %rdi
movl 0x6c(%rsp), %edx
leaq 0x12907(%rip), %rsi     # 0x35036
movb $0x0, %al
callq 0x1140
movq 0x48(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x90(%rsp), %rax
addq $0x98, %rsp
retq
nopw %cs:(%rax,%rax)