// File: /workspace/github_c_makefile_star2_O0/kernfel[P]fNEAT/extract.c
// Function: build_tree
int build_tree( BinLeaf *p, struct Extraction_Params *eparams ) {
	int i, j, err=0;

	// Divide the parent
	if (( err = Malloc( p->c, CLUSTERSIZE*sizeof *p->c ) ))
		return err;

	double w = 1.0 / (1 << (p->level+2));
	for ( i=0; i<CLUSTERSIZE; i++ ) {
		p->c[i].c = 0;
		p->c[i].level = p->level+1;
		for ( j=0; j<DIMENSIONS; j++ ) {
			// Adjust child coords to be in the center of the quadrant/octant
			p->c[i].x[j] = p->x[j] + ( (i>>j & 1) ? (-1) : 1 ) * w;
		}

		// Populate the new child with CPPN data
		if ( eparams->outgoing )
			read_CPPN( eparams->cppn, eparams->params, eparams->ref, p->c[i].x, p->c[i].r );
		else
			read_CPPN( eparams->cppn, eparams->params, p->c[i].x, eparams->ref, p->c[i].r );
	}

	// Recurse
	if ( p->level < eparams->params->min_resolution-1 \
	 || ( p->level < eparams->params->max_resolution-1 && get_binleaf_variance(p, eparams->params) > eparams->params->variance_threshold ) ) {
		for ( i=0; i<CLUSTERSIZE; i++ ) {
			if (( err = build_tree( &p->c[i], eparams ) ))
				return err;
		}
	}

	return err;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x10(%rbp), %rdi
movl $0xa0, %esi
callq 0x6330
movl %eax, -0x24(%rbp)
cmpl $0x0, %eax
je 0x64c8
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x66f2
movq -0x10(%rbp), %rax
movl 0x20(%rax), %ecx
addl $0x2, %ecx
movl $0x1, %eax
shll %cl, %eax
cvtsi2sd %eax, %xmm1
movsd 0x3b83(%rip), %xmm0     # 0xa068
divsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movl $0x0, -0x1c(%rbp)
cmpl $0x4, -0x1c(%rbp)
jge 0x6653
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq $0x0, (%rax)
movq -0x10(%rbp), %rax
movl 0x20(%rax), %ecx
addl $0x1, %ecx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x1c(%rbp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x20(%rax)
movl $0x0, -0x20(%rbp)
cmpl $0x2, -0x20(%rbp)
jge 0x65a5
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movsd 0x10(%rax,%rcx,8), %xmm1
movl -0x1c(%rbp), %edx
movl -0x20(%rbp), %ecx
sarl %cl, %edx
andl $0x1, %edx
movl $0x1, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl $0x0, %edx
cmovnel %ecx, %eax
cvtsi2sd %eax, %xmm0
movsd -0x30(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movslq -0x20(%rbp), %rcx
movsd %xmm0, 0x10(%rax,%rcx,8)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x653e
movq -0x18(%rbp), %rax
cmpb $0x0, 0x18(%rax)
je 0x65fa
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rsi
movq -0x18(%rbp), %rdx
addq $0x8, %rdx
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movslq -0x1c(%rbp), %rax
imulq $0x28, %rax, %rax
addq %rax, %rcx
addq $0x10, %rcx
movq -0x10(%rbp), %rax
movq (%rax), %r8
movslq -0x1c(%rbp), %rax
imulq $0x28, %rax, %rax
addq %rax, %r8
addq $0x8, %r8
callq 0x3590
jmp 0x6643
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rsi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movslq -0x1c(%rbp), %rax
imulq $0x28, %rax, %rax
addq %rax, %rdx
addq $0x10, %rdx
movq -0x18(%rbp), %rcx
addq $0x8, %rcx
movq -0x10(%rbp), %rax
movq (%rax), %r8
movslq -0x1c(%rbp), %rax
imulq $0x28, %rax, %rax
addq %rax, %r8
addq $0x8, %r8
callq 0x3590
jmp 0x6645
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x64f5
movq -0x10(%rbp), %rax
movl 0x20(%rax), %eax
movq -0x18(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl 0x4(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jl 0x66a5
movq -0x10(%rbp), %rax
movl 0x20(%rax), %eax
movq -0x18(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl 0x8(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x66ec
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rsi
callq 0x6a90
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
ucomisd 0x10(%rax), %xmm0
jbe 0x66ec
movl $0x0, -0x1c(%rbp)
cmpl $0x4, -0x1c(%rbp)
jge 0x66ea
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movslq -0x1c(%rbp), %rax
imulq $0x28, %rax, %rax
addq %rax, %rdi
movq -0x18(%rbp), %rsi
callq 0x6490
movl %eax, -0x24(%rbp)
cmpl $0x0, %eax
je 0x66dd
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x66f2
jmp 0x66df
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x66ac
jmp 0x66ec
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)