// File: kebwi[P]Trifid/src/FourierTransform.cpp
// Function: generatePowerSpectrum(ImageReal const&, ImageReal&, GainType, bool)
void generatePowerSpectrum(const ImageReal &ft, ImageReal &ps, GainType gainType, bool shiftCenter)
{
	long dim = ft.width();
	assert(ft.height() == dim);
	long halfDim = dim / 2;
	int totalPixels = ft.totalPixels();
	
	ps.resize(ft.width(), ft.height());
	
	ImageReal psDCinCorner(ft.width(), ft.height());
	
	//Main body
	for (int y = 0; y < dim; y++)
		for (int x = 2; x < dim; x += 2)
			psDCinCorner(x / 2, y) = pow(ft(x, y), 2) + pow(ft(x + 1, y), 2);
	
	//Upper left corner (DC term)
	psDCinCorner(0, 0) = pow(ft(0, 0), 2) + pow(ft(1, 0), 2);
	
	//Left edge (DC stuff)
	for (int y = 1; y < halfDim; y++)
		psDCinCorner(0, y) = psDCinCorner(0, dim - y) = pow(ft(0, y), 2) + pow(ft(1, y), 2);
	psDCinCorner(0, halfDim) = pow(ft(1, 0), 2);
	
	//Center column (Nyquist)
	for (int y = 1; y < halfDim; y++)
		psDCinCorner(halfDim, y) = psDCinCorner(halfDim, dim - y) =
			pow(ft(0, halfDim + y), 2) + pow(ft(1, halfDim + y), 2);
	psDCinCorner(halfDim, 0) = pow(ft(0, halfDim), 2);
	psDCinCorner(halfDim, halfDim) = pow(ft(1, halfDim), 2);
	
	//Reflection of main body into right half of image
	for (int y = 1; y < dim; y++)
		for (int x = 1; x < halfDim; x++)
			psDCinCorner(halfDim + x, y) = psDCinCorner(halfDim - x, dim - y);
	
	//Reflection along top edge (DC stuff)
	for (int x = 1; x <= halfDim; x++)
		psDCinCorner(dim - x, 0) = psDCinCorner(x, 0);
	
	for (int i = 0; i < totalPixels; i++)
		assert(psDCinCorner[i] >= 0);
	
	if (gainType != GT_NONE)
	{
		//Gain
		for (int i = 0; i < totalPixels; i++)
			switch (gainType)
			{
				case GT_LINEAR:
					//psArr[y * dim + x] /= sInvertedGain;
					psDCinCorner[i] /= sInvertedGain;
					break;
				case GT_SQRT3:
					//psArr[y * dim + x] = sqrt(sqrt(sqrt(psArr[y * dim + x])));
					psDCinCorner[i] = sqrt(sqrt(sqrt(psDCinCorner[i])));
					break;
				case GT_LOG10:
					//psArr[y * dim + x] = log10(psArr[y * dim + x]);
					if (psDCinCorner[i] > 0)
						psDCinCorner[i] = log10(psDCinCorner[i]);
					else psDCinCorner[i] = 0;
					break;
				case GT_LOGLOG10:
					//psArr[y * dim + x] = log10(log10(psArr[y * dim + x]));
					if (psDCinCorner[i] > 0)
						psDCinCorner[i] = log10(log10(psDCinCorner[i]));
					else psDCinCorner[i] = 0;
					break;
				case GT_NONE:
					//I just added this case statement to make a warning go away
					assert(false);
			}
		
		for (int i = 0; i < totalPixels; i++)
			assert(!isnan(psDCinCorner[i]));
	}
	
	//Floor nonnegative
	for (int i = 0; i < totalPixels; i++)
		if (psDCinCorner[i] < 0)
			psDCinCorner[i] = 0;
	
	//Normalize
	if (gainType != GT_LINEAR)
	{
		Float_t maxVal = 0;
		for (int i = 0; i < totalPixels; i++)
			if (psDCinCorner[i] > maxVal)
				maxVal = psDCinCorner[i];
		assert(maxVal > 0);
		for (int i = 0; i < totalPixels; i++)
			psDCinCorner[i] /= maxVal;
	}
	
	//Floor/Ceiling to [0-1]
	for (int i = 0; i < totalPixels; i++)
		if (psDCinCorner[i] < 0)
			psDCinCorner[i] = 0;
		else if (psDCinCorner[i] > 1.0)
			psDCinCorner[i] = 1.0;
	
	for (int i = 0; i < totalPixels; i++)
		assert(!isnan(psDCinCorner[i]));
	
	//180 degree phase shift (put DC term in center instead of upper left corner)
	//This is wasteful, the power spectrum should be produced into this arrangement in the first place
	if (shiftCenter)
		for (int y = 0; y < dim; y++)
			for (int x = 0; x < dim; x++)
				ps(x, y) = psDCinCorner((x + halfDim) % dim, (y + halfDim) % dim);
	else
		for (int y = 0; y < dim; y++)
			for (int x = 0; x < dim; x++)
				ps(x, y) = psDCinCorner(x, y);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x360, %rsp            # imm = 0x360
movb %cl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
andb $0x1, %al
movb %al, -0x15(%rbp)
movq -0x8(%rbp), %rdi
callq 0xedd0
cltq
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
callq 0xedf0
cltq
cmpq -0x20(%rbp), %rax
jne 0x2678f
jmp 0x267ae
leaq 0x254a6(%rip), %rdi     # 0x4bc3c
leaq 0x254b2(%rip), %rsi     # 0x4bc4f
movl $0x3c, %edx
leaq 0x254bb(%rip), %rcx     # 0x4bc64
callq 0x4240
movq -0x20(%rbp), %rax
movl $0x2, %ecx
cqto
idivq %rcx
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
callq 0xf200
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x8(%rbp), %rdi
callq 0xedd0
movl %eax, -0xd8(%rbp)
movq -0x8(%rbp), %rdi
callq 0xedf0
movq -0xe0(%rbp), %rdi
movl -0xd8(%rbp), %esi
movl %eax, %edx
movq (%rdi), %rax
callq *0x28(%rax)
movq -0x8(%rbp), %rdi
callq 0xedd0
movl %eax, -0xd4(%rbp)
movq -0x8(%rbp), %rdi
callq 0xedf0
movl -0xd4(%rbp), %esi
movl %eax, %edx
leaq -0x70(%rbp), %rdi
callq 0x15710
movl $0x0, -0x74(%rbp)
movslq -0x74(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x26952
movl $0x2, -0x78(%rbp)
movslq -0x78(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x26942
movq -0x8(%rbp), %rdi
movl -0x78(%rbp), %esi
movl -0x74(%rbp), %edx
callq 0x1d980
movq %rax, -0xe8(%rbp)
jmp 0x2686f
movq -0xe8(%rbp), %rax
movsd (%rax), %xmm0
movl $0x2, %edi
callq 0x258f0
movsd %xmm0, -0xf0(%rbp)
jmp 0x2688e
movq -0x8(%rbp), %rdi
movl -0x78(%rbp), %esi
incl %esi
movl -0x74(%rbp), %edx
callq 0x1d980
movq %rax, -0xf8(%rbp)
jmp 0x268a8
movq -0xf8(%rbp), %rax
movsd (%rax), %xmm0
movl $0x2, %edi
callq 0x258f0
movsd %xmm0, -0x100(%rbp)
jmp 0x268c7
movsd -0x100(%rbp), %xmm1
movsd -0xf0(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x110(%rbp)
movl -0x78(%rbp), %esi
movl %esi, %eax
shrl $0x1f, %eax
addl %eax, %esi
sarl %esi
movl -0x74(%rbp), %edx
leaq -0x70(%rbp), %rdi
callq 0x16fd0
movq %rax, -0x108(%rbp)
jmp 0x26904
movq -0x108(%rbp), %rax
movsd -0x110(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x78(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x78(%rbp)
jmp 0x26849
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x157e0
jmp 0x27741
jmp 0x26944
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x26834
movq -0x8(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x1d980
movq %rax, -0x118(%rbp)
jmp 0x26968
movq -0x118(%rbp), %rax
movsd (%rax), %xmm0
movl $0x2, %edi
callq 0x258f0
movsd %xmm0, -0x120(%rbp)
jmp 0x26987
movq -0x8(%rbp), %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x1d980
movq %rax, -0x128(%rbp)
jmp 0x269a0
movq -0x128(%rbp), %rax
movsd (%rax), %xmm0
movl $0x2, %edi
callq 0x258f0
movsd %xmm0, -0x130(%rbp)
jmp 0x269bf
movsd -0x130(%rbp), %xmm1
movsd -0x120(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x140(%rbp)
leaq -0x70(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x16fd0
movq %rax, -0x138(%rbp)
jmp 0x269f1
movq -0x138(%rbp), %rax
movsd -0x140(%rbp), %xmm0
movsd %xmm0, (%rax)
movl $0x1, -0x88(%rbp)
movslq -0x88(%rbp), %rax
cmpq -0x28(%rbp), %rax
jge 0x26b23
movq -0x8(%rbp), %rdi
movl -0x88(%rbp), %edx
xorl %esi, %esi
callq 0x1d980
movq %rax, -0x148(%rbp)
jmp 0x26a39
movq -0x148(%rbp), %rax
movsd (%rax), %xmm0
movl $0x2, %edi
callq 0x258f0
movsd %xmm0, -0x150(%rbp)
jmp 0x26a58
movq -0x8(%rbp), %rdi
movl -0x88(%rbp), %edx
movl $0x1, %esi
callq 0x1d980
movq %rax, -0x158(%rbp)
jmp 0x26a75
movq -0x158(%rbp), %rax
movsd (%rax), %xmm0
movl $0x2, %edi
callq 0x258f0
movsd %xmm0, -0x160(%rbp)
jmp 0x26a94
movsd -0x160(%rbp), %xmm1
movsd -0x150(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x170(%rbp)
movl -0x20(%rbp), %edx
movl -0x88(%rbp), %eax
subl %eax, %edx
leaq -0x70(%rbp), %rdi
xorl %esi, %esi
callq 0x16fd0
movq %rax, -0x168(%rbp)
jmp 0x26acf
movq -0x168(%rbp), %rax
movsd -0x170(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x88(%rbp), %edx
leaq -0x70(%rbp), %rdi
xorl %esi, %esi
callq 0x16fd0
movq %rax, -0x178(%rbp)
jmp 0x26afc
movq -0x178(%rbp), %rax
movsd -0x170(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x26a0e
movq -0x8(%rbp), %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x1d980
movq %rax, -0x180(%rbp)
jmp 0x26b3c
movq -0x180(%rbp), %rax
movsd (%rax), %xmm0
movl $0x2, %edi
callq 0x258f0
movsd %xmm0, -0x188(%rbp)
jmp 0x26b5b
movl -0x28(%rbp), %edx
leaq -0x70(%rbp), %rdi
xorl %esi, %esi
callq 0x16fd0
movq %rax, -0x190(%rbp)
jmp 0x26b72
movq -0x190(%rbp), %rax
movsd -0x188(%rbp), %xmm0
movsd %xmm0, (%rax)
movl $0x1, -0x8c(%rbp)
movslq -0x8c(%rbp), %rax
cmpq -0x28(%rbp), %rax
jge 0x26cb0
movq -0x8(%rbp), %rdi
movl -0x28(%rbp), %edx
movl -0x8c(%rbp), %eax
addl %eax, %edx
xorl %esi, %esi
callq 0x1d980
movq %rax, -0x198(%rbp)
jmp 0x26bbf
movq -0x198(%rbp), %rax
movsd (%rax), %xmm0
movl $0x2, %edi
callq 0x258f0
movsd %xmm0, -0x1a0(%rbp)
jmp 0x26bde
movq -0x8(%rbp), %rdi
movl -0x28(%rbp), %edx
movl -0x8c(%rbp), %eax
addl %eax, %edx
movl $0x1, %esi
callq 0x1d980
movq %rax, -0x1a8(%rbp)
jmp 0x26c00
movq -0x1a8(%rbp), %rax
movsd (%rax), %xmm0
movl $0x2, %edi
callq 0x258f0
movsd %xmm0, -0x1b0(%rbp)
jmp 0x26c1f
movsd -0x1b0(%rbp), %xmm1
movsd -0x1a0(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x1c0(%rbp)
movl -0x28(%rbp), %esi
movl -0x20(%rbp), %edx
movl -0x8c(%rbp), %eax
subl %eax, %edx
leaq -0x70(%rbp), %rdi
callq 0x16fd0
movq %rax, -0x1b8(%rbp)
jmp 0x26c5b
movq -0x1b8(%rbp), %rax
movsd -0x1c0(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x28(%rbp), %esi
movl -0x8c(%rbp), %edx
leaq -0x70(%rbp), %rdi
callq 0x16fd0
movq %rax, -0x1c8(%rbp)
jmp 0x26c89
movq -0x1c8(%rbp), %rax
movsd -0x1c0(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x26b8f
movq -0x8(%rbp), %rdi
movl -0x28(%rbp), %edx
xorl %esi, %esi
callq 0x1d980
movq %rax, -0x1d0(%rbp)
jmp 0x26cc7
movq -0x1d0(%rbp), %rax
movsd (%rax), %xmm0
movl $0x2, %edi
callq 0x258f0
movsd %xmm0, -0x1d8(%rbp)
jmp 0x26ce6
movl -0x28(%rbp), %esi
leaq -0x70(%rbp), %rdi
xorl %edx, %edx
callq 0x16fd0
movq %rax, -0x1e0(%rbp)
jmp 0x26cfd
movq -0x1e0(%rbp), %rax
movsd -0x1d8(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x8(%rbp), %rdi
movl -0x28(%rbp), %edx
movl $0x1, %esi
callq 0x1d980
movq %rax, -0x1e8(%rbp)
jmp 0x26d2a
movq -0x1e8(%rbp), %rax
movsd (%rax), %xmm0
movl $0x2, %edi
callq 0x258f0
movsd %xmm0, -0x1f0(%rbp)
jmp 0x26d49
movl -0x28(%rbp), %edx
leaq -0x70(%rbp), %rdi
movl %edx, %esi
callq 0x16fd0
movq %rax, -0x1f8(%rbp)
jmp 0x26d60
movq -0x1f8(%rbp), %rax
movsd -0x1f0(%rbp), %xmm0
movsd %xmm0, (%rax)
movl $0x1, -0x90(%rbp)
movslq -0x90(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x26e44
movl $0x1, -0x94(%rbp)
movslq -0x94(%rbp), %rax
cmpq -0x28(%rbp), %rax
jge 0x26e2e
movl -0x28(%rbp), %esi
movl -0x94(%rbp), %eax
subl %eax, %esi
movl -0x20(%rbp), %edx
movl -0x90(%rbp), %eax
subl %eax, %edx
leaq -0x70(%rbp), %rdi
callq 0x16fd0
movq %rax, -0x200(%rbp)
jmp 0x26dd1
movq -0x200(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x210(%rbp)
movl -0x28(%rbp), %esi
movl -0x94(%rbp), %eax
addl %eax, %esi
movl -0x90(%rbp), %edx
leaq -0x70(%rbp), %rdi
callq 0x16fd0
movq %rax, -0x208(%rbp)
jmp 0x26e07
movq -0x208(%rbp), %rax
movsd -0x210(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x26d98
jmp 0x26e30
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
jmp 0x26d7d
movl $0x1, -0x98(%rbp)
movslq -0x98(%rbp), %rax
cmpq -0x28(%rbp), %rax
jg 0x26ecb
movl -0x98(%rbp), %esi
leaq -0x70(%rbp), %rdi
xorl %edx, %edx
callq 0x16fd0
movq %rax, -0x218(%rbp)
jmp 0x26e75
movq -0x218(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x228(%rbp)
movl -0x20(%rbp), %esi
movl -0x98(%rbp), %eax
subl %eax, %esi
leaq -0x70(%rbp), %rdi
xorl %edx, %edx
callq 0x16fd0
movq %rax, -0x220(%rbp)
jmp 0x26ea7
movq -0x220(%rbp), %rax
movsd -0x228(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x98(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x98(%rbp)
jmp 0x26e4e
movl $0x0, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x26f40
movl -0x9c(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0xef70
movq %rax, -0x230(%rbp)
jmp 0x26ef8
movq -0x230(%rbp), %rax
movsd (%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x26f0e
jmp 0x26f2d
leaq 0x24d9a(%rip), %rdi     # 0x4bcaf
leaq 0x24d33(%rip), %rsi     # 0x4bc4f
movl $0x62, %edx
leaq 0x24d3c(%rip), %rcx     # 0x4bc64
callq 0x4240
jmp 0x26f2f
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x26ed5
cmpl $0x0, -0x14(%rbp)
je 0x27268
movl $0x0, -0xa0(%rbp)
movl -0xa0(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x271df
movl -0x14(%rbp), %eax
movq %rax, -0x238(%rbp)
subq $0x4, %rax
ja 0x271c9
movq -0x238(%rbp), %rax
leaq 0x24ca3(%rip), %rcx     # 0x4bc28
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movsd 0x333ea(%rip), %xmm0    # 0x5a380
movsd %xmm0, -0x248(%rbp)
movl -0xa0(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0xef70
movq %rax, -0x240(%rbp)
jmp 0x26fb6
movq -0x240(%rbp), %rax
movsd -0x248(%rbp), %xmm1
movsd (%rax), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, (%rax)
jmp 0x271c9
movl -0xa0(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0xef70
movq %rax, -0x250(%rbp)
jmp 0x26fee
movq -0x250(%rbp), %rax
movsd (%rax), %xmm0
callq 0x42c0
callq 0x42c0
callq 0x42c0
movsd %xmm0, -0x260(%rbp)
movl -0xa0(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0xef70
movq %rax, -0x258(%rbp)
jmp 0x27028
movq -0x258(%rbp), %rax
movsd -0x260(%rbp), %xmm0
movsd %xmm0, (%rax)
jmp 0x271c9
movl -0xa0(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0xef70
movq %rax, -0x268(%rbp)
jmp 0x27058
movq -0x268(%rbp), %rax
movsd (%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x270c9
movl -0xa0(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0xef70
movq %rax, -0x270(%rbp)
jmp 0x27084
movq -0x270(%rbp), %rax
movsd (%rax), %xmm0
callq 0x41c0
movsd %xmm0, -0x280(%rbp)
movl -0xa0(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0xef70
movq %rax, -0x278(%rbp)
jmp 0x270b4
movq -0x278(%rbp), %rax
movsd -0x280(%rbp), %xmm0
movsd %xmm0, (%rax)
jmp 0x270ef
movl -0xa0(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0xef70
movq %rax, -0x288(%rbp)
jmp 0x270e1
movq -0x288(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
jmp 0x271c9
movl -0xa0(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0xef70
movq %rax, -0x290(%rbp)
jmp 0x2710c
movq -0x290(%rbp), %rax
movsd (%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x27182
movl -0xa0(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0xef70
movq %rax, -0x298(%rbp)
jmp 0x27138
movq -0x298(%rbp), %rax
movsd (%rax), %xmm0
callq 0x41c0
callq 0x41c0
movsd %xmm0, -0x2a8(%rbp)
movl -0xa0(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0xef70
movq %rax, -0x2a0(%rbp)
jmp 0x2716d
movq -0x2a0(%rbp), %rax
movsd -0x2a8(%rbp), %xmm0
movsd %xmm0, (%rax)
jmp 0x271a8
movl -0xa0(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0xef70
movq %rax, -0x2b0(%rbp)
jmp 0x2719a
movq -0x2b0(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
jmp 0x271c9
leaq 0x24b13(%rip), %rdi     # 0x4bcc4
leaq 0x24a97(%rip), %rsi     # 0x4bc4f
movl $0x80, %edx
leaq 0x24aa0(%rip), %rcx     # 0x4bc64
callq 0x4240
jmp 0x271cb
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
jmp 0x26f54
movl $0x0, -0xa4(%rbp)
movl -0xa4(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x27266
movl -0xa4(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0xef70
movq %rax, -0x2b8(%rbp)
jmp 0x2720c
movq -0x2b8(%rbp), %rax
movsd (%rax), %xmm0
callq 0x29330
movb %al, -0x2b9(%rbp)
jmp 0x27224
movb -0x2b9(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x27232
jmp 0x27234
jmp 0x27253
leaq 0x24a8f(%rip), %rdi     # 0x4bcca
leaq 0x24a0d(%rip), %rsi     # 0x4bc4f
movl $0x84, %edx
leaq 0x24a16(%rip), %rcx     # 0x4bc64
callq 0x4240
jmp 0x27255
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x271e9
jmp 0x27268
movl $0x0, -0xa8(%rbp)
movl -0xa8(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x272de
movl -0xa8(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0xef70
movq %rax, -0x2c8(%rbp)
jmp 0x27295
movq -0x2c8(%rbp), %rax
xorps %xmm0, %xmm0
ucomisd (%rax), %xmm0
jbe 0x272cb
movl -0xa8(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0xef70
movq %rax, -0x2d0(%rbp)
jmp 0x272bd
movq -0x2d0(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
jmp 0x272cd
movl -0xa8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa8(%rbp)
jmp 0x27272
cmpl $0x1, -0x14(%rbp)
je 0x27410
xorps %xmm0, %xmm0
movsd %xmm0, -0xb0(%rbp)
movl $0x0, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x27373
movl -0xb4(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0xef70
movq %rax, -0x2d8(%rbp)
jmp 0x27320
movq -0x2d8(%rbp), %rax
movsd (%rax), %xmm0
ucomisd -0xb0(%rbp), %xmm0
jbe 0x27360
movl -0xb4(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0xef70
movq %rax, -0x2e0(%rbp)
jmp 0x2734d
movq -0x2e0(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0xb0(%rbp)
jmp 0x27362
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x272fd
movsd -0xb0(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x27386
jmp 0x273a5
leaq 0x24955(%rip), %rdi     # 0x4bce2
leaq 0x248bb(%rip), %rsi     # 0x4bc4f
movl $0x93, %edx
leaq 0x248c4(%rip), %rcx     # 0x4bc64
callq 0x4240
movl $0x0, -0xb8(%rbp)
movl -0xb8(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x2740e
movsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0x2f0(%rbp)
movl -0xb8(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0xef70
movq %rax, -0x2e8(%rbp)
jmp 0x273e2
movq -0x2e8(%rbp), %rax
movsd -0x2f0(%rbp), %xmm1
movsd (%rax), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movl -0xb8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb8(%rbp)
jmp 0x273af
jmp 0x27410
movl $0x0, -0xbc(%rbp)
movl -0xbc(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x274ed
movl -0xbc(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0xef70
movq %rax, -0x2f8(%rbp)
jmp 0x27441
movq -0x2f8(%rbp), %rax
xorps %xmm0, %xmm0
ucomisd (%rax), %xmm0
jbe 0x27479
movl -0xbc(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0xef70
movq %rax, -0x300(%rbp)
jmp 0x27469
movq -0x300(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
jmp 0x274d7
movl -0xbc(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0xef70
movq %rax, -0x308(%rbp)
jmp 0x27491
movq -0x308(%rbp), %rax
movsd (%rax), %xmm0
movsd 0x21b7c(%rip), %xmm1    # 0x49020
ucomisd %xmm1, %xmm0
jbe 0x274d5
movl -0xbc(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0xef70
movq %rax, -0x310(%rbp)
jmp 0x274c2
movq -0x310(%rbp), %rax
movsd 0x21b4f(%rip), %xmm0    # 0x49020
movsd %xmm0, (%rax)
jmp 0x274d7
jmp 0x274d9
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
jmp 0x2741a
movl $0x0, -0xc0(%rbp)
movl -0xc0(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x27574
movl -0xc0(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0xef70
movq %rax, -0x318(%rbp)
jmp 0x2751a
movq -0x318(%rbp), %rax
movsd (%rax), %xmm0
callq 0x29330
movb %al, -0x319(%rbp)
jmp 0x27532
movb -0x319(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x27540
jmp 0x27542
jmp 0x27561
leaq 0x24781(%rip), %rdi     # 0x4bcca
leaq 0x246ff(%rip), %rsi     # 0x4bc4f
movl $0xa0, %edx
leaq 0x24708(%rip), %rcx     # 0x4bc64
callq 0x4240
jmp 0x27563
movl -0xc0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc0(%rbp)
jmp 0x274f7
testb $0x1, -0x15(%rbp)
je 0x27672
movl $0x0, -0xc4(%rbp)
movslq -0xc4(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x2766d
movl $0x0, -0xc8(%rbp)
movslq -0xc8(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x27657
movslq -0xc8(%rbp), %rax
movq -0x28(%rbp), %rcx
movq %rcx, -0x330(%rbp)
addq %rcx, %rax
movq -0x20(%rbp), %rcx
cqto
idivq %rcx
movq %rdx, %rax
movq -0x330(%rbp), %rdx
movl %eax, %esi
movslq -0xc4(%rbp), %rax
addq %rdx, %rax
cqto
idivq %rcx
leaq -0x70(%rbp), %rdi
callq 0x16fd0
movq %rax, -0x328(%rbp)
jmp 0x275ff
movq -0x328(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x340(%rbp)
movq -0x10(%rbp), %rdi
movl -0xc8(%rbp), %esi
movl -0xc4(%rbp), %edx
callq 0x16fd0
movq %rax, -0x338(%rbp)
jmp 0x27630
movq -0x338(%rbp), %rax
movsd -0x340(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0xc8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc8(%rbp)
jmp 0x275a3
jmp 0x27659
movl -0xc4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc4(%rbp)
jmp 0x27588
jmp 0x2772f
movl $0x0, -0xcc(%rbp)
movslq -0xcc(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x2772d
movl $0x0, -0xd0(%rbp)
movslq -0xd0(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x27717
movl -0xd0(%rbp), %esi
movl -0xcc(%rbp), %edx
leaq -0x70(%rbp), %rdi
callq 0x16fd0
movq %rax, -0x348(%rbp)
jmp 0x276c2
movq -0x348(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x358(%rbp)
movq -0x10(%rbp), %rdi
movl -0xd0(%rbp), %esi
movl -0xcc(%rbp), %edx
callq 0x16fd0
movq %rax, -0x350(%rbp)
jmp 0x276f3
movq -0x350(%rbp), %rax
movsd -0x358(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0xd0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd0(%rbp)
jmp 0x27697
jmp 0x27719
movl -0xcc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xcc(%rbp)
jmp 0x2767c
jmp 0x2772f
leaq -0x70(%rbp), %rdi
callq 0x157e0
addq $0x360, %rsp            # imm = 0x360
popq %rbp
retq
movq -0x80(%rbp), %rdi
callq 0x4620
nopw (%rax,%rax)