// File: /workspace/github_cpp_makefile_star2_O1/kebwi[P]Trifid/src/SteerablePyramid.cpp
// Function: SteerablePyramid::GenerateMaxAbsImages(char const*)
void SteerablePyramid::GenerateMaxAbsImages(const char* filenameHeader)
{
	for (int i = 0; i < numLevels_; i++)
	{
		int horDim = width_ / pow(2, i);
		int verDim = height_ / pow(2, i);
		int totalPixelsThisLevel = horDim * verDim;
		Float_t *img = new Float_t[totalPixelsThisLevel];
		
		for (int j = 0; j < totalPixelsThisLevel; j++)
		{
			Float_t meanVal = 0;
			meanVal += b1Coeffs_[i][j];
			meanVal += b2Coeffs_[i][j];
			meanVal += b3Coeffs_[i][j];
			meanVal += b4Coeffs_[i][j];
			meanVal /= 4;
			
			if (meanVal < 0)	//Min
			{
				img[j] = b1Coeffs_[i][j];
				if (b2Coeffs_[i][j] < img[j])
					img[j] = b2Coeffs_[i][j];
				if (b3Coeffs_[i][j] < img[j])
					img[j] = b3Coeffs_[i][j];
				if (b4Coeffs_[i][j] < img[j])
					img[j] = b4Coeffs_[i][j];
			}
			else if (meanVal > 0)	//Max
			{
				img[j] = b1Coeffs_[i][j];
				if (b2Coeffs_[i][j] > img[j])
					img[j] = b2Coeffs_[i][j];
				if (b3Coeffs_[i][j] > img[j])
					img[j] = b3Coeffs_[i][j];
				if (b4Coeffs_[i][j] > img[j])
					img[j] = b4Coeffs_[i][j];
				
				img[j] = -img[j];
			}
			else img[j] = 1;
		}
		
		Float_t maxCoeff = 0;
		for (int j = 0; j < totalPixelsThisLevel; j++)
			if (fabs(img[j]) > maxCoeff)
				maxCoeff = fabs(img[j]);
		
		Float_t coeffScalar = 127.0 / maxCoeff;
		
		string filename(filenameHeader);
		filename += "_";
		filename += '0' + i;
		filename += ".pgm";
		
		GeneratePGMimage(img, horDim, verDim, coeffScalar, 128, filename);
		
		delete [] img;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, 0x60(%rsp)
cmpl $0x0, 0x38(%rdi)
jle 0x21286
movq %rdi, %r14
xorl %r12d, %r12d
xorps %xmm0, %xmm0
cvtsi2sdl 0x30(%r14), %xmm0
movsd %xmm0, 0x10(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
movsd %xmm0, 0x8(%rsp)
callq 0x32a0
movsd 0x10(%rsp), %xmm1
divsd %xmm0, %xmm1
cvttsd2si %xmm1, %ebp
xorps %xmm0, %xmm0
cvtsi2sdl 0x34(%r14), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x32a0
movsd 0x10(%rsp), %xmm1
divsd %xmm0, %xmm1
cvttsd2si %xmm1, %r15d
movl %r15d, %ebx
movl %ebp, 0x8(%rsp)
imull %ebp, %ebx
movslq %ebx, %rbp
leaq (,%rbp,8), %rdi
testl %ebp, %ebp
movq $-0x1, %rax
cmovsq %rax, %rdi
callq 0x3030
movq %rax, %r13
movl %ebx, %eax
testl %ebp, %ebp
xorpd %xmm2, %xmm2
movsd 0xbbce(%rip), %xmm3     # 0x2cc10
movapd 0xb446(%rip), %xmm4     # 0x2c490
movabsq $0x3ff0000000000000, %r9 # imm = 0x3FF0000000000000
jle 0x21168
movq 0x8(%r14), %rcx
movq 0x10(%r14), %rdx
movq (%rcx,%r12,8), %rcx
movq (%rdx,%r12,8), %rdx
movq 0x18(%r14), %rsi
movq (%rsi,%r12,8), %rsi
movq 0x20(%r14), %rdi
movq (%rdi,%r12,8), %rdi
xorl %r8d, %r8d
movsd (%rcx,%r8,8), %xmm0
movapd %xmm0, %xmm1
addsd %xmm2, %xmm1
addsd (%rdx,%r8,8), %xmm1
addsd (%rsi,%r8,8), %xmm1
addsd (%rdi,%r8,8), %xmm1
mulsd %xmm3, %xmm1
ucomisd %xmm1, %xmm2
jbe 0x210f7
movsd %xmm0, (%r13,%r8,8)
movsd (%rdx,%r8,8), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x210c1
movsd %xmm1, (%r13,%r8,8)
movsd (%rsi,%r8,8), %xmm0
movsd (%r13,%r8,8), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x210db
movsd %xmm0, (%r13,%r8,8)
movsd (%rdi,%r8,8), %xmm0
movsd (%r13,%r8,8), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x2115c
movsd %xmm0, (%r13,%r8,8)
jmp 0x2115c
ucomisd %xmm2, %xmm1
jbe 0x21157
movsd %xmm0, (%r13,%r8,8)
movsd (%rdx,%r8,8), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x21117
movsd %xmm1, (%r13,%r8,8)
movsd (%rsi,%r8,8), %xmm0
ucomisd (%r13,%r8,8), %xmm0
jbe 0x2112d
movsd %xmm0, (%r13,%r8,8)
movsd (%rdi,%r8,8), %xmm0
ucomisd (%r13,%r8,8), %xmm0
jbe 0x21143
movsd %xmm0, (%r13,%r8,8)
movsd (%r13,%r8,8), %xmm0
xorpd %xmm4, %xmm0
movlpd %xmm0, (%r13,%r8,8)
jmp 0x2115c
movq %r9, (%r13,%r8,8)
incq %r8
cmpq %r8, %rax
jne 0x2107d
testl %ebx, %ebx
jle 0x211a1
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
leaq 0x50(%rsp), %rbp
movapd 0x9e91(%rip), %xmm1     # 0x2b010
leaq 0x20(%rsp), %rbx
movsd (%r13,%rcx,8), %xmm2
andpd %xmm1, %xmm2
maxsd %xmm0, %xmm2
incq %rcx
movapd %xmm2, %xmm0
cmpq %rcx, %rax
jne 0x21184
jmp 0x211af
xorpd %xmm2, %xmm2
leaq 0x50(%rsp), %rbp
leaq 0x20(%rsp), %rbx
movapd %xmm2, 0x10(%rsp)
movq %rbx, %rdi
movq 0x60(%rsp), %rsi
leaq 0x7(%rsp), %rdx
callq 0x9f34
movq %rbx, %rdi
leaq 0xe124(%rip), %rsi      # 0x2f2f5
callq 0x3540
leal 0x30(%r12), %eax
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3280
movq %rbx, %rdi
leaq 0xb015(%rip), %rsi      # 0x2c205
callq 0x3540
movq %rbp, 0x40(%rsp)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq %rsi, %rdx
leaq 0x40(%rsp), %rdi
callq 0xa97e
movsd 0xcf67(%rip), %xmm0     # 0x2e180
divsd 0x10(%rsp), %xmm0
movq %r13, %rsi
movl 0x8(%rsp), %edx
movl %r15d, %ecx
movsd 0xcf57(%rip), %xmm1     # 0x2e188
leaq 0x40(%rsp), %r8
callq 0x20d08
movq 0x40(%rsp), %rdi
cmpq %rbp, %rdi
je 0x21252
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3310
movq %r13, %rdi
callq 0x33c0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x21276
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3310
incq %r12
movslq 0x38(%r14), %rax
cmpq %rax, %r12
jl 0x20faf
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %rbp, %rdi
je 0x212b4
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3310
jmp 0x212b4
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x212d0
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3310
movq %rbx, %rdi
callq 0x3500