// File: /workspace/github_c_makefile_star2_O3/PoulinV[P]AxiCLASS/build/../external/heating/injection.c
// Function: injection_rate_DM_annihilation
int injection_rate_DM_annihilation(struct injection * pin,
                                   double z,
                                   double * energy_rate){

  /** - Define local variables */
  double annihilation_at_z, boost_factor;

  /** - Calculate change in the annihilation efficiency */
  if (z>pin->DM_annihilation_zmax) {
    annihilation_at_z = pin->DM_annihilation_efficiency*
                        exp(-pin->DM_annihilation_variation*pow(log((pin->DM_annihilation_z+1.)/(pin->DM_annihilation_zmax+1.)),2));
  }
  else if (z>pin->DM_annihilation_zmin) {
    annihilation_at_z = pin->DM_annihilation_efficiency*
                        exp(pin->DM_annihilation_variation*(-pow(log((pin->DM_annihilation_z+1.)/(pin->DM_annihilation_zmax+1.)),2)
                                         +pow(log((z+1.)/(pin->DM_annihilation_zmax+1.)),2)));
  }
  else {
    annihilation_at_z = pin->DM_annihilation_efficiency*
                        exp(pin->DM_annihilation_variation*(-pow(log((pin->DM_annihilation_z+1.)/(pin->DM_annihilation_zmax+1.)),2)
                                         +pow(log((pin->DM_annihilation_zmin+1.)/(pin->DM_annihilation_zmax+1.)),2)));
  }

  /** - Calculate boost factor due to annihilation in halos */
  if(pin->DM_annihilation_z_halo > 0.){
    boost_factor = pin->DM_annihilation_f_halo * erfc((1+z)/(1+pin->DM_annihilation_z_halo)) / pow(1.+z,3);
  }
  else{
    boost_factor = 0;
  }

  /** - Calculate injection rates */
  *energy_rate = pow(pin->rho_cdm,2.)*annihilation_at_z*(1.+boost_factor);           // [J/(m^3 s)]

  return _SUCCESS_;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movsd 0x30(%rdi), %xmm1
ucomisd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
jbe 0xd1843
movsd (%r14), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x20(%r14), %xmm0
xorps 0x1ca20(%rip), %xmm0    # 0xee230
movaps %xmm0, 0x10(%rsp)
movsd 0x1ca43(%rip), %xmm2    # 0xee260
movsd 0x28(%r14), %xmm0
addsd %xmm2, %xmm0
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
callq 0x82c0
mulsd %xmm0, %xmm0
mulsd 0x10(%rsp), %xmm0
jmp 0xd18ea
movsd 0x38(%r14), %xmm2
movsd %xmm2, 0x30(%rsp)
movsd (%r14), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x20(%r14), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x1c9f2(%rip), %xmm2    # 0xee260
movsd 0x28(%r14), %xmm0
addsd %xmm2, %xmm0
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
callq 0x82c0
movsd %xmm0, (%rsp)
movsd 0x8(%rsp), %xmm0
ucomisd 0x30(%rsp), %xmm0
jbe 0xd18ac
movsd 0x1c9c0(%rip), %xmm1    # 0xee260
addsd %xmm1, %xmm0
addsd 0x30(%r14), %xmm1
jmp 0xd18c2
movupd 0x30(%r14), %xmm1
addpd 0x20076(%rip), %xmm1    # 0xf1930
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
divsd %xmm1, %xmm0
callq 0x82c0
mulsd %xmm0, %xmm0
movsd (%rsp), %xmm1
mulsd %xmm1, %xmm1
subsd %xmm1, %xmm0
movsd 0x10(%rsp), %xmm1
mulsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0x8670
movapd %xmm0, %xmm2
movsd 0x48(%r14), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jbe 0xd1973
movsd 0x40(%r14), %xmm0
movsd %xmm0, (%rsp)
movsd 0x1c94a(%rip), %xmm0    # 0xee260
movsd 0x8(%rsp), %xmm3
addsd %xmm0, %xmm3
movsd %xmm3, 0x8(%rsp)
addsd %xmm0, %xmm1
movapd %xmm3, %xmm0
divsd %xmm1, %xmm0
movsd %xmm2, 0x10(%rsp)
callq 0x8610
mulsd (%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd 0x1dd31(%rip), %xmm1    # 0xef680
movsd 0x8(%rsp), %xmm0
callq 0x8620
movsd (%rsp), %xmm3
movsd 0x10(%rsp), %xmm2
divsd %xmm0, %xmm3
addsd 0x1c8ef(%rip), %xmm3    # 0xee260
jmp 0xd197b
movsd 0x1c8e5(%rip), %xmm3    # 0xee260
movsd 0x28(%rsp), %xmm1
mulsd %xmm2, %xmm1
movsd 0x410(%r14), %xmm0
mulsd %xmm0, %xmm0
mulsd %xmm1, %xmm0
mulsd %xmm3, %xmm0
movsd %xmm0, (%rbx)
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r14
retq