// File: /workspace/github_c_makefile_star2_O1/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 0xd5051
movsd (%r14), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x20(%r14), %xmm0
xorps 0x1c212(%rip), %xmm0    # 0xf1230
movaps %xmm0, 0x10(%rsp)
movsd 0x1c235(%rip), %xmm2    # 0xf1260
movsd 0x28(%r14), %xmm0
addsd %xmm2, %xmm0
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
callq 0x82c0
mulsd %xmm0, %xmm0
mulsd 0x10(%rsp), %xmm0
jmp 0xd50f8
movsd 0x38(%r14), %xmm2
movsd %xmm2, 0x30(%rsp)
movsd (%r14), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x20(%r14), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x1c1e4(%rip), %xmm2    # 0xf1260
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 0xd50ba
movsd 0x1c1b2(%rip), %xmm1    # 0xf1260
addsd %xmm1, %xmm0
addsd 0x30(%r14), %xmm1
jmp 0xd50d0
movupd 0x30(%r14), %xmm1
addpd 0x1f858(%rip), %xmm1    # 0xf4920
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 0xd5181
movsd 0x40(%r14), %xmm0
movsd %xmm0, (%rsp)
movsd 0x1c13c(%rip), %xmm0    # 0xf1260
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 0x1d523(%rip), %xmm1    # 0xf2680
movsd 0x8(%rsp), %xmm0
callq 0x8620
movsd (%rsp), %xmm3
movsd 0x10(%rsp), %xmm2
divsd %xmm0, %xmm3
addsd 0x1c0e1(%rip), %xmm3    # 0xf1260
jmp 0xd5189
movsd 0x1c0d7(%rip), %xmm3    # 0xf1260
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