// File: kebwi[P]Trifid/src/SteerablePyramid.cpp
// Function: SteerablePyramid::FindStrongestCoefficients(std::vector<double, std::allocator<double>>&, std::vector<double, std::allocator<double>>&)
void SteerablePyramid::FindStrongestCoefficients(vector<Float_t> &maxCoeffs, vector<Float_t> &maxThumbnailPixels)
{
	maxCoeffs.clear();
	maxThumbnailPixels.clear();
	
	//Find the highest magnitude coefficients
	for (int i = 0; i < 2/*numLevels_*/; i++)
	{
		Float_t maxCoeff = 0;
		int horDim = width_ / pow(2, i);
		int verDim = height_ / pow(2, i);
		int totalPixels = horDim * verDim;
		for (int j = 0; j < totalPixels; j++)
		{
			//if (i == 0 && fabs(h0Coeffs_[j]) > maxCoeff)
			//	maxCoeff = fabs(h0Coeffs_[j]);
			if (fabs(b1Coeffs_[i][j]) > maxCoeff)
				maxCoeff = fabs(b1Coeffs_[i][j]);
			if (fabs(b2Coeffs_[i][j]) > maxCoeff)
				maxCoeff = fabs(b2Coeffs_[i][j]);
			if (fabs(b3Coeffs_[i][j]) > maxCoeff)
				maxCoeff = fabs(b3Coeffs_[i][j]);
			if (fabs(b4Coeffs_[i][j]) > maxCoeff)
				maxCoeff = fabs(b4Coeffs_[i][j]);
		}
		maxCoeffs.push_back(maxCoeff);
	}
	
	//Find the highest thumbnail values
	for (int i = 0; i < numLevels_; i++)
	{
		Float_t maxThumbnailPixel = 0;
		int horDim = width_ / pow(2, i + 1);
		int verDim = height_ / pow(2, i + 1);
		int totalPixels = horDim * verDim;
		for (int j = 0; j < totalPixels; j++)
			if (fabs(l1Coeffs_[i][j]) > maxThumbnailPixel)
				maxThumbnailPixel = fabs(l1Coeffs_[i][j]);
		maxThumbnailPixels.push_back(maxThumbnailPixel);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rdi
callq 0x32fc0
movq -0x18(%rbp), %rdi
callq 0x32fc0
movl $0x0, -0x1c(%rbp)
cmpl $0x2, -0x1c(%rbp)
jge 0x3022e
movq -0x60(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, -0x28(%rbp)
cvtsi2sdl 0x30(%rax), %xmm0
movsd %xmm0, -0x70(%rbp)
movl -0x1c(%rbp), %esi
movl $0x2, %edi
callq 0x1d7f0
movq -0x60(%rbp), %rax
movaps %xmm0, %xmm1
movsd -0x70(%rbp), %xmm0
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
movl %ecx, -0x2c(%rbp)
cvtsi2sdl 0x34(%rax), %xmm0
movsd %xmm0, -0x68(%rbp)
movl -0x1c(%rbp), %esi
movl $0x2, %edi
callq 0x1d7f0
movaps %xmm0, %xmm1
movsd -0x68(%rbp), %xmm0
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x30(%rbp)
movl -0x2c(%rbp), %eax
imull -0x30(%rbp), %eax
movl %eax, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x30213
movq -0x60(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movaps 0x18f6d(%rip), %xmm1    # 0x49040
pand %xmm1, %xmm0
ucomisd -0x28(%rbp), %xmm0
jbe 0x30107
movq -0x60(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movaps 0x18f42(%rip), %xmm1    # 0x49040
pand %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movaps 0x18f19(%rip), %xmm1    # 0x49040
pand %xmm1, %xmm0
ucomisd -0x28(%rbp), %xmm0
jbe 0x3015b
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movaps 0x18eee(%rip), %xmm1    # 0x49040
pand %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movaps 0x18ec5(%rip), %xmm1    # 0x49040
pand %xmm1, %xmm0
ucomisd -0x28(%rbp), %xmm0
jbe 0x301af
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movaps 0x18e9a(%rip), %xmm1    # 0x49040
pand %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movq -0x60(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movaps 0x18e71(%rip), %xmm1    # 0x49040
pand %xmm1, %xmm0
ucomisd -0x28(%rbp), %xmm0
jbe 0x30203
movq -0x60(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movaps 0x18e46(%rip), %xmm1    # 0x49040
pand %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x30205
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x300a7
movq -0x10(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x32fe0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x30028
movl $0x0, -0x3c(%rbp)
movq -0x60(%rbp), %rcx
movl -0x3c(%rbp), %eax
cmpl 0x38(%rcx), %eax
jge 0x30344
movq -0x60(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, -0x48(%rbp)
cvtsi2sdl 0x30(%rax), %xmm0
movsd %xmm0, -0x80(%rbp)
movl -0x3c(%rbp), %esi
addl $0x1, %esi
movl $0x2, %edi
callq 0x1d7f0
movq -0x60(%rbp), %rax
movaps %xmm0, %xmm1
movsd -0x80(%rbp), %xmm0
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
movl %ecx, -0x4c(%rbp)
cvtsi2sdl 0x34(%rax), %xmm0
movsd %xmm0, -0x78(%rbp)
movl -0x3c(%rbp), %esi
addl $0x1, %esi
movl $0x2, %edi
callq 0x1d7f0
movaps %xmm0, %xmm1
movsd -0x78(%rbp), %xmm0
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x50(%rbp)
movl -0x4c(%rbp), %eax
imull -0x50(%rbp), %eax
movl %eax, -0x54(%rbp)
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0x54(%rbp), %eax
jge 0x30329
movq -0x60(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x58(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movaps 0x18d58(%rip), %xmm1    # 0x49040
pand %xmm1, %xmm0
ucomisd -0x48(%rbp), %xmm0
jbe 0x3031c
movq -0x60(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x58(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movaps 0x18d2d(%rip), %xmm1    # 0x49040
pand %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
jmp 0x3031e
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x302c0
movq -0x18(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x32fe0
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x30235
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)