// File: /workspace/github_c_makefile_star2_O1/pwelke[P]GraphMiningTools/minhashing.c
// Function: randomProjectionEmbeddingLocalEasy
int* randomProjectionEmbeddingLocalEasy(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);

	// alloc output array
	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=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);

			// update output
			approximateEmbedding[i] = match;

			// update evaluation plan
			++nEvaluations;
			updateEvaluationPlan(p, currentGraphNumber, match);
		}
	}

	dumpSpanningtreeTree(sptTree, gp);

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

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %r9, %r15
movq %r8, 0x48(%rsp)
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, 0x40(%rsp)
movq %rdi, %rsi
leaq 0x100(%rsp), %rax
movq (%rax), %rbx
movslq (%rbx), %rax
testq %rax, %rax
jle 0x160b3
leaq 0x100(%rsp), %rcx
movq 0x8(%rcx), %rdx
movq 0x10(%rbx), %rcx
movq 0x10(%rdx), %rdx
xorl %edi, %edi
xorl %r8d, %r8d
movq (%rcx,%r8,8), %r9
movl %edi, 0x1c(%r9)
movq (%rdx,%r8,8), %r9
movl %edi, 0x1c(%r9)
incq %r8
cmpq %r8, %rax
jne 0x1609b
leaq 0xa0(%rsp), %r13
movq %r13, %rdi
movq %r15, %rdx
callq 0xe85c
movq 0x20(%r13), %rax
movq %rax, 0x20(%rsp)
movups (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq 0x68(%rsp), %rdi
movl %ebp, %esi
movl $0x1, %edx
movq 0x48(%rsp), %rcx
movq %r15, %r8
callq 0xf05d
movslq (%rbx), %rax
leaq -0x4(,%rax,4), %rdi
callq 0x1190
testq %rax, %rax
jne 0x1611d
callq 0x1fbf
xorl %r13d, %r13d
jmp 0x162a1
movq %rax, %r13
xorl %ebp, %ebp
testl %r14d, %r14d
movq 0x40(%rsp), %rcx
jle 0x16250
movl %r14d, %edx
leaq 0x100(%rsp), %rax
movq (%rax), %rsi
movq %rsi, 0x58(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x60(%rsp)
xorl %r12d, %r12d
xorl %ebp, %ebp
movq %rdx, 0x50(%rsp)
movslq (%rcx,%r12,4), %r14
movq 0x10(%rbx), %rax
movq (%rax,%r14,8), %rax
cmpl $0x0, 0x1c(%rax)
jne 0x16244
movq %rbx, %r15
movq (%rax), %rsi
leaq 0x68(%rsp), %rdi
movq 0x48(%rsp), %rdx
callq 0xfadf
movl %ebp, %ebx
movq %r13, %rbp
movl %eax, %r13d
movq 0x98(%rsp), %rax
movq %rax, 0x30(%rsp)
movups 0x68(%rsp), %xmm0
movups 0x78(%rsp), %xmm1
movups 0x88(%rsp), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0xf483
movsbl %r13b, %eax
movq %rbp, %r13
movl %ebx, %ebp
movl %eax, (%r13,%r12,4)
incl %ebp
testb %al, %al
je 0x16204
movq 0x60(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax,%r14,8), %rdi
leaq 0x100(%rsp), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x15417
jmp 0x16237
movq 0x58(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax,%r14,8), %rdi
leaq 0x100(%rsp), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x15484
movq 0x40(%rsp), %rcx
movq %r15, %rbx
movq 0x50(%rsp), %rdx
incq %r12
cmpq %r12, %rdx
jne 0x16156
movq 0x98(%rsp), %rax
movq %rax, 0x30(%rsp)
movups 0x68(%rsp), %xmm0
movups 0x78(%rsp), %xmm1
movups 0x88(%rsp), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq 0x48(%rsp), %rdi
callq 0xf502
movq 0x16d6a(%rip), %rax     # 0x2cff8
movq (%rax), %rdi
leaq 0x9d9e(%rip), %rsi      # 0x20036
movl %ebp, %edx
xorl %eax, %eax
callq 0x1160
movq %r13, %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop