// File: /workspace/github_c_makefile_star2_O2/pwelke[P]GraphMiningTools/subtreeIsomorphismSampling.c
// Function: recursiveSubtreeIsomorphismSamplerWithSampledMaximumMatching
static int recursiveSubtreeIsomorphismSamplerWithSampledMaximumMatching(struct Vertex* parent, struct Graph* g, struct GraphPool* gp, int computeEstimate) {

	struct Vertex* parentImage = g->vertices[parent->visited - 1];

	int matchingSize;
	int n_matchings = 0;
	struct VertexList** maximumMatching = uniformBlockMaximumMatching(parent, parentImage, &matchingSize, &n_matchings, computeEstimate);

	// base case: if there are no children that need to be matched, although parent is not a leaf, we are happy
	if (maximumMatching == EMPTY_MATCHING) {
		return 1;
	}

	// is there a matching here covering all unmatched neighbors of parent?
	// if not, there is no subgraph iso here
	if (maximumMatching == NULL) {
		return 0;
	}

	// recurse to the matched vertices
	for (int i=0; i<matchingSize; ++i) {
		int embeddingWorked = recursiveSubtreeIsomorphismSamplerWithSampledMaximumMatching(maximumMatching[i]->endPoint, g, gp, computeEstimate);
		if (!embeddingWorked) {
			free(maximumMatching);
			return 0;
		} else {
			n_matchings *= embeddingWorked;
		}
	}

	// so far, we have been successful
	free(maximumMatching);
	if (computeEstimate) {
		return n_matchings;
	} else {
		return 1;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %edx, %ebp
movq %rsi, %r15
movq 0x10(%rsi), %rax
movslq 0x1c(%rdi), %rcx
movq -0x8(%rax,%rcx,8), %rbx
leaq 0x54(%rsp), %r14
movq %r14, %rsi
callq 0x1959c
movq %rax, %r12
leaq 0x34(%rsp), %rsi
movq %rbx, %rdi
callq 0x1959c
movq %rax, %rbx
movslq (%r14), %rsi
testq %rsi, %rsi
je 0x19eba
movq %rbx, (%rsp)
movl 0x34(%rsp), %ebx
cmpl %ebx, %esi
jle 0x19ed9
movq %r12, %rdi
callq 0x1030
movq (%rsp), %rdi
callq 0x1030
xorl %r12d, %r12d
xorl %r14d, %r14d
xorl %r13d, %r13d
jmp 0x1a15a
movq %r12, %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1030
pushq $0x1
popq %r13
xorl %r12d, %r12d
xorl %r14d, %r14d
jmp 0x1a15a
movq %r15, 0x38(%rsp)
movq %r12, %rdi
pushq $0x1
popq %r13
pushq $0x1
popq %r15
movslq %ebx, %r12
leaq 0x2d6(%rip), %rcx       # 0x1a1c9
pushq $0x8
popq %r14
movq %rdi, 0x20(%rsp)
movq %rsi, 0x10(%rsp)
movq %r14, %rdx
callq 0x1080
movq (%rsp), %rdi
movq %r12, 0x40(%rsp)
movq %r12, %rsi
movq %r14, %rdx
leaq 0x2aa(%rip), %rcx       # 0x1a1c9
callq 0x1080
cmpl $0x2, %ebx
movl %r13d, %r14d
movl %ebx, 0x30(%rsp)
cmovgel %ebx, %r14d
decl %r14d
movq %r14, %r12
movq (%rsp), %rdi
subq $0x1, %r12
jb 0x19f5a
leaq 0x8(%rdi), %rbx
movq %rbx, %rsi
callq 0x1a1c9
cmpl $0x1, %eax
sbbl $-0x1, %r13d
movq %rbx, %rdi
jmp 0x19f3c
movl %ebp, 0xc(%rsp)
movl %r13d, %eax
movq %rax, 0x48(%rsp)
leaq 0x4(,%rax,4), %rdi
callq 0x1180
movq %rax, 0x28(%rsp)
movl %r13d, (%rax)
negq %r14
pushq $0x1
popq %rax
movl %eax, 0x1c(%rsp)
xorl %r12d, %r12d
movq (%rsp), %rax
leaq (%rax,%r12,8), %rdi
leaq (%r14,%r12), %rbp
xorl %r13d, %r13d
cmpq %r13, %rbp
je 0x19fcc
leaq 0x8(%rdi), %rbx
movq %rbx, %rsi
callq 0x1a1c9
decq %r13
movq %rbx, %rdi
testl %eax, %eax
je 0x19f97
movl 0x1c(%rsp), %edx
movl %edx, %eax
subq %r13, %r12
movq 0x28(%rsp), %rcx
movl %r12d, (%rcx,%rax,4)
incl %edx
movl %edx, 0x1c(%rsp)
jmp 0x19f88
movq 0x28(%rsp), %r12
movl 0x30(%rsp), %eax
movq 0x48(%rsp), %rcx
movl %eax, (%r12,%rcx,4)
movslq (%r12), %rbx
xorl %eax, %eax
movq 0x20(%rsp), %r13
movq (%rsp), %r14
cmpq %rbx, %r15
jg 0x1a00f
movl (%r12,%r15,4), %ebp
movl %ebp, %ecx
subl %eax, %ecx
cltq
leaq (%r14,%rax,8), %rdi
movslq %ecx, %rsi
callq 0x17cd2
incq %r15
movl %ebp, %eax
jmp 0x19fed
movq %r14, %rbx
xorl %r12d, %r12d
xorl %r15d, %r15d
movl 0xc(%rsp), %ebp
cmpl 0x10(%rsp), %r15d
jge 0x1a070
cmpq 0x40(%rsp), %r12
jge 0x1a070
movslq %r15d, %rax
leaq (,%rax,8), %r14
addq %r13, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1a1c9
testl %eax, %eax
jne 0x1a067
movq (%rbx), %rax
movq 0x18(%rax), %rax
movl 0x18(%rax), %ecx
incl %ecx
movq (%r14), %rdx
movq 0x18(%rdx), %rdx
movl %ecx, 0x1c(%rdx)
movl $0x1, 0x1c(%rax)
incl %r15d
incq %r12
addq $0x8, %rbx
jmp 0x1a01c
movq 0x10(%rsp), %r12
cmpl %r12d, %r15d
setne %al
testl %ebp, %ebp
sete %cl
xorl %r14d, %r14d
orb %al, %cl
jne 0x1a122
movb $0x1, %r13b
xorl %r12d, %r12d
pushq $0x1
popq %r14
xorl %r15d, %r15d
xorl %ebx, %ebx
xorl %ebp, %ebp
cmpl 0x10(%rsp), %r15d
jge 0x1a114
cmpq 0x40(%rsp), %r12
jge 0x1a114
movslq %r15d, %rax
movq 0x20(%rsp), %rcx
leaq (%rcx,%rax,8), %rdi
movq (%rsp), %rax
leaq (%rax,%r12,8), %rsi
callq 0x1a1c9
movb $0x1, %cl
testl %eax, %eax
jne 0x1a10a
testb %r13b, %r13b
je 0x1a103
movl %ebx, %edi
movl %ebp, %esi
callq 0x751c
movl %eax, %r13d
movl %ebx, %edi
movl %ebp, %esi
callq 0x7524
pushq $0x1
popq %rcx
testl %r13d, %r13d
je 0x1a0fb
movl %eax, %edx
subl %r13d, %edx
cmpl %eax, %edx
jge 0x1a0fb
incl %edx
imull %edx, %ecx
jmp 0x1a0f0
imull %ecx, %r14d
xorl %ebx, %ebx
xorl %ebp, %ebp
incl %r15d
incl %ebx
xorl %ecx, %ecx
incl %ebp
incq %r12
movl %ecx, %r13d
jmp 0x1a09c
movl 0xc(%rsp), %ebp
movq 0x20(%rsp), %r13
movq 0x10(%rsp), %r12
movq (%rsp), %rdi
callq 0x1030
movq 0x28(%rsp), %rdi
callq 0x1030
cmpl %r12d, %r15d
jne 0x1a147
movq %r13, %rdi
movq %r12, %rsi
callq 0x17cd2
jmp 0x1a155
movq %r13, %rdi
callq 0x1030
xorl %r12d, %r12d
xorl %r13d, %r13d
movq 0x38(%rsp), %r15
testq %r13, %r13
je 0x1a1b4
cmpq $0x1, %r13
jne 0x1a16b
pushq $0x1
popq %r14
jmp 0x1a1b7
xorl %ebx, %ebx
testl %r12d, %r12d
cmovlel %ebx, %r12d
cmpq %rbx, %r12
je 0x1a199
movq (%r13,%rbx,8), %rax
movq 0x18(%rax), %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x19e47
testl %eax, %eax
je 0x1a1ac
imull %eax, %r14d
incq %rbx
jmp 0x1a174
movq %r13, %rdi
callq 0x1030
testl %ebp, %ebp
pushq $0x1
popq %rax
cmovel %eax, %r14d
jmp 0x1a1b7
movq %r13, %rdi
callq 0x1030
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq