// File: /workspace/github_c_makefile_star2_O3/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, %rbx
movq %rdi, %r14
movl $0x0, 0x14(%rsp)
movslq 0xbf0(%rcx), %r15
movq %r15, %r13
shlq $0x3, %r13
movq %r13, %rdi
callq 0x8460
movq %rax, 0xbc8(%rbx)
testq %rax, %rax
je 0xc93ad
testl %r15d, %r15d
jle 0xc9279
leaq 0x1602(%rbx), %r12
xorl %ebp, %ebp
movq 0xc00(%rbx), %rdi
movq 0xbc0(%rbx), %rax
leaq (,%rbp,8), %r8
movq (%rax,%rbp,8), %rsi
movl 0x330(%rbx), %edx
movq 0x348(%rbx), %rcx
addq 0xbc8(%rbx), %r8
movq %r12, %r9
callq 0x1b547
cmpl $0x1, %eax
je 0xc93f4
movslq 0xbec(%rbx), %rax
cmpq %rax, %rbp
jl 0xc9258
movq 0x340(%rbx), %rax
movsd 0x8(%rax), %xmm0
movsd 0x2504e(%rip), %xmm1    # 0xee260
addsd %xmm1, %xmm0
callq 0x82c0
movsd %xmm0, 0x8(%rsp)
movq 0x340(%rbx), %rax
movsd (%rax), %xmm0
addsd 0x2502c(%rip), %xmm0    # 0xee260
callq 0x82c0
movsd 0x8(%rsp), %xmm1
subsd %xmm0, %xmm1
movq 0xbc8(%rbx), %rax
movsd (%rax,%rbp,8), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rbp,8)
incq %rbp
movl 0xbf0(%rbx), %r15d
movslq %r15d, %r13
cmpq %r13, %rbp
jl 0xc91b3
movq 0xbc8(%rbx), %rax
shlq $0x3, %r13
movslq 0xbe0(%rbx), %rcx
movsd 0x282f8(%rip), %xmm0    # 0xf1580
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 0x5cbad(%rip), %xmm0    # 0x125e68
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)
movq %r13, %rdi
callq 0x8460
movq %rax, 0xbd0(%rbx)
testq %rax, %rax
je 0xc9432
movq %r14, 0x18(%rsp)
testl %r15d, %r15d
jle 0xc9343
movq %rax, %r12
movslq 0x368(%rbx), %rbp
movq %rbp, %r13
shlq $0x3, %r13
movl %r15d, %r15d
xorl %r14d, %r14d
movq %r13, %rdi
callq 0x8460
movq %rax, (%r12,%r14,8)
movq 0xbd0(%rbx), %r12
cmpq $0x0, (%r12,%r14,8)
je 0xc9699
incq %r14
cmpq %r14, %r15
jne 0xc931d
cmpl $0x4, (%rbx)
jne 0xc9478
cmpl $0x0, 0x4(%rbx)
je 0xc9478
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
callq 0xcb4b8
testl %eax, %eax
je 0xc96df
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x25077(%rip), %rsi     # 0xee3f0
leaq 0x5dd12(%rip), %rdx     # 0x127092
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x24c9b(%rip), %rsi     # 0xee034
leaq 0x5dbf5(%rip), %rdx     # 0x126f95
movq %rbx, %rdi
movl $0x3c3, %ecx            # imm = 0x3C3
jmp 0xc9a99
leal (,%r15,8), %ecx
leaq 0x24c48(%rip), %rsi     # 0xee004
leaq 0x5dbba(%rip), %rdx     # 0x126f7d
leaq 0x50(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x24c54(%rip), %rsi     # 0xee034
leaq 0x5dbae(%rip), %rdx     # 0x126f95
movq %rbx, %rdi
movl $0x38a, %ecx            # imm = 0x38A
jmp 0xc9a99
leaq 0x24ff5(%rip), %rsi     # 0xee3f0
leaq 0x5dbb7(%rip), %rdx     # 0x126fb9
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x24c19(%rip), %rsi     # 0xee034
leaq 0x5db73(%rip), %rdx     # 0x126f95
movq %r12, %rdi
movl $0x396, %ecx            # imm = 0x396
movq %rbx, %r8
jmp 0xc9a9c
shll $0x3, %r15d
leaq 0x24bc7(%rip), %rsi     # 0xee004
leaq 0x5dc1a(%rip), %rdx     # 0x12705e
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movl %r15d, %ecx
xorl %eax, %eax
callq 0x30af0
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x24bd0(%rip), %rsi     # 0xee034
leaq 0x5db2a(%rip), %rdx     # 0x126f95
movq %rbx, %rdi
movl $0x3a8, %ecx            # imm = 0x3A8
jmp 0xc9a99
cmpl $0x0, 0x368(%rbx)
jle 0xc9604
movq 0x370(%rbx), %rax
xorl %r15d, %r15d
movsd (%rax,%r15,8), %xmm0
movsd 0x27f9b(%rip), %xmm1    # 0xf1438
callq 0x8620
movsd %xmm0, 0x8(%rsp)
movq 0x370(%rbx), %rax
movsd (%rax,%r15,8), %xmm0
movapd 0x24d73(%rip), %xmm1    # 0xee230
xorpd %xmm1, %xmm0
callq 0x8670
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x370(%rbx), %rax
movsd (%rax,%r15,8), %xmm0
xorpd 0x24d49(%rip), %xmm0    # 0xee230
callq 0x8670
movsd 0x24d6c(%rip), %xmm1    # 0xee260
subsd %xmm0, %xmm1
mulsd %xmm1, %xmm1
movsd 0x8(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x8(%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, 0x20(%rsp)
xorpd 0x24cf1(%rip), %xmm0    # 0xee230
callq 0x8670
addsd 0x24d14(%rip), %xmm0    # 0xee260
mulsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movq 0x370(%rbx), %rax
movsd (%rax,%r15,8), %xmm0
xorpd 0x24cc3(%rip), %xmm0    # 0xee230
callq 0x8670
movsd 0x24ce6(%rip), %xmm2    # 0xee260
movapd %xmm2, %xmm1
subsd %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
divsd %xmm1, %xmm0
addsd 0x27ed4(%rip), %xmm0    # 0xf1468
mulsd 0x8(%rsp), %xmm0
movq 0xbd0(%rbx), %rcx
movslq 0xbe8(%rbx), %rax
movq (%rcx,%rax,8), %rax
movsd %xmm0, (%rax,%r15,8)
movslq 0xbe0(%rbx), %rax
movq (%rcx,%rax,8), %rdx
movq 0x370(%rbx), %rax
movapd %xmm2, %xmm0
divsd (%rax,%r15,8), %xmm0
movsd 0x5c89a(%rip), %xmm1    # 0x125e70
subsd %xmm0, %xmm1
mulsd (%rdx,%r15,8), %xmm1
movslq 0xbe4(%rbx), %rdx
movq (%rcx,%rdx,8), %rcx
movsd %xmm1, (%rcx,%r15,8)
incq %r15
movslq 0x368(%rbx), %rcx
cmpq %rcx, %r15
jl 0xc948f
movq $0x0, 0xbf8(%rbx)
cmpl $0x4, (%rbx)
jne 0xc97c0
cmpl $0x0, 0x4(%rbx)
je 0xc97c0
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 0x40(%rsp), %rcx
movq %r15, %r8
callq 0x1b518
cmpl $0x1, %eax
jne 0xc9731
leaq 0x24d8b(%rip), %rsi     # 0xee3f0
leaq 0x5db52(%rip), %rdx     # 0x1271be
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x249af(%rip), %rsi     # 0xee034
leaq 0x5d909(%rip), %rdx     # 0x126f95
movq %r15, %rdi
movl $0x3f0, %ecx            # imm = 0x3F0
jmp 0xc942a
leal (,%rbp,8), %ecx
leaq 0x2495d(%rip), %rsi     # 0xee004
leaq 0x5d9c4(%rip), %rdx     # 0x127072
leaq 0x50(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x24969(%rip), %rsi     # 0xee034
leaq 0x5d8c3(%rip), %rdx     # 0x126f95
movq %rbx, %rdi
movl $0x3ac, %ecx            # imm = 0x3AC
jmp 0xc9a99
movq %rbx, %rdi
callq 0xcbc14
testl %eax, %eax
je 0xc9ae1
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x24cf3(%rip), %rsi     # 0xee3f0
leaq 0x5d9b0(%rip), %rdx     # 0x1270b4
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x24917(%rip), %rsi     # 0xee034
leaq 0x5d871(%rip), %rdx     # 0x126f95
movq %rbx, %rdi
movl $0x3c6, %ecx            # imm = 0x3C6
jmp 0xc9a99
cmpl $0x0, 0x4(%rbx)
jle 0xc97c0
movl 0xbec(%rbx), %eax
xorl %r13d, %r13d
leaq 0x48(%rsp), %r12
movq 0xbd0(%rbx), %rcx
cltq
addq %r13, %rax
movq (%rcx,%rax,8), %rdi
movl 0x368(%rbx), %esi
movq 0x378(%rbx), %rdx
movq %r12, %rcx
movq %r15, %r8
callq 0x1b518
cmpl $0x1, %eax
je 0xc9bd1
movsd 0x48(%rsp), %xmm0
mulsd 0x27cb0(%rip), %xmm0    # 0xf1438
divsd 0x40(%rsp), %xmm0
movq 0xbc8(%rbx), %rcx
movslq 0xbec(%rbx), %rax
movq %rax, %rdx
addq %r13, %rdx
mulsd (%rcx,%rdx,8), %xmm0
addsd 0xbf8(%rbx), %xmm0
movsd %xmm0, 0xbf8(%rbx)
incq %r13
cmpl 0x4(%rbx), %r13d
jl 0xc9749
movslq 0x368(%rbx), %r15
leaq (,%r15,8), %rbp
movq %rbp, %rdi
callq 0x8460
movq %rax, 0xc10(%rbx)
testq %rax, %rax
je 0xc99cf
movslq 0xbf0(%rbx), %rdi
movl %edi, %r12d
shlq $0x3, %rdi
callq 0x8460
movq %rax, 0xbd8(%rbx)
testq %rax, %rax
je 0xc9a15
movq %rax, %r13
testl %r12d, %r12d
jle 0xc983d
xorl %r14d, %r14d
movq %rbp, %rdi
callq 0x8460
movq %rax, (%r13,%r14,8)
movq 0xbd8(%rbx), %r13
cmpq $0x0, (%r13,%r14,8)
je 0xc9a58
incq %r14
cmpq %r14, %r12
jne 0xc9815
testl %r15d, %r15d
movq 0x18(%rsp), %r14
jle 0xc9abc
movq 0xc10(%rbx), %rax
xorl %ecx, %ecx
movsd 0x24a04(%rip), %xmm0    # 0xee260
movsd 0x2546c(%rip), %xmm1    # 0xeecd0
movq $0x0, (%rax,%rcx,8)
testl %r12d, %r12d
jle 0xc992e
movl 0xbe0(%rbx), %edx
movslq %edx, %rsi
xorl %edi, %edi
cmpq %rdi, %rdx
jne 0xc98e1
xorpd %xmm2, %xmm2
cmpl $0x1, 0xce8(%rbx)
movq %rdx, %r8
jne 0xc9902
movq 0xbc8(%rbx), %r8
movq 0xbd0(%rbx), %r9
movsd (%r8,%rsi,8), %xmm3
movapd %xmm3, %xmm2
addsd %xmm0, %xmm2
mulsd %xmm3, %xmm2
movq (%r9,%rsi,8), %r8
mulsd %xmm3, %xmm3
mulsd %xmm1, %xmm3
movslq 0xbe8(%rbx), %r10
movq (%r9,%r10,8), %r9
mulsd (%r9,%rcx,8), %xmm3
mulsd (%r8,%rcx,8), %xmm2
addsd %xmm3, %xmm2
movq %rdx, %r8
jmp 0xc9902
movq 0xbc8(%rbx), %r8
movq 0xbd0(%rbx), %r9
movsd (%r8,%rdi,8), %xmm2
movq (%r9,%rdi,8), %r8
mulsd (%r8,%rcx,8), %xmm2
movq %rdi, %r8
movq (%r13,%r8,8), %r8
movsd %xmm2, (%r8,%rcx,8)
movq (%r13,%rdi,8), %r8
movsd (%r8,%rcx,8), %xmm2
addsd (%rax,%rcx,8), %xmm2
movsd %xmm2, (%rax,%rcx,8)
incq %rdi
cmpq %rdi, %r12
jne 0xc9880
incq %rcx
cmpq %r15, %rcx
jne 0xc9864
cmpl $0x1, 0xce0(%rbx)
jne 0xc9ac9
testl %r15d, %r15d
jle 0xc9c0c
xorl %r13d, %r13d
leaq 0x38(%rsp), %r15
leaq 0x30(%rsp), %r12
movq 0x370(%rbx), %rax
movsd (%rax,%r13,8), %xmm4
movq %rbx, %rdx
movsd 0x248fb(%rip), %xmm0    # 0xee270
movsd 0x5c4fb(%rip), %xmm1    # 0x125e78
movsd 0x5c4fb(%rip), %xmm2    # 0x125e80
movapd %xmm2, %xmm3
movq %r15, %rcx
movq %r12, %r8
callq 0xcc2d1
testl %eax, %eax
jne 0xc9e00
movsd 0x30(%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 0xc995d
movsd 0x38(%rsp), %xmm0
jmp 0xc9c0c
shll $0x3, %r15d
leaq 0x2462a(%rip), %rsi     # 0xee004
leaq 0x5d8e3(%rip), %rdx     # 0x1272c4
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movl %r15d, %ecx
xorl %eax, %eax
callq 0x30af0
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x24633(%rip), %rsi     # 0xee034
leaq 0x5d58d(%rip), %rdx     # 0x126f95
movq %rbx, %rdi
movl $0x400, %ecx            # imm = 0x400
jmp 0xc9a99
shll $0x3, %r12d
leaq 0x245e4(%rip), %rsi     # 0xee004
leaq 0x5d8a5(%rip), %rdx     # 0x1272cc
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x30af0
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x245ed(%rip), %rsi     # 0xee034
leaq 0x5d547(%rip), %rdx     # 0x126f95
movq %rbx, %rdi
movl $0x404, %ecx            # imm = 0x404
jmp 0xc9a99
shll $0x3, %r15d
leaq 0x245a1(%rip), %rsi     # 0xee004
leaq 0x5d870(%rip), %rdx     # 0x1272da
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movl %r15d, %ecx
xorl %eax, %eax
callq 0x30af0
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x245aa(%rip), %rsi     # 0xee034
leaq 0x5d504(%rip), %rdx     # 0x126f95
movq %rbx, %rdi
movl $0x408, %ecx            # imm = 0x408
movq %r14, %r8
xorl %eax, %eax
callq 0x30af0
movl $0x1, %ebp
movl %ebp, %eax
addq $0x858, %rsp            # imm = 0x858
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x1, 0xce0(%rbx)
je 0xc9c0c
movq 0xbc8(%rbx), %rax
movslq 0xbe8(%rbx), %rcx
movsd (%rax,%rcx,8), %xmm0
jmp 0xc9c24
movslq 0x4(%rbx), %r12
leaq (,%r12,8), %rdi
callq 0x8460
testq %rax, %rax
je 0xc9dba
movq %rax, %r15
cmpl $0x0, 0x368(%rbx)
jle 0xc9bbc
xorl %r13d, %r13d
leaq 0x14(%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 0xcbfb9
testl %eax, %eax
jne 0xc9e42
movslq 0x4(%rbx), %rax
testq %rax, %rax
jle 0xc9ba9
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 0xc9b91
incq %r13
movslq 0x368(%rbx), %rax
cmpq %rax, %r13
jl 0xc9b13
movq %rbx, %rdi
callq 0xcc25d
movq %r15, %rdi
callq 0x8410
jmp 0xc9604
leaq 0x24818(%rip), %rsi     # 0xee3f0
leaq 0x5d65d(%rip), %rdx     # 0x12723c
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x2443c(%rip), %rsi     # 0xee034
leaq 0x5d396(%rip), %rdx     # 0x126f95
movq %r15, %rdi
movl $0x3f8, %ecx            # imm = 0x3F8
jmp 0xc942a
movq 0xbc8(%rbx), %rax
movslq 0xbe8(%rbx), %rcx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movslq 0xbe4(%rbx), %rcx
movsd (%rax,%rcx,8), %xmm1
divsd 0x5c230(%rip), %xmm1    # 0x125e68
mulsd 0x277f8(%rip), %xmm0    # 0xf1438
addsd %xmm1, %xmm0
addsd 0xbf8(%rbx), %xmm0
movsd %xmm0, 0xc08(%rbx)
movl 0xce8(%rbx), %edx
cmpl $0x1, %edx
jne 0xc9c7f
movslq 0xbe0(%rbx), %rsi
movsd (%rax,%rsi,8), %xmm1
mulsd 0x277c5(%rip), %xmm1    # 0xf1438
addsd %xmm0, %xmm1
movsd %xmm1, 0xc08(%rbx)
movzwl 0x1600(%rbx), %esi
xorl %ebp, %ebp
cmpw $0x2, %si
jl 0xc9aa8
cmpl $0x1, %edx
setne %dl
cmpw $0x4, %si
setb %sil
orb %dl, %sil
jne 0xc9cd6
movslq 0xbe0(%rbx), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x8f8(%r14), %xmm1
leaq 0x5d6a0(%rip), %rdi     # 0x127361
movb $0x2, %al
callq 0x8030
movq 0xbc8(%rbx), %rax
movslq 0xbe4(%rbx), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd 0x5c1a5(%rip), %xmm0    # 0x125e88
leaq 0x5d6da(%rip), %rax     # 0x1273c4
leaq 0x5d740(%rip), %rdi     # 0x127431
cmovaq %rax, %rdi
movb $0x1, %al
callq 0x8030
movq 0xbc8(%rbx), %rax
movslq 0xbe8(%rbx), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd 0x5c179(%rip), %xmm0    # 0x125e90
leaq 0x5d72a(%rip), %rax     # 0x127448
leaq 0x5d78f(%rip), %rdi     # 0x1274b4
cmovaq %rax, %rdi
movb $0x1, %al
callq 0x8030
cmpl $0x4, (%rbx)
jne 0xc9d9f
movl 0x4(%rbx), %eax
testl %eax, %eax
je 0xc9d9f
cmpw $0x3, 0x1600(%rbx)
setl %cl
testl %eax, %eax
setle %al
orb %cl, %al
jne 0xc9d89
xorl %eax, %eax
leaq 0x5d771(%rip), %r14     # 0x1274ca
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 0xc9d59
movsd 0xbf8(%rbx), %xmm0
leaq 0x5d750(%rip), %rdi     # 0x1274e8
movb $0x1, %al
callq 0x8030
movsd 0xc08(%rbx), %xmm0
leaq 0x5d756(%rip), %rdi     # 0x127504
movb $0x1, %al
callq 0x8030
jmp 0xc9aa8
shll $0x3, %r12d
leaq 0x2423f(%rip), %rsi     # 0xee004
leaq 0x269ce(%rip), %rdx     # 0xf079a
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x30af0
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x24248(%rip), %rsi     # 0xee034
leaq 0x5d1a2(%rip), %rdx     # 0x126f95
movq %rbx, %rdi
movl $0x3cb, %ecx            # imm = 0x3CB
jmp 0xc9a99
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x245e2(%rip), %rsi     # 0xee3f0
leaq 0x5d4df(%rip), %rdx     # 0x1272f4
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x24206(%rip), %rsi     # 0xee034
leaq 0x5d160(%rip), %rdx     # 0x126f95
movq %rbx, %rdi
movl $0x434, %ecx            # imm = 0x434
jmp 0xc9a99
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x245a0(%rip), %rsi     # 0xee3f0
leaq 0x5d27d(%rip), %rdx     # 0x1270d4
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x241c4(%rip), %rsi     # 0xee034
leaq 0x5d11e(%rip), %rdx     # 0x126f95
movq %rbx, %rdi
movl $0x3d7, %ecx            # imm = 0x3D7
jmp 0xc9a99