// File: /workspace/github_c_makefile_star2_O1/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 $0x848, %rsp            # imm = 0x848
movq %rcx, %rbx
movq %rdi, %r14
movl $0x0, 0xc(%rsp)
movslq 0xbf0(%rcx), %r15
leaq (,%r15,8), %rdi
callq 0x8460
movq %rax, 0xbc8(%rbx)
testq %rax, %rax
je 0xccc50
movl 0xbf0(%rbx), %r12d
testl %r12d, %r12d
jle 0xccb15
leaq 0x1602(%rbx), %r15
xorl %r13d, %r13d
movq 0xc00(%rbx), %rdi
movq 0xbc0(%rbx), %rax
leaq (,%r13,8), %r8
movq (%rax,%r13,8), %rsi
movl 0x330(%rbx), %edx
movq 0x348(%rbx), %rcx
addq 0xbc8(%rbx), %r8
movq %r15, %r9
callq 0x1b494
cmpl $0x1, %eax
je 0xccc96
movslq 0xbec(%rbx), %rax
cmpq %rax, %r13
jl 0xccb02
movq 0x340(%rbx), %rax
movsd 0x8(%rax), %xmm0
movsd 0x247a4(%rip), %xmm1    # 0xf1260
addsd %xmm1, %xmm0
callq 0x82c0
movsd %xmm0, (%rsp)
movq 0x340(%rbx), %rax
movsd (%rax), %xmm0
addsd 0x24783(%rip), %xmm0    # 0xf1260
callq 0x82c0
movsd (%rsp), %xmm1
subsd %xmm0, %xmm1
movq 0xbc8(%rbx), %rax
movsd (%rax,%r13,8), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, (%rax,%r13,8)
incq %r13
movslq 0xbf0(%rbx), %r12
cmpq %r12, %r13
jl 0xcca5d
movq 0xbc8(%rbx), %rax
movslq 0xbe0(%rbx), %rcx
movsd 0x27a45(%rip), %xmm0    # 0xf4570
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, (%rax,%rcx,8)
movslq 0xbe8(%rbx), %rcx
mulsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movslq 0xbe4(%rbx), %rdx
movsd (%rax,%rdx,8), %xmm0
mulsd 0x5c2da(%rip), %xmm0    # 0x128e38
movsd %xmm0, (%rax,%rdx,8)
movsd 0x300(%rbx), %xmm0
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movsd 0x308(%rbx), %xmm0
addsd (%rax,%rdx,8), %xmm0
movsd %xmm0, (%rax,%rdx,8)
movslq %r12d, %rdi
shlq $0x3, %rdi
callq 0x8460
movq %rax, 0xbd0(%rbx)
testq %rax, %rax
je 0xcccd4
testl %r12d, %r12d
jle 0xccbe8
movslq 0x368(%rbx), %r13
movq %r13, %r15
shlq $0x3, %r15
movl %r12d, %r12d
xorl %ebp, %ebp
movq %r15, %rdi
callq 0x8460
movq 0xbd0(%rbx), %rcx
movq %rax, (%rcx,%rbp,8)
movq 0xbd0(%rbx), %rax
cmpq $0x0, (%rax,%rbp,8)
je 0xccf35
incq %rbp
cmpq %rbp, %r12
jne 0xccbbb
cmpl $0x4, (%rbx)
jne 0xccd1a
cmpl $0x0, 0x4(%rbx)
je 0xccd1a
movq %r14, %rdi
movq %rbx, %rsi
callq 0xced28
testl %eax, %eax
je 0xccf7c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x247d4(%rip), %rsi     # 0xf13f0
leaq 0x5d447(%rip), %rdx     # 0x12a06a
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x243f8(%rip), %rsi     # 0xf1034
leaq 0x5d32a(%rip), %rdx     # 0x129f6d
movq %rbx, %rdi
movl $0x3c3, %ecx            # imm = 0x3C3
jmp 0xcd6d9
shll $0x3, %r15d
leaq 0x243a9(%rip), %rsi     # 0xf1004
leaq 0x5d2f3(%rip), %rdx     # 0x129f55
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movl %r15d, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x243b2(%rip), %rsi     # 0xf1034
leaq 0x5d2e4(%rip), %rdx     # 0x129f6d
movq %rbx, %rdi
movl $0x38a, %ecx            # imm = 0x38A
jmp 0xcd6d9
leaq 0x24753(%rip), %rsi     # 0xf13f0
leaq 0x5d2ed(%rip), %rdx     # 0x129f91
leaq 0x40(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x24377(%rip), %rsi     # 0xf1034
leaq 0x5d2a9(%rip), %rdx     # 0x129f6d
movq %r15, %rdi
movl $0x396, %ecx            # imm = 0x396
movq %rbx, %r8
jmp 0xcd6dc
shll $0x3, %r12d
leaq 0x24325(%rip), %rsi     # 0xf1004
leaq 0x5d350(%rip), %rdx     # 0x12a036
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x2432e(%rip), %rsi     # 0xf1034
leaq 0x5d260(%rip), %rdx     # 0x129f6d
movq %rbx, %rdi
movl $0x3a8, %ecx            # imm = 0x3A8
jmp 0xcd6d9
cmpl $0x0, 0x368(%rbx)
jle 0xccea0
xorl %r15d, %r15d
movq 0x370(%rbx), %rax
movsd (%rax,%r15,8), %xmm0
movsd 0x276e9(%rip), %xmm1    # 0xf4428
callq 0x8620
movsd %xmm0, (%rsp)
movq 0x370(%rbx), %rax
movsd (%rax,%r15,8), %xmm0
movapd 0x244d2(%rip), %xmm1    # 0xf1230
xorpd %xmm1, %xmm0
callq 0x8670
mulsd (%rsp), %xmm0
movsd %xmm0, (%rsp)
movq 0x370(%rbx), %rax
movsd (%rax,%r15,8), %xmm0
xorpd 0x244aa(%rip), %xmm0    # 0xf1230
callq 0x8670
movsd 0x244cd(%rip), %xmm1    # 0xf1260
subsd %xmm0, %xmm1
mulsd %xmm1, %xmm1
movsd (%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, (%rsp)
movq 0xbd0(%rbx), %rax
movslq 0xbe0(%rbx), %rcx
movq (%rax,%rcx,8), %rax
movsd %xmm0, (%rax,%r15,8)
movq 0x370(%rbx), %rax
movsd (%rax,%r15,8), %xmm0
movapd %xmm0, 0x10(%rsp)
xorpd 0x24454(%rip), %xmm0    # 0xf1230
callq 0x8670
addsd 0x24477(%rip), %xmm0    # 0xf1260
mulsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x370(%rbx), %rax
movsd (%rax,%r15,8), %xmm0
xorpd 0x24426(%rip), %xmm0    # 0xf1230
callq 0x8670
movsd 0x24449(%rip), %xmm2    # 0xf1260
movapd %xmm2, %xmm1
subsd %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
divsd %xmm1, %xmm0
addsd 0x27627(%rip), %xmm0    # 0xf4458
mulsd (%rsp), %xmm0
movq 0xbd0(%rbx), %rax
movslq 0xbe8(%rbx), %rcx
movq (%rax,%rcx,8), %rcx
movsd %xmm0, (%rcx,%r15,8)
movslq 0xbe0(%rbx), %rcx
movq (%rax,%rcx,8), %rcx
movq 0x370(%rbx), %rdx
movapd %xmm2, %xmm0
divsd (%rdx,%r15,8), %xmm0
movsd 0x5bfce(%rip), %xmm1    # 0x128e40
subsd %xmm0, %xmm1
mulsd (%rcx,%r15,8), %xmm1
movslq 0xbe4(%rbx), %rcx
movq (%rax,%rcx,8), %rax
movsd %xmm1, (%rax,%r15,8)
incq %r15
movslq 0x368(%rbx), %rax
cmpq %rax, %r15
jl 0xccd2a
movq $0x0, 0xbf8(%rbx)
cmpl $0x4, (%rbx)
jne 0xcd059
cmpl $0x0, 0x4(%rbx)
je 0xcd059
movq 0xbd0(%rbx), %rax
movslq 0xbe0(%rbx), %rcx
movq (%rax,%rcx,8), %rdi
movl 0x368(%rbx), %esi
movq 0x378(%rbx), %rdx
leaq 0x1602(%rbx), %r15
leaq 0x30(%rsp), %rcx
movq %r15, %r8
callq 0x1b465
cmpl $0x1, %eax
jne 0xccfce
leaq 0x244ef(%rip), %rsi     # 0xf13f0
leaq 0x5d28e(%rip), %rdx     # 0x12a196
leaq 0x40(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x24113(%rip), %rsi     # 0xf1034
leaq 0x5d045(%rip), %rdx     # 0x129f6d
movq %r15, %rdi
movl $0x3f0, %ecx            # imm = 0x3F0
jmp 0xccccc
leal (,%r13,8), %ecx
leaq 0x240c0(%rip), %rsi     # 0xf1004
leaq 0x5d0ff(%rip), %rdx     # 0x12a04a
leaq 0x40(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x240cc(%rip), %rsi     # 0xf1034
leaq 0x5cffe(%rip), %rdx     # 0x129f6d
movq %rbx, %rdi
movl $0x3ac, %ecx            # imm = 0x3AC
jmp 0xcd6d9
movq %rbx, %rdi
callq 0xcf4a5
testl %eax, %eax
je 0xcd4ec
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x24456(%rip), %rsi     # 0xf13f0
leaq 0x5d0eb(%rip), %rdx     # 0x12a08c
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x2407a(%rip), %rsi     # 0xf1034
leaq 0x5cfac(%rip), %rdx     # 0x129f6d
movq %rbx, %rdi
movl $0x3c6, %ecx            # imm = 0x3C6
jmp 0xcd6d9
cmpl $0x0, 0x4(%rbx)
jle 0xcd059
xorl %r13d, %r13d
leaq 0x38(%rsp), %r12
movq 0xbd0(%rbx), %rax
movslq 0xbec(%rbx), %rcx
addq %r13, %rcx
movq (%rax,%rcx,8), %rdi
movl 0x368(%rbx), %esi
movq 0x378(%rbx), %rdx
movq %r12, %rcx
movq %r15, %r8
callq 0x1b465
cmpl $0x1, %eax
je 0xcd5dc
movsd 0x38(%rsp), %xmm0
mulsd 0x27404(%rip), %xmm0    # 0xf4428
divsd 0x30(%rsp), %xmm0
movq 0xbc8(%rbx), %rax
movslq 0xbec(%rbx), %rcx
addq %r13, %rcx
mulsd (%rax,%rcx,8), %xmm0
addsd 0xbf8(%rbx), %xmm0
movsd %xmm0, 0xbf8(%rbx)
incq %r13
cmpl 0x4(%rbx), %r13d
jl 0xccfe0
movslq 0x368(%rbx), %r15
leaq (,%r15,8), %r13
movq %r13, %rdi
callq 0x8460
movq %rax, 0xc10(%rbx)
testq %rax, %rax
je 0xcd41a
movslq 0xbf0(%rbx), %r12
leaq (,%r12,8), %rdi
callq 0x8460
movq %rax, 0xbd8(%rbx)
testq %rax, %rax
je 0xcd460
testl %r12d, %r12d
jle 0xcd0d8
xorl %ebp, %ebp
movq %r13, %rdi
callq 0x8460
movq 0xbd8(%rbx), %rcx
movq %rax, (%rcx,%rbp,8)
movq 0xbd8(%rbx), %rax
cmpq $0x0, (%rax,%rbp,8)
je 0xcd4a6
incq %rbp
cmpq %rbp, %r12
jne 0xcd0ab
testl %r15d, %r15d
jle 0xcd1d0
movq 0xc10(%rbx), %rax
movl %r12d, %ecx
xorl %edx, %edx
movsd 0x2416b(%rip), %xmm0    # 0xf1260
movsd 0x24bd3(%rip), %xmm1    # 0xf1cd0
movq $0x0, (%rax,%rdx,8)
testl %r12d, %r12d
jle 0xcd1c4
movl 0xbe0(%rbx), %esi
movslq %esi, %rdi
movq 0xbd8(%rbx), %r8
xorl %r9d, %r9d
cmpq %r9, %rsi
jne 0xcd17c
xorpd %xmm2, %xmm2
cmpl $0x1, 0xce8(%rbx)
jne 0xcd19a
movq 0xbc8(%rbx), %r10
movq 0xbd0(%rbx), %r11
movsd (%r10,%rdi,8), %xmm3
movapd %xmm3, %xmm2
addsd %xmm0, %xmm2
mulsd %xmm3, %xmm2
mulsd %xmm3, %xmm3
mulsd %xmm1, %xmm3
movslq 0xbe8(%rbx), %r10
movq (%r11,%r10,8), %r10
mulsd (%r10,%rdx,8), %xmm3
movq (%r11,%rdi,8), %r10
mulsd (%r10,%rdx,8), %xmm2
addsd %xmm3, %xmm2
jmp 0xcd19a
movq 0xbc8(%rbx), %r10
movq 0xbd0(%rbx), %r11
movsd (%r10,%r9,8), %xmm2
movq (%r11,%r9,8), %r10
mulsd (%r10,%rdx,8), %xmm2
movq (%r8,%r9,8), %r10
movsd %xmm2, (%r10,%rdx,8)
movq (%r8,%r9,8), %r10
movsd (%r10,%rdx,8), %xmm2
addsd (%rax,%rdx,8), %xmm2
movsd %xmm2, (%rax,%rdx,8)
incq %r9
cmpq %r9, %rcx
jne 0xcd121
incq %rdx
cmpq %r15, %rdx
jne 0xcd0fd
cmpl $0x1, 0xce0(%rbx)
jne 0xcd278
cmpl $0x0, 0x368(%rbx)
jle 0xcd25a
xorl %r13d, %r13d
leaq 0x28(%rsp), %r15
leaq 0x20(%rsp), %r12
movq 0x370(%rbx), %rax
movsd (%rax,%r13,8), %xmm4
movq %rbx, %rdx
movsd 0x24065(%rip), %xmm0    # 0xf1270
movsd 0x5bc35(%rip), %xmm1    # 0x128e48
movsd 0x5bc35(%rip), %xmm2    # 0x128e50
movapd %xmm2, %xmm3
movq %r15, %rcx
movq %r12, %r8
callq 0xcfb62
testl %eax, %eax
jne 0xcd617
movsd 0x20(%rsp), %xmm0
movq 0xc10(%rbx), %rax
addsd (%rax,%r13,8), %xmm0
movsd %xmm0, (%rax,%r13,8)
incq %r13
movslq 0x368(%rbx), %rax
cmpq %rax, %r13
jl 0xcd1f3
movsd 0x28(%rsp), %xmm0
movq 0xbc8(%rbx), %rax
movslq 0xbe8(%rbx), %rcx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movq 0xbc8(%rbx), %rax
movslq 0xbe8(%rbx), %rcx
movsd (%rax,%rcx,8), %xmm0
movslq 0xbe4(%rbx), %rcx
movsd (%rax,%rcx,8), %xmm1
divsd 0x5bb99(%rip), %xmm1    # 0x128e38
mulsd 0x27181(%rip), %xmm0    # 0xf4428
addsd %xmm1, %xmm0
addsd 0xbf8(%rbx), %xmm0
movsd %xmm0, 0xc08(%rbx)
movl 0xce8(%rbx), %ecx
cmpl $0x1, %ecx
jne 0xcd2e6
movslq 0xbe0(%rbx), %rdx
movsd (%rax,%rdx,8), %xmm1
mulsd 0x2714e(%rip), %xmm1    # 0xf4428
addsd %xmm0, %xmm1
movsd %xmm1, 0xc08(%rbx)
movzwl 0x1600(%rbx), %edx
xorl %ebp, %ebp
cmpw $0x2, %dx
jl 0xcd6e8
cmpl $0x1, %ecx
setne %cl
cmpw $0x4, %dx
setl %dl
orb %cl, %dl
jne 0xcd32d
movslq 0xbe0(%rbx), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x8f8(%r14), %xmm1
leaq 0x5d013(%rip), %rdi     # 0x12a339
movb $0x2, %al
callq 0x8030
movq 0xbc8(%rbx), %rax
movslq 0xbe4(%rbx), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd 0x5bb10(%rip), %xmm0    # 0x128e58
leaq 0x5d04d(%rip), %rax     # 0x12a39c
leaq 0x5d0b3(%rip), %rdi     # 0x12a409
cmovaq %rax, %rdi
movb $0x1, %al
callq 0x8030
movq 0xbc8(%rbx), %rax
movslq 0xbe8(%rbx), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd 0x5bae4(%rip), %xmm0    # 0x128e60
leaq 0x5d09d(%rip), %rax     # 0x12a420
leaq 0x5d102(%rip), %rdi     # 0x12a48c
cmovaq %rax, %rdi
movb $0x1, %al
callq 0x8030
cmpl $0x4, (%rbx)
jne 0xcd3ff
cmpl $0x0, 0x4(%rbx)
je 0xcd3ff
cmpw $0x3, 0x1600(%rbx)
jl 0xcd3e9
cmpl $0x0, 0x4(%rbx)
jle 0xcd3e9
xorl %eax, %eax
leaq 0x5d0e9(%rip), %r14     # 0x12a4a2
leaq 0x1(%rax), %r15
movq 0xbc8(%rbx), %rcx
movslq 0xbec(%rbx), %rdx
addq %rax, %rdx
movsd (%rcx,%rdx,8), %xmm0
movq %r14, %rdi
movl %r15d, %esi
movb $0x1, %al
callq 0x8030
movq %r15, %rax
cmpl 0x4(%rbx), %r15d
jl 0xcd3b9
movsd 0xbf8(%rbx), %xmm0
leaq 0x5d0c8(%rip), %rdi     # 0x12a4c0
movb $0x1, %al
callq 0x8030
movsd 0xc08(%rbx), %xmm0
leaq 0x5d0ce(%rip), %rdi     # 0x12a4dc
movb $0x1, %al
callq 0x8030
jmp 0xcd6e8
shll $0x3, %r15d
leaq 0x23bdf(%rip), %rsi     # 0xf1004
leaq 0x5ce70(%rip), %rdx     # 0x12a29c
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movl %r15d, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x23be8(%rip), %rsi     # 0xf1034
leaq 0x5cb1a(%rip), %rdx     # 0x129f6d
movq %rbx, %rdi
movl $0x400, %ecx            # imm = 0x400
jmp 0xcd6d9
shll $0x3, %r12d
leaq 0x23b99(%rip), %rsi     # 0xf1004
leaq 0x5ce32(%rip), %rdx     # 0x12a2a4
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x23ba2(%rip), %rsi     # 0xf1034
leaq 0x5cad4(%rip), %rdx     # 0x129f6d
movq %rbx, %rdi
movl $0x404, %ecx            # imm = 0x404
jmp 0xcd6d9
shll $0x3, %r15d
leaq 0x23b53(%rip), %rsi     # 0xf1004
leaq 0x5cdfa(%rip), %rdx     # 0x12a2b2
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movl %r15d, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x23b5c(%rip), %rsi     # 0xf1034
leaq 0x5ca8e(%rip), %rdx     # 0x129f6d
movq %rbx, %rdi
movl $0x408, %ecx            # imm = 0x408
jmp 0xcd6d9
movslq 0x4(%rbx), %r12
leaq (,%r12,8), %rdi
callq 0x8460
testq %rax, %rax
je 0xcd659
movq %rax, %r15
cmpl $0x0, 0x368(%rbx)
jle 0xcd5c7
xorl %r13d, %r13d
leaq 0xc(%rsp), %r12
movq 0x370(%rbx), %rax
leaq (,%r13,8), %rcx
movsd (%rax,%r13,8), %xmm0
mulsd 0x380(%rbx), %xmm0
movq 0xbd0(%rbx), %rax
movslq 0xbe0(%rbx), %rdx
movq (%rax,%rdx,8), %rsi
addq %rcx, %rsi
movslq 0xbe8(%rbx), %rdx
movq (%rax,%rdx,8), %rdx
addq %rcx, %rdx
movslq 0xbe4(%rbx), %rdi
addq (%rax,%rdi,8), %rcx
movq %rbx, %rdi
movq %r15, %r8
movq %r12, %r9
callq 0xcf84a
testl %eax, %eax
jne 0xcd69c
movslq 0x4(%rbx), %rax
testq %rax, %rax
jle 0xcd5b4
movslq 0xbec(%rbx), %rcx
shlq $0x3, %rcx
addq 0xbd0(%rbx), %rcx
xorl %edx, %edx
movsd (%r15,%rdx,8), %xmm0
movq (%rcx,%rdx,8), %rsi
movsd %xmm0, (%rsi,%r13,8)
incq %rdx
cmpq %rdx, %rax
jne 0xcd59c
incq %r13
movslq 0x368(%rbx), %rax
cmpq %rax, %r13
jl 0xcd51e
movq %rbx, %rdi
callq 0xcfaee
movq %r15, %rdi
callq 0x8410
jmp 0xccea0
leaq 0x23e0d(%rip), %rsi     # 0xf13f0
leaq 0x5cc2a(%rip), %rdx     # 0x12a214
leaq 0x40(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x23a31(%rip), %rsi     # 0xf1034
leaq 0x5c963(%rip), %rdx     # 0x129f6d
movq %r15, %rdi
movl $0x3f8, %ecx            # imm = 0x3F8
jmp 0xccccc
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x23dcb(%rip), %rsi     # 0xf13f0
leaq 0x5cca0(%rip), %rdx     # 0x12a2cc
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x239ef(%rip), %rsi     # 0xf1034
leaq 0x5c921(%rip), %rdx     # 0x129f6d
movq %rbx, %rdi
movl $0x434, %ecx            # imm = 0x434
jmp 0xcd6d9
shll $0x3, %r12d
leaq 0x239a0(%rip), %rsi     # 0xf1004
leaq 0x2611f(%rip), %rdx     # 0xf378a
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x239a9(%rip), %rsi     # 0xf1034
leaq 0x5c8db(%rip), %rdx     # 0x129f6d
movq %rbx, %rdi
movl $0x3cb, %ecx            # imm = 0x3CB
jmp 0xcd6d9
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x23d46(%rip), %rsi     # 0xf13f0
leaq 0x5c9fb(%rip), %rdx     # 0x12a0ac
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x2396a(%rip), %rsi     # 0xf1034
leaq 0x5c89c(%rip), %rdx     # 0x129f6d
movq %rbx, %rdi
movl $0x3d7, %ecx            # imm = 0x3D7
movq %r14, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %ebp
movl %ebp, %eax
addq $0x848, %rsp            # imm = 0x848
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq