// File: /workspace/github_c_makefile_star2_O0/pwelke[P]GraphMiningTools/minhashing.c
// Function: fastMinHashForAbsImportantTrees
int* fastMinHashForAbsImportantTrees(struct Graph* g, struct EvaluationPlan p, int importance, struct GraphPool* gp) {
	int* sketch = malloc(p.sketchSize * sizeof(int));
	if (!sketch) {
		fprintf(stderr, "Could not allocate memory for sketch. This is a bad thing.\n");
		return NULL;
	}
	int nEvaluations = 0;

	cleanEvaluationPlan(p);

	for (size_t i=0; i<p.sketchSize; ++i) {
		sketch[i] = -1; // init sketch values to 'infty'
	}
	for (size_t i=0; i<p.orderLength; ++i) {
		struct PosPair current = p.order[i];
		int currentGraphNumber = p.shrunkPermutations[current.permutation][current.level];

		// check if we already found level min for the permutation
		if (sketch[current.permutation] != -1) {
			continue;
		}

		// check if we already evaluated the embedding operator for this pattern or found a subpattern that had no match
		if (p.poset->vertices[currentGraphNumber]->visited != 0) {
			// either the pattern with id currentGraphNumber was evaluated positively and we hence have found the
			// min value for the current permutation or we need to continue
			if (p.poset->vertices[currentGraphNumber]->visited == 1) {
				sketch[current.permutation] = current.level;
			}
			continue;
		}

		// evaluate the embedding operator
		struct Graph* currentGraph = (struct Graph*)(p.poset->vertices[currentGraphNumber]->label);
		char match = isImportantSubtreeAbsolute(g, currentGraph, importance, gp);
		++nEvaluations;

		updateEvaluationPlan(p, currentGraphNumber, match);
	}

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

// Assembly:
subq $0xa8, %rsp
leaq 0xb0(%rsp), %rax
movq %rax, 0x38(%rsp)
movq %rdi, 0x98(%rsp)
movl %esi, 0x94(%rsp)
movq %rdx, 0x88(%rsp)
movq 0x28(%rax), %rdi
shlq $0x2, %rdi
callq 0x1170
movq %rax, 0x80(%rsp)
cmpq $0x0, 0x80(%rsp)
jne 0x216b4
movq 0x1c966(%rip), %rax     # 0x3dff8
movq (%rax), %rdi
leaq 0x14578(%rip), %rsi     # 0x35c14
movb $0x0, %al
callq 0x1140
movq $0x0, 0xa0(%rsp)
jmp 0x21899
movq 0x38(%rsp), %rax
movl $0x0, 0x7c(%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
movq $0x0, 0x70(%rsp)
movq 0x38(%rsp), %rcx
movq 0x70(%rsp), %rax
cmpq 0x28(%rcx), %rax
jae 0x2171c
movq 0x80(%rsp), %rax
movq 0x70(%rsp), %rcx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
movq 0x70(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x70(%rsp)
jmp 0x216e8
movq $0x0, 0x68(%rsp)
movq 0x38(%rsp), %rcx
movq 0x68(%rsp), %rax
cmpq 0x20(%rcx), %rax
jae 0x2186d
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rcx
movq 0x68(%rsp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
movq 0x8(%rcx), %rcx
movq %rcx, 0x60(%rsp)
movq 0x18(%rax), %rax
movq 0x60(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x58(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x54(%rsp)
movq 0x80(%rsp), %rax
movq 0x60(%rsp), %rcx
cmpl $-0x1, (%rax,%rcx,4)
je 0x21790
jmp 0x2185a
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movslq 0x54(%rsp), %rcx
movq (%rax,%rcx,8), %rax
cmpl $0x0, 0x1c(%rax)
je 0x217df
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movslq 0x54(%rsp), %rcx
movq (%rax,%rcx,8), %rax
cmpl $0x1, 0x1c(%rax)
jne 0x217dd
movq 0x58(%rsp), %rax
movl %eax, %edx
movq 0x80(%rsp), %rax
movq 0x60(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x2185a
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movslq 0x54(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movq %rax, 0x48(%rsp)
movq 0x98(%rsp), %rdi
movq 0x48(%rsp), %rsi
movl 0x94(%rsp), %edx
movq 0x88(%rsp), %rcx
callq 0xd970
movq 0x38(%rsp), %rcx
movb %al, 0x47(%rsp)
movl 0x7c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x7c(%rsp)
movl 0x54(%rsp), %edi
movb 0x47(%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
movq 0x68(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x68(%rsp)
jmp 0x21725
movq 0x1c784(%rip), %rax     # 0x3dff8
movq (%rax), %rdi
movl 0x7c(%rsp), %edx
leaq 0x137b4(%rip), %rsi     # 0x35036
movb $0x0, %al
callq 0x1140
movq 0x80(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0xa0(%rsp), %rax
addq $0xa8, %rsp
retq
nopl (%rax)