// File: /workspace/github_c_makefile_star2_O0/pwelke[P]GraphMiningTools/lwm_initAndCollect.c
// Function: getAllSpanningTreesOfDB
static int getAllSpanningTreesOfDB(struct Graph*** db, int k, struct GraphPool* gp, struct ShallowGraphPool* sgp) {
	struct Graph* g = NULL;
	int dbSize = 0;
	int i = 0;

	while ((g = iterateFile())) {
		struct Graph* h = NULL;
		if (g->n < 2) {
			h = cloneGraph(g, gp);
		} else {
			// sample k spanning trees, canonicalize them and add them in a search tree (to avoid duplicates, i.e. isomorphic spanning trees)
			struct ShallowGraph* sample = runForEachConnectedComponent(&xlistSpanningTrees, g, k, k, 1, gp, sgp);
			for (struct ShallowGraph* tree=sample; tree!=NULL; tree=tree->next) {
				if (tree->m != 0) {
					struct Graph* tmp = shallowGraphToGraph(tree, gp);
					tmp->next = h;
					h = tmp;
				}
			}
			dumpShallowGraphCycle(sgp, sample);
		}

		h = mergeGraphs(h, gp);
		h->number = g->number;
		h->activity = g->activity;

		// avoid memory leaks, access to freed memory, and free unused stuff
		hardCopyGraphLabels(h);
		dumpGraph(gp, g);

		/* make space for storing graphs in array */
		if (dbSize <= i) {
			dbSize = dbSize == 0 ? 128 : dbSize * 2;
			*db = realloc(*db, dbSize * sizeof (struct Graph*));
		}
		/* store graph */
		(*db)[i] = h;
		++i;
	}

	return i;
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movl %esi, 0x5c(%rsp)
movq %rdx, 0x50(%rsp)
movq %rcx, 0x48(%rsp)
movq $0x0, 0x40(%rsp)
movl $0x0, 0x3c(%rsp)
movl $0x0, 0x38(%rsp)
movb $0x0, %al
callq 0x13f30
movq %rax, 0x40(%rsp)
cmpq $0x0, %rax
je 0x1b331
movq $0x0, 0x30(%rsp)
movq 0x40(%rsp), %rax
cmpl $0x2, (%rax)
jge 0x1b1d2
movq 0x40(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0xacb0
movq %rax, 0x30(%rsp)
jmp 0x1b26f
movq 0x40(%rsp), %rsi
movl 0x5c(%rsp), %edx
movslq 0x5c(%rsp), %rcx
movq 0x50(%rsp), %r9
movq 0x48(%rsp), %rax
leaq 0xfe7f(%rip), %rdi      # 0x2b070
movl $0x1, %r8d
movq %rax, (%rsp)
callq 0x2bad0
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x20(%rsp)
je 0x1b260
movq 0x20(%rsp), %rax
cmpl $0x0, 0x10(%rax)
je 0x1b24e
movq 0x20(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0xb1e0
movq %rax, 0x18(%rsp)
movq 0x30(%rsp), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x18(%rsp), %rax
movq %rax, 0x30(%rsp)
jmp 0x1b250
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x20(%rsp)
jmp 0x1b20f
movq 0x48(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x20000
movq 0x30(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0xa870
movq %rax, 0x30(%rsp)
movq 0x40(%rsp), %rax
movl 0x8(%rax), %ecx
movq 0x30(%rsp), %rax
movl %ecx, 0x8(%rax)
movq 0x40(%rsp), %rax
movl 0xc(%rax), %ecx
movq 0x30(%rsp), %rax
movl %ecx, 0xc(%rax)
movq 0x30(%rsp), %rdi
callq 0x1a320
movq 0x50(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x1fb30
movl 0x3c(%rsp), %eax
cmpl 0x38(%rsp), %eax
jg 0x1b30b
cmpl $0x0, 0x3c(%rsp)
jne 0x1b2d8
movl $0x80, %eax
movl %eax, 0x14(%rsp)
jmp 0x1b2e2
movl 0x3c(%rsp), %eax
shll %eax
movl %eax, 0x14(%rsp)
movl 0x14(%rsp), %eax
movl %eax, 0x3c(%rsp)
movq 0x60(%rsp), %rax
movq (%rax), %rdi
movslq 0x3c(%rsp), %rsi
shlq $0x3, %rsi
callq 0x11a0
movq %rax, %rcx
movq 0x60(%rsp), %rax
movq %rcx, (%rax)
movq 0x30(%rsp), %rdx
movq 0x60(%rsp), %rax
movq (%rax), %rax
movslq 0x38(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movl 0x38(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x38(%rsp)
jmp 0x1b190
movl 0x38(%rsp), %eax
addq $0x68, %rsp
retq
nopw (%rax,%rax)