// File: kebwi[P]Trifid/src/SteerablePyramid.cpp
// Function: SteerablePyramid::DoOneStepWaveletAnalysisUsingFT(double*, int)
void SteerablePyramid::DoOneStepWaveletAnalysisUsingFT(Float_t* pixelValues, int level)
{
	int horDim = width_ / pow(2, level);
	int verDim = height_ / pow(2, level);
	
	int filterIndex = getFilterFTIndex();
	
	for (int i = 0; i < verDim; i++)
		yLookup_[i] = i * horDim;
	
	Float_t *l0OriginalCoeffs = NULL;
	
	if (level == 0)
	{
		assert(doFourierAnalysis(pixelValues, scratch_2D_B_, horDim, verDim));
		assert(multiplyFourierTransformsAndInvert(scratch_2D_B_, skFiltersFTs[filterIndex].filtersFTs[0][level], horDim, verDim, h0Coeffs_));
		
		l0OriginalCoeffs = new Float_t[horDim * verDim];
		assert(l0OriginalCoeffs);
		assert(multiplyFourierTransformsAndInvert(scratch_2D_B_, skFiltersFTs[filterIndex].filtersFTs[1][level], horDim, verDim, l0OriginalCoeffs));
	}
	else l0OriginalCoeffs = l1Coeffs_[level - 1];
	
	assert(doFourierAnalysis(l0OriginalCoeffs, scratch_2D_B_, horDim, verDim));
	
	assert(multiplyFourierTransformsAndInvert(scratch_2D_B_, skFiltersFTs[filterIndex].filtersFTs[3][level], horDim, verDim, b1Coeffs_[level]));
	assert(multiplyFourierTransformsAndInvert(scratch_2D_B_, skFiltersFTs[filterIndex].filtersFTs[4][level], horDim, verDim, b2Coeffs_[level]));
	assert(multiplyFourierTransformsAndInvert(scratch_2D_B_, skFiltersFTs[filterIndex].filtersFTs[5][level], horDim, verDim, b3Coeffs_[level]));
	assert(multiplyFourierTransformsAndInvert(scratch_2D_B_, skFiltersFTs[filterIndex].filtersFTs[6][level], horDim, verDim, b4Coeffs_[level]));
	assert(multiplyFourierTransformsAndInvert(scratch_2D_B_, skFiltersFTs[filterIndex].filtersFTs[2][level], horDim, verDim, pixelValues));
	
	const Float_t *pixelPtr;
	Float_t *coeffPtr = l1Coeffs_[level];
	for (int y = 0; y < verDim / 2; y++)
	{
		pixelPtr = &pixelValues[(y * 2) * horDim];
		for (int x = 0; x < horDim / 2; x++)
		{
			*coeffPtr++ = *pixelPtr;
			pixelPtr += 2;
		}
	}
	
	if (level == 0)
		delete [] l0OriginalCoeffs;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
cvtsi2sdl 0x30(%rax), %xmm0
movsd %xmm0, -0x60(%rbp)
movl -0x14(%rbp), %esi
movl $0x2, %edi
callq 0x1d7f0
movq -0x58(%rbp), %rax
movaps %xmm0, %xmm1
movsd -0x60(%rbp), %xmm0
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
movl %ecx, -0x18(%rbp)
cvtsi2sdl 0x34(%rax), %xmm0
movsd %xmm0, -0x50(%rbp)
movl -0x14(%rbp), %esi
movl $0x2, %edi
callq 0x1d7f0
movq -0x58(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x50(%rbp), %xmm0
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x1c(%rbp)
callq 0x2a990
movl %eax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x2cd82
movq -0x58(%rbp), %rax
movl -0x24(%rbp), %edx
imull -0x18(%rbp), %edx
movq 0x40(%rax), %rax
movslq -0x24(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2cd59
movq $0x0, -0x30(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x2cf03
movq -0x10(%rbp), %rdi
movq 0x2fe19(%rip), %rsi     # 0x5cbb8
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
callq 0x27750
testb $0x1, %al
jne 0x2cdb0
jmp 0x2cdb2
jmp 0x2cdd1
leaq 0x1f993(%rip), %rdi     # 0x4c74c
leaq 0x1f596(%rip), %rsi     # 0x4c356
movl $0x4c3, %edx            # imm = 0x4C3
leaq 0x1f9be(%rip), %rcx     # 0x4c78a
callq 0x4240
movq 0x2fde0(%rip), %rax     # 0x5cbb8
movq %rax, -0x68(%rbp)
movslq -0x20(%rbp), %rsi
leaq 0x2fdb1(%rip), %rdi     # 0x5cb98
callq 0x32af0
movq %rax, %rdi
addq $0x8, %rdi
movslq -0x14(%rbp), %rsi
callq 0x32c90
movq -0x68(%rbp), %rdi
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq (%rcx), %rsi
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
movq (%rax), %r8
callq 0x279d0
testb $0x1, %al
jne 0x2ce1e
jmp 0x2ce20
jmp 0x2ce3f
leaq 0x1f9aa(%rip), %rdi     # 0x4c7d1
leaq 0x1f528(%rip), %rsi     # 0x4c356
movl $0x4c4, %edx            # imm = 0x4C4
leaq 0x1f950(%rip), %rcx     # 0x4c78a
callq 0x4240
movl -0x18(%rbp), %eax
imull -0x1c(%rbp), %eax
cltq
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x4030
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x2ce76
jmp 0x2ce95
leaq 0x1f87e(%rip), %rdi     # 0x4c6fb
leaq 0x1f4d2(%rip), %rsi     # 0x4c356
movl $0x4c7, %edx            # imm = 0x4C7
leaq 0x1f8fa(%rip), %rcx     # 0x4c78a
callq 0x4240
movq 0x2fd1c(%rip), %rax     # 0x5cbb8
movq %rax, -0x70(%rbp)
movslq -0x20(%rbp), %rsi
leaq 0x2fced(%rip), %rdi     # 0x5cb98
callq 0x32af0
movq %rax, %rdi
addq $0x8, %rdi
addq $0x18, %rdi
movslq -0x14(%rbp), %rsi
callq 0x32c90
movq -0x70(%rbp), %rdi
movq (%rax), %rsi
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
movq -0x30(%rbp), %r8
callq 0x279d0
testb $0x1, %al
jne 0x2cee0
jmp 0x2cee2
jmp 0x2cf01
leaq 0x1f965(%rip), %rdi     # 0x4c84e
leaq 0x1f466(%rip), %rsi     # 0x4c356
movl $0x4c8, %edx            # imm = 0x4C8
leaq 0x1f88e(%rip), %rcx     # 0x4c78a
callq 0x4240
jmp 0x2cf1c
movq -0x58(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movq 0x2fc91(%rip), %rsi     # 0x5cbb8
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
callq 0x27750
testb $0x1, %al
jne 0x2cf38
jmp 0x2cf3a
jmp 0x2cf59
leaq 0x1f991(%rip), %rdi     # 0x4c8d2
leaq 0x1f40e(%rip), %rsi     # 0x4c356
movl $0x4cc, %edx            # imm = 0x4CC
leaq 0x1f836(%rip), %rcx     # 0x4c78a
callq 0x4240
movq 0x2fc58(%rip), %rax     # 0x5cbb8
movq %rax, -0x78(%rbp)
movslq -0x20(%rbp), %rsi
leaq 0x2fc29(%rip), %rdi     # 0x5cb98
callq 0x32af0
movq %rax, %rdi
addq $0x8, %rdi
addq $0x48, %rdi
movslq -0x14(%rbp), %rsi
callq 0x32c90
movq -0x78(%rbp), %rdi
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq (%rcx), %rsi
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
movq 0x8(%rax), %rax
movslq -0x14(%rbp), %r8
movq (%rax,%r8,8), %r8
callq 0x279d0
testb $0x1, %al
jne 0x2cfb3
jmp 0x2cfb5
jmp 0x2cfd4
leaq 0x1f959(%rip), %rdi     # 0x4c915
leaq 0x1f393(%rip), %rsi     # 0x4c356
movl $0x4ce, %edx            # imm = 0x4CE
leaq 0x1f7bb(%rip), %rcx     # 0x4c78a
callq 0x4240
movq 0x2fbdd(%rip), %rax     # 0x5cbb8
movq %rax, -0x80(%rbp)
movslq -0x20(%rbp), %rsi
leaq 0x2fbae(%rip), %rdi     # 0x5cb98
callq 0x32af0
movq %rax, %rdi
addq $0x8, %rdi
addq $0x60, %rdi
movslq -0x14(%rbp), %rsi
callq 0x32c90
movq -0x80(%rbp), %rdi
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq (%rcx), %rsi
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
movq 0x10(%rax), %rax
movslq -0x14(%rbp), %r8
movq (%rax,%r8,8), %r8
callq 0x279d0
testb $0x1, %al
jne 0x2d02e
jmp 0x2d030
jmp 0x2d04f
leaq 0x1f962(%rip), %rdi     # 0x4c999
leaq 0x1f318(%rip), %rsi     # 0x4c356
movl $0x4cf, %edx            # imm = 0x4CF
leaq 0x1f740(%rip), %rcx     # 0x4c78a
callq 0x4240
movq 0x2fb62(%rip), %rax     # 0x5cbb8
movq %rax, -0x88(%rbp)
movslq -0x20(%rbp), %rsi
leaq 0x2fb30(%rip), %rdi     # 0x5cb98
callq 0x32af0
movq %rax, %rdi
addq $0x8, %rdi
addq $0x78, %rdi
movslq -0x14(%rbp), %rsi
callq 0x32c90
movq -0x88(%rbp), %rdi
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq (%rcx), %rsi
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
movq 0x18(%rax), %rax
movslq -0x14(%rbp), %r8
movq (%rax,%r8,8), %r8
callq 0x279d0
testb $0x1, %al
jne 0x2d0af
jmp 0x2d0b1
jmp 0x2d0d0
leaq 0x1f965(%rip), %rdi     # 0x4ca1d
leaq 0x1f297(%rip), %rsi     # 0x4c356
movl $0x4d0, %edx            # imm = 0x4D0
leaq 0x1f6bf(%rip), %rcx     # 0x4c78a
callq 0x4240
movq 0x2fae1(%rip), %rax     # 0x5cbb8
movq %rax, -0x90(%rbp)
movslq -0x20(%rbp), %rsi
leaq 0x2faaf(%rip), %rdi     # 0x5cb98
callq 0x32af0
movq %rax, %rdi
addq $0x8, %rdi
addq $0x90, %rdi
movslq -0x14(%rbp), %rsi
callq 0x32c90
movq -0x90(%rbp), %rdi
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq (%rcx), %rsi
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
movq 0x20(%rax), %rax
movslq -0x14(%rbp), %r8
movq (%rax,%r8,8), %r8
callq 0x279d0
testb $0x1, %al
jne 0x2d133
jmp 0x2d135
jmp 0x2d154
leaq 0x1f965(%rip), %rdi     # 0x4caa1
leaq 0x1f213(%rip), %rsi     # 0x4c356
movl $0x4d1, %edx            # imm = 0x4D1
leaq 0x1f63b(%rip), %rcx     # 0x4c78a
callq 0x4240
movq 0x2fa5d(%rip), %rax     # 0x5cbb8
movq %rax, -0x98(%rbp)
movslq -0x20(%rbp), %rsi
leaq 0x2fa2b(%rip), %rdi     # 0x5cb98
callq 0x32af0
movq %rax, %rdi
addq $0x8, %rdi
addq $0x30, %rdi
movslq -0x14(%rbp), %rsi
callq 0x32c90
movq -0x98(%rbp), %rdi
movq (%rax), %rsi
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %r8
callq 0x279d0
testb $0x1, %al
jne 0x2d1a5
jmp 0x2d1a7
jmp 0x2d1c6
leaq 0x1f977(%rip), %rdi     # 0x4cb25
leaq 0x1f1a1(%rip), %rsi     # 0x4c356
movl $0x4d2, %edx            # imm = 0x4D2
leaq 0x1f5c9(%rip), %rcx     # 0x4c78a
callq 0x4240
movq -0x58(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x9c(%rbp)
movl -0x1c(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x9c(%rbp), %eax
cmpl %ecx, %eax
jge 0x2d289
movq -0x10(%rbp), %rax
movl -0x44(%rbp), %ecx
shll %ecx
imull -0x18(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
movl %eax, -0xa0(%rbp)
movl -0x18(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0xa0(%rbp), %eax
cmpl %ecx, %eax
jge 0x2d279
movq -0x38(%rbp), %rax
movsd (%rax), %xmm0
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x40(%rbp)
movsd %xmm0, (%rax)
movq -0x38(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x38(%rbp)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x2d227
jmp 0x2d27b
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x2d1e1
cmpl $0x0, -0x14(%rbp)
jne 0x2d2ae
movq -0x30(%rbp), %rax
movq %rax, -0xa8(%rbp)
cmpq $0x0, %rax
je 0x2d2ac
movq -0xa8(%rbp), %rdi
callq 0x44d0
jmp 0x2d2ae
addq $0xb0, %rsp
popq %rbp
retq
nopw (%rax,%rax)