// File: /workspace/github_cpp_makefile_star2_O2/bauerj4[P]Riemann1D/src/Fluxes.cpp
// Function: HLLC_FLUX(mesh_t&, std::vector<std::vector<double, std::allocator<double>>, std::allocator<std::vector<double, std::allocator<double>>>>&, double&)
int HLLC_FLUX(mesh_t &mesh, vector<vector<double> > &fluxes, double &smax)
{
  // From Toro 2009
  double gamma = 1.4; // Given.
  
  if (fluxes.size() != (mesh.NCells - 1)) // Should confirm that this is the correct number
    {
      printf("INVALID FLUX VECTOR SIZE!\n");
      return 1;
    }
  // Compute quantities in starred region
  
  double u_L, u_R, p_star, P_bar, P_L, P_R, rho_bar, rho_L, rho_R, tempSmax,
    a_bar, a_L, a_R, q_L, q_R, S_L, S_R, S_star, E_L, E_R, prefactor_L, prefactor_R;

  vector<double> Conserved_R(3,0);
  vector<double> Conserved_L(3,0);
  vector<double> Conserved_R_Star(3,0);
  vector<double> Conserved_L_Star(3,0);
  vector<double> Flux_R(3, 0.0);
  vector<double> Flux_L(3, 0.0);
  vector<double> Flux_R_Star(3,0.0);
  vector<double> Flux_L_Star(3,0.0);
  
  tempSmax = 0.;
  //print("COMPUTING FUNDAMENTALS...\n")
  for (int i = 1; i < (mesh.NCells ); i++)
    {
      //printf("ITERATION %d\n",i);
      P_L = mesh.FirstPressureElement[i-1];
      P_R = mesh.FirstPressureElement[i];

      if (P_L < 0)
	{
	  //P_L = 0;
	  printf("WARNING: P_L < 0\n");
	}

      if (P_R < 0)
	{
          //P_R =0;
          printf("WARNING: P_R = %10.10f  < 0\n", P_R);
	}

      P_bar = 0.5 * (P_L + P_R);

      rho_L = mesh.FirstDensityElement[i-1];
      rho_R = mesh.FirstDensityElement[i];
      rho_bar = 0.5 * (rho_L + rho_R);

      // The a's represent the sound speeds.
      // Compute as consequence of EoS
      a_L = pow((gamma * P_L / rho_L),0.5);
      a_R = pow((gamma * P_R / rho_R),0.5);
      a_bar = 0.5 * (a_L + a_R);
      //printf("SOUND SPEEDS: %10.10f, %10.10f, %10.10f\n", a_L,a_R,a_bar);

      u_L = mesh.FirstVelocityElement[i-1];
      u_R = mesh.FirstVelocityElement[i];

      p_star = P_bar - 0.5 * (u_R - u_L) * a_bar * rho_bar;
      printf("P STAR IS %10.10f\n", p_star);
      if (p_star < 0)
	{
	  //printf("P star is 0.\n");
	  p_star = 0.;
	}

      if (p_star <= P_L)
	{
	  q_L = 1.;
	}
      else
	{
	  double num = 1 + (((gamma + 1)/(2 * gamma)) * ((p_star/P_L) - 1));
	  q_L = pow(num,0.5);
	}

      if (p_star <= P_R)
	{
          q_R =1.;
	}
      else
	{
          double num = 1. + ((gamma + 1.)/(2. * gamma)) * ((p_star/P_R) - 1.);
          q_R =pow(num,0.5);
	}

      S_L = u_L - a_L * q_L;
      S_R = u_R + a_R * q_R;

      // MAKE SURE THIS IS RIGHT
      if (fabs(u_L) + a_L > tempSmax)
	{
	  tempSmax = fabs(u_L) + a_L;
	  //tempSmax = fabs(S_L);
	}
      if (fabs(u_R) + a_R  > tempSmax)
	{
          tempSmax = fabs(u_R) + a_R;
	  //tempSmax = fabs(S_R);
        }



      double numerator = P_R - P_L + (rho_L * u_L * (S_L - u_L)) - (rho_R * u_R * (S_R - u_R));
      double denominator = (rho_L * (S_L - u_L)) - (rho_R * (S_R - u_R));

      if (denominator == 0)
	{
	  printf("DENOMINATOR => DIVISION BY 0\n");
	  //return 1;
	}
      S_star = numerator / denominator;
      //printf("THE MAX SIGNAL SPEEDS ARE: %10.10f, %10.10f, %10.10f\n", S_L,S_R, S_star);

      printf("S_star is %10.10f\n",S_star);

      //printf("The signal speed is %10.10f\n", S_R);

      // Construct conserved L/R and L/R star vectors from previously defined functions

      vector<double> primative_L(3);
      double primative_L_arr[3] = {rho_L, u_L, P_L};
      primative_L.assign(&primative_L_arr[0], &primative_L_arr[0] + 3);
      //printf("%10.10f, %10.10f,%10.10f\n", primative_L[0], primative_L[1], primative_L[2]);
      //printf("The size of the primative variables is %d\n",(int)primative_L.size());
      vector<double> primative_R(3);
      double primative_R_arr[3] = {rho_R, u_R, P_R};
      primative_R.assign(&primative_R_arr[0], &primative_R_arr[0] + 3);


      Conserved_R = primativeTo1DConservative(primative_R);
      //printf("%10.10f, %10.10f,%10.10f\n", Conserved_R[0], Conserved_R[1], Conserved_R[2]); 

      Conserved_L = primativeTo1DConservative(primative_L);

      prefactor_L = rho_L * (S_L - u_L) / (S_L - S_star);
      prefactor_R = rho_R * (S_R - u_R) / (S_R - S_star);

      E_L = rho_L *(P_L / (rho_L*(gamma - 1)) + 0.5 * pow(u_L,2.0));
      E_R = rho_R *(P_R / (rho_R*(gamma - 1)) + 0.5 * pow(u_R,2.0));
      

      Conserved_L_Star[0] = prefactor_L;
      Conserved_L_Star[1] = prefactor_L * S_star;
      Conserved_L_Star[2] = prefactor_L * ((E_L / rho_L) + (S_star - u_L) * (S_star + (P_L)/(rho_L*(S_L - u_L))));

      Conserved_R_Star[0] = prefactor_R;
      Conserved_R_Star[1] = prefactor_R * S_star;
      Conserved_R_Star[2] = prefactor_R * ((E_R / rho_R) + (S_star - u_R) * (S_star + (P_R)/(rho_R*(S_R - u_R))));

      Flux_R[0] = rho_R * u_R;
      Flux_R[1] = rho_R * u_R * u_R + P_R;
      Flux_R[2] = u_R * (E_R + P_R);

      Flux_L[0] = rho_L * u_L;
      Flux_L[1] = rho_L * u_L * u_L + P_L;
      Flux_L[2] = u_L * (E_L + P_L);

      Flux_R_Star[0] = Flux_R[0] + S_R * (Conserved_R_Star[0] - Conserved_R[0]);
      Flux_R_Star[1] = Flux_R[1] + S_R * (Conserved_R_Star[1] - Conserved_R[1]);
      Flux_R_Star[2] = Flux_R[2] + S_R * (Conserved_R_Star[2] - Conserved_R[2]);

      Flux_L_Star[0] = Flux_L[0] + S_L * (Conserved_L_Star[0] - Conserved_L[0]);
      Flux_L_Star[1] = Flux_L[1] + S_L * (Conserved_L_Star[1] - Conserved_L[1]);
      Flux_L_Star[2] = Flux_L[2] + S_L * (Conserved_L_Star[2] - Conserved_L[2]);

      // Construct the HLLC flux
      //printf("Constructing fluxes...\n");
      
      //int debugCount = 0;
      if (S_L >= 0)
{
  fluxes[i-1] = Flux_L;
  printf("Condition 1 tripped.\n");
  //debugCount++;
}

      else if (S_star >= 0 && S_L <= 0)
{
  fluxes[i-1] = Flux_L_Star;
          printf("Condition 2 tripped.\n");
  //debugCount++;
}

      else if (S_star <= 0 && S_R >= 0)
{
  fluxes[i-1] = Flux_R_Star;
          printf("Condition 3 tripped.\n");
  //debugCount++;
}

      else if (S_R <= 0)
{
  fluxes[i-1] = Flux_R;
          printf("Condition 4 tripped.\n");
  //debugCount++;
}
      //printf("The debug count is %d\n", debugCount);
      printf("flux = [%10.10f, %10.10f, %10.10f]\n", fluxes[i-1][0], fluxes[i-1][1], fluxes[i-1][2]);
  
    }

  //  printf("flux = [%10.10f, %10.10f, %10.10f]", fluxes[i][0], fluxes[i][1], fluxes[i][2]);
  smax = tempSmax;
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rdx, %r14
movq 0x8(%rsi), %rax
movq %rsi, 0x20(%rsp)
subq (%rsi), %rax
pushq $0x18
popq %rcx
cqto
idivq %rcx
movslq (%rdi), %rcx
decq %rcx
cmpq %rcx, %rax
jne 0x3e96
movq %rdi, %r13
leaq 0x158(%rsp), %rdx
andq $0x0, (%rdx)
leaq 0x188(%rsp), %rdi
pushq $0x3
popq %rbx
leaq 0x140(%rsp), %r12
movq %rbx, %rsi
movq %r12, %rcx
callq 0x7c0c
andq $0x0, (%r12)
leaq 0x158(%rsp), %rdi
leaq 0x140(%rsp), %rdx
leaq 0x128(%rsp), %rcx
movq %rbx, %rsi
callq 0x7c0c
leaq 0x128(%rsp), %rdx
andq $0x0, (%rdx)
leaq 0x140(%rsp), %rdi
pushq $0x3
popq %rsi
leaq 0xc8(%rsp), %rcx
callq 0x7c0c
leaq 0xc8(%rsp), %rdx
andq $0x0, (%rdx)
leaq 0x128(%rsp), %rdi
pushq $0x3
popq %rsi
leaq 0xb0(%rsp), %rcx
callq 0x7c0c
leaq 0xb0(%rsp), %rdx
andq $0x0, (%rdx)
leaq 0xc8(%rsp), %rdi
pushq $0x3
popq %rsi
leaq 0x98(%rsp), %rcx
callq 0x7c0c
leaq 0x98(%rsp), %rdx
andq $0x0, (%rdx)
leaq 0xb0(%rsp), %rdi
pushq $0x3
popq %rsi
leaq 0x80(%rsp), %rcx
callq 0x7c0c
leaq 0x80(%rsp), %rdx
andq $0x0, (%rdx)
leaq 0x98(%rsp), %rdi
pushq $0x3
popq %rsi
leaq 0x1b0(%rsp), %rcx
callq 0x7c0c
movq %r14, 0xf8(%rsp)
leaq 0x1b0(%rsp), %rdx
andq $0x0, (%rdx)
leaq 0x80(%rsp), %rdi
pushq $0x3
popq %rsi
leaq 0xe0(%rsp), %rcx
callq 0x7c0c
xorpd %xmm0, %xmm0
pushq $0x1
popq %r15
xorl %r14d, %r14d
leaq 0x1b0(%rsp), %r12
leaq 0x1f8(%rsp), %rbx
xorps %xmm1, %xmm1
movq %r13, 0x100(%rsp)
movslq (%r13), %rax
cmpq %rax, %r15
jge 0x3ea7
movsd %xmm1, 0x108(%rsp)
movq 0x18(%r13), %rax
movsd -0x8(%rax,%r15,8), %xmm1
movsd (%rax,%r15,8), %xmm2
movsd %xmm2, (%rsp)
ucomisd %xmm1, %xmm0
movsd %xmm1, 0x8(%rsp)
jbe 0x368f
leaq 0x6df4(%rip), %rdi      # 0xa474
callq 0x22b0
movsd 0x8(%rsp), %xmm1
xorpd %xmm0, %xmm0
movsd (%rsp), %xmm2
ucomisd %xmm2, %xmm0
movapd %xmm2, %xmm0
jbe 0x36bc
leaq 0x6c6b(%rip), %rdi      # 0xa310
movsd (%rsp), %xmm0
movb $0x1, %al
callq 0x2030
movsd (%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
movapd %xmm1, %xmm2
addsd %xmm0, %xmm2
movsd 0x6bfc(%rip), %xmm3     # 0xa2c8
mulsd %xmm3, %xmm2
movsd %xmm2, 0x10(%rsp)
movq 0x10(%r13), %rax
movsd -0x8(%rax,%r15,8), %xmm2
movsd (%rax,%r15,8), %xmm4
movsd %xmm4, 0x28(%rsp)
movapd %xmm2, %xmm0
addsd %xmm4, %xmm0
mulsd %xmm3, %xmm0
movsd %xmm0, 0x30(%rsp)
movapd %xmm1, %xmm0
movsd 0x6bed(%rip), %xmm1     # 0xa2f8
mulsd %xmm1, %xmm0
movsd %xmm2, 0x38(%rsp)
divsd %xmm2, %xmm0
movapd %xmm3, %xmm1
callq 0x2310
movsd %xmm0, 0x58(%rsp)
movsd (%rsp), %xmm0
mulsd 0x6bc3(%rip), %xmm0     # 0xa2f8
divsd 0x28(%rsp), %xmm0
movsd 0x6b85(%rip), %xmm1     # 0xa2c8
callq 0x2310
movsd 0x58(%rsp), %xmm1
movsd %xmm0, 0x40(%rsp)
addsd %xmm0, %xmm1
mulsd 0x6b68(%rip), %xmm1     # 0xa2c8
movq 0x20(%r13), %rax
movsd -0x8(%rax,%r15,8), %xmm2
movsd (%rax,%r15,8), %xmm0
movapd %xmm0, 0x70(%rsp)
movapd %xmm2, 0x60(%rsp)
subsd %xmm2, %xmm0
mulsd 0x6b67(%rip), %xmm0     # 0xa2f0
mulsd %xmm1, %xmm0
mulsd 0x30(%rsp), %xmm0
addsd 0x10(%rsp), %xmm0
movapd %xmm0, 0x10(%rsp)
leaq 0x6b87(%rip), %rdi      # 0xa32d
movb $0x1, %al
callq 0x2030
xorpd %xmm2, %xmm2
maxsd 0x10(%rsp), %xmm2
movsd 0x8(%rsp), %xmm0
ucomisd %xmm2, %xmm0
movsd 0x6af7(%rip), %xmm0     # 0xa2c0
movapd %xmm0, %xmm4
jae 0x3816
movapd %xmm2, %xmm0
divsd 0x8(%rsp), %xmm0
addsd 0x6af7(%rip), %xmm0     # 0xa2d8
mulsd 0x6b17(%rip), %xmm0     # 0xa300
addsd 0x6acf(%rip), %xmm0     # 0xa2c0
movsd 0x6acf(%rip), %xmm1     # 0xa2c8
movsd %xmm2, 0x10(%rsp)
callq 0x2310
movsd 0x10(%rsp), %xmm2
movapd %xmm0, %xmm4
movsd 0x6aaa(%rip), %xmm0     # 0xa2c0
movq %r15, 0x120(%rsp)
movsd (%rsp), %xmm1
ucomisd %xmm2, %xmm1
jae 0x3863
divsd (%rsp), %xmm2
addsd 0x6aa2(%rip), %xmm2     # 0xa2d8
mulsd 0x6ac2(%rip), %xmm2     # 0xa300
addsd 0x6a7a(%rip), %xmm2     # 0xa2c0
movapd %xmm2, %xmm0
movsd 0x6a76(%rip), %xmm1     # 0xa2c8
movsd %xmm4, 0x10(%rsp)
callq 0x2310
movsd 0x10(%rsp), %xmm4
movq %r14, %rbp
movq %rbx, %r15
mulsd 0x58(%rsp), %xmm4
movapd 0x60(%rsp), %xmm1
movapd %xmm1, %xmm3
subsd %xmm4, %xmm3
mulsd 0x40(%rsp), %xmm0
movapd 0x70(%rsp), %xmm2
addsd %xmm2, %xmm0
movapd %xmm3, 0x1a0(%rsp)
subsd %xmm1, %xmm3
movsd %xmm0, 0x30(%rsp)
movapd %xmm0, %xmm5
subsd %xmm2, %xmm5
movsd 0x28(%rsp), %xmm0
mulsd %xmm5, %xmm0
movsd 0x38(%rsp), %xmm2
movapd %xmm2, %xmm4
mulsd %xmm3, %xmm4
movsd %xmm4, 0x110(%rsp)
movapd %xmm4, %xmm6
movsd %xmm0, 0x118(%rsp)
subsd %xmm0, %xmm6
ucomisd 0x6a26(%rip), %xmm6     # 0xa308
jne 0x3922
jp 0x3922
leaq 0x6b98(%rip), %rdi      # 0xa485
movapd %xmm3, 0x10(%rsp)
movsd %xmm5, 0x50(%rsp)
movsd %xmm6, 0x48(%rsp)
callq 0x22b0
movsd 0x48(%rsp), %xmm6
movsd 0x50(%rsp), %xmm5
movsd 0x38(%rsp), %xmm2
movapd 0x10(%rsp), %xmm3
movapd 0x60(%rsp), %xmm1
movsd (%rsp), %xmm0
subsd 0x8(%rsp), %xmm0
movapd %xmm2, %xmm4
mulsd %xmm1, %xmm4
movsd %xmm4, 0x50(%rsp)
mulsd %xmm4, %xmm3
addsd %xmm0, %xmm3
movsd 0x28(%rsp), %xmm0
mulsd 0x70(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
mulsd %xmm0, %xmm5
subsd %xmm5, %xmm3
divsd %xmm6, %xmm3
leaq 0x69d8(%rip), %rdi      # 0xa340
movapd %xmm3, 0x10(%rsp)
movapd %xmm3, %xmm0
movb $0x1, %al
callq 0x2030
movq %r12, %rdi
pushq $0x3
popq %rsi
leaq 0xe0(%rsp), %rbx
movq %rbx, %rdx
callq 0x7c62
movsd 0x38(%rsp), %xmm0
movsd %xmm0, 0xe0(%rsp)
movaps 0x60(%rsp), %xmm0
movsd %xmm0, 0xe8(%rsp)
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0xf0(%rsp)
movq %r12, %r13
movq %r12, %rdi
movq %rbx, %rsi
leaq 0xf8(%rsp), %rdx
callq 0x7ff0
movq %r15, %rbx
movq %r15, %rdi
pushq $0x3
popq %rsi
leaq 0x170(%rsp), %r15
movq %r15, %rdx
callq 0x7c62
movsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x170(%rsp)
movaps 0x70(%rsp), %xmm0
movsd %xmm0, 0x178(%rsp)
movsd (%rsp), %xmm0
movsd %xmm0, 0x180(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
leaq 0x188(%rsp), %rdx
callq 0x7ff0
movq %rbp, %r14
movq 0x120(%rsp), %r15
leaq 0x1e0(%rsp), %rbp
movq %r13, %r12
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x7cb4
leaq 0x210(%rsp), %r13
movq %r13, %rdi
movq %rbp, %rsi
callq 0x32f1
leaq 0x188(%rsp), %rdi
movq %r13, %rsi
callq 0x810c
movq %r13, %rdi
callq 0x7f02
movq %rbp, %rdi
callq 0x7f02
leaq 0x1c8(%rsp), %rbp
movq %rbp, %rdi
movq %r12, %rsi
callq 0x7cb4
movq %r13, %rdi
movq %rbp, %rsi
callq 0x32f1
leaq 0x158(%rsp), %rdi
movq %r13, %rsi
callq 0x810c
movq %r13, %rdi
callq 0x7f02
movq %rbp, %rdi
callq 0x7f02
movapd 0x1a0(%rsp), %xmm0
movapd 0x10(%rsp), %xmm13
subsd %xmm13, %xmm0
movsd 0x110(%rsp), %xmm12
movapd %xmm12, %xmm3
divsd %xmm0, %xmm3
movsd 0x30(%rsp), %xmm0
subsd %xmm13, %xmm0
movsd 0x118(%rsp), %xmm11
movapd %xmm11, %xmm1
divsd %xmm0, %xmm1
movsd 0x38(%rsp), %xmm15
movapd %xmm15, %xmm0
movsd 0x67d4(%rip), %xmm6     # 0xa2e8
mulsd %xmm6, %xmm0
movsd 0x8(%rsp), %xmm9
movapd %xmm9, %xmm2
divsd %xmm0, %xmm2
movapd 0x60(%rsp), %xmm8
movapd %xmm8, %xmm0
mulsd %xmm8, %xmm0
movsd 0x6787(%rip), %xmm5     # 0xa2c8
mulsd %xmm5, %xmm0
addsd %xmm2, %xmm0
mulsd %xmm15, %xmm0
movsd 0x28(%rsp), %xmm14
movapd %xmm14, %xmm2
mulsd %xmm6, %xmm2
movsd (%rsp), %xmm10
movapd %xmm10, %xmm4
divsd %xmm2, %xmm4
movapd 0x70(%rsp), %xmm7
movapd %xmm7, %xmm2
mulsd %xmm7, %xmm2
mulsd %xmm5, %xmm2
addsd %xmm4, %xmm2
movapd %xmm0, %xmm4
divsd %xmm15, %xmm4
movapd %xmm9, %xmm5
divsd %xmm12, %xmm5
movapd %xmm13, %xmm6
subsd %xmm8, %xmm6
addsd %xmm13, %xmm5
mulsd %xmm6, %xmm5
addsd %xmm4, %xmm5
movapd %xmm13, %xmm4
unpcklpd %xmm5, %xmm4            # xmm4 = xmm4[0],xmm5[0]
movq 0x128(%rsp), %rax
movsd %xmm3, (%rax)
unpcklpd %xmm3, %xmm3            # xmm3 = xmm3[0,0]
mulpd %xmm4, %xmm3
mulsd %xmm14, %xmm2
movupd %xmm3, 0x8(%rax)
movapd %xmm2, %xmm3
divsd %xmm14, %xmm3
movapd %xmm10, %xmm4
divsd %xmm11, %xmm4
movapd %xmm13, %xmm5
subsd %xmm7, %xmm5
addsd %xmm13, %xmm4
mulsd %xmm5, %xmm4
addsd %xmm3, %xmm4
movapd %xmm13, %xmm3
unpcklpd %xmm4, %xmm3            # xmm3 = xmm3[0],xmm4[0]
movq 0x140(%rsp), %rdx
movsd %xmm1, (%rdx)
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd %xmm3, %xmm1
movupd %xmm1, 0x8(%rdx)
movq 0xc8(%rsp), %rsi
movsd 0x48(%rsp), %xmm1
movsd %xmm1, (%rsi)
mulsd %xmm7, %xmm1
addsd %xmm10, %xmm1
movsd %xmm1, 0x8(%rsi)
addsd %xmm10, %xmm2
mulsd %xmm7, %xmm2
movsd %xmm2, 0x10(%rsi)
movapd 0x1a0(%rsp), %xmm2
movq 0xb0(%rsp), %rcx
movsd 0x50(%rsp), %xmm1
movsd %xmm1, (%rcx)
mulsd %xmm8, %xmm1
addsd %xmm9, %xmm1
movsd %xmm1, 0x8(%rcx)
movsd 0x30(%rsp), %xmm1
addsd %xmm9, %xmm0
mulsd %xmm8, %xmm0
movsd %xmm0, 0x10(%rcx)
movsd (%rdx), %xmm0
movq 0x188(%rsp), %rdi
subsd (%rdi), %xmm0
mulsd %xmm1, %xmm0
addsd (%rsi), %xmm0
movq 0x98(%rsp), %r8
movsd %xmm0, (%r8)
movsd 0x8(%rdx), %xmm0
subsd 0x8(%rdi), %xmm0
mulsd %xmm1, %xmm0
addsd 0x8(%rsi), %xmm0
movsd %xmm0, 0x8(%r8)
movsd 0x10(%rdx), %xmm0
subsd 0x10(%rdi), %xmm0
mulsd %xmm1, %xmm0
addsd 0x10(%rsi), %xmm0
movsd %xmm0, 0x10(%r8)
movsd (%rax), %xmm0
movq 0x158(%rsp), %rdx
subsd (%rdx), %xmm0
mulsd %xmm2, %xmm0
addsd (%rcx), %xmm0
movq 0x80(%rsp), %rsi
movsd %xmm0, (%rsi)
movsd 0x8(%rax), %xmm0
subsd 0x8(%rdx), %xmm0
mulsd %xmm2, %xmm0
addsd 0x8(%rcx), %xmm0
movsd %xmm0, 0x8(%rsi)
movsd 0x10(%rax), %xmm0
subsd 0x10(%rdx), %xmm0
mulsd %xmm2, %xmm0
addsd 0x10(%rcx), %xmm0
movsd %xmm0, 0x10(%rsi)
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm2
jae 0x3d77
ucomisd %xmm0, %xmm13
jb 0x3e37
ucomisd %xmm2, %xmm0
jb 0x3e37
movq 0x20(%rsp), %rax
movq (%rax), %rdi
addq %r14, %rdi
leaq 0x80(%rsp), %rsi
callq 0x7d02
leaq 0x67f2(%rip), %rdi      # 0xa567
jmp 0x3d96
movq 0x20(%rsp), %rax
movq (%rax), %rdi
addq %r14, %rdi
leaq 0xb0(%rsp), %rsi
callq 0x7d02
leaq 0x67e6(%rip), %rdi      # 0xa57c
callq 0x22b0
movapd 0x60(%rsp), %xmm8
movapd 0x6436(%rip), %xmm0     # 0xa1e0
andpd %xmm0, %xmm8
movsd 0x58(%rsp), %xmm1
addsd %xmm8, %xmm1
maxsd 0x108(%rsp), %xmm1
movapd 0x70(%rsp), %xmm2
andpd %xmm0, %xmm2
movsd 0x40(%rsp), %xmm0
addsd %xmm2, %xmm0
maxsd %xmm1, %xmm0
movsd %xmm0, 0x40(%rsp)
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq (%rax,%r14), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
leaq 0x6551(%rip), %rdi      # 0xa353
movb $0x3, %al
callq 0x2030
movq %rbx, %rdi
callq 0x7f02
movq %r12, %rdi
callq 0x7f02
incq %r15
addq $0x18, %r14
movsd 0x40(%rsp), %xmm1
xorpd %xmm0, %xmm0
movq 0x100(%rsp), %r13
jmp 0x3641
ucomisd %xmm13, %xmm0
jb 0x3e68
ucomisd %xmm0, %xmm1
jb 0x3e68
movq 0x20(%rsp), %rax
movq (%rax), %rdi
addq %r14, %rdi
leaq 0x98(%rsp), %rsi
callq 0x7d02
leaq 0x66ef(%rip), %rdi      # 0xa552
jmp 0x3d96
ucomisd %xmm1, %xmm0
jb 0x3da2
movq 0x20(%rsp), %rax
movq (%rax), %rdi
addq %r14, %rdi
leaq 0xc8(%rsp), %rsi
callq 0x7d02
leaq 0x66ac(%rip), %rdi      # 0xa53d
jmp 0x3d96
leaq 0x6707(%rip), %rdi      # 0xa5a4
callq 0x22b0
pushq $0x1
popq %rax
jmp 0x3f1d
movq 0xf8(%rsp), %rax
movsd %xmm1, (%rax)
leaq 0x80(%rsp), %rdi
callq 0x7f02
leaq 0x98(%rsp), %rdi
callq 0x7f02
leaq 0xb0(%rsp), %rdi
callq 0x7f02
leaq 0xc8(%rsp), %rdi
callq 0x7f02
leaq 0x128(%rsp), %rdi
callq 0x7f02
leaq 0x140(%rsp), %rdi
callq 0x7f02
leaq 0x158(%rsp), %rdi
callq 0x7f02
leaq 0x188(%rsp), %rdi
callq 0x7f02
xorl %eax, %eax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x3fc0
movq %rax, %rbx
jmp 0x3fcd
movq %rax, %rbx
jmp 0x3fda
movq %rax, %rbx
jmp 0x3fe7
movq %rax, %rbx
jmp 0x3ff4
movq %rax, %rbx
jmp 0x4001
movq %rax, %rbx
jmp 0x400e
movq %rax, %rbx
leaq 0x1c8(%rsp), %rdi
jmp 0x3f7f
movq %rax, %rbx
leaq 0x1e0(%rsp), %rdi
callq 0x7f02
jmp 0x3f99
jmp 0x3f91
jmp 0x3f96
jmp 0x3f96
movq %rax, %rbx
jmp 0x3fb3
movq %rax, %rbx
jmp 0x3fa6
movq %rax, %rbx
leaq 0x1f8(%rsp), %rdi
callq 0x7f02
leaq 0x1b0(%rsp), %rdi
callq 0x7f02
leaq 0x80(%rsp), %rdi
callq 0x7f02
leaq 0x98(%rsp), %rdi
callq 0x7f02
leaq 0xb0(%rsp), %rdi
callq 0x7f02
leaq 0xc8(%rsp), %rdi
callq 0x7f02
leaq 0x128(%rsp), %rdi
callq 0x7f02
leaq 0x140(%rsp), %rdi
callq 0x7f02
leaq 0x158(%rsp), %rdi
callq 0x7f02
leaq 0x188(%rsp), %rdi
callq 0x7f02
movq %rbx, %rdi
callq 0x2320