// File: shuwenyue[P]MD_code_cell_list/force.cpp
// Function: force::getForcecellist(double, int, double, double, double, std::vector<vec3<double>, std::allocator<vec3<double>>>)
double force::getForcecellist(double t, int NParticles, double BoxLength, double cutoff, double density, vector<double3> coord)
{
    // define force vector initialized to 0
    forceVector.resize(NParticles);
    for (int f=0; f < NParticles; f++)
    {
        forceVector[f].x = 0;
        forceVector[f].y = 0;
        forceVector[f].z = 0;
    }

	// define initial energy to 0
	double energy = 0;

	// define objects to use functions in other classes   
	particle particleObj;
	box boxObj;

	// calculations for 'long range interaction' (mean field energy outside of cutoff), to be used in total Energy calculation
    double rcutoff6i = 1/(cutoff*cutoff*cutoff*cutoff*cutoff*cutoff); // 1/(cutoff^6) 
    double rcutoff12i = rcutoff6i*rcutoff6i; // 1/(cutoff^12)

	// define length variables
	double xlength, ylength, zlength, r2;

	// build Cell List, determine number of cells long on each side of box (each cell length > cutoff)
	int CellsPerSide = round(BoxLength/cutoff);

	// length of each cell
	double cellLength = BoxLength/CellsPerSide;

	// total number of cells
	int Ncells = CellsPerSide*CellsPerSide*CellsPerSide;
	
	// ParticleCell vector contains the cell number location for each particle
	ParticleCell.resize(NParticles);	
	for (int a=0; a<NParticles; a++)
	{
		// convert position coordinates to cell coordinates
		double cx = floor(coord[a].x/cellLength); 
		double cy = floor(coord[a].y/cellLength);
		double cz = floor(coord[a].z/cellLength);
		ParticleCell[a] = CellsPerSide*CellsPerSide*cz+cy*CellsPerSide+cx; // algorithm to determine cell number location of a particle
	}
	
	// create head vector and linked list and initialize to -1 (NULL)
	HeadList.resize(Ncells);
	LinkedList.resize(NParticles);
	for (int m=0; m<Ncells; m++)
	{
		HeadList[m] = -1;
	}
	for (int m=0; m<NParticles; m++)
	{
		LinkedList[m] = -1;
	}
		
	// create cell coordinate matrix: NParticlesx3 matrix of cell coordinate for each particle
	CellCoord.resize(NParticles);
	int cellCounter = 0;
	for (int z = 0; z < CellsPerSide ; z++)
	{
		for (int y = 0; y < CellsPerSide ; y++)
		{
			for(int x = 0; x < CellsPerSide ; x++)
			{
				CellCoord[cellCounter].x = x;
				CellCoord[cellCounter].y = y;
				CellCoord[cellCounter].z = z;
				cellCounter = cellCounter + 1;
			}
		}
	}

	//loop over particle list and assign values to headlist and linked list
	for (int i = 0; i<NParticles; i++)
	{
		double cellnumber = ParticleCell[i];
		LinkedList[i]=HeadList[cellnumber];
		HeadList[cellnumber] = i;
	}


	// loop over all cells for interactions, where any 1 cell is designated 'center cell' for surrounding interactions
	for (int cell = 0; cell < Ncells; cell++)
	{
		// loop over all 26 neighbors of 'center cell' and 'center cell' itself (27 boxes total)
		for (int cx1 = CellCoord[cell].x-1; cx1 < CellCoord[cell].x+2; cx1++)
		{
			for (int cy1 = CellCoord[cell].y-1; cy1 < CellCoord[cell].y+2; cy1++)
			{
				for (int cz1 = CellCoord[cell].z-1; cz1 < CellCoord[cell].z+2; cz1++)
				{

					// periodic boundary conditions (correct cell locations of neighbors)
					int cx11 = cx1;
					int cy11 = cy1;
					int cz11 = cz1;

					if (cx1 < 0)
					{
						cx11 = CellsPerSide - 1;
					}
					else if (cx1 > (CellsPerSide-1))
					{
						cx11 = 0;
					}
					if (cy1 < 0)
					{
						cy11 = CellsPerSide - 1;
					}
					else if (cy1 > (CellsPerSide-1))
					{
						cy11 = 0;
					}
					if (cz1 < 0)
					{
						cz11 = CellsPerSide - 1;
					}
					else if(cz1 > (CellsPerSide-1))
					{
						cz11 = 0;
					}
					
					// use algorithm to determine cell number of neighbor cells
					int neighborCell = CellsPerSide*CellsPerSide*cz11+cy11*CellsPerSide+cx11;

					// define atom i as HeadList value of 'center cell'
					int i = HeadList[cell];
					
					// scan for atom i in center cell (cell)
					int counter = 0;
					while (i > -1) // while HeadList vector space is null
					{
						counter = counter + 1;

						// scan atom j in cell neighbor (neighborCell)
						int j = HeadList[neighborCell];
						
						while (j > -1) // while LinkedList vector space is null
						{
						
							if (i < j) // avoid double counting of each pair
							{
            					xlength = coord[i].x - coord[j].x; // interaction length between particle i and j in the x direction
            					ylength = coord[i].y - coord[j].y; // interaction length between particle i and j in the y direction
           						zlength = coord[i].z - coord[j].z; // interaction length between particle i and j in the z direction

								// apply periodic boundary conditions on interaction lengths
								xlength = boxObj.boundaries(xlength, BoxLength);
								ylength = boxObj.boundaries(ylength, BoxLength);
								zlength = boxObj.boundaries(zlength, BoxLength);

								// calculate radius^2
								r2 = (xlength*xlength) + (ylength*ylength) + (zlength*zlength);

								// define formulas for LJ force calculation 
								// LJ force formula is force = (48/cutoff^2)*(1/cutoff^12 - 1/cutoff^6) - we can break this down to multiple components
								double r6i = 1/(r2*r2*r2);
								double r12i = r6i*r6i;
								double lj = (48/r2)*(r12i-0.5*r6i);	// used for derivation of energy = force

								// if r < cutoff radius, then add explicitly calculated interaction force to cumulative force
								// otherwise, this interaction is outside of cutoff radius and not included in calculation
								if (r2 < (cutoff*cutoff))
								{
									// update force
									forceVector[i].x = forceVector[i].x + lj*xlength;
									forceVector[i].y = forceVector[i].y + lj*ylength;
                					forceVector[i].z = forceVector[i].z + lj*zlength;
                
               						forceVector[j].x = forceVector[j].x - lj*xlength;
               						forceVector[j].y = forceVector[j].y - lj*ylength;
                					forceVector[j].z = forceVector[j].z - lj*zlength;
							

									// interactions energy outside of cutoff distance represented by in 'long range correction' (8/3*pi*density...)
									// energy = energy + LJ energy of current interaction long range correction
									energy = energy + 4*(r12i-r6i) - (8/3)*3.14159265*density*((1/3)*(1/pow(cutoff,9.0))-(1/pow(cutoff,6.0)));
								}
							}
							j = LinkedList[j];
						}
						i = LinkedList[i];
					}
				}
			}
		}
	}
	// returns total energy
	return energy;
}

// Assembly:
subq $0x278, %rsp            # imm = 0x278
movq %rdx, 0xd8(%rsp)
movq %rdi, 0x270(%rsp)
movsd %xmm0, 0x268(%rsp)
movl %esi, 0x264(%rsp)
movsd %xmm1, 0x258(%rsp)
movsd %xmm2, 0x250(%rsp)
movsd %xmm3, 0x248(%rsp)
movq %rdx, 0x240(%rsp)
movq 0x270(%rsp), %rdi
movq %rdi, 0xe0(%rsp)
movslq 0x264(%rsp), %rsi
callq 0x5ca0
movl $0x0, 0x23c(%rsp)
movl 0x23c(%rsp), %eax
cmpl 0x264(%rsp), %eax
jge 0x6efb
movq 0xe0(%rsp), %rdi
movslq 0x23c(%rsp), %rsi
callq 0x3350
movq 0xe0(%rsp), %rdi
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movslq 0x23c(%rsp), %rsi
callq 0x3350
movq 0xe0(%rsp), %rdi
xorps %xmm0, %xmm0
movsd %xmm0, 0x8(%rax)
movslq 0x23c(%rsp), %rsi
callq 0x3350
xorps %xmm0, %xmm0
movsd %xmm0, 0x10(%rax)
movl 0x23c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x23c(%rsp)
jmp 0x6e82
movq $0x0, 0x230(%rsp)
leaq 0x1d0(%rsp), %rdi
callq 0x3110
movsd 0x250(%rsp), %xmm0
movaps %xmm0, %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
movsd 0x20d4(%rip), %xmm0     # 0x9010
divsd %xmm1, %xmm0
movsd %xmm0, 0x1c0(%rsp)
movsd 0x1c0(%rsp), %xmm0
mulsd %xmm0, %xmm0
movsd %xmm0, 0x1b8(%rsp)
movsd 0x258(%rsp), %xmm0
movsd 0x250(%rsp), %xmm1
divsd %xmm1, %xmm0
callq 0x2080
movq 0xe0(%rsp), %rdi
cvttsd2si %xmm0, %eax
movl %eax, 0x194(%rsp)
movsd 0x258(%rsp), %xmm0
cvtsi2sdl 0x194(%rsp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x188(%rsp)
movl 0x194(%rsp), %ecx
movl %ecx, %eax
imull %eax, %eax
imull %ecx, %eax
movl %eax, 0x184(%rsp)
addq $0x30, %rdi
movslq 0x264(%rsp), %rsi
callq 0x7ef0
jmp 0x6fd5
movl $0x0, 0x170(%rsp)
movl 0x170(%rsp), %eax
cmpl 0x264(%rsp), %eax
jge 0x7132
movq 0xd8(%rsp), %rdi
movslq 0x170(%rsp), %rsi
callq 0x3350
movsd (%rax), %xmm0
divsd 0x188(%rsp), %xmm0
callq 0x21b0
movq 0xd8(%rsp), %rdi
movsd %xmm0, 0x168(%rsp)
movslq 0x170(%rsp), %rsi
callq 0x3350
movsd 0x8(%rax), %xmm0
divsd 0x188(%rsp), %xmm0
callq 0x21b0
movq 0xd8(%rsp), %rdi
movsd %xmm0, 0x160(%rsp)
movslq 0x170(%rsp), %rsi
callq 0x3350
movsd 0x10(%rax), %xmm0
divsd 0x188(%rsp), %xmm0
callq 0x21b0
movq 0xe0(%rsp), %rdi
movsd %xmm0, 0x158(%rsp)
movl 0x194(%rsp), %eax
imull 0x194(%rsp), %eax
cvtsi2sd %eax, %xmm0
movsd 0x158(%rsp), %xmm2
movsd 0x160(%rsp), %xmm1
cvtsi2sdl 0x194(%rsp), %xmm3
mulsd %xmm3, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
addsd 0x168(%rsp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0xd4(%rsp)
addq $0x30, %rdi
movslq 0x170(%rsp), %rsi
callq 0x7f90
movl 0xd4(%rsp), %ecx
movl %ecx, (%rax)
movl 0x170(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x170(%rsp)
jmp 0x6fe0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x178(%rsp)
movl %eax, 0x174(%rsp)
leaq 0x1d0(%rsp), %rdi
callq 0x33d0
jmp 0x7eaa
movq 0xe0(%rsp), %rdi
addq $0x48, %rdi
movslq 0x184(%rsp), %rsi
callq 0x7ef0
jmp 0x714d
movq 0xe0(%rsp), %rdi
addq $0x60, %rdi
movslq 0x264(%rsp), %rsi
callq 0x7ef0
jmp 0x7168
movl $0x0, 0x154(%rsp)
movl 0x154(%rsp), %eax
cmpl 0x184(%rsp), %eax
jge 0x71b5
movq 0xe0(%rsp), %rdi
addq $0x48, %rdi
movslq 0x154(%rsp), %rsi
callq 0x7f90
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl 0x154(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x154(%rsp)
jmp 0x7173
movl $0x0, 0x150(%rsp)
movl 0x150(%rsp), %eax
cmpl 0x264(%rsp), %eax
jge 0x7202
movq 0xe0(%rsp), %rdi
addq $0x60, %rdi
movslq 0x150(%rsp), %rsi
callq 0x7f90
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl 0x150(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x150(%rsp)
jmp 0x71c0
movq 0xe0(%rsp), %rdi
addq $0x78, %rdi
movslq 0x264(%rsp), %rsi
callq 0x5ca0
jmp 0x721d
movl $0x0, 0x14c(%rsp)
movl $0x0, 0x148(%rsp)
movl 0x148(%rsp), %eax
cmpl 0x194(%rsp), %eax
jge 0x7386
movl $0x0, 0x144(%rsp)
movl 0x144(%rsp), %eax
cmpl 0x194(%rsp), %eax
jge 0x736e
movl $0x0, 0x140(%rsp)
movl 0x140(%rsp), %eax
cmpl 0x194(%rsp), %eax
jge 0x7356
movq 0xe0(%rsp), %rdi
cvtsi2sdl 0x140(%rsp), %xmm0
movsd %xmm0, 0xb8(%rsp)
addq $0x78, %rdi
movslq 0x14c(%rsp), %rsi
callq 0x3350
movsd 0xb8(%rsp), %xmm0
movq 0xe0(%rsp), %rdi
movsd %xmm0, (%rax)
cvtsi2sdl 0x144(%rsp), %xmm0
movsd %xmm0, 0xc0(%rsp)
addq $0x78, %rdi
movslq 0x14c(%rsp), %rsi
callq 0x3350
movsd 0xc0(%rsp), %xmm0
movq 0xe0(%rsp), %rdi
movsd %xmm0, 0x8(%rax)
cvtsi2sdl 0x148(%rsp), %xmm0
movsd %xmm0, 0xc8(%rsp)
addq $0x78, %rdi
movslq 0x14c(%rsp), %rsi
callq 0x3350
movsd 0xc8(%rsp), %xmm0
movsd %xmm0, 0x10(%rax)
movl 0x14c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14c(%rsp)
movl 0x140(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x140(%rsp)
jmp 0x7271
jmp 0x7358
movl 0x144(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x144(%rsp)
jmp 0x7252
jmp 0x7370
movl 0x148(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x148(%rsp)
jmp 0x7233
movl $0x0, 0x13c(%rsp)
movl 0x13c(%rsp), %eax
cmpl 0x264(%rsp), %eax
jge 0x74b1
movq 0xe0(%rsp), %rdi
addq $0x30, %rdi
movslq 0x13c(%rsp), %rsi
callq 0x7f90
movq 0xe0(%rsp), %rdi
cvtsi2sdl (%rax), %xmm0
movsd %xmm0, 0x130(%rsp)
addq $0x48, %rdi
movq %rdi, 0xa8(%rsp)
movsd 0x130(%rsp), %xmm0
movsd 0x1e98(%rip), %xmm2     # 0x9288
movsd %xmm2, 0xa0(%rsp)
movaps %xmm0, %xmm1
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %rax
cvttsd2si %xmm0, %rsi
movq %rsi, %rcx
sarq $0x3f, %rcx
andq %rcx, %rax
orq %rax, %rsi
callq 0x7f90
movq 0xe0(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x9c(%rsp)
addq $0x60, %rdi
movslq 0x13c(%rsp), %rsi
callq 0x7f90
movl 0x9c(%rsp), %ecx
movsd 0xa0(%rsp), %xmm2
movq 0xa8(%rsp), %rdi
movl %ecx, (%rax)
movl 0x13c(%rsp), %eax
movl %eax, 0xb4(%rsp)
movsd 0x130(%rsp), %xmm0
movaps %xmm0, %xmm1
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %rax
cvttsd2si %xmm0, %rsi
movq %rsi, %rcx
sarq $0x3f, %rcx
andq %rcx, %rax
orq %rax, %rsi
callq 0x7f90
movl 0xb4(%rsp), %ecx
movl %ecx, (%rax)
movl 0x13c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x13c(%rsp)
jmp 0x7391
movl $0x0, 0x12c(%rsp)
movl 0x12c(%rsp), %eax
cmpl 0x184(%rsp), %eax
jge 0x7e82
movq 0xe0(%rsp), %rdi
addq $0x78, %rdi
movslq 0x12c(%rsp), %rsi
callq 0x3350
movsd (%rax), %xmm0
movsd 0x1b1b(%rip), %xmm1     # 0x9010
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x128(%rsp)
movq 0xe0(%rsp), %rdi
cvtsi2sdl 0x128(%rsp), %xmm0
movsd %xmm0, 0x90(%rsp)
addq $0x78, %rdi
movslq 0x12c(%rsp), %rsi
callq 0x3350
movsd 0x90(%rsp), %xmm1
movsd 0x1cf0(%rip), %xmm0     # 0x9230
addsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x7e6a
movq 0xe0(%rsp), %rdi
addq $0x78, %rdi
movslq 0x12c(%rsp), %rsi
callq 0x3350
movsd 0x8(%rax), %xmm0
movsd 0x1a9c(%rip), %xmm1     # 0x9010
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x124(%rsp)
movq 0xe0(%rsp), %rdi
cvtsi2sdl 0x124(%rsp), %xmm0
movsd %xmm0, 0x88(%rsp)
addq $0x78, %rdi
movslq 0x12c(%rsp), %rsi
callq 0x3350
movsd 0x88(%rsp), %xmm1
movsd 0x1c71(%rip), %xmm0     # 0x9230
addsd 0x8(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x7e52
movq 0xe0(%rsp), %rdi
addq $0x78, %rdi
movslq 0x12c(%rsp), %rsi
callq 0x3350
movsd 0x10(%rax), %xmm0
movsd 0x1a1c(%rip), %xmm1     # 0x9010
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x120(%rsp)
movq 0xe0(%rsp), %rdi
cvtsi2sdl 0x120(%rsp), %xmm0
movsd %xmm0, 0x80(%rsp)
addq $0x78, %rdi
movslq 0x12c(%rsp), %rsi
callq 0x3350
movsd 0x80(%rsp), %xmm1
movsd 0x1bf1(%rip), %xmm0     # 0x9230
addsd 0x10(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x7e3a
movl 0x128(%rsp), %eax
movl %eax, 0x11c(%rsp)
movl 0x124(%rsp), %eax
movl %eax, 0x118(%rsp)
movl 0x120(%rsp), %eax
movl %eax, 0x114(%rsp)
cmpl $0x0, 0x128(%rsp)
jge 0x7695
movl 0x194(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x11c(%rsp)
jmp 0x76b7
movl 0x128(%rsp), %eax
movl 0x194(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0x76b5
movl $0x0, 0x11c(%rsp)
jmp 0x76b7
cmpl $0x0, 0x124(%rsp)
jge 0x76d4
movl 0x194(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x118(%rsp)
jmp 0x76f6
movl 0x124(%rsp), %eax
movl 0x194(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0x76f4
movl $0x0, 0x118(%rsp)
jmp 0x76f6
cmpl $0x0, 0x120(%rsp)
jge 0x7713
movl 0x194(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x114(%rsp)
jmp 0x7735
movl 0x120(%rsp), %eax
movl 0x194(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0x7733
movl $0x0, 0x114(%rsp)
jmp 0x7735
movq 0xe0(%rsp), %rdi
movl 0x194(%rsp), %eax
imull 0x194(%rsp), %eax
imull 0x114(%rsp), %eax
movl 0x118(%rsp), %ecx
imull 0x194(%rsp), %ecx
addl %ecx, %eax
addl 0x11c(%rsp), %eax
movl %eax, 0x110(%rsp)
addq $0x48, %rdi
movslq 0x12c(%rsp), %rsi
callq 0x7f90
movl (%rax), %eax
movl %eax, 0x10c(%rsp)
movl $0x0, 0x108(%rsp)
cmpl $-0x1, 0x10c(%rsp)
jle 0x7e22
movq 0xe0(%rsp), %rdi
movl 0x108(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x108(%rsp)
addq $0x48, %rdi
movslq 0x110(%rsp), %rsi
callq 0x7f90
movl (%rax), %eax
movl %eax, 0x104(%rsp)
cmpl $-0x1, 0x104(%rsp)
jle 0x7dfb
movl 0x10c(%rsp), %eax
cmpl 0x104(%rsp), %eax
jge 0x7dd4
movq 0xd8(%rsp), %rdi
movslq 0x10c(%rsp), %rsi
callq 0x3350
movq 0xd8(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0x60(%rsp)
movslq 0x104(%rsp), %rsi
callq 0x3350
movsd 0x60(%rsp), %xmm0
movq 0xd8(%rsp), %rdi
movsd (%rax), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, 0x1b0(%rsp)
movslq 0x10c(%rsp), %rsi
callq 0x3350
movq 0xd8(%rsp), %rdi
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x68(%rsp)
movslq 0x104(%rsp), %rsi
callq 0x3350
movsd 0x68(%rsp), %xmm0
movq 0xd8(%rsp), %rdi
movsd 0x8(%rax), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, 0x1a8(%rsp)
movslq 0x10c(%rsp), %rsi
callq 0x3350
movq 0xd8(%rsp), %rdi
movsd 0x10(%rax), %xmm0
movsd %xmm0, 0x70(%rsp)
movslq 0x104(%rsp), %rsi
callq 0x3350
movsd 0x70(%rsp), %xmm0
movsd 0x10(%rax), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, 0x1a0(%rsp)
movsd 0x1b0(%rsp), %xmm0
movsd 0x258(%rsp), %xmm1
leaq 0x1cf(%rsp), %rdi
callq 0x8900
movsd %xmm0, 0x78(%rsp)
jmp 0x7907
movsd 0x78(%rsp), %xmm0
movsd %xmm0, 0x1b0(%rsp)
movsd 0x1a8(%rsp), %xmm0
movsd 0x258(%rsp), %xmm1
leaq 0x1cf(%rsp), %rdi
callq 0x8900
movsd %xmm0, 0x58(%rsp)
jmp 0x793d
movsd 0x58(%rsp), %xmm0
movsd %xmm0, 0x1a8(%rsp)
movsd 0x1a0(%rsp), %xmm0
movsd 0x258(%rsp), %xmm1
leaq 0x1cf(%rsp), %rdi
callq 0x8900
movsd %xmm0, 0x50(%rsp)
jmp 0x7973
movsd 0x50(%rsp), %xmm0
movsd %xmm0, 0x1a0(%rsp)
movsd 0x1b0(%rsp), %xmm1
movsd 0x1b0(%rsp), %xmm2
movsd 0x1a8(%rsp), %xmm0
mulsd 0x1a8(%rsp), %xmm0
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd 0x1a0(%rsp), %xmm0
movsd 0x1a0(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x198(%rsp)
movsd 0x198(%rsp), %xmm1
mulsd 0x198(%rsp), %xmm1
mulsd 0x198(%rsp), %xmm1
movsd 0x161c(%rip), %xmm0     # 0x9010
divsd %xmm1, %xmm0
movsd %xmm0, 0xf8(%rsp)
movsd 0xf8(%rsp), %xmm0
mulsd 0xf8(%rsp), %xmm0
movsd %xmm0, 0xf0(%rsp)
movsd 0x183c(%rip), %xmm0     # 0x9260
divsd 0x198(%rsp), %xmm0
movsd 0xf0(%rsp), %xmm2
movsd 0xf8(%rsp), %xmm1
movsd 0x1811(%rip), %xmm3     # 0x9258
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0xe8(%rsp)
movsd 0x198(%rsp), %xmm1
movsd 0x250(%rsp), %xmm0
mulsd 0x250(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x7dd2
movq 0xe0(%rsp), %rdi
movslq 0x10c(%rsp), %rsi
callq 0x3350
movq 0xe0(%rsp), %rdi
movsd (%rax), %xmm1
movsd 0xe8(%rsp), %xmm0
movsd 0x1b0(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movslq 0x10c(%rsp), %rsi
callq 0x3350
movsd 0x8(%rsp), %xmm0
movq 0xe0(%rsp), %rdi
movsd %xmm0, (%rax)
movslq 0x10c(%rsp), %rsi
callq 0x3350
movq 0xe0(%rsp), %rdi
movsd 0x8(%rax), %xmm1
movsd 0xe8(%rsp), %xmm0
movsd 0x1a8(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movslq 0x10c(%rsp), %rsi
callq 0x3350
movsd 0x10(%rsp), %xmm0
movq 0xe0(%rsp), %rdi
movsd %xmm0, 0x8(%rax)
movslq 0x10c(%rsp), %rsi
callq 0x3350
movq 0xe0(%rsp), %rdi
movsd 0x10(%rax), %xmm1
movsd 0xe8(%rsp), %xmm0
movsd 0x1a0(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
movslq 0x10c(%rsp), %rsi
callq 0x3350
movsd 0x18(%rsp), %xmm0
movq 0xe0(%rsp), %rdi
movsd %xmm0, 0x10(%rax)
movslq 0x104(%rsp), %rsi
callq 0x3350
movq 0xe0(%rsp), %rdi
movsd (%rax), %xmm1
movsd 0xe8(%rsp), %xmm0
movsd 0x1b0(%rsp), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
movslq 0x104(%rsp), %rsi
callq 0x3350
movsd 0x20(%rsp), %xmm0
movq 0xe0(%rsp), %rdi
movsd %xmm0, (%rax)
movslq 0x104(%rsp), %rsi
callq 0x3350
movq 0xe0(%rsp), %rdi
movsd 0x8(%rax), %xmm1
movsd 0xe8(%rsp), %xmm0
movsd 0x1a8(%rsp), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
movslq 0x104(%rsp), %rsi
callq 0x3350
movsd 0x28(%rsp), %xmm0
movq 0xe0(%rsp), %rdi
movsd %xmm0, 0x8(%rax)
movslq 0x104(%rsp), %rsi
callq 0x3350
movq 0xe0(%rsp), %rdi
movsd 0x10(%rax), %xmm1
movsd 0xe8(%rsp), %xmm0
movsd 0x1a0(%rsp), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movslq 0x104(%rsp), %rsi
callq 0x3350
movsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x10(%rax)
movsd 0x230(%rsp), %xmm1
movsd 0xf0(%rsp), %xmm0
subsd 0xf8(%rsp), %xmm0
movsd 0x157f(%rip), %xmm2     # 0x9280
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x40(%rsp)
movsd 0x1561(%rip), %xmm0     # 0x9278
mulsd 0x248(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
movsd 0x250(%rsp), %xmm0
movsd 0x1539(%rip), %xmm1     # 0x9270
callq 0x21e0
movaps %xmm0, %xmm1
movsd 0x12c9(%rip), %xmm0     # 0x9010
divsd %xmm1, %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0x250(%rsp), %xmm0
movsd 0x1506(%rip), %xmm1     # 0x9268
callq 0x21e0
movsd 0x38(%rsp), %xmm2
movsd 0x40(%rsp), %xmm1
movaps %xmm0, %xmm4
movsd 0x48(%rsp), %xmm0
movsd 0x128c(%rip), %xmm3     # 0x9010
divsd %xmm4, %xmm3
movq %xmm3, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm3
xorps %xmm4, %xmm4
mulsd %xmm4, %xmm2
addsd %xmm3, %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x230(%rsp)
jmp 0x7dd4
movq 0xe0(%rsp), %rdi
addq $0x60, %rdi
movslq 0x104(%rsp), %rsi
callq 0x7f90
movl (%rax), %eax
movl %eax, 0x104(%rsp)
jmp 0x77d9
movq 0xe0(%rsp), %rdi
addq $0x60, %rdi
movslq 0x10c(%rsp), %rsi
callq 0x7f90
movl (%rax), %eax
movl %eax, 0x10c(%rsp)
jmp 0x7798
jmp 0x7e24
movl 0x120(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x120(%rsp)
jmp 0x7603
jmp 0x7e3c
movl 0x124(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x124(%rsp)
jmp 0x7583
jmp 0x7e54
movl 0x128(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x128(%rsp)
jmp 0x7504
jmp 0x7e6c
movl 0x12c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x12c(%rsp)
jmp 0x74bc
movsd 0x230(%rsp), %xmm0
movsd %xmm0, (%rsp)
leaq 0x1d0(%rsp), %rdi
callq 0x33d0
movsd (%rsp), %xmm0
addq $0x278, %rsp            # imm = 0x278
retq
movq 0x178(%rsp), %rdi
callq 0x21f0
nopw (%rax,%rax)