// File: /workspace/github_c_makefile_star2_O3/pwelke[P]GraphMiningTools/iterativeSubtreeIsomorphism.c
// Function: makeBipartiteInstanceFromVerticesCached
static struct Graph* makeBipartiteInstanceFromVerticesCached(struct SubtreeIsoDataStore data, struct CachedGraph* cachedB, struct Vertex* removalVertex, struct Vertex* u, struct Vertex* v, struct GraphPool* gp) {

	int sizeofX = degree(u);
	int sizeofY = degree(v);

	// if one of the neighbors of u is removed from this instance to see if there is a matching covering all neighbors but it,
	// the bipartite graph must be smaller
	if (removalVertex->number != u->number) {
		--sizeofX;
	}

	struct Graph* B = getCachedGraph(sizeofX + sizeofY, cachedB);

	/* store size of first partitioning set */
	B->number = sizeofX;

	/* add vertex numbers of original vertices to ->lowPoint of each vertex in B
	and add edge labels to vertex labels to compare edges easily */
	int i = 0;
	for (struct VertexList* e=u->neighborhood; e!=NULL; e=e->next) {
		if (e->endPoint->number != removalVertex->number) {
			B->vertices[i]->lowPoint = e->endPoint->number;
			B->vertices[i]->label = e->label;
			++i;
		}
	}
	for (struct VertexList* e=v->neighborhood; e!=NULL; e=e->next) {
		B->vertices[i]->lowPoint = e->endPoint->number;
		B->vertices[i]->label = e->label;
		++i;
	}

	/* add edge (x,y) if u in S(y,x) */
	for (i=0; i<sizeofX; ++i) {
		int x = B->vertices[i]->lowPoint;
		for (int j=sizeofX; j<B->n; ++j) {
			int y = B->vertices[j]->lowPoint;

			/* y has to be a child of v */
			if (data.g->vertices[y]->visited < v->visited) {
				/* edge labels have to match, (v, child)->label in g == (u, child)->label in h
				these values were stored in B->vertices[i,j]->label */
				if (labelCmp(B->vertices[i]->label, B->vertices[j]->label) == 0) {
					if (containsCharacteristic(data, u, data.h->vertices[x], data.g->vertices[y])) {
						addResidualEdges(B->vertices[i], B->vertices[j], gp->listPool);
						++B->m;
					}
				}
			}
		}
	}
	return B;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r8, 0x40(%rsp)
movq %rcx, %r14
movq %rdx, %rbx
movq %rsi, %rbp
movq %rdi, %r13
movq %rdx, %rdi
callq 0x7c4e
movl %eax, %r15d
movq %r14, %rdi
callq 0x7c4e
movl 0x18(%rbp), %ecx
xorl %edx, %edx
cmpl 0x18(%rbx), %ecx
setne %dl
subl %edx, %r15d
leal (%rax,%r15), %edi
movq %r13, %rsi
callq 0x3c97
movq %rax, %r13
movq %r15, 0x30(%rsp)
movl %r15d, 0x8(%rax)
movq %rbx, 0x48(%rsp)
movq 0x8(%rbx), %rcx
xorl %eax, %eax
testq %rcx, %rcx
je 0xa0e9
movl 0x18(%rbp), %edx
movq 0x18(%rcx), %rsi
movl 0x18(%rsi), %esi
cmpl %edx, %esi
je 0xa0de
movq 0x10(%r13), %rdi
cltq
movq (%rdi,%rax,8), %rdi
movl %esi, 0x20(%rdi)
movq (%rcx), %rsi
movq %rsi, (%rdi)
incl %eax
movq 0x8(%rcx), %rcx
testq %rcx, %rcx
jne 0xa0be
cltq
movq 0x8(%r14), %rcx
testq %rcx, %rcx
je 0xa11a
shlq $0x3, %rax
addq 0x10(%r13), %rax
movq 0x18(%rcx), %rdx
movl 0x18(%rdx), %edx
movq (%rax), %rsi
movl %edx, 0x20(%rsi)
movq (%rcx), %rdx
movq %rdx, (%rsi)
movq 0x8(%rcx), %rcx
addq $0x8, %rax
testq %rcx, %rcx
jne 0xa0fa
cmpl $0x0, 0x30(%rsp)
jle 0xa211
leaq 0x90(%rsp), %rbp
movl 0x30(%rsp), %eax
movq %rax, 0x38(%rsp)
movl (%r13), %eax
xorl %ebx, %ebx
cmpl %eax, 0x30(%rsp)
jge 0xa203
movq 0x10(%r13), %rax
movq (%rax,%rbx,8), %rax
movslq 0x20(%rax), %rax
movq %rax, 0x50(%rsp)
movq 0x38(%rsp), %r15
movq 0x10(%r13), %rcx
movq (%rcx,%r15,8), %rax
movslq 0x20(%rax), %r12
movq 0x8(%rbp), %rdx
movq 0x10(%rdx), %rdx
movq (%rdx,%r12,8), %rdx
movl 0x1c(%rdx), %edx
cmpl 0x1c(%r14), %edx
jge 0xa1f3
movq (%rcx,%rbx,8), %rcx
movq (%rcx), %rdi
movq (%rax), %rsi
callq 0x1bb34
testl %eax, %eax
jne 0xa1f3
movq 0x8(%rbp), %rax
movq 0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq 0x50(%rsp), %rdx
movq (%rcx,%rdx,8), %rsi
movq 0x10(%rax), %rax
movq (%rax,%r12,8), %rdx
movq 0x20(%rbp), %rax
movq %rax, 0x20(%rsp)
movups (%rbp), %xmm0
movups 0x10(%rbp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq 0x48(%rsp), %rdi
callq 0x16201
testl %eax, %eax
je 0xa1f3
movq 0x10(%r13), %rax
movq (%rax,%rbx,8), %rdi
movq (%rax,%r15,8), %rsi
movq 0x40(%rsp), %rax
movq 0x18(%rax), %rdx
callq 0x3468
incl 0x4(%r13)
incq %r15
movl (%r13), %eax
cmpl %r15d, %eax
jg 0xa15c
incq %rbx
cmpq 0x38(%rsp), %rbx
jne 0xa13c
movq %r13, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq