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

	int nEvaluations = 0;
	cleanEvaluationPlan(p);

	struct BlockTree blockTree = getBlockTreeT(g, sgp);
	struct SpanningtreeTree sptTree = getSampledSpanningtreeTree(blockTree, nLocalTrees, 1, gp, sgp);

	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* pattern = (struct Graph*)(p.poset->vertices[currentGraphNumber]->label);
			char match = subtreeCheckForSpanningtreeTree(&sptTree, pattern, gp);
			wipeCharacteristicsForLocalEasy(sptTree);
			++nEvaluations;
			updateEvaluationPlan(p, currentGraphNumber, match);
		}
	}

	dumpSpanningtreeTree(sptTree, gp);

	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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %r9, %r13
movq %r8, 0x40(%rsp)
movl %ecx, %ebx
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %rsi
leaq 0xe0(%rsp), %rax
movq (%rax), %rbp
movq 0x8(%rax), %rax
movl (%rbp), %ecx
xorl %edx, %edx
testl %ecx, %ecx
cmovlel %edx, %ecx
cmpq %rdx, %rcx
je 0x12e9b
movq 0x10(%rbp), %rdi
movq (%rdi,%rdx,8), %rdi
andl $0x0, 0x1c(%rdi)
movq 0x10(%rax), %rdi
movq (%rdi,%rdx,8), %rdi
andl $0x0, 0x1c(%rdi)
incq %rdx
jmp 0x12e79
leaq 0x80(%rsp), %r12
movq %r12, %rdi
movq %r13, %rdx
callq 0xbe98
movq 0x20(%r12), %rax
movq %rax, 0x20(%rsp)
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq 0x48(%rsp), %rdi
pushq $0x1
popq %rdx
movl %ebx, %esi
movq 0x40(%rsp), %rcx
movq %r13, %r8
callq 0xc605
xorl %ebx, %ebx
testl %r14d, %r14d
cmovlel %ebx, %r14d
movl $0x0, 0x3c(%rsp)
cmpq %rbx, %r14
je 0x12f89
movslq (%r15,%rbx,4), %r13
movq 0x10(%rbp), %rax
movq (%rax,%r13,8), %rax
cmpl $0x0, 0x1c(%rax)
jne 0x12f81
movq (%rax), %rsi
leaq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rdx
callq 0xcfbf
movl %eax, %r12d
movq 0x78(%rsp), %rax
movq %rax, 0x30(%rsp)
movups 0x48(%rsp), %xmm0
movups 0x58(%rsp), %xmm1
movups 0x68(%rsp), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0xc9af
incl 0x3c(%rsp)
leaq 0xe0(%rsp), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movsbl %r12b, %esi
movl %r13d, %edi
callq 0x120b2
incq %rbx
jmp 0x12ef4
movq 0x78(%rsp), %rax
movq %rax, 0x30(%rsp)
movups 0x48(%rsp), %xmm0
movups 0x58(%rsp), %xmm1
movups 0x68(%rsp), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq 0x40(%rsp), %rdi
callq 0xca2f
movslq (%rbp), %r14
leaq -0x4(,%r14,4), %rdi
callq 0x1180
movq %rax, %rbx
testq %rax, %rax
jne 0x12ff1
movq 0x1701e(%rip), %rax     # 0x29ff8
movq (%rax), %rcx
leaq 0xabe2(%rip), %rdi      # 0x1dbc6
pushq $0x3b
popq %rsi
pushq $0x1
popq %rdx
callq 0x1210
jmp 0x13029
pushq $0x1
popq %rax
cmpq %r14, %rax
jge 0x1300d
movq 0x10(%rbp), %rcx
movq (%rcx,%rax,8), %rcx
movl 0x1c(%rcx), %ecx
movl %ecx, -0x4(%rbx,%rax,4)
incq %rax
jmp 0x12ff4
movq 0x16fe4(%rip), %rax     # 0x29ff8
movq (%rax), %rdi
leaq 0xa018(%rip), %rsi      # 0x1d036
movl 0x3c(%rsp), %edx
xorl %eax, %eax
callq 0x1150
movq %rbx, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq