// File: /workspace/github_c_makefile_star2_O0/pwelke[P]GraphMiningTools/searchTree.c
// Function: addStringToSearchTreeRec
static char addStringToSearchTreeRec(struct Vertex* root, struct VertexList* edge, int id, struct GraphPool* p) {

	/* if edge == NULL, stop recursion, remember, that some string ends here */
	if (edge == NULL) {
		root->visited += 1;
		if (root->visited == 1) {
			root->lowPoint = id;
			return 1;
		} else {
			return 0;
		}
	} else {
		struct VertexList* idx;
		for (idx=root->neighborhood; idx; idx=idx->next) {
			/* if the next label is already in the tree, continue recursively */
			if (strcmp(idx->label, edge->label) == 0) {
				char isNew = addStringToSearchTreeRec(idx->endPoint, edge->next, id, p);
				/* edges dangling at edge are consumed or dumped by the following recursion steps */
				edge->next = NULL;
				dumpVertexList(p->listPool, edge);
				return isNew;
			}
		}

		/* otherwise add the current edge to the tree and continue recursively */
		idx = edge->next;
		edge->startPoint = root;
		edge->endPoint = getVertex(p->vertexPool);
		addEdge(root, edge);
		// if edge is not responsible for its label, make it by making a copy of the label.
		// as search trees tend to live longer than the graphs they are derived from, this saves trouble
		// although it makes the method depend on the length of the strings.
		if (edge->isStringMaster == 0) {
			edge->label = copyString(edge->label);
			edge->isStringMaster = 1;
		}
		addStringToSearchTreeRec(edge->endPoint, idx, id, p);
		return 1;
	}
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movl %edx, 0x1c(%rsp)
movq %rcx, 0x10(%rsp)
cmpq $0x0, 0x20(%rsp)
jne 0x2bd98
movq 0x28(%rsp), %rax
movl 0x1c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x1c(%rax)
movq 0x28(%rsp), %rax
cmpl $0x1, 0x1c(%rax)
jne 0x2bd8e
movl 0x1c(%rsp), %ecx
movq 0x28(%rsp), %rax
movl %ecx, 0x20(%rax)
movb $0x1, 0x37(%rsp)
jmp 0x2bec7
movb $0x0, 0x37(%rsp)
jmp 0x2bec7
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0x2be32
movq 0x8(%rsp), %rax
movq (%rax), %rdi
movq 0x20(%rsp), %rax
movq (%rax), %rsi
callq 0x1120
cmpl $0x0, %eax
jne 0x2be1d
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rsi
movl 0x1c(%rsp), %edx
movq 0x10(%rsp), %rcx
callq 0x2bd40
movb %al, 0x7(%rsp)
movq 0x20(%rsp), %rax
movq $0x0, 0x8(%rax)
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x20(%rsp), %rsi
callq 0x1f410
movb 0x7(%rsp), %al
movb %al, 0x37(%rsp)
jmp 0x2bec7
jmp 0x2be1f
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x2bda6
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x28(%rsp), %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x1f6a0
movq %rax, %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0xa660
movq 0x20(%rsp), %rax
cmpl $0x0, 0x28(%rax)
jne 0x2bea6
movq 0x20(%rsp), %rax
movq (%rax), %rdi
callq 0x20090
movq %rax, %rcx
movq 0x20(%rsp), %rax
movq %rcx, (%rax)
movq 0x20(%rsp), %rax
movl $0x1, 0x28(%rax)
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x8(%rsp), %rsi
movl 0x1c(%rsp), %edx
movq 0x10(%rsp), %rcx
callq 0x2bd40
movb $0x1, 0x37(%rsp)
movb 0x37(%rsp), %al
addq $0x38, %rsp
retq