// File: /workspace/github_c_makefile_star2_O2/PoulinV[P]AxiCLASS/build/../source/distortions.c
// Function: distortions_compute_spectral_shapes
int distortions_compute_spectral_shapes(struct precision * ppr,
                                        struct background * pba,
                                        struct thermodynamics * pth,
                                        struct distortions * psd){

  /** Define local variables */
  double * S;
  int last_index = 0;
  int index_type, index_x, index_k;
  double sum_S, sum_G;
  double g;
  double y_reio, DI_reio;

  /** Allocate space for spectral distortion amplitude in table sd_parameter_table */
  class_alloc(psd->sd_parameter_table,
              psd->type_size*sizeof(double),
              psd->error_message);

  /** Compute distortion amplitudes corresponding to each branching ratio (g, y and mu) */
  /* Define y, mu, g and mu_k from heating rates */
  for (index_type=0; index_type<psd->type_size; ++index_type){
    class_call(array_trapezoidal_convolution(psd->dQrho_dz_tot,
                                             psd->br_table[index_type],
                                             psd->z_size,
                                             psd->z_weights,
                                             &(psd->sd_parameter_table[index_type]),
                                             psd->error_message),
               psd->error_message,
               psd->error_message);

    if (index_type>=psd->index_type_PCA) {
      /* The S_k are not properly normalized, we have to renormalize here */
      psd->sd_parameter_table[index_type] /= (log(1.+psd->z[1])-log(1.+psd->z[0]));
    }
  }

  psd->sd_parameter_table[psd->index_type_g] /= 4.;
  psd->sd_parameter_table[psd->index_type_y] /= 4.;
  psd->sd_parameter_table[psd->index_type_mu] *= 1.401;

  psd->sd_parameter_table[psd->index_type_y] += psd->sd_add_y;
  psd->sd_parameter_table[psd->index_type_mu] += psd->sd_add_mu;

  /** Allocate space for distortions shapes in distortions_table */
  class_alloc(psd->sd_shape_table,
              psd->type_size*sizeof(double*),
              psd->error_message);
  for (index_type=0; index_type<psd->type_size; ++index_type){
    class_alloc(psd->sd_shape_table[index_type],
                psd->x_size*sizeof(double),
                psd->error_message);
  }

  /** Calculate spectral shapes */
  if (psd->sd_branching_approx != bra_exact || psd->sd_PCA_size == 0) {
    /* If no PCA analysis is required, the shapes have simple analistical form */
    for (index_x=0; index_x<psd->x_size; ++index_x){
      psd->sd_shape_table[psd->index_type_g][index_x] = pow(psd->x[index_x],4.)*exp(-psd->x[index_x])/
        pow(1.-exp(-psd->x[index_x]),2.);        // [-]
      psd->sd_shape_table[psd->index_type_y][index_x] = psd->sd_shape_table[psd->index_type_g][index_x]*
        (psd->x[index_x]*(1.+exp(-psd->x[index_x]))/
         (1.-exp(-psd->x[index_x]))-4.);          // [-]
      psd->sd_shape_table[psd->index_type_mu][index_x] = psd->sd_shape_table[psd->index_type_g][index_x]*
        (1./2.19229-1./psd->x[index_x]);         // [-]
    }
  }
  else {
    /* If PCA analysis is required, the shapes has to be vectorized. This is done in the external
       file spectral_shapes.dat using generate_PCA_files.py */

    /* Read and spline data from file spectral_shapes.dat */
    class_call(distortions_read_sd_data(ppr,psd),
               psd->error_message,
               psd->error_message);
    class_call(distortions_spline_sd_data(psd),
               psd->error_message,
               psd->error_message);

    /* Allocate local variable */
    class_alloc(S,
                psd->sd_PCA_size*sizeof(double),
                psd->error_message);

    /* Interpolate over z */
    for (index_x=0; index_x<psd->x_size; ++index_x){
      class_call(distortions_interpolate_sd_data(psd,
                                                 psd->x[index_x]*psd->x_to_nu,
                                                 &psd->sd_shape_table[psd->index_type_g][index_x],
                                                 &psd->sd_shape_table[psd->index_type_y][index_x],
                                                 &psd->sd_shape_table[psd->index_type_mu][index_x],
                                                 S,
                                                 &last_index),
                 psd->error_message,
                 psd->error_message);

      for (index_k=0; index_k<psd->sd_PCA_size; ++index_k){
        psd->sd_shape_table[psd->index_type_PCA+index_k][index_x] = S[index_k];
      }
    }

    /* Free allocated space */
    class_call(distortions_free_sd_data(psd),
               psd->error_message,
               psd->error_message);
    free(S);
  }

  /** Compute distortion amplitude for residual parameter epsilon */
  /* For the details of the calculation see Chluba & Jeong 2014, left column of page 6 */
  psd->epsilon = 0.;

  if (psd->sd_branching_approx == bra_exact && psd->sd_PCA_size != 0) {
    class_call(array_trapezoidal_integral(psd->sd_shape_table[psd->index_type_g],
                                          psd->x_size,
                                          psd->x_weights,
                                          &(sum_G),
                                          psd->error_message),
               psd->error_message,
               psd->error_message);
    for (index_k=0; index_k<psd->sd_PCA_size; ++index_k){
      class_call(array_trapezoidal_integral(psd->sd_shape_table[psd->index_type_PCA+index_k],
                                            psd->x_size,
                                            psd->x_weights,
                                            &(sum_S),
                                            psd->error_message),
                 psd->error_message,
                 psd->error_message);
      psd->epsilon += (4.*sum_S/sum_G)*psd->sd_parameter_table[psd->index_type_PCA+index_k];
    }
  }

  /** Allocate space for final spectral distortion */
  class_alloc(psd->DI,
              psd->x_size*sizeof(double),
              psd->error_message);

  class_alloc(psd->sd_table,
              psd->type_size*sizeof(double*),
              psd->error_message);
  for (index_type=0; index_type<psd->type_size; ++index_type){
    class_alloc(psd->sd_table[index_type],
                psd->x_size*sizeof(double),
                psd->error_message);
  }

  /** Calculate spectral distortions according to Chluba & Jeong 2014 (arxiv:1306.5751, Eq. (11)) */
  for (index_x=0;index_x<psd->x_size;++index_x){
    psd->DI[index_x] = 0.;

    for (index_type=0;index_type<psd->type_size;++index_type){
      if (index_type==psd->index_type_g) {
        if (psd->include_g_distortion == _TRUE_) {
          g = psd->sd_parameter_table[psd->index_type_g];
          psd->sd_table[index_type][index_x] = (1.+g)*g*psd->sd_shape_table[psd->index_type_g][index_x]+
            g*g*0.5*psd->sd_shape_table[psd->index_type_y][index_x];
        }
        else {
          g = 0.;
          psd->sd_table[index_type][index_x] = 0.;
        }
      }
      else {
        psd->sd_table[index_type][index_x] = psd->sd_parameter_table[index_type]*psd->sd_shape_table[index_type][index_x];
      }

      psd->DI[index_x] += psd->sd_table[index_type][index_x];
    }
  }

  /** Include additional sources of distortions */
  /* Superposition of blackbodies */
  //psd->sd_parameter_table[psd->index_type_y] += 2.525e-7;   // CMB Dipole (Chluba & Sunyaev 2004)
  //psd->sd_parameter_table[psd->index_type_y] += 4.59e-13;   // CMB Quadrupole (Chluba & Sunyaev 2004)

  /* Reionization */
  if (psd->has_SZ_effect == _TRUE_) {
    for (index_x=0;index_x<psd->x_size;++index_x){
      class_call(distortions_add_effects_reio(pba,pth,psd,
                                              5.e0,
                                              2.e-4,
                                              1./300.,
                                              1./300.,
                                              psd->x[index_x],
                                              &y_reio,
                                              &DI_reio),
                 psd->error_message,
                 psd->error_message);
      psd->DI[index_x] += DI_reio;
    }

    psd->sd_parameter_table[psd->index_type_y] += y_reio;
  }

  /** Compute total heating */
  psd->Drho_over_rho = psd->sd_parameter_table[psd->index_type_y]*4.+
    psd->sd_parameter_table[psd->index_type_mu]/1.401+
    psd->epsilon;

  if (psd->include_g_distortion == _TRUE_) {
    psd->Drho_over_rho += psd->sd_parameter_table[psd->index_type_g]*4.;
  }

  /** Print found parameters */
  if (psd->distortions_verbose > 1) {

    if (psd->distortions_verbose > 3 && psd->include_g_distortion == _TRUE_) {
      printf(" -> g-parameter %g (Note, that this does not include contributions from earlier than sd_z_max=%g)\n", psd->sd_parameter_table[psd->index_type_g], ppr->sd_z_max);
    }

    if (psd->sd_parameter_table[psd->index_type_mu] > 9.e-5) {
      printf(" -> mu-parameter = %g. WARNING: The value of your mu-parameter is larger than the FIRAS constraint mu<9e-5.\n", psd->sd_parameter_table[psd->index_type_mu]);
    }
    else {
      printf(" -> mu-parameter = %g\n", psd->sd_parameter_table[psd->index_type_mu]);
    }

    if (psd->sd_parameter_table[psd->index_type_y]>1.5e-5) {
      printf(" -> y-parameter = %g. WARNING: The value of your y-parameter is larger than the FIRAS constraint y<1.5e-5.\n", psd->sd_parameter_table[psd->index_type_y]);
    }
    else {
      printf(" -> y-parameter = %g\n", psd->sd_parameter_table[psd->index_type_y]);
    }

    if (psd->sd_branching_approx == bra_exact && psd->sd_PCA_size != 0) {
      if (psd->distortions_verbose > 2) {
        for (index_k=0; index_k<psd->sd_PCA_size; ++index_k){
          printf(" -> PCA multipole mu_%d = %g\n", index_k+1, psd->sd_parameter_table[psd->index_type_PCA+index_k]);
        }
      }
      printf(" -> epsilon-parameter = %g\n", psd->epsilon);
    }

    printf(" -> total injected/extracted heat = %g\n", psd->Drho_over_rho);
  }

  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x858, %rsp            # imm = 0x858
movq %rcx, %r14
andl $0x0, 0x14(%rsp)
movq %rdi, %rbp
movslq 0xbf0(%rcx), %r12
movq %r12, %rdi
shlq $0x3, %rdi
callq 0x8490
movq %rax, 0xbc8(%r14)
testq %rax, %rax
je 0xc1cfa
leaq 0x1602(%r14), %rbx
xorl %r15d, %r15d
xorl %r13d, %r13d
movslq %r12d, %rdi
cmpq %rdi, %r13
jge 0xc1d44
movq 0xc00(%r14), %rdi
movq 0xbc0(%r14), %rax
movq (%rax,%r15), %rsi
movl 0x330(%r14), %edx
movq 0x348(%r14), %rcx
movq 0xbc8(%r14), %r8
addq %r15, %r8
movq %rbx, %r9
callq 0x192bc
cmpl $0x1, %eax
je 0xc1e52
movslq 0xbec(%r14), %rax
cmpq %rax, %r13
jl 0xc1ce7
movq 0x340(%r14), %rax
movsd 0x8(%rax), %xmm0
movsd 0x235c1(%rip), %xmm1    # 0xe5260
addsd %xmm1, %xmm0
callq 0x82e0
movsd %xmm0, 0x8(%rsp)
movq 0x340(%r14), %rax
movsd (%rax), %xmm0
addsd 0x2359f(%rip), %xmm0    # 0xe5260
callq 0x82e0
movsd 0x8(%rsp), %xmm1
subsd %xmm0, %xmm1
movq 0xbc8(%r14), %rax
movsd (%rax,%r15), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, (%rax,%r15)
incq %r13
movl 0xbf0(%r14), %r12d
addq $0x8, %r15
jmp 0xc1c38
leal (,%r12,8), %ecx
leaq 0x232fb(%rip), %rsi     # 0xe5004
leaq 0x5c11d(%rip), %rdx     # 0x11de2d
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x1602, %r14           # imm = 0x1602
leaq 0x23307(%rip), %rsi     # 0xe5034
leaq 0x5c111(%rip), %rdx     # 0x11de45
movq %r14, %rdi
movl $0x38a, %ecx            # imm = 0x38A
movq %rbx, %r8
jmp 0xc1ec7
movq 0xbc8(%r14), %rax
movslq 0xbe0(%r14), %rcx
movsd 0x267a6(%rip), %xmm0    # 0xe8500
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, (%rax,%rcx,8)
movslq 0xbe8(%r14), %rcx
mulsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movslq 0xbe4(%r14), %rdx
movsd (%rax,%rdx,8), %xmm0
mulsd 0x5af8b(%rip), %xmm0    # 0x11cd18
movsd %xmm0, (%rax,%rdx,8)
movsd 0x300(%r14), %xmm0
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movsd 0x308(%r14), %xmm0
addsd (%rax,%rdx,8), %xmm0
movsd %xmm0, (%rax,%rdx,8)
shlq $0x3, %rdi
callq 0x8490
movq %rax, 0xbd0(%r14)
testq %rax, %rax
je 0xc1e8a
movq %rax, %r13
movq %rbp, 0x18(%rsp)
xorl %r15d, %r15d
testl %r12d, %r12d
cmovlel %r15d, %r12d
cmpq %r15, %r12
je 0xc1ee5
movslq 0x368(%r14), %rbp
leaq (,%rbp,8), %rdi
callq 0x8490
movq %rax, (%r13,%r15,8)
movq 0xbd0(%r14), %r13
cmpq $0x0, (%r13,%r15,8)
leaq 0x1(%r15), %r15
jne 0xc1de3
shll $0x3, %ebp
leaq 0x231e2(%rip), %rsi     # 0xe5004
leaq 0x5c0f9(%rip), %rdx     # 0x11df22
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x2e014
leaq 0x231f3(%rip), %rsi     # 0xe5034
leaq 0x5bffd(%rip), %rdx     # 0x11de45
movq %rbx, %rdi
movl $0x3ac, %ecx            # imm = 0x3AC
jmp 0xc1ec4
leaq 0x23597(%rip), %rsi     # 0xe53f0
leaq 0x5c009(%rip), %rdx     # 0x11de69
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x231bb(%rip), %rsi     # 0xe5034
leaq 0x5bfc5(%rip), %rdx     # 0x11de45
movq %rbx, %rdi
movl $0x396, %ecx            # imm = 0x396
jmp 0xc1ec4
shll $0x3, %r12d
leaq 0x2316f(%rip), %rsi     # 0xe5004
leaq 0x5c072(%rip), %rdx     # 0x11df0e
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x2e014
leaq 0x2317f(%rip), %rsi     # 0xe5034
leaq 0x5bf89(%rip), %rdx     # 0x11de45
movq %rbx, %rdi
movl $0x3a8, %ecx            # imm = 0x3A8
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rbx
movl %ebx, %eax
addq $0x858, %rsp            # imm = 0x858
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x4, (%r14)
jne 0xc1f3f
cmpl $0x0, 0x4(%r14)
je 0xc1f3f
movq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0xc3e63
testl %eax, %eax
je 0xc20c3
leaq 0x234e2(%rip), %rsi     # 0xe53f0
leaq 0x5c02d(%rip), %rdx     # 0x11df42
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x23106(%rip), %rsi     # 0xe5034
leaq 0x5bf10(%rip), %rdx     # 0x11de45
movq %rbx, %rdi
movl $0x3c3, %ecx            # imm = 0x3C3
jmp 0xc1ec4
xorl %r15d, %r15d
movslq 0x368(%r14), %rax
cmpq %rax, %r15
jge 0xc222f
movq 0x370(%r14), %rax
movsd (%rax,%r15,8), %xmm0
movsd 0x26491(%rip), %xmm1    # 0xe83f8
callq 0x8650
movsd %xmm0, 0x8(%rsp)
movq 0x370(%r14), %rax
movsd (%rax,%r15,8), %xmm0
movapd 0x232a9(%rip), %xmm1    # 0xe5230
xorpd %xmm1, %xmm0
callq 0x86a0
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x370(%r14), %rax
movsd (%rax,%r15,8), %xmm0
xorpd 0x2327f(%rip), %xmm0    # 0xe5230
callq 0x86a0
movsd 0x232a2(%rip), %xmm1    # 0xe5260
subsd %xmm0, %xmm1
mulsd %xmm1, %xmm1
movsd 0x8(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0xbd0(%r14), %rax
movslq 0xbe0(%r14), %rcx
movq (%rax,%rcx,8), %rax
movsd %xmm0, (%rax,%r15,8)
movq 0x370(%r14), %rax
movsd (%rax,%r15,8), %xmm0
movapd %xmm0, 0x20(%rsp)
xorpd 0x23227(%rip), %xmm0    # 0xe5230
callq 0x86a0
addsd 0x2324a(%rip), %xmm0    # 0xe5260
mulsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movq 0x370(%r14), %rax
movsd (%rax,%r15,8), %xmm0
xorpd 0x231f9(%rip), %xmm0    # 0xe5230
callq 0x86a0
movsd 0x2321c(%rip), %xmm2    # 0xe5260
movapd %xmm2, %xmm1
subsd %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
divsd %xmm1, %xmm0
addsd 0x263ca(%rip), %xmm0    # 0xe8428
mulsd 0x8(%rsp), %xmm0
movq 0xbd0(%r14), %rax
movslq 0xbe8(%r14), %rcx
movq (%rax,%rcx,8), %rcx
movsd %xmm0, (%rcx,%r15,8)
movslq 0xbe0(%r14), %rcx
movq (%rax,%rcx,8), %rcx
movq 0x370(%r14), %rdx
movapd %xmm2, %xmm0
divsd (%rdx,%r15,8), %xmm0
movsd 0x5aca0(%rip), %xmm1    # 0x11cd40
subsd %xmm0, %xmm1
mulsd (%rcx,%r15,8), %xmm1
movslq 0xbe4(%r14), %rcx
movq (%rax,%rcx,8), %rax
movsd %xmm1, (%rax,%r15,8)
incq %r15
jmp 0xc1f42
movq %r14, %rdi
callq 0xc45ce
testl %eax, %eax
je 0xc210a
leaq 0x2331a(%rip), %rsi     # 0xe53f0
leaq 0x5be87(%rip), %rdx     # 0x11df64
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x22f3e(%rip), %rsi     # 0xe5034
leaq 0x5bd48(%rip), %rdx     # 0x11de45
movq %rbx, %rdi
movl $0x3c6, %ecx            # imm = 0x3C6
jmp 0xc1ec4
movslq 0x4(%r14), %r13
leaq (,%r13,8), %rdi
callq 0x8490
testq %rax, %rax
je 0xc21e0
movq %rax, %r12
xorl %r15d, %r15d
leaq 0x14(%rsp), %r13
xorl %ebp, %ebp
movslq 0x368(%r14), %rax
cmpq %rax, %rbp
jge 0xc221f
movq 0x370(%r14), %rax
leaq (,%rbp,8), %rcx
movsd (%rax,%rbp,8), %xmm0
mulsd 0x380(%r14), %xmm0
movq 0xbd0(%r14), %rax
movslq 0xbe0(%r14), %rdx
movq (%rax,%rdx,8), %rsi
addq %rcx, %rsi
movslq 0xbe8(%r14), %rdx
movq (%rax,%rdx,8), %rdx
addq %rcx, %rdx
movslq 0xbe4(%r14), %rdi
addq (%rax,%rdi,8), %rcx
movq %r14, %rdi
movq %r12, %r8
movq %r13, %r9
callq 0xc4962
testl %eax, %eax
jne 0xc281f
movl 0x4(%r14), %eax
testl %eax, %eax
cmovlel %r15d, %eax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0xc21d8
movsd (%r12,%rcx,8), %xmm0
movq 0xbd0(%r14), %rdx
movslq 0xbec(%r14), %rsi
addq %rcx, %rsi
movq (%rdx,%rsi,8), %rdx
movsd %xmm0, (%rdx,%rbp,8)
incq %rcx
jmp 0xc21ae
incq %rbp
jmp 0xc2131
shll $0x3, %r13d
leaq 0x22e19(%rip), %rsi     # 0xe5004
leaq 0x25568(%rip), %rdx     # 0xe775a
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movl %r13d, %ecx
xorl %eax, %eax
callq 0x2e014
leaq 0x22e29(%rip), %rsi     # 0xe5034
leaq 0x5bc33(%rip), %rdx     # 0x11de45
movq %rbx, %rdi
movl $0x3cb, %ecx            # imm = 0x3CB
jmp 0xc1ec4
movq %r14, %rdi
callq 0xc4c08
movq %r12, %rdi
callq 0x8430
andq $0x0, 0xbf8(%r14)
cmpl $0x4, (%r14)
jne 0xc233f
cmpl $0x0, 0x4(%r14)
je 0xc233f
movq 0xbd0(%r14), %rax
movslq 0xbe0(%r14), %rcx
movq (%rax,%rcx,8), %rdi
movl 0x368(%r14), %esi
movq 0x378(%r14), %rdx
leaq 0x40(%rsp), %rcx
movq %rbx, %r8
callq 0x19292
cmpl $0x1, %eax
jne 0xc22b9
leaq 0x2316b(%rip), %rsi     # 0xe53f0
leaq 0x5bde2(%rip), %rdx     # 0x11e06e
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x22d8f(%rip), %rsi     # 0xe5034
leaq 0x5bb99(%rip), %rdx     # 0x11de45
movq %rbx, %rdi
movl $0x3f0, %ecx            # imm = 0x3F0
jmp 0xc1ec4
xorl %r15d, %r15d
leaq 0x48(%rsp), %r12
cmpl 0x4(%r14), %r15d
jge 0xc233f
movq 0xbd0(%r14), %rax
movslq 0xbec(%r14), %rcx
addq %r15, %rcx
movq (%rax,%rcx,8), %rdi
movl 0x368(%r14), %esi
movq 0x378(%r14), %rdx
movq %r12, %rcx
movq %rbx, %r8
callq 0x19292
cmpl $0x1, %eax
je 0xc2600
movsd 0x48(%rsp), %xmm0
mulsd 0x260ec(%rip), %xmm0    # 0xe83f8
divsd 0x40(%rsp), %xmm0
movq 0xbc8(%r14), %rax
movslq 0xbec(%r14), %rcx
addq %r15, %rcx
mulsd (%rax,%rcx,8), %xmm0
addsd 0xbf8(%r14), %xmm0
movsd %xmm0, 0xbf8(%r14)
incq %r15
jmp 0xc22c1
movslq 0x368(%r14), %r15
movq %r15, %r13
shlq $0x3, %r13
movq %r13, %rdi
callq 0x8490
movq %rax, 0xc10(%r14)
testq %rax, %rax
je 0xc240d
movq %r15, 0x8(%rsp)
movslq 0xbf0(%r14), %r15
movq %r15, %rdi
shlq $0x3, %rdi
callq 0x8490
movq %rax, 0xbd8(%r14)
testq %rax, %rax
je 0xc244d
movq %rax, %r12
xorl %ebp, %ebp
testl %r15d, %r15d
movq %r15, %rax
movl $0x0, %r15d
cmovgl %eax, %r15d
cmpq %rbp, %r15
je 0xc248d
movq %r13, %rdi
callq 0x8490
movq %rax, (%r12,%rbp,8)
movq 0xbd8(%r14), %r12
cmpq $0x0, (%r12,%rbp,8)
leaq 0x1(%rbp), %rbp
jne 0xc23a2
movq 0x8(%rsp), %rax
leal (,%rax,8), %ecx
leaq 0x22c28(%rip), %rsi     # 0xe5004
leaq 0x5bda7(%rip), %rdx     # 0x11e18a
leaq 0x50(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
leaq 0x22c3b(%rip), %rsi     # 0xe5034
leaq 0x5ba45(%rip), %rdx     # 0x11de45
movq %rbx, %rdi
movl $0x408, %ecx            # imm = 0x408
jmp 0xc1ec4
leal (,%r15,8), %ecx
leaq 0x22be8(%rip), %rsi     # 0xe5004
leaq 0x5bd51(%rip), %rdx     # 0x11e174
leaq 0x50(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
leaq 0x22bfb(%rip), %rsi     # 0xe5034
leaq 0x5ba05(%rip), %rdx     # 0x11de45
movq %rbx, %rdi
movl $0x400, %ecx            # imm = 0x400
jmp 0xc1ec4
leal (,%r15,8), %ecx
leaq 0x22ba8(%rip), %rsi     # 0xe5004
leaq 0x5bd19(%rip), %rdx     # 0x11e17c
leaq 0x50(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
leaq 0x22bbb(%rip), %rsi     # 0xe5034
leaq 0x5b9c5(%rip), %rdx     # 0x11de45
movq %rbx, %rdi
movl $0x404, %ecx            # imm = 0x404
jmp 0xc1ec4
xorl %eax, %eax
movq 0x8(%rsp), %r10
testl %r10d, %r10d
movl $0x0, %ecx
cmovgl %r10d, %ecx
movsd 0x23808(%rip), %xmm0    # 0xe5cb0
movq 0x18(%rsp), %rbp
cmpq %rcx, %rax
je 0xc2575
movq 0xc10(%r14), %rdx
andq $0x0, (%rdx,%rax,8)
xorl %esi, %esi
cmpq %rsi, %r15
je 0xc256d
movl 0xbe0(%r14), %edi
cmpq %rdi, %rsi
jne 0xc2536
xorpd %xmm1, %xmm1
cmpl $0x1, 0xce8(%r14)
jne 0xc2552
movslq %edi, %rdi
movq 0xbc8(%r14), %r8
movq 0xbd0(%r14), %r9
movsd (%r8,%rdi,8), %xmm2
movapd %xmm2, %xmm1
addsd 0x22d56(%rip), %xmm1    # 0xe5260
mulsd %xmm2, %xmm1
mulsd %xmm2, %xmm2
mulsd %xmm0, %xmm2
movslq 0xbe8(%r14), %r8
movq (%r9,%r8,8), %r8
mulsd (%r8,%rax,8), %xmm2
movq (%r9,%rdi,8), %rdi
mulsd (%rdi,%rax,8), %xmm1
addsd %xmm2, %xmm1
jmp 0xc2552
movq 0xbc8(%r14), %rdi
movq 0xbd0(%r14), %r8
movsd (%rdi,%rsi,8), %xmm1
movq (%r8,%rsi,8), %rdi
mulsd (%rdi,%rax,8), %xmm1
movq (%r12,%rsi,8), %rdi
movsd %xmm1, (%rdi,%rax,8)
addsd (%rdx,%rax,8), %xmm1
movsd %xmm1, (%rdx,%rax,8)
incq %rsi
jmp 0xc24c4
incq %rax
jmp 0xc24ad
cmpl $0x1, 0xce0(%r14)
jne 0xc263b
xorl %r15d, %r15d
leaq 0x38(%rsp), %r12
leaq 0x30(%rsp), %r13
movslq %r10d, %rax
cmpq %rax, %r15
jge 0xc2650
movq 0x370(%r14), %rax
movsd (%rax,%r15,8), %xmm4
movq %r14, %rdx
movsd 0x22cbc(%rip), %xmm0    # 0xe5270
movsd 0x5a774(%rip), %xmm1    # 0x11cd30
movsd 0x5a774(%rip), %xmm2    # 0x11cd38
movapd %xmm2, %xmm3
movq %r12, %rcx
movq %r13, %r8
callq 0xc4c7c
testl %eax, %eax
jne 0xc27e4
movsd 0x30(%rsp), %xmm0
movq 0xc10(%r14), %rax
addsd (%rax,%r15,8), %xmm0
movsd %xmm0, (%rax,%r15,8)
incq %r15
movl 0x368(%r14), %r10d
jmp 0xc2590
leaq 0x22de9(%rip), %rsi     # 0xe53f0
leaq 0x5bade(%rip), %rdx     # 0x11e0ec
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x22a0d(%rip), %rsi     # 0xe5034
leaq 0x5b817(%rip), %rdx     # 0x11de45
movq %rbx, %rdi
movl $0x3f8, %ecx            # imm = 0x3F8
jmp 0xc1ec4
movq 0xbc8(%r14), %rax
movslq 0xbe8(%r14), %rcx
movsd (%rax,%rcx,8), %xmm0
jmp 0xc266e
movsd 0x38(%rsp), %xmm0
movq 0xbc8(%r14), %rax
movslq 0xbe8(%r14), %rcx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movslq 0xbe4(%r14), %rcx
movsd (%rax,%rcx,8), %xmm1
divsd 0x5a696(%rip), %xmm1    # 0x11cd18
mulsd 0x25d6e(%rip), %xmm0    # 0xe83f8
addsd %xmm1, %xmm0
addsd 0xbf8(%r14), %xmm0
movsd %xmm0, 0xc08(%r14)
movl 0xce8(%r14), %edx
cmpl $0x1, %edx
jne 0xc26cd
movslq 0xbe0(%r14), %rsi
movsd (%rax,%rsi,8), %xmm1
mulsd 0x25d38(%rip), %xmm1    # 0xe83f8
addsd %xmm0, %xmm1
movsd %xmm1, 0xc08(%r14)
movzwl 0x1600(%r14), %esi
xorl %ebx, %ebx
cmpw $0x2, %si
jl 0xc1ed1
cmpl $0x1, %edx
setne %dl
cmpw $0x4, %si
setb %sil
orb %dl, %sil
jne 0xc2724
movslq 0xbe0(%r14), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x8f8(%rbp), %xmm1
leaq 0x5bb02(%rip), %rdi     # 0x11e211
movb $0x2, %al
callq 0x8030
movq 0xbc8(%r14), %rax
movslq 0xbe4(%r14), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd 0x5a5ef(%rip), %xmm0    # 0x11cd20
leaq 0x5bb3c(%rip), %rax     # 0x11e274
leaq 0x5bba2(%rip), %rdi     # 0x11e2e1
cmovaq %rax, %rdi
movb $0x1, %al
callq 0x8030
movq 0xbc8(%r14), %rax
movslq 0xbe8(%r14), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd 0x5a5c3(%rip), %xmm0    # 0x11cd28
leaq 0x5bb8c(%rip), %rax     # 0x11e2f8
leaq 0x5bbf1(%rip), %rdi     # 0x11e364
cmovaq %rax, %rdi
movb $0x1, %al
callq 0x8030
cmpl $0x4, (%r14)
jne 0xc2871
movl 0x4(%r14), %eax
testl %eax, %eax
je 0xc2871
cmpw $0x3, 0x1600(%r14)
jl 0xc285a
xorl %ecx, %ecx
leaq 0x5bbce(%rip), %r15     # 0x11e37a
cmpl %eax, %ecx
jge 0xc285a
leaq 0x1(%rcx), %r12
movq 0xbc8(%r14), %rax
movslq 0xbec(%r14), %rdx
addq %rcx, %rdx
movsd (%rax,%rdx,8), %xmm0
movq %r15, %rdi
movl %r12d, %esi
movb $0x1, %al
callq 0x8030
movl 0x4(%r14), %eax
movq %r12, %rcx
jmp 0xc27ac
leaq 0x22c05(%rip), %rsi     # 0xe53f0
leaq 0x5b9b2(%rip), %rdx     # 0x11e1a4
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x22829(%rip), %rsi     # 0xe5034
leaq 0x5b633(%rip), %rdx     # 0x11de45
movq %rbx, %rdi
movl $0x434, %ecx            # imm = 0x434
jmp 0xc1ec4
leaq 0x22bca(%rip), %rsi     # 0xe53f0
leaq 0x5b757(%rip), %rdx     # 0x11df84
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x227ee(%rip), %rsi     # 0xe5034
leaq 0x5b5f8(%rip), %rdx     # 0x11de45
movq %rbx, %rdi
movl $0x3d7, %ecx            # imm = 0x3D7
jmp 0xc1ec4
movsd 0xbf8(%r14), %xmm0
leaq 0x5bb2e(%rip), %rdi     # 0x11e398
movb $0x1, %al
callq 0x8030
movsd 0xc08(%r14), %xmm0
leaq 0x5bb33(%rip), %rdi     # 0x11e3b4
movb $0x1, %al
callq 0x8030
jmp 0xc1ed1