// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq (%rsi), %rax
cmpq %rax, 0x8(%rsi)
je 0x1f1be
movq %rax, 0x8(%r15)
movq (%rbx), %rax
cmpq %rax, 0x8(%rbx)
je 0x1f1cb
movq %rax, 0x8(%rbx)
movb $0x1, %bpl
xorl %r13d, %r13d
leaq 0x8(%rsp), %r12
movq $0x0, 0x8(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movsd %xmm0, 0x28(%rsp)
movss 0x30(%r14), %xmm1
movaps %xmm1, 0x10(%rsp)
callq 0x32a0
movapd %xmm0, 0x30(%rsp)
movups 0x34(%r14), %xmm0
unpcklps 0x10(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
cvtdq2pd %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movsd 0x28(%rsp), %xmm0
callq 0x32a0
unpcklpd 0x30(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0]
movapd 0x10(%rsp), %xmm1
divpd %xmm0, %xmm1
cvttpd2dq %xmm1, %xmm0
movd %xmm0, %eax
pshufd $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movd %xmm0, %edi
imull %eax, %edi
testl %edi, %edi
movapd 0xadc1(%rip), %xmm2     # 0x2a010
jle 0x1f2f0
movsd 0x8(%rsp), %xmm0
movq 0x8(%r14), %rax
movq 0x10(%r14), %rcx
movq (%rax,%r13,8), %rax
movq (%rcx,%r13,8), %rcx
movq 0x18(%r14), %rdx
movq (%rdx,%r13,8), %rdx
movq 0x20(%r14), %rsi
movq (%rsi,%r13,8), %rsi
movl %edi, %edi
xorl %r8d, %r8d
movsd (%rax,%r8,8), %xmm1
andpd %xmm2, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x1f29a
movsd %xmm1, 0x8(%rsp)
movapd %xmm1, %xmm0
movsd (%rcx,%r8,8), %xmm1
andpd %xmm2, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x1f2b4
movsd %xmm1, 0x8(%rsp)
movapd %xmm1, %xmm0
movsd (%rdx,%r8,8), %xmm1
andpd %xmm2, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x1f2ce
movsd %xmm1, 0x8(%rsp)
movapd %xmm1, %xmm0
movsd (%rsi,%r8,8), %xmm1
andpd %xmm2, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x1f2e8
movsd %xmm1, 0x8(%rsp)
movapd %xmm1, %xmm0
incq %r8
cmpq %r8, %rdi
jne 0x1f280
movq 0x8(%r15), %rsi
cmpq 0x10(%r15), %rsi
je 0x1f30e
movq 0x8(%rsp), %xmm0
movq %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%r15)
jmp 0x1f319
movq %r15, %rdi
movq %r12, %rdx
callq 0x224c6
movl $0x1, %r13d
testb $0x1, %bpl
movl $0x0, %ebp
jne 0x1f1d6
cmpl $0x0, 0x38(%r14)
jle 0x1f42c
xorl %r13d, %r13d
leaq 0x8(%rsp), %r15
movq $0x0, 0x8(%rsp)
leaq 0x1(%r13), %r12
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
movsd %xmm0, 0x28(%rsp)
movss 0x30(%r14), %xmm1
movaps %xmm1, 0x10(%rsp)
callq 0x32a0
movapd %xmm0, 0x30(%rsp)
movups 0x34(%r14), %xmm0
unpcklps 0x10(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
cvtdq2pd %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movsd 0x28(%rsp), %xmm0
callq 0x32a0
unpcklpd 0x30(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0]
movapd 0x10(%rsp), %xmm1
divpd %xmm0, %xmm1
cvttpd2dq %xmm1, %xmm0
movd %xmm0, %eax
pshufd $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movd %xmm0, %ecx
imull %eax, %ecx
testl %ecx, %ecx
movapd 0xac52(%rip), %xmm2     # 0x2a010
jle 0x1f3f3
movsd 0x8(%rsp), %xmm0
movq 0x28(%r14), %rax
movq (%rax,%r13,8), %rax
movl %ecx, %ecx
xorl %edx, %edx
movsd (%rax,%rdx,8), %xmm1
andpd %xmm2, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x1f3eb
movsd %xmm1, 0x8(%rsp)
movapd %xmm1, %xmm0
incq %rdx
cmpq %rdx, %rcx
jne 0x1f3d2
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x1f411
movq 0x8(%rsp), %xmm0
movq %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x1f41c
movq %rbx, %rdi
movq %r15, %rdx
callq 0x224c6
movslq 0x38(%r14), %rax
movq %r12, %r13
cmpq %rax, %r12
jl 0x1f341
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop