// File: /workspace/github_c_makefile_star2_O0/pwelke[P]GraphMiningTools/opk.c
// Function: outerplanarKernel
void outerplanarKernel(struct Graph *g, int depth, struct ShallowGraphPool *sgp, struct GraphPool *gp,
		char outputOptions, struct Vertex* globalTreeSet, struct compInfo** results, int* resSize) {

	struct ShallowGraph* biconnectedComponents = listBiconnectedComponents(g, sgp);
	struct BBTree* bbTree = createBlockAndBridgeTree(biconnectedComponents, g, gp, sgp);

	/* if the depth of dfs is not set to a constant, it will be n */
	if (depth == -1) {
		depth = g->n;
	}

	if (bbTree) {

		/* start a tree kernel on both bridge and block vertices */
		struct ShallowGraph* trees1 = bfsSubtreeEnumeration(bbTree->tree, depth, sgp);
		struct Vertex* searchTree = buildSearchTree(trees1, gp, sgp);

		int pos = 0;

		if (bbTree->blocks) {
			struct ShallowGraph* trees2 = bfsSubtreeEnumeration(bbTree->blocks, depth, sgp);
			struct Vertex* tmpSearchTree = buildSearchTree(trees2, gp, sgp);

			/* adjust storage size if necessary */
			if (searchTree->number + tmpSearchTree->number > *resSize) {
				if (*results) {
					free(*results);
				}
				*results = getResultVector(searchTree->number + tmpSearchTree->number);
				*resSize = searchTree->number + tmpSearchTree->number;
			}
			shallowMergeSearchTrees(searchTree, tmpSearchTree, 1, *results, &pos, searchTree, 0, gp);

			/* garbage collection */
			dumpSearchTree(gp, tmpSearchTree);

		}



		/* adjust storage size if necessary */
		if (searchTree->number > *resSize) {
			if (*results) {
				free(*results);
			}
			*results = getResultVector(searchTree->number);
			*resSize = searchTree->number;
		}



		pos = 0;
		/* add elements to global search trees to obtain mapping from strings to integers */
		mergeSearchTrees(globalTreeSet, searchTree, 1, *results, &pos, globalTreeSet, 0, gp);


		/* sort the output elements by increasing id */
		qsort(*results, pos, sizeof(struct compInfo), &compInfoComparison);

		/* output options */
		switch (outputOptions) {
		int i;
		int n;

		case 'a':
			/* "all" output the feature vector for the current graph in the format specified
			 * by SVMlight g->activity is assumed to be either 0, 1 or -1 to be compliant with
			 * the specs of SVMlight.
			 */

			/* print the id and label of the graph */
			printf("%i", g->activity);

			/* print key:value pairs */
			for (i=0; i<pos; ++i) {
				printf(" %i:%i", (*results)[i].id, (*results)[i].count);
			}
			printf("\n");
			break;
		case 'o':
			printf("%i %i\n", g->number, (bbTree) ? 1 : 0);
			break;
		case 'c':
			/* returns the number of cycles found in the graph */
			if (searchTree)
				printf("%i %i\n", g->number, searchTree->number / 2);
			else
				printf("%i 0\n", g->number);
			break;
		case 'v':
			/* returns the number of vertices in the graph */
			printf("%i %i\n", g->number, g->n);
			break;
		case 'e':
			/* returns the number of edges in the graph */
			printf("%i %i\n", g->number, g->m);
			break;
		case 'b':
			/* returns the number of vertices in the bbtree */
			n = 0;
			if (bbTree) {
				if (bbTree->blocks) {
					n += bbTree->blocks->n;
				}
				if (bbTree->tree) {
					for (i=0; i<bbTree->tree->n; ++i) {
						if (bbTree->tree->vertices[i]) {
							++n;
						}
					}
				}
			} else {
				n = -1;
			}
			printf("%i %i\n", g->number, n);
			break;
		case 'd':
			printf("%i", g->number);
			if (bbTree->blocks) {
				for (i=0; i<bbTree->blocks->n; ++i) {
					struct Graph* tmpGraph = shallowGraphToGraph(bbTree->blockComponents[i], gp);
					printf(" %i", tmpGraph->m - tmpGraph->n);
					dumpGraph(gp, tmpGraph);
				}
			} else {
				printf(" -1");
			}
			printf("\n");
			break;
		}


		/* prelim garbage collection */
		dumpSearchTree(gp, searchTree);
		dumpBBTree(gp, sgp, bbTree);
	}
}

// Assembly:
subq $0x98, %rsp
movb %r8b, %al
movq 0xa8(%rsp), %r8
movq 0xa0(%rsp), %r8
movq %rdi, 0x90(%rsp)
movl %esi, 0x8c(%rsp)
movq %rdx, 0x80(%rsp)
movq %rcx, 0x78(%rsp)
movb %al, 0x77(%rsp)
movq %r9, 0x68(%rsp)
movq 0x90(%rsp), %rdi
movq 0x80(%rsp), %rsi
callq 0x10700
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rdi
movq 0x90(%rsp), %rsi
movq 0x78(%rsp), %rdx
movq 0x80(%rsp), %rcx
callq 0x24eb0
movq %rax, 0x58(%rsp)
cmpl $-0x1, 0x8c(%rsp)
jne 0x23458
movq 0x90(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x8c(%rsp)
cmpq $0x0, 0x58(%rsp)
je 0x23997
movq 0x58(%rsp), %rax
movq (%rax), %rdi
movl 0x8c(%rsp), %esi
movq 0x80(%rsp), %rdx
callq 0x319d0
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rdi
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rdx
callq 0x2d520
movq %rax, 0x48(%rsp)
movl $0x0, 0x44(%rsp)
movq 0x58(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x235ba
movq 0x58(%rsp), %rax
movq 0x8(%rax), %rdi
movl 0x8c(%rsp), %esi
movq 0x80(%rsp), %rdx
callq 0x319d0
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rdi
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rdx
callq 0x2d520
movq %rax, 0x30(%rsp)
movq 0x48(%rsp), %rax
movl 0x18(%rax), %eax
movq 0x30(%rsp), %rcx
addl 0x18(%rcx), %eax
movq 0xa8(%rsp), %rcx
cmpl (%rcx), %eax
jle 0x2356e
movq 0xa0(%rsp), %rax
cmpq $0x0, (%rax)
je 0x23531
movq 0xa0(%rsp), %rax
movq (%rax), %rdi
callq 0x1030
movq 0x48(%rsp), %rax
movl 0x18(%rax), %edi
movq 0x30(%rsp), %rax
addl 0x18(%rax), %edi
callq 0x2c430
movq %rax, %rcx
movq 0xa0(%rsp), %rax
movq %rcx, (%rax)
movq 0x48(%rsp), %rax
movl 0x18(%rax), %ecx
movq 0x30(%rsp), %rax
addl 0x18(%rax), %ecx
movq 0xa8(%rsp), %rax
movl %ecx, (%rax)
movq 0x48(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0xa0(%rsp), %rax
movq (%rax), %rcx
movq 0x48(%rsp), %r9
movq 0x78(%rsp), %rax
movl $0x1, %edx
leaq 0x44(%rsp), %r8
xorl %r10d, %r10d
movl $0x0, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x2d110
movq 0x78(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x2d3c0
movq 0x48(%rsp), %rax
movl 0x18(%rax), %eax
movq 0xa8(%rsp), %rcx
cmpl (%rcx), %eax
jle 0x23619
movq 0xa0(%rsp), %rax
cmpq $0x0, (%rax)
je 0x235ec
movq 0xa0(%rsp), %rax
movq (%rax), %rdi
callq 0x1030
movq 0x48(%rsp), %rax
movl 0x18(%rax), %edi
callq 0x2c430
movq %rax, %rcx
movq 0xa0(%rsp), %rax
movq %rcx, (%rax)
movq 0x48(%rsp), %rax
movl 0x18(%rax), %ecx
movq 0xa8(%rsp), %rax
movl %ecx, (%rax)
movl $0x0, 0x44(%rsp)
movq 0x68(%rsp), %r9
movq 0x48(%rsp), %rsi
movq 0xa0(%rsp), %rax
movq (%rax), %rcx
movq 0x78(%rsp), %rdx
movq %rsp, %rax
movq %rdx, 0x8(%rax)
movl $0x0, (%rax)
movl $0x1, %edx
leaq 0x44(%rsp), %r8
movq %r9, %rdi
callq 0x2c650
movq 0xa0(%rsp), %rax
movq (%rax), %rdi
movslq 0x44(%rsp), %rsi
leaq 0x8ddf(%rip), %rcx      # 0x2c450
movl $0xc, %edx
callq 0x1060
movsbl 0x77(%rsp), %eax
addl $-0x61, %eax
movl %eax, %ecx
movq %rcx, 0x18(%rsp)
subl $0x15, %eax
ja 0x23971
movq 0x18(%rsp), %rax
leaq 0x12635(%rip), %rcx     # 0x35cd4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x90(%rsp), %rax
movl 0xc(%rax), %esi
leaq 0x12f3a(%rip), %rdi     # 0x365f4
movb $0x0, %al
callq 0x1090
movl $0x0, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
cmpl 0x44(%rsp), %eax
jge 0x23721
movq 0xa0(%rsp), %rax
movq (%rax), %rax
movslq 0x2c(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %esi
movq 0xa0(%rsp), %rax
movq (%rax), %rax
movslq 0x2c(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %edx
leaq 0x11a23(%rip), %rdi     # 0x35130
movb $0x0, %al
callq 0x1090
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x236c9
leaq 0x1198d(%rip), %rdi     # 0x350b5
movb $0x0, %al
callq 0x1090
jmp 0x23971
movq 0x90(%rsp), %rax
movl 0x8(%rax), %esi
movq 0x58(%rsp), %rcx
xorl %edx, %edx
movl $0x1, %eax
cmpq $0x0, %rcx
cmovnel %eax, %edx
leaq 0x128ea(%rip), %rdi     # 0x36043
movb $0x0, %al
callq 0x1090
jmp 0x23971
cmpq $0x0, 0x48(%rsp)
je 0x2379a
movq 0x90(%rsp), %rax
movl 0x8(%rax), %esi
movq 0x48(%rsp), %rax
movl 0x18(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %edx
leaq 0x128b2(%rip), %rdi     # 0x36043
movb $0x0, %al
callq 0x1090
jmp 0x237b3
movq 0x90(%rsp), %rax
movl 0x8(%rax), %esi
leaq 0x1198b(%rip), %rdi     # 0x35137
movb $0x0, %al
callq 0x1090
jmp 0x23971
movq 0x90(%rsp), %rax
movl 0x8(%rax), %esi
movq 0x90(%rsp), %rax
movl (%rax), %edx
leaq 0x1286f(%rip), %rdi     # 0x36043
movb $0x0, %al
callq 0x1090
jmp 0x23971
movq 0x90(%rsp), %rax
movl 0x8(%rax), %esi
movq 0x90(%rsp), %rax
movl 0x4(%rax), %edx
leaq 0x12846(%rip), %rdi     # 0x36043
movb $0x0, %al
callq 0x1090
jmp 0x23971
movl $0x0, 0x28(%rsp)
cmpq $0x0, 0x58(%rsp)
je 0x23891
movq 0x58(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x23838
movq 0x58(%rsp), %rax
movq 0x8(%rax), %rax
movl (%rax), %eax
addl 0x28(%rsp), %eax
movl %eax, 0x28(%rsp)
movq 0x58(%rsp), %rax
cmpq $0x0, (%rax)
je 0x2388f
movl $0x0, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
movq 0x58(%rsp), %rcx
movq (%rcx), %rcx
cmpl (%rcx), %eax
jge 0x2388d
movq 0x58(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movslq 0x2c(%rsp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x2387e
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x23880
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x2384b
jmp 0x2388f
jmp 0x23899
movl $0xffffffff, 0x28(%rsp) # imm = 0xFFFFFFFF
movq 0x90(%rsp), %rax
movl 0x8(%rax), %esi
movl 0x28(%rsp), %edx
leaq 0x12794(%rip), %rdi     # 0x36043
movb $0x0, %al
callq 0x1090
jmp 0x23971
movq 0x90(%rsp), %rax
movl 0x8(%rax), %esi
leaq 0x12d27(%rip), %rdi     # 0x365f4
movb $0x0, %al
callq 0x1090
movq 0x58(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x23955
movl $0x0, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
movq 0x58(%rsp), %rcx
movq 0x8(%rcx), %rcx
cmpl (%rcx), %eax
jge 0x23953
movq 0x58(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x2c(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x78(%rsp), %rsi
callq 0xb1e0
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movl 0x4(%rax), %esi
movq 0x20(%rsp), %rax
subl (%rax), %esi
leaq 0x12cc3(%rip), %rdi     # 0x365f3
movb $0x0, %al
callq 0x1090
movq 0x78(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0x1fb30
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x238e8
jmp 0x23963
leaq 0x12428(%rip), %rdi     # 0x35d84
movb $0x0, %al
callq 0x1090
leaq 0x1174b(%rip), %rdi     # 0x350b5
movb $0x0, %al
callq 0x1090
movq 0x78(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0x2d3c0
movq 0x78(%rsp), %rdi
movq 0x80(%rsp), %rsi
movq 0x58(%rsp), %rdx
callq 0x24d10
addq $0x98, %rsp
retq
nop