// File: /workspace/github_c_makefile_star2_O2/pwelke[P]GraphMiningTools/iterativeSubtreeIsomorphism.c
// Function: initIterativeSubtreeCheckForEdge
struct SubtreeIsoDataStore initIterativeSubtreeCheckForEdge(struct SubtreeIsoDataStore base, struct Graph* h) {
	struct SubtreeIsoDataStore info = {0};
	// copy stuff from below
	info.g = base.g;
	info.postorder = base.postorder;

	// create graph from edge
	info.h = h;
	char* edgeLabel = h->vertices[0]->neighborhood->label;

	// create cube
	createNewCubeForEdgePattern(&info);

	int* parents = getParentsFromPostorder(info.g, info.postorder);

	for (int vi=0; vi<(info.g)->n; ++vi) {
		struct Vertex* v = (info.g)->vertices[info.postorder[vi]];
		for (int ui=0; ui<2; ++ui) {
			struct Vertex* u = (info.h)->vertices[ui];
			struct Vertex* y = (info.h)->vertices[(ui + 1) % 2];
			if (labelCmp(v->label, u->label) == 0) {
				// if vertex labels match, there is a characteristic (H^y_u, v)
				addCharacteristic(&info, y, u, v);
				char foundIso = 0;
				// if there is at least one edge that matches and does not lead to the parent, then there is a characteristic (H^u_u, v)
				// we add this characteristic only once below
				for (struct VertexList* e=v->neighborhood; e!=NULL; e=e->next) {
					if (parents[v->number] != e->endPoint->number) {
						// check if edge labels match
						if (labelCmp(e->label, edgeLabel) == 0) {
							// if edge does not lead to parent, there is a characteristic (H^u_u, v) if vertex labels of endpoint match
							if (labelCmp(e->endPoint->label, y->label) == 0) {
								foundIso = 1;
							}
						}
					}
				}
				if (foundIso) {
					addCharacteristic(&info, u, u, v);
					info.foundIso = 1;
				}
			}
		}
	}
	free(parents);
	return info;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r13
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rdi)
movaps 0x60(%rsp), %xmm0
movups %xmm0, (%rdi)
movq %rsi, 0x10(%rdi)
movq 0x10(%rsi), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq (%rax), %rbx
callq 0x1338f
movq (%r13), %rsi
movq 0x8(%r13), %rdi
callq 0x7da0
movq %rax, %r15
xorl %edx, %edx
movq %r13, 0x18(%rsp)
movq %rbx, 0x10(%rsp)
movq 0x8(%r13), %rax
movslq (%rax), %rcx
cmpq %rcx, %rdx
jge 0x8335
movq 0x10(%rax), %rax
movq (%r13), %rcx
movq %rdx, 0x8(%rsp)
movslq (%rcx,%rdx,4), %rcx
movq (%rax,%rcx,8), %rbp
xorl %ebx, %ebx
cmpq $0x2, %rbx
je 0x8328
movq 0x10(%r13), %rax
movq 0x10(%rax), %rax
movq (%rax,%rbx,8), %r14
incq %rbx
movl %ebx, %ecx
andl $0x1, %ecx
movq (%rax,%rcx,8), %r12
movq (%rbp), %rdi
movq (%r14), %rsi
callq 0x19340
testl %eax, %eax
jne 0x824b
movq %r13, %rdi
movq %r12, %r13
movq %r12, %rsi
movq %r14, 0x20(%rsp)
movq %r14, %rdx
movq %rbp, %rcx
callq 0x13402
movl $0x0, 0x4(%rsp)
movq %rbp, %r12
movq 0x10(%rsp), %r14
movq 0x8(%r12), %r12
testq %r12, %r12
je 0x82f8
movslq 0x18(%rbp), %rax
movl (%r15,%rax,4), %eax
movq 0x18(%r12), %rcx
cmpl 0x18(%rcx), %eax
je 0x82a6
movq (%r12), %rdi
movq %r14, %rsi
callq 0x19340
testl %eax, %eax
jne 0x82a6
movq 0x18(%r12), %rax
movq (%rax), %rdi
movq (%r13), %rsi
callq 0x19340
testl %eax, %eax
movl 0x4(%rsp), %ecx
movzbl %cl, %ecx
pushq $0x1
popq %rax
cmovel %eax, %ecx
movl %ecx, 0x4(%rsp)
jmp 0x82a6
cmpb $0x0, 0x4(%rsp)
movq 0x18(%rsp), %r13
movq 0x20(%rsp), %rdx
je 0x824b
movq %r13, %rdi
movq %rdx, %rsi
movq %rbp, %rcx
callq 0x13402
movl $0x1, 0x20(%r13)
jmp 0x824b
movq 0x8(%rsp), %rdx
incq %rdx
jmp 0x8224
movq %r15, %rdi
callq 0x1030
movq %r13, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq