// File: /workspace/github_c_makefile_star2_O3/pwelke[P]GraphMiningTools/lwm_initAndCollect.c
// Function: getFrequentVertices
int getFrequentVertices(struct Graph** db, int dbSize, struct Vertex* frequentVertices, struct GraphPool* gp) {
	int i = 0;
	struct compInfo* results = NULL;
	int resultSize = 0;

	/* iterate over all graphs in the database */
	for (i=0; i<dbSize; ++i) {
		struct Graph* g = db[i];

		int v;

		/* the vertices contained in g can be obtained from a single spanning tree, as all spanning trees contain
		the same vertex set. However, to omit multiplicity, we again resort to a temporary searchTree */
		struct Vertex* containedVertices = getVertex(gp->vertexPool);

		/* init temporary result storage if necessary */
		int neededResultSize = g->n;
		int resultPos = 0;
		if (neededResultSize > resultSize) {
			if (results) {
				free(results);
			}

			results = getResultVector(neededResultSize);
			resultSize = neededResultSize;
		}

		for (v=0; v<g->n; ++v) {
			/* See commented out how it would look if done by the book.
			However, this has to be fast and canonicalStringOfTree has
			too much overhead!
			    struct ShallowGraph* cString;
			    auxiliary->vertices[0]->label = patternGraph->vertices[v]->label;
			    cString = canonicalStringOfTree(auxiliary, sgp);
			    addToSearchTree(containedVertices, cString, gp, sgp); */
			struct VertexList* cString = getVertexList(gp->listPool);
			cString->label = g->vertices[v]->label;
			containedVertices->d += addStringToSearchTree(containedVertices, cString, gp);
			containedVertices->number += 1;
		}
		/* set multiplicity of patterns to 1 and add to global vertex pattern set, print to file */
		resetToUnique(containedVertices);
		mergeSearchTrees(frequentVertices, containedVertices, 1, results, &resultPos, frequentVertices, 0, gp);
		dumpSearchTree(gp, containedVertices);
	}
	if (results != NULL) {
		free(results);
	}
	return resultSize;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, 0x20(%rsp)
movq %rdi, 0x18(%rsp)
testl %esi, %esi
jle 0x11318
movq %rcx, %rbx
movl %esi, %eax
movq %rax, 0x10(%rsp)
xorl %r15d, %r15d
xorl %r13d, %r13d
movl $0x0, 0x8(%rsp)
movq 0x18(%rsp), %rax
movq (%rax,%r15,8), %r14
movq 0x10(%rbx), %rdi
callq 0x1447e
movq %rax, %r12
movl (%r14), %ebp
movl $0x0, 0xc(%rsp)
cmpl 0x8(%rsp), %ebp
jle 0x1127b
testq %r13, %r13
je 0x1126d
movq %r13, %rdi
callq 0x1030
movl %ebp, %edi
callq 0x1ada1
movq %rax, %r13
movl %ebp, 0x8(%rsp)
cmpl $0x0, (%r14)
jle 0x112c0
xorl %ebp, %ebp
movq 0x18(%rbx), %rdi
callq 0x141f1
movq 0x10(%r14), %rcx
movq (%rcx,%rbp,8), %rcx
movq (%rcx), %rcx
movq %rcx, (%rax)
movq %r12, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x1aa50
movsbl %al, %eax
addl %eax, 0x28(%r12)
incl 0x18(%r12)
incq %rbp
movslq (%r14), %rax
cmpq %rax, %rbp
jl 0x11283
movq %r12, %rdi
callq 0x1b06c
movq 0x20(%rsp), %rdi
movq %r12, %rsi
movl $0x1, %edx
movq %r13, %rcx
leaq 0xc(%rsp), %r8
movq %rdi, %r9
pushq %rbx
pushq $0x0
callq 0x1aefc
addq $0x10, %rsp
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1b546
incq %r15
cmpq 0x10(%rsp), %r15
jne 0x1123a
testq %r13, %r13
je 0x11312
movq %r13, %rdi
callq 0x1030
movl 0x8(%rsp), %eax
jmp 0x1131a
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq