// File: /workspace/github_cpp_makefile_star2_O3/kebwi[P]Trifid/src/SteerablePyramid.cpp
// Function: SteerablePyramid::DoOneStepWaveletSynthesisUsingFT(int, double*, double*)
void SteerablePyramid::DoOneStepWaveletSynthesisUsingFT(int level, Float_t* pixelValues, Float_t *upsampledThumbnail)
{
	int horDim = width_ / pow(2, level);
	int verDim = height_ / pow(2, level);
	int totalPixels = horDim * verDim;
	
	int filterIndex = getFilterFTIndex();
	
	for (int i = 0; i < verDim; i++)
		yLookup_[i] = i * horDim;
	
	Float_t *finalImage = NULL;
	Float_t *pixelPtr = NULL;
	Float_t *coeffPtr = NULL;
	
	if (level == 0)
		finalImage = new Float_t[totalPixels];
	
	//Is this necessary or did new clear out the allocated memory?
	memset(upsampledThumbnail, 0, totalPixels * sizeof(Float_t));
	
	//Upsample the growing thumbnail from the base thumbnail (lowest level) or the previous iteration's thumbnail
	
	if (level == numLevels_ - 1)	//Lowest level, upsample actual stored thumbnail
		pixelPtr = l1Coeffs_[level];
	else	//Intermediate level, upsample growing thumbnail from previous iteration
		pixelPtr = pixelValues;
	
	for (int y = 0; y < verDim / 2; y++)
	{
		coeffPtr = &upsampledThumbnail[(y * 2) * horDim];
		for (int x = 0; x < horDim / 2; x++)
		{
			*coeffPtr = *pixelPtr++ * 4;
			coeffPtr += 2;
		}
	}
	
	assert(doFourierAnalysis(upsampledThumbnail, scratch_2D_A_, horDim, verDim));
	assert(multiplyFourierTransformsAndInvert(scratch_2D_A_, skFiltersFTs[filterIndex].filtersInvFTs[2][level], horDim, verDim, pixelValues));
	
	assert(doFourierAnalysis(b1Coeffs_[level], scratch_2D_A_, horDim, verDim));
	assert(multiplyFourierTransformsAndInvert(scratch_2D_A_, skFiltersFTs[filterIndex].filtersInvFTs[3][level], horDim, verDim, scratch_2D_B_));
	for (int i = 0; i < totalPixels; i++)
		pixelValues[i] += scratch_2D_B_[i];
	
	assert(doFourierAnalysis(b2Coeffs_[level], scratch_2D_A_, horDim, verDim));
	assert(multiplyFourierTransformsAndInvert(scratch_2D_A_, skFiltersFTs[filterIndex].filtersInvFTs[4][level], horDim, verDim, scratch_2D_B_));
	for (int i = 0; i < totalPixels; i++)
		pixelValues[i] += scratch_2D_B_[i];
	
	assert(doFourierAnalysis(b3Coeffs_[level], scratch_2D_A_, horDim, verDim));
	assert(multiplyFourierTransformsAndInvert(scratch_2D_A_, skFiltersFTs[filterIndex].filtersInvFTs[5][level], horDim, verDim, scratch_2D_B_));
	for (int i = 0; i < totalPixels; i++)
		pixelValues[i] += scratch_2D_B_[i];
	
	assert(doFourierAnalysis(b4Coeffs_[level], scratch_2D_A_, horDim, verDim));
	assert(multiplyFourierTransformsAndInvert(scratch_2D_A_, skFiltersFTs[filterIndex].filtersInvFTs[6][level], horDim, verDim, scratch_2D_B_));
	for (int i = 0; i < totalPixels; i++)
		pixelValues[i] += scratch_2D_B_[i];
	
	if (level == 0)
	{
		assert(doFourierAnalysis(pixelValues, scratch_2D_A_, horDim, verDim));
		assert(multiplyFourierTransformsAndInvert(scratch_2D_A_, skFiltersFTs[filterIndex].filtersInvFTs[1][level], horDim, verDim, finalImage));
		
		assert(doFourierAnalysis(h0Coeffs_, scratch_2D_A_, horDim, verDim));
		assert(multiplyFourierTransformsAndInvert(scratch_2D_A_, skFiltersFTs[filterIndex].filtersInvFTs[0][level], horDim, verDim, scratch_2D_B_));
		for (int i = 0; i < totalPixels; i++)
			finalImage[i] += scratch_2D_B_[i];
	}
	
	if (level == 0)
		memcpy(pixelValues, finalImage, totalPixels * sizeof(Float_t));
	
	if (level == 0)
		delete [] finalImage;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %rbp
movq %rdx, %rbx
movl %esi, %r15d
movq %rdi, %r12
cvtsi2sdl 0x30(%rdi), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0xc413(%rip), %xmm0     # 0x2a058
movl %esi, %edi
callq 0x3410
movsd 0x10(%rsp), %xmm1
divsd %xmm0, %xmm1
cvttsd2si %xmm1, %r14d
xorps %xmm0, %xmm0
cvtsi2sdl 0x34(%r12), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0xc3e5(%rip), %xmm0     # 0x2a058
movl %r15d, 0x18(%rsp)
movl %r15d, %edi
callq 0x3410
movsd 0x10(%rsp), %xmm1
divsd %xmm0, %xmm1
cvttsd2si %xmm1, %r15d
movl %r15d, %eax
imull %r14d, %eax
movl %eax, 0xc(%rsp)
movq %r12, 0x10(%rsp)
movq %r12, %rdi
callq 0x1b8b4
movl %eax, 0x1c(%rsp)
testl %r15d, %r15d
jle 0x1dd5e
movq 0x10(%rsp), %rax
movq 0x40(%rax), %rax
movl %r15d, %edx
leal 0x1(%r15), %ecx
decq %rdx
movq %rdx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
shrl %ecx
shlq $0x3, %rcx
leal (%r14,%r14), %edx
movdqa 0xf4ed(%rip), %xmm1     # 0x2d1d0
xorl %esi, %esi
movdqa 0xf4f3(%rip), %xmm2     # 0x2d1e0
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movdqa 0xf4f3(%rip), %xmm4     # 0x2d1f0
xorl %edi, %edi
movdqa %xmm1, %xmm5
pxor %xmm2, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
movd %xmm5, %r8d
notl %r8d
testb $0x1, %r8b
je 0x1dd36
movl %esi, (%rax,%rdi)
pxor %xmm3, %xmm5
pextrw $0x4, %xmm5, %r8d
testb $0x1, %r8b
je 0x1dd4f
leal (%r14,%rsi), %r8d
movl %r8d, 0x4(%rax,%rdi)
paddq %xmm4, %xmm1
addq $0x8, %rdi
addl %edx, %esi
cmpq %rdi, %rcx
jne 0x1dcff
movslq 0xc(%rsp), %rdx
cmpl $0x0, 0x18(%rsp)
je 0x1dd73
shlq $0x3, %rdx
xorl %r13d, %r13d
jmp 0x1dd93
leaq (,%rdx,8), %r12
testl %edx, %edx
movq $-0x1, %rdi
cmovnsq %r12, %rdi
callq 0x3030
movq %rax, %r13
movq %r12, %rdx
movq %rbp, %rdi
xorl %esi, %esi
movq %rdx, 0x20(%rsp)
callq 0x3190
movq 0x10(%rsp), %rax
movl 0x38(%rax), %ecx
decl %ecx
movl 0x18(%rsp), %edx
movslq %edx, %r12
movq %rbx, %rax
cmpl %edx, %ecx
jne 0x1ddc7
movq 0x10(%rsp), %rax
movq 0x28(%rax), %rax
movq (%rax,%r12,8), %rax
cmpl $0x2, %r15d
jl 0x1de2b
movl %r15d, %ecx
shrl %ecx
leal (%r14,%r14), %edx
movl %r14d, %esi
shrl $0x1f, %esi
addl %r14d, %esi
sarl %esi
xorl %edi, %edi
movsd 0xf3dd(%rip), %xmm0     # 0x2d1c8
cmpl $0x2, %r14d
jl 0x1de23
movl %edx, %r8d
imull %edi, %r8d
movslq %r8d, %r8
leaq (,%r8,8), %r8
addq %rbp, %r8
movl %esi, %r9d
movsd (%rax), %xmm1
mulsd %xmm0, %xmm1
addq $0x8, %rax
movsd %xmm1, (%r8)
addq $0x10, %r8
decl %r9d
jne 0x1de09
incq %rdi
cmpq %rcx, %rdi
jne 0x1ddeb
movq 0x1bcae(%rip), %rsi     # 0x39ae0
movq %rbp, %rdi
movl %r14d, %edx
movl %r15d, %ecx
callq 0x194c7
testb %al, %al
je 0x1e1c0
movq 0x1bc91(%rip), %rdi     # 0x39ae0
movslq 0x1c(%rsp), %rax
movq 0x1bc6d(%rip), %rcx     # 0x39ac8
imulq $0x158, %rax, %rbp      # imm = 0x158
movq 0xe0(%rcx,%rbp), %rax
movq (%rax,%r12,8), %rsi
movl %r14d, %edx
movl %r15d, %ecx
movq %rbx, %r8
callq 0x196dd
testb %al, %al
je 0x1e1df
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
movq (%rax,%r12,8), %rdi
movq 0x1bc48(%rip), %rsi     # 0x39ae0
movl %r14d, %edx
movl %r15d, %ecx
callq 0x194c7
testb %al, %al
je 0x1e1fe
movq 0x1bc2e(%rip), %rdi     # 0x39ae0
movq 0x1bc0f(%rip), %rax     # 0x39ac8
movq 0xf8(%rax,%rbp), %rax
movq (%rax,%r12,8), %rsi
movq 0x1bc1c(%rip), %r8      # 0x39ae8
movl %r14d, %edx
movl %r15d, %ecx
callq 0x196dd
testb %al, %al
je 0x1e21d
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
jle 0x1df09
movq 0x1bbfa(%rip), %rax     # 0x39ae8
movl %ecx, %ecx
xorl %edx, %edx
movsd (%rax,%rdx,8), %xmm0
addsd (%rbx,%rdx,8), %xmm0
movsd %xmm0, (%rbx,%rdx,8)
incq %rdx
cmpq %rdx, %rcx
jne 0x1def2
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax,%r12,8), %rdi
movq 0x1bbc3(%rip), %rsi     # 0x39ae0
movl %r14d, %edx
movl %r15d, %ecx
callq 0x194c7
testb %al, %al
je 0x1e23c
movq 0x1bba9(%rip), %rdi     # 0x39ae0
movq 0x1bb8a(%rip), %rax     # 0x39ac8
movq 0x110(%rax,%rbp), %rax
movq (%rax,%r12,8), %rsi
movq 0x1bb97(%rip), %r8      # 0x39ae8
movl %r14d, %edx
movl %r15d, %ecx
callq 0x196dd
testb %al, %al
je 0x1e25b
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
jle 0x1df8e
movq 0x1bb75(%rip), %rax     # 0x39ae8
movl %ecx, %ecx
xorl %edx, %edx
movsd (%rax,%rdx,8), %xmm0
addsd (%rbx,%rdx,8), %xmm0
movsd %xmm0, (%rbx,%rdx,8)
incq %rdx
cmpq %rdx, %rcx
jne 0x1df77
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rax
movq (%rax,%r12,8), %rdi
movq 0x1bb3e(%rip), %rsi     # 0x39ae0
movl %r14d, %edx
movl %r15d, %ecx
callq 0x194c7
testb %al, %al
je 0x1e27a
movq 0x1bb24(%rip), %rdi     # 0x39ae0
movq 0x1bb05(%rip), %rax     # 0x39ac8
movq 0x128(%rax,%rbp), %rax
movq (%rax,%r12,8), %rsi
movq 0x1bb12(%rip), %r8      # 0x39ae8
movl %r14d, %edx
movl %r15d, %ecx
callq 0x196dd
testb %al, %al
je 0x1e299
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
jle 0x1e013
movq 0x1baf0(%rip), %rax     # 0x39ae8
movl %ecx, %ecx
xorl %edx, %edx
movsd (%rax,%rdx,8), %xmm0
addsd (%rbx,%rdx,8), %xmm0
movsd %xmm0, (%rbx,%rdx,8)
incq %rdx
cmpq %rdx, %rcx
jne 0x1dffc
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
movq (%rax,%r12,8), %rdi
movq 0x1bab9(%rip), %rsi     # 0x39ae0
movl %r14d, %edx
movl %r15d, %ecx
callq 0x194c7
testb %al, %al
je 0x1e2b8
movq 0x1ba9f(%rip), %rdi     # 0x39ae0
movq 0x1ba80(%rip), %rax     # 0x39ac8
movq 0x140(%rax,%rbp), %rax
movq (%rax,%r12,8), %rsi
movq 0x1ba8d(%rip), %r8      # 0x39ae8
movl %r14d, %edx
movl %r15d, %ecx
callq 0x196dd
testb %al, %al
je 0x1e2d7
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
jle 0x1e098
movq 0x1ba6b(%rip), %rax     # 0x39ae8
movl %ecx, %ecx
xorl %edx, %edx
movsd (%rax,%rdx,8), %xmm0
addsd (%rbx,%rdx,8), %xmm0
movsd %xmm0, (%rbx,%rdx,8)
incq %rdx
cmpq %rdx, %rcx
jne 0x1e081
cmpl $0x0, 0x18(%rsp)
je 0x1e0ae
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1ba2b(%rip), %rsi     # 0x39ae0
movq %rbx, %rdi
movl %r14d, %edx
movl %r15d, %ecx
callq 0x194c7
testb %al, %al
je 0x1e2f6
movq 0x1ba0e(%rip), %rdi     # 0x39ae0
movq 0x1b9ef(%rip), %rax     # 0x39ac8
movq 0xc8(%rax,%rbp), %rax
movq (%rax,%r12,8), %rsi
movl %r14d, %edx
movl %r15d, %ecx
movq %r13, %r8
callq 0x196dd
testb %al, %al
je 0x1e315
movq 0x10(%rsp), %rax
movq (%rax), %rdi
movq 0x1b9d6(%rip), %rsi     # 0x39ae0
movl %r14d, %edx
movl %r15d, %ecx
callq 0x194c7
testb %al, %al
je 0x1e334
movq 0x1b9bc(%rip), %rdi     # 0x39ae0
movq 0x1b99d(%rip), %rax     # 0x39ac8
movq 0xb0(%rax,%rbp), %rax
movq (%rax,%r12,8), %rsi
movq 0x1b9aa(%rip), %r8      # 0x39ae8
movl %r14d, %edx
movl %r15d, %ecx
callq 0x196dd
testb %al, %al
je 0x1e353
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
jle 0x1e191
movq 0x1b988(%rip), %rax     # 0x39ae8
movl %ecx, %ecx
xorl %edx, %edx
movsd (%rax,%rdx,8), %xmm0
addsd (%r13,%rdx,8), %xmm0
movsd %xmm0, (%r13,%rdx,8)
incq %rdx
cmpq %rdx, %rcx
jne 0x1e164
movq %rbx, %rdi
movq %r13, %rsi
movq 0x20(%rsp), %rdx
callq 0x3260
jmp 0x1e1aa
movq %rbx, %rdi
movq %r13, %rsi
movq 0x20(%rsp), %rdx
callq 0x3260
testq %r13, %r13
je 0x1e09f
movq %r13, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x33c0
leaq 0xf953(%rip), %rdi      # 0x2db1a
leaq 0xf154(%rip), %rsi      # 0x2d322
leaq 0xf98a(%rip), %rcx      # 0x2db5f
movl $0x57d, %edx            # imm = 0x57D
callq 0x31c0
leaq 0xf9cc(%rip), %rdi      # 0x2dbb2
leaq 0xf135(%rip), %rsi      # 0x2d322
leaq 0xf96b(%rip), %rcx      # 0x2db5f
movl $0x57e, %edx            # imm = 0x57E
callq 0x31c0
leaq 0xfa2f(%rip), %rdi      # 0x2dc34
leaq 0xf116(%rip), %rsi      # 0x2d322
leaq 0xf94c(%rip), %rcx      # 0x2db5f
movl $0x580, %edx            # imm = 0x580
callq 0x31c0
leaq 0xfa53(%rip), %rdi      # 0x2dc77
leaq 0xf0f7(%rip), %rsi      # 0x2d322
leaq 0xf92d(%rip), %rcx      # 0x2db5f
movl $0x581, %edx            # imm = 0x581
callq 0x31c0
leaq 0xfab8(%rip), %rdi      # 0x2dcfb
leaq 0xf0d8(%rip), %rsi      # 0x2d322
leaq 0xf90e(%rip), %rcx      # 0x2db5f
movl $0x585, %edx            # imm = 0x585
callq 0x31c0
leaq 0xfadc(%rip), %rdi      # 0x2dd3e
leaq 0xf0b9(%rip), %rsi      # 0x2d322
leaq 0xf8ef(%rip), %rcx      # 0x2db5f
movl $0x586, %edx            # imm = 0x586
callq 0x31c0
leaq 0xfb41(%rip), %rdi      # 0x2ddc2
leaq 0xf09a(%rip), %rsi      # 0x2d322
leaq 0xf8d0(%rip), %rcx      # 0x2db5f
movl $0x58a, %edx            # imm = 0x58A
callq 0x31c0
leaq 0xfb65(%rip), %rdi      # 0x2de05
leaq 0xf07b(%rip), %rsi      # 0x2d322
leaq 0xf8b1(%rip), %rcx      # 0x2db5f
movl $0x58b, %edx            # imm = 0x58B
callq 0x31c0
leaq 0xfbca(%rip), %rdi      # 0x2de89
leaq 0xf05c(%rip), %rsi      # 0x2d322
leaq 0xf892(%rip), %rcx      # 0x2db5f
movl $0x58f, %edx            # imm = 0x58F
callq 0x31c0
leaq 0xfbee(%rip), %rdi      # 0x2decc
leaq 0xf03d(%rip), %rsi      # 0x2d322
leaq 0xf873(%rip), %rcx      # 0x2db5f
movl $0x590, %edx            # imm = 0x590
callq 0x31c0
leaq 0xfc53(%rip), %rdi      # 0x2df50
leaq 0xf01e(%rip), %rsi      # 0x2d322
leaq 0xf854(%rip), %rcx      # 0x2db5f
movl $0x596, %edx            # imm = 0x596
callq 0x31c0
leaq 0xfc72(%rip), %rdi      # 0x2df8e
leaq 0xefff(%rip), %rsi      # 0x2d322
leaq 0xf835(%rip), %rcx      # 0x2db5f
movl $0x597, %edx            # imm = 0x597
callq 0x31c0
leaq 0xfcd4(%rip), %rdi      # 0x2e00f
leaq 0xefe0(%rip), %rsi      # 0x2d322
leaq 0xf816(%rip), %rcx      # 0x2db5f
movl $0x599, %edx            # imm = 0x599
callq 0x31c0
leaq 0xfcf1(%rip), %rdi      # 0x2e04b
leaq 0xefc1(%rip), %rsi      # 0x2d322
leaq 0xf7f7(%rip), %rcx      # 0x2db5f
movl $0x59a, %edx            # imm = 0x59A
callq 0x31c0