// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../external/heating/noninjection.c
// Function: noninjection_rate_acoustic_diss
int noninjection_rate_acoustic_diss(struct noninjection * pni,
                                    double z,
                                    double * energy_rate){

  /** Define local variables */
  int index_k;
  double dQrho_dz;
  double A_wkb;

  /** a) Calculate full function */
  // CURRENTLY NOT YET IMPLEMENTED

  /** b) Calculate approximated function */
  if (_TRUE_){

    A_wkb = 1./(1.+4./15.*pni->f_nu_wkb);

    /* Define integrand for approximated function */
    for (index_k=0; index_k<pni->k_size; index_k++) {
      pni->integrand_approx[index_k] = 4.*A_wkb*A_wkb*pow(pni->k[index_k],1.)*
                              pni->pk_primordial_k[index_k]*
                              exp(-2.*pow(pni->k[index_k]/pni->kD,2.))*
                              pni->dkD_dz;
    }

    class_call(array_trapezoidal_integral(pni->integrand_approx,
                                          pni->k_size,
                                          pni->k_weights,
                                          &dQrho_dz,
                                          pni->error_message),
               pni->error_message,
               pni->error_message);

  }

  *energy_rate = dQrho_dz*pni->H*pni->rho_g/pni->a;                                                 // [J/(m^3 s)]

  return _SUCCESS_;
}

// Assembly:
subq $0x848, %rsp            # imm = 0x848
movq %rdi, 0x838(%rsp)
movsd %xmm0, 0x830(%rsp)
movq %rsi, 0x828(%rsp)
movq 0x838(%rsp), %rax
movsd 0x78(%rax), %xmm1
movsd 0x511eb(%rip), %xmm0    # 0x1f62c0
mulsd %xmm0, %xmm1
movsd 0x2d167(%rip), %xmm0    # 0x1d2248
addsd %xmm0, %xmm1
movsd 0x2d15b(%rip), %xmm0    # 0x1d2248
divsd %xmm1, %xmm0
movsd %xmm0, 0x810(%rsp)
movl $0x0, 0x824(%rsp)
movl 0x824(%rsp), %eax
movq 0x838(%rsp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x1a5223
movsd 0x303a3(%rip), %xmm0    # 0x1d54c8
mulsd 0x810(%rsp), %xmm0
mulsd 0x810(%rsp), %xmm0
movsd %xmm0, (%rsp)
movq 0x838(%rsp), %rax
movq 0x18(%rax), %rax
movslq 0x824(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x2d0eb(%rip), %xmm1    # 0x1d2248
callq 0x8610
movaps %xmm0, %xmm1
movsd (%rsp), %xmm0
mulsd %xmm1, %xmm0
movq 0x838(%rsp), %rax
movq 0x28(%rax), %rax
movslq 0x824(%rsp), %rcx
mulsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x838(%rsp), %rax
movq 0x18(%rax), %rax
movslq 0x824(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x838(%rsp), %rax
divsd 0x88(%rax), %xmm0
movsd 0x2dac2(%rip), %xmm1    # 0x1d2c80
callq 0x8610
movaps %xmm0, %xmm1
movsd 0x2e5b2(%rip), %xmm0    # 0x1d3780
mulsd %xmm1, %xmm0
callq 0x8670
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
mulsd %xmm1, %xmm0
movq 0x838(%rsp), %rax
mulsd 0x80(%rax), %xmm0
movq 0x838(%rsp), %rax
movq 0x30(%rax), %rax
movslq 0x824(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x824(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x824(%rsp)
jmp 0x1a5105
movq 0x838(%rsp), %rax
movq 0x30(%rax), %rdi
movq 0x838(%rsp), %rax
movl 0x10(%rax), %esi
movq 0x838(%rsp), %rax
movq 0x20(%rax), %rdx
movq 0x838(%rsp), %r8
addq $0x110, %r8             # imm = 0x110
leaq 0x818(%rsp), %rcx
callq 0x2ab10
cmpl $0x1, %eax
jne 0x1a52cb
leaq 0x10(%rsp), %rdi
movq 0x838(%rsp), %rcx
addq $0x110, %rcx            # imm = 0x110
leaq 0x2d156(%rip), %rsi     # 0x1d23d8
leaq 0x6927e(%rip), %rdx     # 0x20e507
movb $0x0, %al
callq 0x5b9c0
movq 0x838(%rsp), %rdi
addq $0x110, %rdi            # imm = 0x110
leaq 0x10(%rsp), %r8
leaq 0x2cd89(%rip), %rsi     # 0x1d2034
leaq 0x692c3(%rip), %rdx     # 0x20e575
movl $0x16c, %ecx            # imm = 0x16C
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x844(%rsp)
jmp 0x1a531b
movsd 0x818(%rsp), %xmm0
movq 0x838(%rsp), %rax
mulsd 0xc8(%rax), %xmm0
movq 0x838(%rsp), %rax
mulsd 0xd8(%rax), %xmm0
movq 0x838(%rsp), %rax
divsd 0xd0(%rax), %xmm0
movq 0x828(%rsp), %rax
movsd %xmm0, (%rax)
movl $0x0, 0x844(%rsp)
movl 0x844(%rsp), %eax
addq $0x848, %rsp            # imm = 0x848
retq
nopw (%rax,%rax)