// File: /workspace/github_c_makefile_star2_O3/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 0x15fa1
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 0x15f89
leaq 0xa0(%rsp), %r13
movq %r13, %rdi
movq %r15, %rdx
callq 0xe7b8
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 0xefc8
movslq (%rbx), %rax
leaq -0x4(,%rax,4), %rdi
callq 0x1190
movq %rax, 0x50(%rsp)
testq %rax, %rax
jne 0x1600d
callq 0x1f5f
jmp 0x16178
xorl %ebp, %ebp
testl %r14d, %r14d
movq 0x40(%rsp), %rcx
jle 0x16127
movl %r14d, %r15d
leaq 0x100(%rsp), %rax
movq (%rax), %rdx
movq %rdx, 0x58(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x60(%rsp)
xorl %r12d, %r12d
xorl %ebp, %ebp
movslq (%rcx,%r12,4), %r14
movq 0x10(%rbx), %rax
movq (%rax,%r14,8), %rax
cmpl $0x0, 0x1c(%rax)
jne 0x1611b
movq (%rax), %rsi
leaq 0x68(%rsp), %rdi
movq 0x48(%rsp), %rdx
callq 0xfa92
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 0xf3f1
movsbl %r13b, %eax
movq 0x50(%rsp), %rcx
movl %eax, (%rcx,%r12,4)
incl %ebp
testb %al, %al
je 0x160e3
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 0x15312
jmp 0x16116
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 0x1537f
movq 0x40(%rsp), %rcx
incq %r12
cmpq %r12, %r15
jne 0x1603e
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 0xf470
movq 0x16e93(%rip), %rax     # 0x2cff8
movq (%rax), %rdi
leaq 0x9ec7(%rip), %rsi      # 0x20036
movl %ebp, %edx
xorl %eax, %eax
callq 0x1160
movq 0x50(%rsp), %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop