// File: /workspace/github_c_makefile_star2_O1/pwelke[P]GraphMiningTools/lwm_initAndCollect.c
// Function: initPatternEnumeration
size_t initPatternEnumeration(// input
		size_t threshold,
		double importance,
		// output
		struct Vertex** initialFrequentPatterns,
		struct SupportSet** supportSets,
		struct ShallowGraph** extensionEdgeList,
		void** dataStructures,
		// printing
		FILE* featureStream,
		FILE* patternStream,
		FILE* logStream,
		// pools
		struct GraphPool* gp,
		struct ShallowGraphPool* sgp) {

	(void)importance; // unused

	struct Graph** db = NULL;
	int nGraphs = getDB(&db);

	struct Vertex* frequentVertices;
	struct Vertex* frequentEdges;
	getFrequentVerticesAndEdges(db, nGraphs, threshold, &frequentVertices, &frequentEdges, logStream, gp);

	/* convert frequentEdges to ShallowGraph of extension edges */
	struct Graph* extensionEdgesVertexStore = NULL;
	struct ShallowGraph* extensionEdges = edgeSearchTree2ShallowGraph(frequentEdges, &extensionEdgesVertexStore, gp, sgp);
	dumpSearchTree(gp, frequentEdges);

	// levelwise search for patterns with one vertex:
	struct SupportSet* frequentVerticesSupportSets = getSupportSetsOfVerticesForPatternEnumeration(db, nGraphs, frequentVertices, gp, sgp);
	printStringsInSearchTree(frequentVertices, patternStream, sgp);
	printSupportSetsSparse(frequentVerticesSupportSets, featureStream);

	// store pointers for final garbage collection
	struct IterativeBfsForForestsDataStructures* x = malloc(sizeof(struct IterativeBfsForForestsDataStructures));
	x->db = db;
	x->nGraphs = nGraphs;
	x->extensionEdges = extensionEdges;
	x->extensionEdgesVertexStore = extensionEdgesVertexStore;
	x->initialFrequentPatterns = frequentVertices;

	// 'return'
	*initialFrequentPatterns = frequentVertices;
	*supportSets = frequentVerticesSupportSets;
	*extensionEdgeList = extensionEdges;
	*dataStructures = x;
	return 1; // returned patterns have 1 vertex
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r9, 0x10(%rsp)
movq %r8, 0x30(%rsp)
movq %rcx, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq %rdi, %r15
movq 0xa0(%rsp), %r14
xorl %r13d, %r13d
leaq 0x50(%rsp), %rbx
movq %r13, (%rbx)
movq %rbx, %rdi
callq 0x10f58
movl %eax, %ebp
movq (%rbx), %rbx
movq %r14, (%rsp)
leaq 0x40(%rsp), %rcx
leaq 0x48(%rsp), %r12
movq %rbx, %rdi
movl %eax, %esi
movq %r15, %rdx
movq %r12, %r8
movq 0x98(%rsp), %r9
callq 0x117c5
leaq 0x38(%rsp), %rsi
movq %r13, (%rsi)
movq (%r12), %r15
movq %r15, %rdi
movq %r14, %rdx
movq 0xa8(%rsp), %rcx
callq 0x1140a
movq %rax, %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x1b644
leaq 0x40(%rsp), %rax
movq (%rax), %r13
movq %rbx, %rdi
movl %ebp, %esi
movq %r13, %rdx
movq %r14, %rcx
callq 0x12932
movq %rax, %r14
movq %r13, %rdi
movq 0x90(%rsp), %rsi
movq 0xa8(%rsp), %rdx
callq 0x1b857
movq %r14, %rdi
movq 0x10(%rsp), %rsi
callq 0x1cf5c
movl $0x30, %edi
callq 0x1190
movq %rbx, (%rax)
movl %ebp, 0x28(%rax)
movq %r12, 0x18(%rax)
leaq 0x38(%rsp), %rcx
movq (%rcx), %rcx
movq %rcx, 0x20(%rax)
movq %r13, 0x10(%rax)
movq 0x18(%rsp), %rcx
movq %r13, (%rcx)
movq 0x20(%rsp), %rcx
movq %r14, (%rcx)
movq 0x28(%rsp), %rcx
movq %r12, (%rcx)
movq 0x30(%rsp), %rcx
movq %rax, (%rcx)
movl $0x1, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq