// File: kebwi[P]Trifid/src/SteerablePyramid.cpp
// Function: SteerablePyramid::ConvolveImage(double const*, int, int, double*, int, double*, bool)
void SteerablePyramid::ConvolveImage(const Float_t* image, int width, int height, Float_t kernel[], int kernelDim, Float_t* result, bool initValues)
{
	Float_t* resultPtr = result;
	if (initValues)
		memset(result, 0, width * height * sizeof(Float_t));
	
	assert(kernelDim % 2 == 1);	//Kernel dim should be odd
	int kernelHalfDim = kernelDim / 2;
	int widthMinusKernelHalfDim = width - kernelHalfDim, widthMinusKernelDimMinusOne = width - (kernelDim - 1);
	int heightMinusKernelHalfDim = height - kernelHalfDim;
	int y, x;
	int xx, yy;
	int ky, kx;
	
	Float_t* kernelPtr;
	const Float_t* imagePtr;
	Float_t sum;
	
	//Convolve the interior
	unsigned long t = getCurrentTime_ms();
	for (y = kernelHalfDim; y < heightMinusKernelHalfDim; y++)
	{
		resultPtr = &result[yLookup_[y] + kernelHalfDim];
		for (x = 0; x < widthMinusKernelDimMinusOne; x++)
		{
			//For each component in the kernel
			kernelPtr = kernel;
			sum = 0;
			for (ky = -kernelHalfDim; ky <= kernelHalfDim; ky++)
			{
				imagePtr = image + yLookup_[y + ky] + x;
				for (kx = 0; kx < kernelDim; kx++)
				{
					sum += *imagePtr++ * *kernelPtr++;
					
					//if (kernelDim == 17 && width == 32 && y == kernelHalfDim && x == 0)
					//	cout << setw(6) << x + kx << setw(4) << y + ky;
				}
				//if (kernelDim == 17 && width == 32 && y == kernelHalfDim && x == 0)
				//	cout << endl;
			}
			*resultPtr++ += sum;
		}
	}
	gT2 += getCurrentTime_ms() - t;
	
	//Convolve the border
	t = getCurrentTime_ms();
	
	//Horizontal stripes top and bottom
	for (y = 0; y < kernelHalfDim; y++)
	{
		resultPtr = &result[yLookup_[y] + kernelHalfDim];
		for (x = kernelHalfDim; x < widthMinusKernelHalfDim; x++, resultPtr++)
		{
			//For each component in the kernel
			kernelPtr = kernel;
			for (ky = -kernelHalfDim; ky <= kernelHalfDim; ky++)
			{
				yy = y + ky;
				
				if (yy < 0)
					yy = handleNegEdge(yy, height);
				else if (yy >= height)
					assert(false);
				
				if (yy == -1)
				{
					kernelPtr += kernelDim;
					continue;
				}
				
				for (kx = -kernelHalfDim; kx <= kernelHalfDim; kx++)
				{
					//Find the offset pixel location
					xx = x + kx;
					assert(xx >= 0 && xx < width);
					*resultPtr += image[yLookup_[yy] + xx] * *kernelPtr++;
					
					//if (kernelDim == 17 && width == 32 && y == 0 && x == kernelHalfDim)
					//	cout << setw(6) << xx << setw(4) << yy;
				}
				//if (kernelDim == 17 && width == 32 && y == 0 && x == kernelHalfDim)
				//	cout << endl;
			}
		}
	}
				
	for (y = heightMinusKernelHalfDim; y < height; y++)
	{
		resultPtr = &result[yLookup_[y] + kernelHalfDim];
		for (x = kernelHalfDim; x < widthMinusKernelHalfDim; x++, resultPtr++)
		{
			//For each component in the kernel
			kernelPtr = kernel;
			for (ky = -kernelHalfDim; ky <= kernelHalfDim; ky++)
			{
				yy = y + ky;
				
				if (yy < 0)
					assert(false);
				else if (yy >= height)
					yy = handlePosEdge(yy, height);
				
				if (yy == -1)
				{
					kernelPtr += kernelDim;
					continue;
				}
				
				for (kx = -kernelHalfDim; kx <= kernelHalfDim; kx++)
				{
					//Find the offset pixel location
					xx = x + kx;
					assert(xx >= 0 && xx < width);
					*resultPtr += image[yLookup_[yy] + xx] * *kernelPtr++;
				}
			}
		}
	}
	
	//Vertical stripes left and right
	for (y = kernelHalfDim; y < heightMinusKernelHalfDim; y++)
	{
		resultPtr = &result[y * width];
		for (x = 0; x < kernelHalfDim; x++, resultPtr++)
		{
			//For each component in the kernel
			kernelPtr = kernel;
			for (ky = -kernelHalfDim; ky <= kernelHalfDim; ky++)
			{
				yy = y + ky;
				for (kx = -kernelHalfDim; kx <= kernelHalfDim; kx++)
				{
					//Find the offset pixel location
					xx = x + kx;
					
					if (xx < 0)
						xx = handleNegEdge(xx, width);
					else if (xx >= width)
						assert(false);
					
					if (xx == -1)
					{
						kernelPtr++;
						continue;
					}
					
					*resultPtr += image[yLookup_[yy] + xx] * *kernelPtr++;
				}
			}
		}
				
		resultPtr = &result[y * width] + widthMinusKernelHalfDim;
		for (x = widthMinusKernelHalfDim; x < width; x++, resultPtr++)
		{
			//For each component in the kernel
			kernelPtr = kernel;
			for (ky = -kernelHalfDim; ky <= kernelHalfDim; ky++)
			{
				yy = y + ky;
				for (kx = -kernelHalfDim; kx <= kernelHalfDim; kx++)
				{
					//Find the offset pixel location
					xx = x + kx;
					
					if (xx < 0)
						assert(false);
					else if (xx >= width)
						xx = handlePosEdge(xx, width);
					
					if (xx == -1)
					{
						kernelPtr++;
						continue;
					}
					
					*resultPtr += image[yLookup_[yy] + xx] * *kernelPtr++;
				}
			}
		}
	}
	
	//Corners
	for (y = 0; y < kernelHalfDim; y++)
		for (x = 0; x < kernelHalfDim; x++)
		{
			//For each component in the kernel
			kernelPtr = kernel;
			for (ky = -kernelHalfDim; ky <= kernelHalfDim; ky++)
				for (kx = -kernelHalfDim; kx <= kernelHalfDim; kx++, kernelPtr++)
				{
					//Find the offset pixel location
					xx = x + kx;
					yy = y + ky;
					
					if (xx < 0)
						xx = handleNegEdge(xx, width);
					else if (xx >= width)
						assert(false);
					
					if (yy < 0)
						yy = handleNegEdge(yy, height);
					else if (yy >= height)
						assert(false);
					
					if (xx != -1 && yy != -1)
						result[y * width + x] += image[yLookup_[yy] + xx] * *kernelPtr;
					
					//Find the offset pixel location
					xx = widthMinusKernelHalfDim + x + kx;
					yy = y + ky;
					
					if (xx < 0)
						assert(false);
					else if (xx >= width)
						xx = handlePosEdge(xx, width);
					
					if (yy < 0)
						yy = handleNegEdge(yy, height);
					else if (yy >= height)
						assert(false);
					
					if (xx != -1 && yy != -1)
						result[y * width + (widthMinusKernelHalfDim + x)] += image[yLookup_[yy] + xx] * *kernelPtr;
					
					//Find the offset pixel location
					xx = x + kx;
					yy = heightMinusKernelHalfDim + y + ky;
					
					if (xx < 0)
						xx = handleNegEdge(xx, width);
					else if (xx >= width)
						assert(false);
					
					if (yy < 0)
						assert(false);
					else if (yy >= height)
						yy = handlePosEdge(yy, height);
					
					if (xx != -1 && yy != -1)
						result[(heightMinusKernelHalfDim + y) * width + x] += image[yLookup_[yy] + xx] * *kernelPtr;
					
					//Find the offset pixel location
					xx = widthMinusKernelHalfDim + x + kx;
					yy = heightMinusKernelHalfDim + y + ky;
					
					if (xx < 0)
						assert(false);
					else if (xx >= width)
						xx = handlePosEdge(xx, width);
					
					if (yy < 0)
						assert(false);
					else if (yy >= height)
						yy = handlePosEdge(yy, height);
					
					if (xx != -1 && yy != -1)
						result[(heightMinusKernelHalfDim + y) * width + (widthMinusKernelHalfDim + x)] += image[yLookup_[yy] + xx] * *kernelPtr;
				}
		}
	gT3 += getCurrentTime_ms() - t;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movb 0x18(%rbp), %al
movq 0x10(%rbp), %r10
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
andb $0x1, %al
movb %al, -0x25(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x80(%rbp)
movq 0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
testb $0x1, -0x25(%rbp)
je 0x2bcec
movq 0x10(%rbp), %rdi
movl -0x14(%rbp), %eax
imull -0x18(%rbp), %eax
movslq %eax, %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x41e0
movl -0x24(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
cmpl $0x1, %edx
jne 0x2bcfe
jmp 0x2bd1d
leaq 0x2096c(%rip), %rdi     # 0x4c671
leaq 0x2064a(%rip), %rsi     # 0x4c356
movl $0x385, %edx            # imm = 0x385
leaq 0x2096c(%rip), %rcx     # 0x4c684
callq 0x4240
movl -0x24(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x34(%rbp)
movl -0x14(%rbp), %eax
subl -0x34(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x14(%rbp), %eax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
subl %ecx, %eax
movl %eax, -0x3c(%rbp)
movl -0x18(%rbp), %eax
subl -0x34(%rbp), %eax
movl %eax, -0x40(%rbp)
callq 0x55c0
movq %rax, -0x78(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x40(%rbp), %eax
jge 0x2be8c
movq -0x80(%rbp), %rcx
movq 0x10(%rbp), %rax
movq 0x40(%rcx), %rcx
movslq -0x44(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
addl -0x34(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0x2be7c
movq -0x20(%rbp), %rax
movq %rax, -0x60(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x70(%rbp)
xorl %eax, %eax
subl -0x34(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x34(%rbp), %eax
jg 0x2be52
movq -0x80(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x40(%rcx), %rcx
movl -0x44(%rbp), %edx
addl -0x54(%rbp), %edx
movslq %edx, %rdx
movslq (%rcx,%rdx,4), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x48(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x2be42
movq -0x68(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x68(%rbp)
movsd (%rax), %xmm0
movq -0x60(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x60(%rbp)
movsd (%rax), %xmm2
movsd -0x70(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x70(%rbp)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x2bdf7
jmp 0x2be44
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x2bdb5
movsd -0x70(%rbp), %xmm0
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x30(%rbp)
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x2bd91
jmp 0x2be7e
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x2bd5a
callq 0x55c0
subq -0x78(%rbp), %rax
addq 0x30dd4(%rip), %rax     # 0x5cc70
movq %rax, 0x30dcd(%rip)     # 0x5cc70
callq 0x55c0
movq %rax, -0x78(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x2c06f
movq -0x80(%rbp), %rcx
movq 0x10(%rbp), %rax
movq 0x40(%rcx), %rcx
movslq -0x44(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
addl -0x34(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x38(%rbp), %eax
jge 0x2c05f
movq -0x20(%rbp), %rax
movq %rax, -0x60(%rbp)
xorl %eax, %eax
subl -0x34(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x34(%rbp), %eax
jg 0x2c043
movl -0x44(%rbp), %eax
addl -0x54(%rbp), %eax
movl %eax, -0x50(%rbp)
cmpl $0x0, -0x50(%rbp)
jge 0x2bf30
movl -0x50(%rbp), %edi
movl -0x18(%rbp), %esi
callq 0x32f40
movl %eax, -0x50(%rbp)
jmp 0x2bf59
movl -0x50(%rbp), %eax
cmpl -0x18(%rbp), %eax
jl 0x2bf57
leaq 0x1fd85(%rip), %rdi     # 0x4bcc4
leaq 0x20410(%rip), %rsi     # 0x4c356
movl $0x3bf, %edx            # imm = 0x3BF
leaq 0x20732(%rip), %rcx     # 0x4c684
callq 0x4240
jmp 0x2bf59
cmpl $-0x1, -0x50(%rbp)
jne 0x2bf79
movl -0x24(%rbp), %ecx
movq -0x60(%rbp), %rax
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
jmp 0x2c035
xorl %eax, %eax
subl -0x34(%rbp), %eax
movl %eax, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0x34(%rbp), %eax
jg 0x2c033
movl -0x48(%rbp), %eax
addl -0x58(%rbp), %eax
movl %eax, -0x4c(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x4c(%rbp)
movb %al, -0x81(%rbp)
jl 0x2bfb3
movl -0x4c(%rbp), %eax
cmpl -0x14(%rbp), %eax
setl %al
movb %al, -0x81(%rbp)
movb -0x81(%rbp), %al
testb $0x1, %al
jne 0x2bfbf
jmp 0x2bfc1
jmp 0x2bfe0
leaq 0x2071d(%rip), %rdi     # 0x4c6e5
leaq 0x20387(%rip), %rsi     # 0x4c356
movl $0x3cb, %edx            # imm = 0x3CB
leaq 0x206a9(%rip), %rcx     # 0x4c684
callq 0x4240
movq -0x80(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x40(%rcx), %rcx
movslq -0x50(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
addl -0x4c(%rbp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x60(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x60(%rbp)
movsd (%rax), %xmm2
movq -0x30(%rbp), %rax
movsd (%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x2bf81
jmp 0x2c035
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x2bf05
jmp 0x2c045
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
movq -0x30(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x30(%rbp)
jmp 0x2bee9
jmp 0x2c061
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x2beb3
movl -0x40(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x2c22f
movq -0x80(%rbp), %rcx
movq 0x10(%rbp), %rax
movq 0x40(%rcx), %rcx
movslq -0x44(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
addl -0x34(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x38(%rbp), %eax
jge 0x2c21f
movq -0x20(%rbp), %rax
movq %rax, -0x60(%rbp)
xorl %eax, %eax
subl -0x34(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x34(%rbp), %eax
jg 0x2c203
movl -0x44(%rbp), %eax
addl -0x54(%rbp), %eax
movl %eax, -0x50(%rbp)
cmpl $0x0, -0x50(%rbp)
jge 0x2c101
leaq 0x1fbdb(%rip), %rdi     # 0x4bcc4
leaq 0x20266(%rip), %rsi     # 0x4c356
movl $0x3e3, %edx            # imm = 0x3E3
leaq 0x20588(%rip), %rcx     # 0x4c684
callq 0x4240
movl -0x50(%rbp), %eax
cmpl -0x18(%rbp), %eax
jl 0x2c117
movl -0x50(%rbp), %edi
movl -0x18(%rbp), %esi
callq 0x32f60
movl %eax, -0x50(%rbp)
jmp 0x2c119
cmpl $-0x1, -0x50(%rbp)
jne 0x2c139
movl -0x24(%rbp), %ecx
movq -0x60(%rbp), %rax
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
jmp 0x2c1f5
xorl %eax, %eax
subl -0x34(%rbp), %eax
movl %eax, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0x34(%rbp), %eax
jg 0x2c1f3
movl -0x48(%rbp), %eax
addl -0x58(%rbp), %eax
movl %eax, -0x4c(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x4c(%rbp)
movb %al, -0x82(%rbp)
jl 0x2c173
movl -0x4c(%rbp), %eax
cmpl -0x14(%rbp), %eax
setl %al
movb %al, -0x82(%rbp)
movb -0x82(%rbp), %al
testb $0x1, %al
jne 0x2c17f
jmp 0x2c181
jmp 0x2c1a0
leaq 0x2055d(%rip), %rdi     # 0x4c6e5
leaq 0x201c7(%rip), %rsi     # 0x4c356
movl $0x3f1, %edx            # imm = 0x3F1
leaq 0x204e9(%rip), %rcx     # 0x4c684
callq 0x4240
movq -0x80(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x40(%rcx), %rcx
movslq -0x50(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
addl -0x4c(%rbp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x60(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x60(%rbp)
movsd (%rax), %xmm2
movq -0x30(%rbp), %rax
movsd (%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x2c141
jmp 0x2c1f5
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x2c0c7
jmp 0x2c205
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
movq -0x30(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x30(%rbp)
jmp 0x2c0ab
jmp 0x2c221
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x2c075
movl -0x34(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x40(%rbp), %eax
jge 0x2c4d9
movq 0x10(%rbp), %rax
movl -0x44(%rbp), %ecx
imull -0x14(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x2c381
movq -0x20(%rbp), %rax
movq %rax, -0x60(%rbp)
xorl %eax, %eax
subl -0x34(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x34(%rbp), %eax
jg 0x2c365
movl -0x44(%rbp), %eax
addl -0x54(%rbp), %eax
movl %eax, -0x50(%rbp)
xorl %eax, %eax
subl -0x34(%rbp), %eax
movl %eax, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0x34(%rbp), %eax
jg 0x2c355
movl -0x48(%rbp), %eax
addl -0x58(%rbp), %eax
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
jge 0x2c2c5
movl -0x4c(%rbp), %edi
movl -0x14(%rbp), %esi
callq 0x32f40
movl %eax, -0x4c(%rbp)
jmp 0x2c2ee
movl -0x4c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jl 0x2c2ec
leaq 0x1f9f0(%rip), %rdi     # 0x4bcc4
leaq 0x2007b(%rip), %rsi     # 0x4c356
movl $0x40b, %edx            # imm = 0x40B
leaq 0x2039d(%rip), %rcx     # 0x4c684
callq 0x4240
jmp 0x2c2ee
cmpl $-0x1, -0x4c(%rbp)
jne 0x2c302
movq -0x60(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x60(%rbp)
jmp 0x2c347
movq -0x80(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x40(%rcx), %rcx
movslq -0x50(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
addl -0x4c(%rbp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x60(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x60(%rbp)
movsd (%rax), %xmm2
movq -0x30(%rbp), %rax
movsd (%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x2c29a
jmp 0x2c357
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x2c27d
jmp 0x2c367
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
movq -0x30(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x30(%rbp)
jmp 0x2c261
movq 0x10(%rbp), %rax
movl -0x44(%rbp), %ecx
imull -0x14(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x38(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x2c4c9
movq -0x20(%rbp), %rax
movq %rax, -0x60(%rbp)
xorl %eax, %eax
subl -0x34(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x34(%rbp), %eax
jg 0x2c4ad
movl -0x44(%rbp), %eax
addl -0x54(%rbp), %eax
movl %eax, -0x50(%rbp)
xorl %eax, %eax
subl -0x34(%rbp), %eax
movl %eax, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0x34(%rbp), %eax
jg 0x2c49d
movl -0x48(%rbp), %eax
addl -0x58(%rbp), %eax
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
jge 0x2c41e
leaq 0x1f8be(%rip), %rdi     # 0x4bcc4
leaq 0x1ff49(%rip), %rsi     # 0x4c356
movl $0x426, %edx            # imm = 0x426
leaq 0x2026b(%rip), %rcx     # 0x4c684
callq 0x4240
movl -0x4c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jl 0x2c434
movl -0x4c(%rbp), %edi
movl -0x14(%rbp), %esi
callq 0x32f60
movl %eax, -0x4c(%rbp)
jmp 0x2c436
cmpl $-0x1, -0x4c(%rbp)
jne 0x2c44a
movq -0x60(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x60(%rbp)
jmp 0x2c48f
movq -0x80(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x40(%rcx), %rcx
movslq -0x50(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
addl -0x4c(%rbp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x60(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x60(%rbp)
movsd (%rax), %xmm2
movq -0x30(%rbp), %rax
movsd (%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x2c3e4
jmp 0x2c49f
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x2c3c7
jmp 0x2c4af
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
movq -0x30(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x30(%rbp)
jmp 0x2c3ab
jmp 0x2c4cb
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x2c235
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x2c923
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x2c913
movq -0x20(%rbp), %rax
movq %rax, -0x60(%rbp)
xorl %eax, %eax
subl -0x34(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x34(%rbp), %eax
jg 0x2c903
xorl %eax, %eax
subl -0x34(%rbp), %eax
movl %eax, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0x34(%rbp), %eax
jg 0x2c8f3
movl -0x48(%rbp), %eax
addl -0x58(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x44(%rbp), %eax
addl -0x54(%rbp), %eax
movl %eax, -0x50(%rbp)
cmpl $0x0, -0x4c(%rbp)
jge 0x2c557
movl -0x4c(%rbp), %edi
movl -0x14(%rbp), %esi
callq 0x32f40
movl %eax, -0x4c(%rbp)
jmp 0x2c580
movl -0x4c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jl 0x2c57e
leaq 0x1f75e(%rip), %rdi     # 0x4bcc4
leaq 0x1fde9(%rip), %rsi     # 0x4c356
movl $0x446, %edx            # imm = 0x446
leaq 0x2010b(%rip), %rcx     # 0x4c684
callq 0x4240
jmp 0x2c580
cmpl $0x0, -0x50(%rbp)
jge 0x2c596
movl -0x50(%rbp), %edi
movl -0x18(%rbp), %esi
callq 0x32f40
movl %eax, -0x50(%rbp)
jmp 0x2c5bf
movl -0x50(%rbp), %eax
cmpl -0x18(%rbp), %eax
jl 0x2c5bd
leaq 0x1f71f(%rip), %rdi     # 0x4bcc4
leaq 0x1fdaa(%rip), %rsi     # 0x4c356
movl $0x44b, %edx            # imm = 0x44B
leaq 0x200cc(%rip), %rcx     # 0x4c684
callq 0x4240
jmp 0x2c5bf
cmpl $-0x1, -0x4c(%rbp)
je 0x2c614
cmpl $-0x1, -0x50(%rbp)
je 0x2c614
movq -0x80(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x40(%rcx), %rcx
movslq -0x50(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
addl -0x4c(%rbp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x60(%rbp), %rax
movsd (%rax), %xmm2
movq 0x10(%rbp), %rax
movl -0x44(%rbp), %ecx
imull -0x14(%rbp), %ecx
addl -0x48(%rbp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x38(%rbp), %eax
addl -0x48(%rbp), %eax
addl -0x58(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x44(%rbp), %eax
addl -0x54(%rbp), %eax
movl %eax, -0x50(%rbp)
cmpl $0x0, -0x4c(%rbp)
jge 0x2c64e
leaq 0x1f68e(%rip), %rdi     # 0x4bcc4
leaq 0x1fd19(%rip), %rsi     # 0x4c356
movl $0x455, %edx            # imm = 0x455
leaq 0x2003b(%rip), %rcx     # 0x4c684
callq 0x4240
movl -0x4c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jl 0x2c664
movl -0x4c(%rbp), %edi
movl -0x14(%rbp), %esi
callq 0x32f60
movl %eax, -0x4c(%rbp)
jmp 0x2c666
cmpl $0x0, -0x50(%rbp)
jge 0x2c67c
movl -0x50(%rbp), %edi
movl -0x18(%rbp), %esi
callq 0x32f40
movl %eax, -0x50(%rbp)
jmp 0x2c6a5
movl -0x50(%rbp), %eax
cmpl -0x18(%rbp), %eax
jl 0x2c6a3
leaq 0x1f639(%rip), %rdi     # 0x4bcc4
leaq 0x1fcc4(%rip), %rsi     # 0x4c356
movl $0x45c, %edx            # imm = 0x45C
leaq 0x1ffe6(%rip), %rcx     # 0x4c684
callq 0x4240
jmp 0x2c6a5
cmpl $-0x1, -0x4c(%rbp)
je 0x2c6ff
cmpl $-0x1, -0x50(%rbp)
je 0x2c6ff
movq -0x80(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x40(%rcx), %rcx
movslq -0x50(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
addl -0x4c(%rbp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x60(%rbp), %rax
movsd (%rax), %xmm2
movq 0x10(%rbp), %rax
movl -0x44(%rbp), %ecx
imull -0x14(%rbp), %ecx
movl -0x38(%rbp), %edx
addl -0x48(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x48(%rbp), %eax
addl -0x58(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x40(%rbp), %eax
addl -0x44(%rbp), %eax
addl -0x54(%rbp), %eax
movl %eax, -0x50(%rbp)
cmpl $0x0, -0x4c(%rbp)
jge 0x2c72a
movl -0x4c(%rbp), %edi
movl -0x14(%rbp), %esi
callq 0x32f40
movl %eax, -0x4c(%rbp)
jmp 0x2c753
movl -0x4c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jl 0x2c751
leaq 0x1f58b(%rip), %rdi     # 0x4bcc4
leaq 0x1fc16(%rip), %rsi     # 0x4c356
movl $0x468, %edx            # imm = 0x468
leaq 0x1ff38(%rip), %rcx     # 0x4c684
callq 0x4240
jmp 0x2c753
cmpl $0x0, -0x50(%rbp)
jge 0x2c778
leaq 0x1f564(%rip), %rdi     # 0x4bcc4
leaq 0x1fbef(%rip), %rsi     # 0x4c356
movl $0x46b, %edx            # imm = 0x46B
leaq 0x1ff11(%rip), %rcx     # 0x4c684
callq 0x4240
movl -0x50(%rbp), %eax
cmpl -0x18(%rbp), %eax
jl 0x2c78e
movl -0x50(%rbp), %edi
movl -0x18(%rbp), %esi
callq 0x32f60
movl %eax, -0x50(%rbp)
jmp 0x2c790
cmpl $-0x1, -0x4c(%rbp)
je 0x2c7e8
cmpl $-0x1, -0x50(%rbp)
je 0x2c7e8
movq -0x80(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x40(%rcx), %rcx
movslq -0x50(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
addl -0x4c(%rbp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x60(%rbp), %rax
movsd (%rax), %xmm2
movq 0x10(%rbp), %rax
movl -0x40(%rbp), %ecx
addl -0x44(%rbp), %ecx
imull -0x14(%rbp), %ecx
addl -0x48(%rbp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x38(%rbp), %eax
addl -0x48(%rbp), %eax
addl -0x58(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x40(%rbp), %eax
addl -0x44(%rbp), %eax
addl -0x54(%rbp), %eax
movl %eax, -0x50(%rbp)
cmpl $0x0, -0x4c(%rbp)
jge 0x2c825
leaq 0x1f4b7(%rip), %rdi     # 0x4bcc4
leaq 0x1fb42(%rip), %rsi     # 0x4c356
movl $0x477, %edx            # imm = 0x477
leaq 0x1fe64(%rip), %rcx     # 0x4c684
callq 0x4240
movl -0x4c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jl 0x2c83b
movl -0x4c(%rbp), %edi
movl -0x14(%rbp), %esi
callq 0x32f60
movl %eax, -0x4c(%rbp)
jmp 0x2c83d
cmpl $0x0, -0x50(%rbp)
jge 0x2c862
leaq 0x1f47a(%rip), %rdi     # 0x4bcc4
leaq 0x1fb05(%rip), %rsi     # 0x4c356
movl $0x47c, %edx            # imm = 0x47C
leaq 0x1fe27(%rip), %rcx     # 0x4c684
callq 0x4240
movl -0x50(%rbp), %eax
cmpl -0x18(%rbp), %eax
jl 0x2c878
movl -0x50(%rbp), %edi
movl -0x18(%rbp), %esi
callq 0x32f60
movl %eax, -0x50(%rbp)
jmp 0x2c87a
cmpl $-0x1, -0x4c(%rbp)
je 0x2c8d7
cmpl $-0x1, -0x50(%rbp)
je 0x2c8d7
movq -0x80(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x40(%rcx), %rcx
movslq -0x50(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
addl -0x4c(%rbp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x60(%rbp), %rax
movsd (%rax), %xmm2
movq 0x10(%rbp), %rax
movl -0x40(%rbp), %ecx
addl -0x44(%rbp), %ecx
imull -0x14(%rbp), %ecx
movl -0x38(%rbp), %edx
addl -0x48(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
jmp 0x2c8d9
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
movq -0x60(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x60(%rbp)
jmp 0x2c523
jmp 0x2c8f5
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x2c50f
jmp 0x2c905
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x2c4f3
jmp 0x2c915
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x2c4e0
callq 0x55c0
subq -0x78(%rbp), %rax
addq 0x30345(%rip), %rax     # 0x5cc78
movq %rax, 0x3033e(%rip)     # 0x5cc78
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)