// File: /workspace/github_cpp_makefile_star2_O2/JRLamontagne[P]cdice_sa/CDICE_doeclim.cpp
// Function: doeclim_init(double, double, int, int, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*)
void doeclim_init(double t2co, double kappa, int dt, int ns, 
		  double *flnd, double *powtoheat, double *cal, double *cas, double *taucfl,
		  double *taukls, double *taucfs, double *tauksl, double *bsi, 
		  double *IB, double *A, double *fso, double *taudif, double *Ker)
{
  
  // Define and initialize parameters
  double pi = 3.141592653589793;
  double B[4] = {0.0, 0.0, 0.0, 0.0};
  double C[4] = {0.0, 0.0, 0.0, 0.0};
  double KT0[ns];
  double KTA1[ns];
  double KTB1[ns];
  double KTA2[ns];
  double KTB2[ns];
  double KTA3[ns];
  double KTB3[ns];

  for(int i=0; i<ns; i++) {
    KT0[i] = 0.0;
    KTA1[i] = 0.0;
    KTB1[i] = 0.0;
    KTA2[i] = 0.0;
    KTB2[i] = 0.0;
    KTA3[i] = 0.0;
    KTB3[i] = 0.0;
  }

  // Define the doeclim parameters
  double ak = 0.31;
  double bk = 1.59;
  double csw = 0.13;
  double earth_area = 5100656 * pow(10.0, 8);
  double kcon = 3155.0;
  double q2co = 3.7; 
  double rlam = 1.43;
  double secs_per_Year = 31556926.0;
  double zbot = 4000.0;
  *bsi = 1.3;
  *cal = 0.52;
  *cas = 7.80;
  *flnd = 0.29;
  *fso = 0.95;
  
  // Dependent Model Parameters
  double ocean_area = (1.0 - *flnd) * earth_area;
  double cnum = rlam * *flnd + *bsi * (1.0 - *flnd);
  double cden = rlam * *flnd - ak * (rlam - *bsi);
  double cfl = *flnd * cnum / cden * q2co / t2co - bk * (rlam - *bsi) / cden;
  double cfs = (rlam * *flnd - ak / (1.0 - *flnd) * (rlam - *bsi)) * cnum / cden * q2co / t2co + rlam * *flnd / (1.0 - *flnd) * bk * (rlam - *bsi) / cden;
  double kls = bk * rlam * *flnd / cden - ak * *flnd * cnum / cden * q2co / t2co; 
  double keff = kcon * kappa;
  double taubot = pow(zbot,2) / keff;
  *powtoheat = ocean_area * secs_per_Year / pow(10.0,22);
  *taucfs = *cas / cfs;
  *taucfl = *cal / cfl;
  *taudif = pow(*cas,2) / pow(csw,2) * pi / keff;
  *tauksl  = (1.0 - *flnd) * *cas / kls;
  *taukls  = *flnd * *cal / kls;
  
  // First order
  KT0[ns-1] = 4.0 - 2.0 * pow(2.0, 0.5);
  KTA1[ns-1] = -8.0 * exp(-taubot / double(dt)) + 4.0 * pow(2.0, 0.5) * exp(-0.5 * taubot / double(dt));
  KTB1[ns-1] = 4.0 * pow((pi * taubot / double(dt)), 0.5) * (1.0 + erf(pow(0.5 * taubot / double(dt), 0.5)) - 2.0 * erf(pow(taubot / double(dt), 0.5)));

  // Second order
  KTA2[ns-1] =  8.0 * exp(-4.0 * taubot / double(dt)) - 4.0 * pow(2.0, 0.5) * exp(-2.0 * taubot / double(dt));
  KTB2[ns-1] = -8.0 * pow((pi * taubot / double(dt)), 0.5) * (1.0 + erf(pow((2.0 * taubot / double(dt)), 0.5)) - 2.0 * erf(2.0 * pow((taubot / double(dt)), 0.5)) );

  // Third order
  KTA3[ns-1] = -8.0 * exp(-9.0 * taubot / double(dt)) + 4.0 * pow(2.0, 0.5) * exp(-4.5 * taubot / double(dt));
  KTB3[ns-1] = 12.0 * pow((pi * taubot / double(dt)), 0.5) * (1.0 + erf(pow((4.5 * taubot / double(dt)), 0.5)) - 2.0 * erf(3.0 * pow((taubot / double(dt)), 0.5)) );

  // Calculate the kernel component vectors
  for(int i=0; i<(ns-1); i++) {
    
    // First order
    KT0[i] = 4.0 * pow((double(ns-i)), 0.5) - 2.0 * pow((double(ns+1-i)), 0.5) - 2.0 * pow(double(ns-1-i), 0.5);      
    KTA1[i] = -8.0 * pow(double(ns-i), 0.5) * exp(-taubot / double(dt) / double(ns-i)) + 4.0 * pow(double(ns+1-i), 0.5) * exp(-taubot / double(dt) / double(ns+1-i)) + 4.0 * pow(double(ns-1-i), 0.5) * exp(-taubot/double(dt) / double(ns-1-i));
    KTB1[i] =  4.0 * pow((pi * taubot / double(dt)), 0.5) * ( erf(pow((taubot / double(dt) / double(ns-1-i)), 0.5)) + erf(pow((taubot / double(dt) / double(ns+1-i)), 0.5)) - 2.0 * erf(pow((taubot / double(dt) / double(ns-i)), 0.5)) );

    // Second order
    KTA2[i] =  8.0 * pow(double(ns-i), 0.5) * exp(-4.0 * taubot / double(dt) / double(ns-i)) - 4.0 * pow(double(ns+1-i), 0.5) * exp(-4.0 * taubot / double(dt) / double(ns+1-i)) - 4.0 * pow(double(ns-1-i), 0.5) * exp(-4.0 * taubot / double(dt) / double(ns-1-i));
    KTB2[i] = -8.0 * pow((pi * taubot / double(dt)), 0.5) * ( erf(2.0 * pow((taubot / double(dt) / double(ns-1-i)), 0.5)) + erf(2.0 * pow((taubot / double(dt) / double(ns+1-i)), 0.5)) - 2.0 * erf(2.0 * pow((taubot / double(dt) / double(ns-i)), 0.5)) );

    // Third order
    KTA3[i] = -8.0 * pow(double(ns-i), 0.5) * exp(-9.0 * taubot / double(dt) / double(ns-i)) + 4.0 * pow(double(ns+1-i), 0.5) * exp(-9.0 * taubot / double(dt) / double(ns+1-i)) + 4.0 * pow(double(ns-1-i), 0.5) * exp(-9.0 * taubot / double(dt) / double(ns-1-i)); 
    KTB3[i] = 12.0 * pow((pi * taubot / double(dt)), 0.5) * ( erf(3.0 * pow((taubot / double(dt) / double(ns-1-i)), 0.5)) + erf(3.0 * pow((taubot / double(dt) / double(ns+1-i)), 0.5)) - 2.0 * erf(3.0 * pow((taubot / double(dt) / double(ns-i)), 0.5)) );

  }

  // Sum up the kernel components
  for(int i=0; i<ns; i++) {
    
    Ker[i] = KT0[i] + KTA1[i] + KTB1[i] + KTA2[i] + KTB2[i] + KTA3[i] + KTB3[i];

  }

  // Switched on (To switch off, comment out lines below)
  C[0] = 1.0 / pow(*taucfl, 2.0) + 1.0 / pow(*taukls, 2.0) + 2.0 / *taucfl / *taukls + *bsi / *taukls / *tauksl;
  C[1] = -1 * *bsi / pow(*taukls, 2.0) - *bsi / *taucfl / *taukls - *bsi / *taucfs / *taukls - pow(*bsi, 2.0) / *taukls / *tauksl;
  C[2] = -1 * *bsi / pow(*tauksl, 2.0) - 1.0 / *taucfs / *tauksl - 1.0 / *taucfl / *tauksl -1.0 / *taukls / *tauksl;
  C[3] = 1.0 / pow(*taucfs, 2.0) + pow(*bsi, 2.0) / pow(*tauksl, 2.0) + 2.0 * *bsi / *taucfs / *tauksl + *bsi / *taukls / *tauksl;
  for(int i=0; i<4; i++) {
    C[i] = C[i] * (pow(double(dt), 2.0) / 12.0);
  }

  //------------------------------------------------------------------
  // Matrices of difference equation system B*T(i+1) = Q(i) + A*T(i)
  // T = (TL,TO)
  // (Equation A.27, EK05, or Equations 2.3.24 and 2.3.27, TK07)
  B[0] = 1.0 + double(dt) / (2.0 * *taucfl) + double(dt) / (2.0 * *taukls);
  B[1] = double(-dt) / (2.0 * *taukls) * *bsi;
  B[2] = double(-dt) / (2.0 * *tauksl);
  B[3] = 1.0 + double(dt) / (2.0 * *taucfs) + double(dt) / (2.0 * *tauksl) * *bsi + 2.0 * *fso * pow((double(dt) / *taudif), 0.5);

  A[0] = 1.0 - double(dt) / (2.0 * *taucfl) - double(dt) / (2.0 * *taukls);
  A[1] = double(dt) / (2.0 * *taukls) * *bsi;
  A[2] = double(dt) / (2.0 * *tauksl);
  A[3] = 1.0 - double(dt) / (2.0 * *taucfs) - double(dt) / (2.0 * *tauksl) * *bsi + Ker[ns-1] * *fso * pow((double(dt) / *taudif), 0.5);

  for (int i=0; i<4; i++) {
    B[i] = B[i] + C[i];
    A[i] = A[i] + C[i];
  }

  // Calculate the inverse of B
  invert_1d_2x2_matrix(B, IB);

  return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movl %esi, %r15d
movq %rsp, -0x190(%rbp)
movq 0x48(%rbp), %r11
xorps %xmm2, %xmm2
movaps %xmm2, -0x170(%rbp)
movaps %xmm2, -0x180(%rbp)
movaps %xmm2, -0x150(%rbp)
movaps %xmm2, -0x160(%rbp)
movl %esi, %eax
movq %rsp, %rsi
leaq 0xf(,%rax,8), %rax
andq $-0x10, %rax
subq %rax, %rsi
movq %rsi, %rsp
movq %rsp, %r10
subq %rax, %r10
movq %r10, %rsp
movq %rsp, %rbx
subq %rax, %rbx
movq %rbx, -0xa8(%rbp)
movq %rbx, %rsp
movq %rsp, %rbx
subq %rax, %rbx
movq %rbx, -0xa0(%rbp)
movq %rbx, %rsp
movq %rsp, %r12
subq %rax, %r12
movq %r12, %rsp
movq %rsp, %r14
subq %rax, %r14
movq %r14, %rsp
movq %rsp, %rbx
subq %rax, %rbx
movq %rbx, %rsp
xorl %eax, %eax
testl %r15d, %r15d
movl $0x0, %r13d
cmovgl %r15d, %r13d
movq %r13, -0x118(%rbp)
cmpq %rax, -0x118(%rbp)
je 0x5eeb
andq $0x0, (%rsi,%rax,8)
andq $0x0, (%r10,%rax,8)
movq -0xa8(%rbp), %r13
andq $0x0, (%r13,%rax,8)
movq -0xa0(%rbp), %r13
andq $0x0, (%r13,%rax,8)
andq $0x0, (%r12,%rax,8)
andq $0x0, (%r14,%rax,8)
andq $0x0, (%rbx,%rax,8)
incq %rax
jmp 0x5eaa
movabsq $0x3ff4cccccccccccd, %rax # imm = 0x3FF4CCCCCCCCCCCD
movq %r10, -0xd0(%rbp)
movq 0x30(%rbp), %r10
movq %rax, (%r10)
movabsq $0x3fe0a3d70a3d70a4, %rax # imm = 0x3FE0A3D70A3D70A4
movq %rax, (%r8)
movabsq $0x401f333333333333, %rax # imm = 0x401F333333333333
movq %rax, (%r9)
movabsq $0x3fd28f5c28f5c28f, %rax # imm = 0x3FD28F5C28F5C28F
movq %rax, (%rdx)
movabsq $0x3fee666666666666, %rax # imm = 0x3FEE666666666666
movq %rax, (%r11)
movsd (%rdx), %xmm2
movsd (%r10), %xmm5
movapd %xmm2, %xmm4
unpcklpd %xmm5, %xmm4            # xmm4 = xmm4[0],xmm5[0]
movapd 0x22e0(%rip), %xmm3     # 0x8230
subpd %xmm4, %xmm3
movsd 0x2204(%rip), %xmm7     # 0x8160
mulsd %xmm3, %xmm7
movapd %xmm3, %xmm4
unpckhpd %xmm3, %xmm4            # xmm4 = xmm4[1],xmm3[1]
movsd 0x21f7(%rip), %xmm8     # 0x8168
mulsd %xmm8, %xmm4
movsd 0x21f2(%rip), %xmm6     # 0x8170
mulsd %xmm2, %xmm6
addsd %xmm6, %xmm4
divsd %xmm3, %xmm8
unpcklpd %xmm8, %xmm5            # xmm5 = xmm5[0],xmm8[0]
mulpd %xmm3, %xmm5
movapd %xmm6, %xmm8
unpcklpd %xmm6, %xmm8            # xmm8 = xmm8[0],xmm6[0]
addpd %xmm5, %xmm8
movapd %xmm2, %xmm5
mulsd %xmm8, %xmm5
divsd %xmm4, %xmm5
shufpd $0x2, %xmm3, %xmm5      # xmm5 = xmm5[0],xmm3[1]
mulpd 0x2283(%rip), %xmm5     # 0x8240
mulsd 0x21d3(%rip), %xmm7     # 0x8198
divsd 0x21d3(%rip), %xmm7     # 0x81a0
movsd %xmm7, (%rcx)
movapd %xmm0, %xmm7
unpcklpd %xmm4, %xmm7            # xmm7 = xmm7[0],xmm4[0]
divpd %xmm7, %xmm5
movapd %xmm5, %xmm7
unpckhpd %xmm5, %xmm7            # xmm7 = xmm7[1],xmm5[1]
subsd %xmm7, %xmm5
movapd %xmm8, %xmm7
unpckhpd %xmm8, %xmm7            # xmm7 = xmm7[1],xmm8[1]
mulsd %xmm8, %xmm7
divsd %xmm4, %xmm7
divsd %xmm3, %xmm6
mulsd 0x2170(%rip), %xmm6     # 0x8178
unpckhpd 0x2240(%rip), %xmm3     # xmm3 = xmm3[1],mem[1]
unpcklpd %xmm7, %xmm6            # xmm6 = xmm6[0],xmm7[0]
mulpd %xmm6, %xmm3
movsd 0x2160(%rip), %xmm6     # 0x8180
mulsd %xmm2, %xmm6
mulsd %xmm8, %xmm6
divsd %xmm4, %xmm6
unpcklpd %xmm0, %xmm4            # xmm4 = xmm4[0],xmm0[0]
divpd %xmm4, %xmm3
movapd %xmm3, %xmm0
unpckhpd %xmm3, %xmm0            # xmm0 = xmm0[1],xmm3[1]
addsd %xmm3, %xmm0
unpcklpd %xmm6, %xmm2            # xmm2 = xmm2[0],xmm6[0]
mulpd 0x2213(%rip), %xmm2     # 0x8260
divpd %xmm4, %xmm2
movapd %xmm2, %xmm3
unpckhpd %xmm2, %xmm3            # xmm3 = xmm3[1],xmm2[1]
mulsd 0x2127(%rip), %xmm1     # 0x8188
subsd %xmm3, %xmm2
movsd 0x2123(%rip), %xmm4     # 0x8190
movsd (%r9), %xmm3
divsd %xmm0, %xmm3
movq 0x20(%rbp), %rax
movsd %xmm3, (%rax)
movsd (%r8), %xmm0
divsd %xmm5, %xmm0
movq 0x10(%rbp), %rax
movsd %xmm0, (%rax)
movsd (%r9), %xmm0
mulsd %xmm0, %xmm0
divsd 0x2108(%rip), %xmm0     # 0x81a8
mulsd 0x2108(%rip), %xmm0     # 0x81b0
divsd %xmm1, %xmm0
movq 0x50(%rbp), %rax
movsd %xmm0, (%rax)
movsd 0x1f4c(%rip), %xmm0     # 0x8008
subsd (%rdx), %xmm0
divsd %xmm1, %xmm4
movapd %xmm4, -0x50(%rbp)
mulsd (%r9), %xmm0
divsd %xmm2, %xmm0
movq 0x28(%rbp), %rax
movsd %xmm0, (%rax)
movsd (%rdx), %xmm0
mulsd (%r8), %xmm0
divsd %xmm2, %xmm0
movq 0x18(%rbp), %rax
movsd %xmm0, (%rax)
movslq %r15d, %r13
leaq -0x1(%r13), %rax
movq %rax, -0x188(%rbp)
movabsq $0x3ff2bec333018866, %rax # imm = 0x3FF2BEC333018866
movq %rsi, -0xc8(%rbp)
movq %rax, -0x8(%rsi,%r13,8)
leal -0x1(%r15), %eax
movq %rax, -0xd8(%rbp)
movapd 0x201a(%rip), %xmm0     # 0x8140
xorpd %xmm4, %xmm0
movl %edi, -0xec(%rbp)
cvtsi2sd %edi, %xmm1
movapd %xmm1, -0x80(%rbp)
divsd %xmm1, %xmm0
movapd %xmm0, -0x140(%rbp)
callq 0x2350
movsd %xmm0, -0x40(%rbp)
movsd 0x2061(%rip), %xmm0     # 0x81b8
mulsd -0x50(%rbp), %xmm0
divsd -0x80(%rbp), %xmm0
callq 0x2350
mulsd 0x2052(%rip), %xmm0     # 0x81c0
movsd -0x40(%rbp), %xmm1
mulsd 0x204d(%rip), %xmm1     # 0x81c8
addsd %xmm0, %xmm1
movq -0xd0(%rbp), %rax
movsd %xmm1, -0x8(%rax,%r13,8)
movsd 0x201b(%rip), %xmm0     # 0x81b0
mulsd -0x50(%rbp), %xmm0
divsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
movsd 0x1fa9(%rip), %xmm1     # 0x8158
callq 0x2330
mulsd 0x2014(%rip), %xmm0     # 0x81d0
movsd %xmm0, -0x40(%rbp)
movapd -0x50(%rbp), %xmm0
movsd 0x1f8a(%rip), %xmm1     # 0x8158
mulsd %xmm1, %xmm0
divsd -0x80(%rbp), %xmm0
callq 0x2330
callq 0x2220
movapd %xmm0, %xmm1
movsd 0x1e1b(%rip), %xmm0     # 0x8008
addsd %xmm0, %xmm1
movsd %xmm1, -0x70(%rbp)
movapd -0x50(%rbp), %xmm0
divsd -0x80(%rbp), %xmm0
movapd %xmm0, -0x110(%rbp)
movsd 0x1f48(%rip), %xmm1     # 0x8158
callq 0x2330
callq 0x2220
addsd %xmm0, %xmm0
movsd -0x70(%rbp), %xmm1
subsd %xmm0, %xmm1
mulsd -0x40(%rbp), %xmm1
movq -0xa8(%rbp), %rax
movsd %xmm1, -0x8(%rax,%r13,8)
movsd 0x1f96(%rip), %xmm0     # 0x81d8
mulsd -0x50(%rbp), %xmm0
divsd -0x80(%rbp), %xmm0
movsd %xmm0, -0xe8(%rbp)
callq 0x2350
movsd %xmm0, -0x40(%rbp)
movsd 0x1f7a(%rip), %xmm0     # 0x81e0
mulsd -0x50(%rbp), %xmm0
divsd -0x80(%rbp), %xmm0
callq 0x2350
mulsd 0x1f6b(%rip), %xmm0     # 0x81e8
movsd -0x40(%rbp), %xmm1
mulsd 0x1f66(%rip), %xmm1     # 0x81f0
addsd %xmm0, %xmm1
movq -0xa0(%rbp), %rax
movsd %xmm1, -0x8(%rax,%r13,8)
movsd -0x98(%rbp), %xmm0
movsd 0x1eac(%rip), %xmm1     # 0x8158
callq 0x2330
mulsd 0x1f0f(%rip), %xmm0     # 0x81c8
movsd %xmm0, -0x40(%rbp)
movapd -0x50(%rbp), %xmm0
addsd %xmm0, %xmm0
divsd -0x80(%rbp), %xmm0
movsd 0x1e84(%rip), %xmm1     # 0x8158
callq 0x2330
callq 0x2220
movapd %xmm0, %xmm1
movsd 0x1d1e(%rip), %xmm0     # 0x8008
addsd %xmm0, %xmm1
movsd %xmm1, -0x70(%rbp)
movapd -0x110(%rbp), %xmm0
movsd 0x1e55(%rip), %xmm1     # 0x8158
callq 0x2330
addsd %xmm0, %xmm0
callq 0x2220
addsd %xmm0, %xmm0
movsd -0x70(%rbp), %xmm1
subsd %xmm0, %xmm1
mulsd -0x40(%rbp), %xmm1
movsd %xmm1, -0x8(%r12,%r13,8)
movsd 0x1ec6(%rip), %xmm0     # 0x81f8
mulsd -0x50(%rbp), %xmm0
divsd -0x80(%rbp), %xmm0
movsd %xmm0, -0xe0(%rbp)
callq 0x2350
movsd %xmm0, -0x40(%rbp)
movsd 0x1eaa(%rip), %xmm0     # 0x8200
mulsd -0x50(%rbp), %xmm0
divsd -0x80(%rbp), %xmm0
callq 0x2350
mulsd 0x1e53(%rip), %xmm0     # 0x81c0
movsd -0x40(%rbp), %xmm1
mulsd 0x1e4e(%rip), %xmm1     # 0x81c8
addsd %xmm0, %xmm1
movsd %xmm1, -0x8(%r14,%r13,8)
movsd -0x98(%rbp), %xmm0
movsd 0x1dc3(%rip), %xmm1     # 0x8158
callq 0x2330
mulsd 0x1dae(%rip), %xmm0     # 0x8150
movsd %xmm0, -0x40(%rbp)
movapd -0x50(%rbp), %xmm0
mulsd 0x1e54(%rip), %xmm0     # 0x8208
divsd -0x80(%rbp), %xmm0
movsd 0x1d97(%rip), %xmm1     # 0x8158
callq 0x2330
callq 0x2220
movapd %xmm0, %xmm1
movsd 0x1c31(%rip), %xmm0     # 0x8008
addsd %xmm0, %xmm1
movsd %xmm1, -0x50(%rbp)
movapd -0x110(%rbp), %xmm0
movsd 0x1d68(%rip), %xmm1     # 0x8158
callq 0x2330
mulsd 0x1e13(%rip), %xmm0     # 0x8210
callq 0x2220
addsd %xmm0, %xmm0
movsd -0x50(%rbp), %xmm1
subsd %xmm0, %xmm1
mulsd -0x40(%rbp), %xmm1
movsd %xmm1, -0x8(%rbx,%r13,8)
xorl %r13d, %r13d
movq -0xd8(%rbp), %rax
testl %eax, %eax
cmovlel %r13d, %eax
shlq $0x3, %rax
movq %rax, -0xd8(%rbp)
cmpq %r13, -0xd8(%rbp)
je 0x6acd
cvtsi2sd %r15d, %xmm0
ucomisd 0x1dc8(%rip), %xmm0     # 0x8218
movsd %xmm0, -0x70(%rbp)
jb 0x645d
sqrtsd %xmm0, %xmm2
jmp 0x6466
callq 0x2150
movapd %xmm0, %xmm2
leal 0x1(%r15), %eax
cvtsi2sd %eax, %xmm0
ucomisd 0x1da2(%rip), %xmm0     # 0x8218
movsd %xmm0, -0x40(%rbp)
jb 0x6483
sqrtsd %xmm0, %xmm3
jmp 0x6496
movapd %xmm2, -0x60(%rbp)
callq 0x2150
movapd -0x60(%rbp), %xmm2
movapd %xmm0, %xmm3
andpd 0x1dd2(%rip), %xmm2     # 0x8270
mulsd 0x1d2a(%rip), %xmm2     # 0x81d0
decl %r15d
cvtsi2sd %r15d, %xmm0
ucomisd 0x1d62(%rip), %xmm0     # 0x8218
movsd %xmm0, -0x50(%rbp)
jb 0x64c3
sqrtsd %xmm0, %xmm0
jmp 0x64e2
movapd %xmm2, -0x60(%rbp)
movapd %xmm3, -0xc0(%rbp)
callq 0x2150
movapd -0xc0(%rbp), %xmm3
movapd -0x60(%rbp), %xmm2
movq -0xc8(%rbp), %rax
movapd 0x1d7f(%rip), %xmm1     # 0x8270
andpd %xmm1, %xmm3
addsd %xmm3, %xmm3
subsd %xmm3, %xmm2
andpd %xmm1, %xmm0
addsd %xmm0, %xmm0
subsd %xmm0, %xmm2
movsd %xmm2, (%rax,%r13)
movsd -0x70(%rbp), %xmm1
ucomisd 0x1cfc(%rip), %xmm1     # 0x8218
jb 0x6524
sqrtsd %xmm1, %xmm0
jmp 0x6532
movapd %xmm1, %xmm0
callq 0x2150
movsd -0x70(%rbp), %xmm1
andpd 0x1d36(%rip), %xmm0     # 0x8270
mulsd 0x1c86(%rip), %xmm0     # 0x81c8
movapd %xmm0, -0x60(%rbp)
movapd -0x140(%rbp), %xmm0
divsd %xmm1, %xmm0
callq 0x2350
movsd %xmm0, -0xc0(%rbp)
movsd -0x40(%rbp), %xmm1
ucomisd 0x1cab(%rip), %xmm1     # 0x8218
jb 0x6575
sqrtsd %xmm1, %xmm0
jmp 0x6583
movapd %xmm1, %xmm0
callq 0x2150
movsd -0x40(%rbp), %xmm1
andpd 0x1ce5(%rip), %xmm0     # 0x8270
mulsd 0x1c3d(%rip), %xmm0     # 0x81d0
movapd %xmm0, -0x130(%rbp)
movapd -0x140(%rbp), %xmm0
divsd %xmm1, %xmm0
callq 0x2350
movapd %xmm0, %xmm3
movsd -0x50(%rbp), %xmm1
ucomisd 0x1c5b(%rip), %xmm1     # 0x8218
jb 0x65c5
sqrtsd %xmm1, %xmm2
jmp 0x65e7
movapd %xmm1, %xmm0
movsd %xmm3, -0x100(%rbp)
callq 0x2150
movsd -0x100(%rbp), %xmm3
movsd -0x50(%rbp), %xmm1
movapd %xmm0, %xmm2
movapd -0x60(%rbp), %xmm0
mulsd -0x130(%rbp), %xmm3
mulsd -0xc0(%rbp), %xmm0
addsd %xmm3, %xmm0
movapd %xmm0, -0x60(%rbp)
andpd 0x1c63(%rip), %xmm2     # 0x8270
movsd 0x1bbb(%rip), %xmm0     # 0x81d0
mulsd %xmm0, %xmm2
movapd %xmm2, -0xc0(%rbp)
movapd -0x140(%rbp), %xmm0
divsd %xmm1, %xmm0
callq 0x2350
mulsd -0xc0(%rbp), %xmm0
addsd -0x60(%rbp), %xmm0
movq -0xd0(%rbp), %rax
movsd %xmm0, (%rax,%r13)
movsd -0x98(%rbp), %xmm0
movsd 0x1afc(%rip), %xmm1     # 0x8158
callq 0x2330
mulsd 0x1b67(%rip), %xmm0     # 0x81d0
movsd %xmm0, -0x60(%rbp)
movapd -0x110(%rbp), %xmm0
divsd -0x50(%rbp), %xmm0
movapd %xmm0, -0xc0(%rbp)
movsd 0x1acd(%rip), %xmm1     # 0x8158
callq 0x2330
callq 0x2220
movsd %xmm0, -0x100(%rbp)
movapd -0x110(%rbp), %xmm0
divsd -0x40(%rbp), %xmm0
movapd %xmm0, -0x130(%rbp)
movsd 0x1a9e(%rip), %xmm1     # 0x8158
callq 0x2330
callq 0x2220
addsd -0x100(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movapd -0x110(%rbp), %xmm0
divsd -0x70(%rbp), %xmm0
movapd %xmm0, -0x100(%rbp)
movsd 0x1a67(%rip), %xmm1     # 0x8158
callq 0x2330
callq 0x2220
movsd -0x70(%rbp), %xmm1
addsd %xmm0, %xmm0
movsd -0x90(%rbp), %xmm2
subsd %xmm0, %xmm2
mulsd -0x60(%rbp), %xmm2
movq -0xa8(%rbp), %rax
movsd %xmm2, (%rax,%r13)
ucomisd 0x1aee(%rip), %xmm1     # 0x8218
jb 0x6732
sqrtsd %xmm1, %xmm0
jmp 0x6740
movapd %xmm1, %xmm0
callq 0x2150
movsd -0x70(%rbp), %xmm1
andpd 0x1b28(%rip), %xmm0     # 0x8270
mulsd 0x1aa0(%rip), %xmm0     # 0x81f0
movapd %xmm0, -0x60(%rbp)
movsd -0xe8(%rbp), %xmm0
divsd %xmm1, %xmm0
callq 0x2350
movsd %xmm0, -0x90(%rbp)
movsd -0x40(%rbp), %xmm1
ucomisd 0x1a9d(%rip), %xmm1     # 0x8218
jb 0x6783
sqrtsd %xmm1, %xmm0
jmp 0x6791
movapd %xmm1, %xmm0
callq 0x2150
movsd -0x40(%rbp), %xmm1
andpd 0x1ad7(%rip), %xmm0     # 0x8270
movapd %xmm0, -0x1a0(%rbp)
movsd -0xe8(%rbp), %xmm0
divsd %xmm1, %xmm0
callq 0x2350
movapd -0x1a0(%rbp), %xmm1
mulsd 0x1a16(%rip), %xmm1     # 0x81d8
mulsd %xmm0, %xmm1
movapd -0x60(%rbp), %xmm0
mulsd -0x90(%rbp), %xmm0
addsd %xmm1, %xmm0
movapd %xmm0, -0x60(%rbp)
movsd -0x50(%rbp), %xmm1
ucomisd 0x1a2f(%rip), %xmm1     # 0x8218
jb 0x67f1
sqrtsd %xmm1, %xmm0
jmp 0x67ff
movapd %xmm1, %xmm0
callq 0x2150
movsd -0x50(%rbp), %xmm1
andpd 0x1a69(%rip), %xmm0     # 0x8270
movapd %xmm0, -0x90(%rbp)
movsd -0xe8(%rbp), %xmm0
divsd %xmm1, %xmm0
callq 0x2350
movapd -0x90(%rbp), %xmm1
mulsd 0x19a8(%rip), %xmm1     # 0x81d8
mulsd %xmm0, %xmm1
addsd -0x60(%rbp), %xmm1
movq -0xa0(%rbp), %rax
movsd %xmm1, (%rax,%r13)
movsd -0x98(%rbp), %xmm0
movsd 0x1902(%rip), %xmm1     # 0x8158
callq 0x2330
mulsd 0x1965(%rip), %xmm0     # 0x81c8
movsd %xmm0, -0x60(%rbp)
movapd -0xc0(%rbp), %xmm0
movsd 0x18e0(%rip), %xmm1     # 0x8158
callq 0x2330
addsd %xmm0, %xmm0
callq 0x2220
movsd %xmm0, -0x90(%rbp)
movapd -0x130(%rbp), %xmm0
movsd 0x18ba(%rip), %xmm1     # 0x8158
callq 0x2330
addsd %xmm0, %xmm0
callq 0x2220
addsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movapd -0x100(%rbp), %xmm0
movsd 0x188c(%rip), %xmm1     # 0x8158
callq 0x2330
addsd %xmm0, %xmm0
callq 0x2220
addsd %xmm0, %xmm0
movsd -0x90(%rbp), %xmm1
subsd %xmm0, %xmm1
mulsd -0x60(%rbp), %xmm1
movsd %xmm1, (%r12,%r13)
movsd -0x70(%rbp), %xmm1
ucomisd 0x1916(%rip), %xmm1     # 0x8218
jb 0x690a
sqrtsd %xmm1, %xmm0
jmp 0x6918
movapd %xmm1, %xmm0
callq 0x2150
movsd -0x70(%rbp), %xmm1
andpd 0x1950(%rip), %xmm0     # 0x8270
mulsd 0x18a0(%rip), %xmm0     # 0x81c8
movapd %xmm0, -0x70(%rbp)
movsd -0xe0(%rbp), %xmm0
divsd %xmm1, %xmm0
callq 0x2350
movsd %xmm0, -0x60(%rbp)
movsd -0x40(%rbp), %xmm1
ucomisd 0x18c8(%rip), %xmm1     # 0x8218
jb 0x6958
sqrtsd %xmm1, %xmm0
jmp 0x6966
movapd %xmm1, %xmm0
callq 0x2150
movsd -0x40(%rbp), %xmm1
andpd 0x1902(%rip), %xmm0     # 0x8270
mulsd 0x185a(%rip), %xmm0     # 0x81d0
movapd %xmm0, -0x40(%rbp)
movsd -0xe0(%rbp), %xmm0
divsd %xmm1, %xmm0
callq 0x2350
movapd %xmm0, %xmm3
movsd -0x50(%rbp), %xmm1
ucomisd 0x187b(%rip), %xmm1     # 0x8218
jb 0x69a5
sqrtsd %xmm1, %xmm0
jmp 0x69c3
movapd %xmm1, %xmm0
movsd %xmm3, -0x90(%rbp)
callq 0x2150
movsd -0x90(%rbp), %xmm3
movsd -0x50(%rbp), %xmm1
movapd -0x70(%rbp), %xmm2
mulsd -0x40(%rbp), %xmm3
mulsd -0x60(%rbp), %xmm2
addsd %xmm3, %xmm2
movapd %xmm2, -0x70(%rbp)
andpd 0x188d(%rip), %xmm0     # 0x8270
mulsd 0x17e5(%rip), %xmm0     # 0x81d0
movapd %xmm0, -0x40(%rbp)
movsd -0xe0(%rbp), %xmm0
divsd %xmm1, %xmm0
callq 0x2350
mulsd -0x40(%rbp), %xmm0
addsd -0x70(%rbp), %xmm0
movsd %xmm0, (%r14,%r13)
movsd -0x98(%rbp), %xmm0
movsd 0x1737(%rip), %xmm1     # 0x8158
callq 0x2330
mulsd 0x1722(%rip), %xmm0     # 0x8150
movsd %xmm0, -0x50(%rbp)
movapd -0xc0(%rbp), %xmm0
movsd 0x1715(%rip), %xmm1     # 0x8158
callq 0x2330
movsd 0x17c0(%rip), %xmm1     # 0x8210
mulsd %xmm1, %xmm0
callq 0x2220
movsd %xmm0, -0x40(%rbp)
movapd -0x130(%rbp), %xmm0
movsd 0x16ea(%rip), %xmm1     # 0x8158
callq 0x2330
mulsd 0x1795(%rip), %xmm0     # 0x8210
callq 0x2220
addsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movapd -0x100(%rbp), %xmm0
movsd 0x16be(%rip), %xmm1     # 0x8158
callq 0x2330
mulsd 0x1769(%rip), %xmm0     # 0x8210
callq 0x2220
addsd %xmm0, %xmm0
movsd -0x40(%rbp), %xmm1
subsd %xmm0, %xmm1
mulsd -0x50(%rbp), %xmm1
movsd %xmm1, (%rbx,%r13)
addq $0x8, %r13
jmp 0x6436
xorl %eax, %eax
movq 0x50(%rbp), %r15
movq 0x48(%rbp), %r13
movl -0xec(%rbp), %edx
movq -0xc8(%rbp), %rsi
movq -0xd0(%rbp), %rdi
cmpq %rax, -0x118(%rbp)
je 0x6b35
movsd (%rsi,%rax,8), %xmm0
addsd (%rdi,%rax,8), %xmm0
movq -0xa8(%rbp), %rcx
addsd (%rcx,%rax,8), %xmm0
movq -0xa0(%rbp), %rcx
addsd (%rcx,%rax,8), %xmm0
addsd (%r12,%rax,8), %xmm0
addsd (%r14,%rax,8), %xmm0
addsd (%rbx,%rax,8), %xmm0
movq 0x58(%rbp), %rcx
movsd %xmm0, (%rcx,%rax,8)
incq %rax
jmp 0x6aeb
movq 0x10(%rbp), %rax
movsd (%rax), %xmm4
movq 0x18(%rbp), %rax
movsd (%rax), %xmm3
movq 0x30(%rbp), %rax
movsd (%rax), %xmm0
movq 0x28(%rbp), %rax
movsd (%rax), %xmm1
movapd 0x15e3(%rip), %xmm6     # 0x8140
xorpd %xmm0, %xmm6
movapd %xmm0, %xmm7
divsd %xmm4, %xmm7
movq 0x20(%rbp), %rax
movsd (%rax), %xmm2
movapd %xmm0, %xmm5
mulsd %xmm0, %xmm5
movapd %xmm4, %xmm9
unpcklpd %xmm3, %xmm9            # xmm9 = xmm9[0],xmm3[0]
mulpd %xmm9, %xmm9
movsd 0x1477(%rip), %xmm11    # 0x8008
movapd %xmm11, %xmm8
unpcklpd %xmm6, %xmm8            # xmm8 = xmm8[0],xmm6[0]
divpd %xmm9, %xmm8
movapd %xmm11, %xmm10
unpcklpd %xmm7, %xmm10           # xmm10 = xmm10[0],xmm7[0]
shufpd $0x1, %xmm3, %xmm9      # xmm9 = xmm9[1],xmm3[0]
divpd %xmm9, %xmm10
movapd %xmm8, %xmm9
addpd %xmm10, %xmm9
subpd %xmm10, %xmm8
movapd 0x16b4(%rip), %xmm7     # 0x8280
unpcklpd %xmm0, %xmm7            # xmm7 = xmm7[0],xmm0[0]
movapd %xmm4, %xmm10
unpcklpd %xmm2, %xmm10           # xmm10 = xmm10[0],xmm2[0]
divpd %xmm10, %xmm7
movapd %xmm3, %xmm10
unpcklpd %xmm3, %xmm10           # xmm10 = xmm10[0],xmm3[0]
divpd %xmm10, %xmm7
addpd %xmm7, %xmm9
subpd %xmm7, %xmm8
movapd %xmm0, %xmm7
unpcklpd %xmm5, %xmm7            # xmm7 = xmm7[0],xmm5[0]
divpd %xmm10, %xmm7
movapd %xmm1, %xmm10
unpcklpd %xmm1, %xmm10           # xmm10 = xmm10[0],xmm1[0]
divpd %xmm10, %xmm7
addpd %xmm7, %xmm9
subpd %xmm7, %xmm8
movsd %xmm9, %xmm8            # xmm8 = xmm9[0],xmm8[1]
movapd %xmm8, -0x160(%rbp)
movapd %xmm1, %xmm8
mulsd %xmm1, %xmm8
divsd %xmm8, %xmm6
movapd %xmm11, %xmm9
divsd %xmm2, %xmm9
divsd %xmm1, %xmm9
subsd %xmm9, %xmm6
movapd %xmm11, %xmm9
divsd %xmm4, %xmm9
divsd %xmm1, %xmm9
subsd %xmm9, %xmm6
movapd %xmm11, %xmm9
divsd %xmm3, %xmm9
divsd %xmm1, %xmm9
subsd %xmm9, %xmm6
movsd %xmm6, -0x150(%rbp)
movapd %xmm2, %xmm6
mulsd %xmm2, %xmm6
movapd %xmm11, %xmm9
divsd %xmm6, %xmm9
divsd %xmm8, %xmm5
addsd %xmm9, %xmm5
movapd %xmm0, %xmm6
addsd %xmm0, %xmm6
divsd %xmm2, %xmm6
divsd %xmm1, %xmm6
addsd %xmm5, %xmm6
addsd %xmm7, %xmm6
movsd %xmm6, -0x148(%rbp)
movapd -0x80(%rbp), %xmm5
mulsd %xmm5, %xmm5
divsd 0x1484(%rip), %xmm5     # 0x8150
xorl %eax, %eax
movq 0x40(%rbp), %rbx
cmpq $0x4, %rax
je 0x6cf3
movsd -0x160(%rbp,%rax,8), %xmm6
mulsd %xmm5, %xmm6
movsd %xmm6, -0x160(%rbp,%rax,8)
incq %rax
jmp 0x6cd2
addsd %xmm4, %xmm4
movapd -0x80(%rbp), %xmm7
movapd %xmm7, %xmm5
divsd %xmm4, %xmm5
movsd 0x12fc(%rip), %xmm4     # 0x8008
addsd %xmm4, %xmm5
movapd %xmm4, %xmm8
addsd %xmm3, %xmm3
negl %edx
cvtsi2sd %edx, %xmm4
movapd %xmm7, %xmm6
unpcklpd %xmm4, %xmm6            # xmm6 = xmm6[0],xmm4[0]
unpcklpd %xmm3, %xmm3            # xmm3 = xmm3[0,0]
divpd %xmm3, %xmm6
movapd %xmm5, %xmm3
unpcklpd %xmm0, %xmm3            # xmm3 = xmm3[0],xmm0[0]
addpd %xmm6, %xmm5
mulpd %xmm6, %xmm3
movsd %xmm5, %xmm3            # xmm3 = xmm5[0],xmm3[1]
movapd %xmm3, -0x180(%rbp)
addsd %xmm1, %xmm1
divsd %xmm1, %xmm4
movsd %xmm4, -0x170(%rbp)
addsd %xmm2, %xmm2
movapd %xmm7, %xmm3
divsd %xmm2, %xmm3
addsd %xmm8, %xmm3
movapd %xmm7, %xmm2
divsd %xmm1, %xmm2
mulsd %xmm0, %xmm2
addsd %xmm3, %xmm2
movapd %xmm2, -0x50(%rbp)
movsd (%r13), %xmm0
addsd %xmm0, %xmm0
movsd %xmm0, -0x40(%rbp)
movapd %xmm7, %xmm0
divsd (%r15), %xmm0
movsd 0x13b7(%rip), %xmm1     # 0x8158
callq 0x2330
mulsd -0x40(%rbp), %xmm0
addsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x168(%rbp)
movq 0x10(%rbp), %rax
movsd (%rax), %xmm0
addsd %xmm0, %xmm0
movapd -0x80(%rbp), %xmm3
movapd %xmm3, %xmm1
divsd %xmm0, %xmm1
movsd 0x122f(%rip), %xmm4     # 0x8008
movapd %xmm4, %xmm0
subsd %xmm1, %xmm0
movq 0x18(%rbp), %rax
movsd (%rax), %xmm1
addsd %xmm1, %xmm1
movapd %xmm3, %xmm2
divsd %xmm1, %xmm2
subsd %xmm2, %xmm0
movsd %xmm0, (%rbx)
movsd (%rax), %xmm0
addsd %xmm0, %xmm0
movapd %xmm3, %xmm1
divsd %xmm0, %xmm1
movq 0x30(%rbp), %rax
mulsd (%rax), %xmm1
movsd %xmm1, 0x8(%rbx)
movq 0x28(%rbp), %rcx
movsd (%rcx), %xmm0
addsd %xmm0, %xmm0
movapd %xmm3, %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rbx)
movq 0x20(%rbp), %rdx
movsd (%rdx), %xmm0
addsd %xmm0, %xmm0
movapd %xmm3, %xmm1
divsd %xmm0, %xmm1
movapd %xmm4, %xmm2
subsd %xmm1, %xmm2
movsd (%rcx), %xmm0
addsd %xmm0, %xmm0
movapd %xmm3, %xmm1
divsd %xmm0, %xmm1
mulsd (%rax), %xmm1
subsd %xmm1, %xmm2
movapd %xmm2, -0x50(%rbp)
movq 0x58(%rbp), %rax
movq -0x188(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
mulsd (%r13), %xmm0
movsd %xmm0, -0x40(%rbp)
divsd (%r15), %xmm3
movapd %xmm3, %xmm0
movsd 0x12c0(%rip), %xmm1     # 0x8158
callq 0x2330
mulsd -0x40(%rbp), %xmm0
addsd -0x50(%rbp), %xmm0
movsd %xmm0, 0x18(%rbx)
xorl %eax, %eax
cmpq $0x4, %rax
je 0x6ee2
movsd -0x160(%rbp,%rax,8), %xmm0
movsd -0x180(%rbp,%rax,8), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, -0x180(%rbp,%rax,8)
addsd (%rbx,%rax,8), %xmm0
movsd %xmm0, (%rbx,%rax,8)
incq %rax
jmp 0x6eae
leaq -0x180(%rbp), %rdi
movq 0x38(%rbp), %rsi
callq 0x5934
movq -0x190(%rbp), %rsp
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq