// File: /workspace/github_cpp_makefile_star2_O2/kebwi[P]Trifid/src/SteerablePyramid.cpp
// Function: SteerablePyramid::CalcStats(std::vector<double, std::allocator<double>>&, std::vector<double, std::allocator<double>>&) const
void SteerablePyramid::CalcStats(vector<Float_t> &means, vector<Float_t> &stdDevs) const
{
	assert(width_ > 0 && height_ > 0);
	
	//Init the vectors
	means.resize(numLevels_ + 1);
	stdDevs.resize(numLevels_ + 1);
	for (int i = 0; i <= numLevels_; i++)
		means[i] = stdDevs[i] = 0;
	
	//Get the H0 means
	int totalPixels = width_ * height_;
	for (int i = 0; i < totalPixels; i++)
		means[0] += fabs(h0Coeffs_[i]);
	means[0] /= totalPixels;
	
	//Get the B means
	for (int i = 0; i < numLevels_; i++)
	{
		totalPixels = (width_ * height_) / (int)(pow(4, i));
		for (int j = 0; j < totalPixels; j++)
		{
			means[i + 1] += fabs(b1Coeffs_[i][j]);
			means[i + 1] += fabs(b2Coeffs_[i][j]);
			means[i + 1] += fabs(b3Coeffs_[i][j]);
			means[i + 1] += fabs(b4Coeffs_[i][j]);
		}
		means[i + 1] /= (totalPixels * 4);
	}
	
	//Get the H0 std devs
	for (int i = 0; i < totalPixels; i++)
		stdDevs[0] += fabs(h0Coeffs_[i] - means[0]);
	stdDevs[0] /= totalPixels;
	
	//Get the B std devs
	for (int i = 0; i < numLevels_; i++)
	{
		totalPixels = (width_ * height_) / (int)(pow(4, i));
		for (int j = 0; j < totalPixels; j++)
		{
			stdDevs[i + 1] += fabs(b1Coeffs_[i][j] - means[i]);
			stdDevs[i + 1] += fabs(b2Coeffs_[i][j] - means[i]);
			stdDevs[i + 1] += fabs(b3Coeffs_[i][j] - means[i]);
			stdDevs[i + 1] += fabs(b4Coeffs_[i][j] - means[i]);
		}
		stdDevs[i + 1] /= (totalPixels * 4);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x0, 0x30(%rdi)
jle 0x18860
movq %rdi, %r15
cmpl $0x0, 0x34(%rdi)
jle 0x18860
movq %rdx, %rbx
movq %rsi, %r14
movslq 0x38(%r15), %rsi
incq %rsi
movq %r14, %rdi
callq 0x80fc
movslq 0x38(%r15), %rsi
incq %rsi
movq %rbx, %rdi
callq 0x80fc
movl 0x38(%r15), %ecx
movq (%rbx), %rax
movq (%r14), %rdx
movslq %ecx, %rsi
xorl %edi, %edi
cmpq %rsi, %rdi
jg 0x185a3
andq $0x0, (%rax,%rdi,8)
andq $0x0, (%rdx,%rdi,8)
incq %rdi
jmp 0x1858f
movl 0x34(%r15), %eax
imull 0x30(%r15), %eax
movq (%r15), %rdx
movq (%r14), %rsi
xorl %edi, %edi
testl %eax, %eax
movl $0x0, %r8d
cmovgl %eax, %r8d
cmpq %rdi, %r8
je 0x185df
movsd (%rdx,%rdi,8), %xmm0
andpd 0x9a3e(%rip), %xmm0     # 0x22010
addsd (%rsi), %xmm0
movsd %xmm0, (%rsi)
incq %rdi
jmp 0x185c0
cvtsi2sd %eax, %xmm0
movq (%r14), %rdx
movsd (%rdx), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rdx)
xorl %r12d, %r12d
movslq %ecx, %rdx
cmpq %rdx, %r12
jge 0x186e6
movl 0x34(%r15), %ebp
imull 0x30(%r15), %ebp
leal (%r12,%r12), %eax
cvtsi2sd %rax, %xmm0
callq 0x3280
movapd 0x99f0(%rip), %xmm2     # 0x22010
cvttsd2si %xmm0, %ecx
movl %ebp, %eax
cltd
idivl %ecx
movq 0x8(%r15), %rcx
movq 0x10(%r15), %rdx
movq (%r14), %rsi
movq 0x18(%r15), %rdi
movq 0x20(%r15), %r8
testl %eax, %eax
movl $0x0, %r9d
cmovgl %eax, %r9d
xorl %r10d, %r10d
cmpq %r10, %r9
je 0x186bc
movq (%rcx,%r12,8), %r11
movsd (%r11,%r10,8), %xmm0
andpd %xmm2, %xmm0
addsd 0x8(%rsi,%r12,8), %xmm0
movsd %xmm0, 0x8(%rsi,%r12,8)
movq (%rdx,%r12,8), %r11
movsd (%r11,%r10,8), %xmm1
andpd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsi,%r12,8)
movq (%rdi,%r12,8), %r11
movsd (%r11,%r10,8), %xmm0
andpd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsi,%r12,8)
movq (%r8,%r12,8), %r11
movsd (%r11,%r10,8), %xmm1
andpd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsi,%r12,8)
incq %r10
jmp 0x1864b
movl %eax, %ecx
shll $0x2, %ecx
cvtsi2sd %ecx, %xmm0
movq (%r14), %rcx
movsd 0x8(%rcx,%r12,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rcx,%r12,8)
incq %r12
movl 0x38(%r15), %ecx
jmp 0x185f5
movq (%r15), %rdx
movq (%r14), %rsi
movq (%rbx), %rdi
xorl %r8d, %r8d
testl %eax, %eax
movl $0x0, %r9d
cmovgl %eax, %r9d
movapd 0x990a(%rip), %xmm1     # 0x22010
cmpq %r8, %r9
je 0x18726
movsd (%rdx,%r8,8), %xmm0
subsd (%rsi), %xmm0
andpd %xmm1, %xmm0
addsd (%rdi), %xmm0
movsd %xmm0, (%rdi)
incq %r8
jmp 0x18706
cvtsi2sd %eax, %xmm0
movq (%rbx), %rax
movsd (%rax), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rax)
xorl %r12d, %r12d
movslq %ecx, %rax
cmpq %rax, %r12
jge 0x18851
movl 0x34(%r15), %ebp
imull 0x30(%r15), %ebp
leal (%r12,%r12), %eax
cvtsi2sd %rax, %xmm0
callq 0x3280
movapd 0x98a9(%rip), %xmm2     # 0x22010
cvttsd2si %xmm0, %ecx
movl %ebp, %eax
cltd
idivl %ecx
movq 0x8(%r15), %rcx
movq 0x10(%r15), %rdx
movq (%r14), %rsi
movq (%rbx), %rdi
movq 0x18(%r15), %r8
movq 0x20(%r15), %r9
testl %eax, %eax
movl $0x0, %r10d
cmovgl %eax, %r10d
xorl %r11d, %r11d
cmpq %r11, %r10
je 0x18829
movq (%rcx,%r12,8), %r13
movsd (%r13,%r11,8), %xmm0
subsd (%rsi,%r12,8), %xmm0
andpd %xmm2, %xmm0
addsd 0x8(%rdi,%r12,8), %xmm0
movsd %xmm0, 0x8(%rdi,%r12,8)
movq (%rdx,%r12,8), %r13
movsd (%r13,%r11,8), %xmm1
subsd (%rsi,%r12,8), %xmm1
andpd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rdi,%r12,8)
movq (%r8,%r12,8), %r13
movsd (%r13,%r11,8), %xmm0
subsd (%rsi,%r12,8), %xmm0
andpd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rdi,%r12,8)
movq (%r9,%r12,8), %r13
movsd (%r13,%r11,8), %xmm1
subsd (%rsi,%r12,8), %xmm1
andpd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rdi,%r12,8)
incq %r11
jmp 0x18795
shll $0x2, %eax
cvtsi2sd %eax, %xmm0
movq (%rbx), %rax
movsd 0x8(%rax,%r12,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rax,%r12,8)
incq %r12
movl 0x38(%r15), %ecx
jmp 0x1873c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd808(%rip), %rdi      # 0x2606f
leaq 0xca54(%rip), %rsi      # 0x252c2
leaq 0xd84d(%rip), %rcx      # 0x260c2
movl $0x603, %edx            # imm = 0x603
callq 0x31a0
nop