// File: /workspace/github_c_makefile_star2_O2/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 $0xb8, %rsp
movq %r9, %rbx
movq %r8, 0x40(%rsp)
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, 0x48(%rsp)
movq %rdi, %rsi
leaq 0xf0(%rsp), %rax
movq (%rax), %r12
movq 0x8(%rax), %rax
movl (%r12), %ecx
xorl %edx, %edx
testl %ecx, %ecx
cmovlel %edx, %ecx
cmpq %rdx, %rcx
je 0x131d0
movq 0x10(%r12), %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 0x131ad
leaq 0x90(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rdx
callq 0xbe98
movq 0x20(%r13), %rax
movq %rax, 0x20(%rsp)
movups (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq 0x58(%rsp), %rdi
pushq $0x1
popq %rdx
movl %ebp, %esi
movq 0x40(%rsp), %rcx
movq %rbx, %r8
callq 0xc605
movslq (%r12), %rax
leaq -0x4(,%rax,4), %rdi
callq 0x1180
movq %rax, 0x50(%rsp)
testq %rax, %rax
jne 0x13252
movq 0x16dc0(%rip), %rax     # 0x29ff8
movq (%rax), %rcx
leaq 0xa984(%rip), %rdi      # 0x1dbc6
pushq $0x3b
popq %rsi
pushq $0x1
popq %rdx
callq 0x1210
jmp 0x13354
xorl %r15d, %r15d
testl %r14d, %r14d
cmovlel %r15d, %r14d
xorl %ebp, %ebp
movq 0x48(%rsp), %rcx
cmpq %r15, %r14
je 0x13306
movslq (%rcx,%r15,4), %r13
movq 0x10(%r12), %rax
movq (%rax,%r13,8), %rax
cmpl $0x0, 0x1c(%rax)
jne 0x132fe
movq (%rax), %rsi
leaq 0x58(%rsp), %rdi
movq 0x40(%rsp), %rdx
callq 0xcfbf
movl %eax, %ebx
movq 0x88(%rsp), %rax
movq %rax, 0x30(%rsp)
movups 0x58(%rsp), %xmm0
movups 0x68(%rsp), %xmm1
movups 0x78(%rsp), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0xc9af
movsbl %bl, %esi
movq 0x50(%rsp), %rax
movl %esi, (%rax,%r15,4)
incl %ebp
leaq 0xf0(%rsp), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movl %r13d, %edi
callq 0x120b2
movq 0x48(%rsp), %rcx
incq %r15
jmp 0x13263
movq 0x88(%rsp), %rax
movq %rax, 0x30(%rsp)
movups 0x58(%rsp), %xmm0
movups 0x68(%rsp), %xmm1
movups 0x78(%rsp), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq 0x40(%rsp), %rdi
callq 0xca2f
movq 0x16cb7(%rip), %rax     # 0x29ff8
movq (%rax), %rdi
leaq 0x9ceb(%rip), %rsi      # 0x1d036
movl %ebp, %edx
xorl %eax, %eax
callq 0x1150
movq 0x50(%rsp), %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop