// File: /workspace/github_c_makefile_star2_O2/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, %r14
movq 0xa0(%rsp), %r15
leaq 0x50(%rsp), %rbx
andq $0x0, (%rbx)
movq %rbx, %rdi
callq 0xe32c
movl %eax, %ebp
movq (%rbx), %rbx
movq %r15, (%rsp)
leaq 0x48(%rsp), %r13
leaq 0x40(%rsp), %r12
movq %rbx, %rdi
movl %eax, %esi
movq %r14, %rdx
movq %r13, %rcx
movq %r12, %r8
movq 0x98(%rsp), %r9
callq 0xeaf9
leaq 0x38(%rsp), %rsi
andq $0x0, (%rsi)
movq (%r12), %r14
movq %r14, %rdi
movq %r15, %rdx
movq 0xa8(%rsp), %rcx
callq 0xe771
movq %rax, %r12
movq %r15, %rdi
movq %r14, %rsi
callq 0x18dcd
movq (%r13), %r13
movq %rbx, %rdi
movl %ebp, %esi
movq %r13, %rdx
movq %r15, %rcx
callq 0xfb4d
movq %rax, %r14
movq %r13, %rdi
movq 0x90(%rsp), %rsi
movq 0xa8(%rsp), %rdx
callq 0x18fd2
movq %r14, %rdi
movq 0x10(%rsp), %rsi
callq 0x1a3b4
pushq $0x30
popq %rdi
callq 0x1180
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)
pushq $0x1
popq %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq