// File: /workspace/github_c_makefile_star2_O0/pwelke[P]GraphMiningTools/lwm_miningAndExtension.c
// Function: BFSgetNextLevel
static struct SupportSet* _BFSgetNextLevel(// input
		struct SupportSet* previousLevelSupportLists,
		struct Vertex* previousLevelSearchTree,
		size_t threshold,
		struct ShallowGraph* frequentEdges,
		// embedding operator function pointer,
		struct SubtreeIsoDataStore (*embeddingOperator)(struct SubtreeIsoDataStore, struct Graph*, double, struct GraphPool*, struct ShallowGraphPool*),
		double importance,
		// output
		struct Vertex** currentLevelSearchTree,
		FILE* logStream,
		// memory management
		struct GraphPool* gp,
		struct ShallowGraphPool* sgp) {
	assert(previousLevelSupportLists != NULL);
	assert(previousLevelSearchTree != NULL);
	assert(frequentEdges != NULL);

	struct SupportSet* currentLevelCandidateSupportSets;
	struct Graph* currentLevelCandidates;

	_extendPreviousLevel(previousLevelSupportLists, previousLevelSearchTree, frequentEdges, threshold,
			&currentLevelCandidateSupportSets, &currentLevelCandidates, logStream,
			gp, sgp);

	//iterate over all patterns in candidateSupports
	struct SupportSet* actualSupportLists = NULL;
	struct SupportSet* actualSupportListsTail = NULL;
	struct SupportSet* candidateSupport = NULL;
	struct Graph* candidate = NULL;
	for (candidateSupport=currentLevelCandidateSupportSets, candidate=currentLevelCandidates; candidateSupport!=NULL; candidateSupport=candidateSupport->next, candidate=candidate->next) {
		struct SupportSet* currentActualSupport = getSupportSet();
		//iterate over all graphs in the support
		for (struct SupportSetElement* e=candidateSupport->first; e!=NULL; e=e->next) {
			// create actual support list for candidate pattern
			struct SubtreeIsoDataStore result = embeddingOperator(e->data, candidate, importance, gp, sgp);

			if (result.foundIso) {
				appendSupportSetData(currentActualSupport, result);
			} else {
				dumpNewCube(result.S, result.g->n);
			}
		}
		// filter out candidates with support < threshold
		if (currentActualSupport->size < threshold) {
			// mark h as infrequent
			candidate->activity = 0;
			dumpSupportSet(currentActualSupport);
		} else {
			// mark h as frequent
			candidate->activity = currentActualSupport->size;
			// add to output list, maintaining order. necessary
			if (actualSupportListsTail) {
				actualSupportListsTail->next = currentActualSupport;
				actualSupportListsTail = currentActualSupport;
			} else {
				actualSupportLists = currentActualSupport;
				actualSupportListsTail = currentActualSupport;
			}
		}
	}

	// garbage collection
	candidateSupport = currentLevelCandidateSupportSets;
	while (candidateSupport) {
		struct SupportSet* tmp = candidateSupport->next;
		dumpSupportSetCopy(candidateSupport);
		candidateSupport = tmp;
	}

	// add frequent extensions to current level search tree output, set their numbers correctly
	// dump those candidates that are not frequent
	int nAllFrequentExtensions = 0;
	candidate = currentLevelCandidates;
	while (candidate) {
		struct Graph* tmp = candidate->next;
		candidate->next = NULL;
		if (candidate->activity == 0) {
			dumpGraph(gp, candidate);
		} else {
			++nAllFrequentExtensions;
			struct ShallowGraph* cString = canonicalStringOfTree(candidate, sgp);
			cString->data = candidate->activity;
			addMultiSetToSearchTree(*currentLevelSearchTree, cString, gp, sgp);
			candidate->number = (*currentLevelSearchTree)->lowPoint;
		}
		candidate = tmp;
	}
	fprintf(logStream, "frequent patterns: %i\n", nAllFrequentExtensions);

	return actualSupportLists;
}

// Assembly:
subq $0xe8, %rsp
movq 0x100(%rsp), %rax
movq 0xf8(%rsp), %rax
movq 0xf0(%rsp), %rax
movq %rdi, 0xe0(%rsp)
movq %rsi, 0xd8(%rsp)
movq %rdx, 0xd0(%rsp)
movq %rcx, 0xc8(%rsp)
movq %r8, 0xc0(%rsp)
movsd %xmm0, 0xb8(%rsp)
movq %r9, 0xb0(%rsp)
movq 0xe0(%rsp), %rdi
movq 0xd8(%rsp), %rsi
movq 0xc8(%rsp), %rdx
movq 0xd0(%rsp), %rcx
movq 0xf0(%rsp), %r11
movq 0xf8(%rsp), %r10
movq 0x100(%rsp), %rax
leaq 0xa8(%rsp), %r8
leaq 0xa0(%rsp), %r9
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x1d390
movq $0x0, 0x98(%rsp)
movq $0x0, 0x90(%rsp)
movq $0x0, 0x88(%rsp)
movq $0x0, 0x80(%rsp)
movq 0xa8(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x80(%rsp)
cmpq $0x0, 0x88(%rsp)
je 0x1d21a
movb $0x0, %al
callq 0x2fd20
movq %rax, 0x78(%rsp)
movq 0x88(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x70(%rsp)
cmpq $0x0, 0x70(%rsp)
je 0x1d160
movq 0xc0(%rsp), %rax
movq 0x70(%rsp), %r8
movq 0x80(%rsp), %rsi
movsd 0xb8(%rsp), %xmm0
movq 0xf8(%rsp), %rdx
movq 0x100(%rsp), %rcx
movq 0x20(%r8), %r9
movq %rsp, %rdi
movq %r9, 0x20(%rdi)
movups (%r8), %xmm1
movups 0x10(%r8), %xmm2
movups %xmm2, 0x10(%rdi)
movups %xmm1, (%rdi)
leaq 0x48(%rsp), %rdi
callq *%rax
cmpl $0x0, 0x68(%rsp)
je 0x1d13a
movq 0x78(%rsp), %rdi
movq 0x68(%rsp), %rcx
movq %rsp, %rax
movq %rcx, 0x20(%rax)
movups 0x48(%rsp), %xmm0
movups 0x58(%rsp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x2fa10
jmp 0x1d14b
movq 0x60(%rsp), %rdi
movq 0x50(%rsp), %rax
movl (%rax), %esi
callq 0x22fa0
jmp 0x1d14d
movq 0x70(%rsp), %rax
movq 0x28(%rax), %rax
movq %rax, 0x70(%rsp)
jmp 0x1d0ae
movq 0x78(%rsp), %rax
movq 0x18(%rax), %rax
cmpq 0xd0(%rsp), %rax
jae 0x1d18e
movq 0x80(%rsp), %rax
movl $0x0, 0xc(%rax)
movq 0x78(%rsp), %rdi
callq 0x2fde0
jmp 0x1d1eb
movq 0x78(%rsp), %rax
movq 0x18(%rax), %rax
movl %eax, %ecx
movq 0x80(%rsp), %rax
movl %ecx, 0xc(%rax)
cmpq $0x0, 0x90(%rsp)
je 0x1d1cf
movq 0x78(%rsp), %rcx
movq 0x90(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x78(%rsp), %rax
movq %rax, 0x90(%rsp)
jmp 0x1d1e9
movq 0x78(%rsp), %rax
movq %rax, 0x98(%rsp)
movq 0x78(%rsp), %rax
movq %rax, 0x90(%rsp)
jmp 0x1d1eb
jmp 0x1d1ed
movq 0x88(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x88(%rsp)
movq 0x80(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x80(%rsp)
jmp 0x1d083
movq 0xa8(%rsp), %rax
movq %rax, 0x88(%rsp)
cmpq $0x0, 0x88(%rsp)
je 0x1d262
movq 0x88(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x40(%rsp)
movq 0x88(%rsp), %rdi
callq 0x2fd70
movq 0x40(%rsp), %rax
movq %rax, 0x88(%rsp)
jmp 0x1d22a
movl $0x0, 0x3c(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x80(%rsp)
cmpq $0x0, 0x80(%rsp)
je 0x1d357
movq 0x80(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x80(%rsp), %rax
movq $0x0, 0x18(%rax)
movq 0x80(%rsp), %rax
cmpl $0x0, 0xc(%rax)
jne 0x1d2cf
movq 0xf8(%rsp), %rdi
movq 0x80(%rsp), %rsi
callq 0x1fb30
jmp 0x1d345
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
movq 0x80(%rsp), %rdi
movq 0x100(%rsp), %rsi
callq 0x9eb0
movq %rax, 0x28(%rsp)
movq 0x80(%rsp), %rax
movl 0xc(%rax), %ecx
movq 0x28(%rsp), %rax
movl %ecx, 0x28(%rax)
movq 0xb0(%rsp), %rax
movq (%rax), %rdi
movq 0x28(%rsp), %rsi
movq 0xf8(%rsp), %rdx
movq 0x100(%rsp), %rcx
callq 0x2c5b0
movq 0xb0(%rsp), %rax
movq (%rax), %rax
movl 0x20(%rax), %ecx
movq 0x80(%rsp), %rax
movl %ecx, 0x8(%rax)
movq 0x30(%rsp), %rax
movq %rax, 0x80(%rsp)
jmp 0x1d27a
movq 0xf0(%rsp), %rdi
movl 0x3c(%rsp), %edx
leaq 0x18658(%rip), %rsi     # 0x359c2
movb $0x0, %al
callq 0x1140
movq 0x98(%rsp), %rax
addq $0xe8, %rsp
retq
nopw %cs:(%rax,%rax)