// File: /workspace/github_c_makefile_star2_O0/pwelke[P]GraphMiningTools/lwm_initAndCollect.c
// Function: initFrequentTreeMiningForForestDB
size_t initFrequentTreeMiningForForestDB(// 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);
	int** postorders = getPostorders(db, nGraphs);

	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 = createSingletonPatternSupportSetsForForestDB(db, postorders, 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->postorders = postorders;
	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:
subq $0x88, %rsp
movq 0xa8(%rsp), %rax
movq 0xa0(%rsp), %rax
movq 0x98(%rsp), %rax
movq 0x90(%rsp), %rax
movq %rdi, 0x80(%rsp)
movsd %xmm0, 0x78(%rsp)
movq %rsi, 0x70(%rsp)
movq %rdx, 0x68(%rsp)
movq %rcx, 0x60(%rsp)
movq %r8, 0x58(%rsp)
movq %r9, 0x50(%rsp)
movq $0x0, 0x48(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x1a080
movl %eax, 0x44(%rsp)
movq 0x48(%rsp), %rdi
movl 0x44(%rsp), %esi
callq 0x1ac80
movq %rax, 0x38(%rsp)
movq 0x48(%rsp), %rdi
movl 0x44(%rsp), %esi
movq 0x80(%rsp), %rdx
movq 0x98(%rsp), %r9
movq 0xa0(%rsp), %rax
leaq 0x30(%rsp), %rcx
leaq 0x28(%rsp), %r8
movq %rax, (%rsp)
callq 0x1acf0
movq $0x0, 0x20(%rsp)
movq 0x28(%rsp), %rdi
movq 0xa0(%rsp), %rdx
movq 0xa8(%rsp), %rcx
leaq 0x20(%rsp), %rsi
callq 0x1a730
movq %rax, 0x18(%rsp)
movq 0xa0(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x2d3c0
movq 0x48(%rsp), %rdi
movq 0x38(%rsp), %rsi
movl 0x44(%rsp), %edx
movq 0x30(%rsp), %rcx
movq 0xa0(%rsp), %r8
movq 0xa8(%rsp), %r9
callq 0x1ae40
movq %rax, 0x10(%rsp)
movq 0x30(%rsp), %rdi
movq 0x90(%rsp), %rsi
movq 0xa8(%rsp), %rdx
callq 0x2d770
movq 0x10(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x2fce0
movl $0x30, %edi
callq 0x1170
movq %rax, 0x8(%rsp)
movq 0x48(%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, (%rax)
movq 0x38(%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x8(%rax)
movl 0x44(%rsp), %ecx
movq 0x8(%rsp), %rax
movl %ecx, 0x28(%rax)
movq 0x18(%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x20(%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x30(%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x30(%rsp), %rcx
movq 0x70(%rsp), %rax
movq %rcx, (%rax)
movq 0x10(%rsp), %rcx
movq 0x68(%rsp), %rax
movq %rcx, (%rax)
movq 0x18(%rsp), %rcx
movq 0x60(%rsp), %rax
movq %rcx, (%rax)
movq 0x8(%rsp), %rcx
movq 0x58(%rsp), %rax
movq %rcx, (%rax)
movl $0x1, %eax
addq $0x88, %rsp
retq
nopw %cs:(%rax,%rax)