// File: /workspace/github_c_makefile_star2_O1/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 0x7c22
movl %eax, %r15d
movq %r14, %rdi
callq 0x7c22
movl 0x18(%rbp), %ecx
xorl %edx, %edx
cmpl 0x18(%rbx), %ecx
setne %dl
subl %edx, %r15d
leal (%rax,%r15), %edi
movq %r13, %rsi
callq 0x3c87
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 0xa093
movl 0x18(%rbp), %edx
movq 0x18(%rcx), %rsi
movl 0x18(%rsi), %esi
cmpl %edx, %esi
je 0xa088
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 0xa068
cltq
movq 0x8(%r14), %rcx
testq %rcx, %rcx
je 0xa0c4
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 0xa0a4
cmpl $0x0, 0x30(%rsp)
jle 0xa1b9
leaq 0x90(%rsp), %rbp
movl 0x30(%rsp), %eax
movq %rax, 0x38(%rsp)
xorl %ebx, %ebx
movq 0x30(%rsp), %rax
cmpl (%r13), %eax
jge 0xa1ab
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 0xa19e
movq (%rcx,%rbx,8), %rcx
movq (%rcx), %rdi
movq (%rax), %rsi
callq 0x1bc18
testl %eax, %eax
jne 0xa19e
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 0x16329
testl %eax, %eax
je 0xa19e
movq 0x10(%r13), %rax
movq (%rax,%rbx,8), %rdi
movq (%rax,%r15,8), %rsi
movq 0x40(%rsp), %rax
movq 0x18(%rax), %rdx
callq 0x344f
incl 0x4(%r13)
incq %r15
cmpl %r15d, (%r13)
jg 0xa107
incq %rbx
cmpq 0x38(%rsp), %rbx
jne 0xa0e2
movq %r13, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq