// File: /workspace/github_c_makefile_star2_O2/PoulinV[P]AxiCLASS/build/../external/HyRec2020/energy_injection.c
// Function: dEdtdV_DM_ann
double dEdtdV_DM_ann(double z, INJ_PARAMS *params){

  double pann_tot, u_min, erfc;
  double zp1, zp1_ann, zp1_max, zp1_min, var, zp1_halo;                        
   
  var       = params->ann_var;
  zp1       = z + 1.; 
  zp1_ann   = params->ann_z + 1.;
  zp1_max   = params->ann_zmax + 1.; 
  zp1_halo  = params->ann_z_halo + 1.; 
  zp1_min   = params->ann_zmin + 1.; 
  
  pann_tot = 0.;
  
  /* Dark matter annihilation in the smooth background */
  if (params->pann > 0.) {

    /* Parametrized variation of pann */
    if (zp1 > zp1_max) pann_tot = params->pann *exp(-var *square(log(zp1_ann/zp1_max)));
    else if (zp1 > zp1_min) {
      pann_tot = params->pann *exp(var*(-square(log(zp1_ann/zp1_max))
				+square(log(zp1/zp1_max))));
    }
    else {
      pann_tot = params->pann *exp(var*(-square(log(zp1_ann/zp1_max))
				+square(log(zp1_min/zp1_max))));
    }
	pann_tot = pann_tot*pow(zp1,3.);
  }
  
  /* Dark matter annihilation in haloes */
  if (params->pann_halo > 0.) {
    u_min = zp1/zp1_halo;
    erfc  = pow(1.+0.278393*u_min+0.230389*u_min*u_min+0.000972*u_min*u_min*u_min+0.078108*u_min*u_min*u_min*u_min,-4); 
    pann_tot += params->pann_halo *erfc;
  }
  
  return square(10537.4*params->odmh2) * zp1*zp1*zp1*1e-9* pann_tot
        +10537.4*params->odmh2*pow((1+z),3)*params->decay;
  /* the prefactor is 3 H100^2/(8 Pi G) c^2 in eV/cm^3, H100 = 100km/s/Mpc */
  /* pann is given in cm^3/s/GeV, multiply by 1e-9 to get cm^3/s/eV */
  
}

// Assembly:
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
movsd 0x8(%rdi), %xmm1
movsd 0x108f7(%rip), %xmm4    # 0xe5260
addsd %xmm4, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x38(%rdi), %xmm2
addsd %xmm4, %xmm2
xorpd %xmm3, %xmm3
ucomisd %xmm3, %xmm1
xorpd %xmm0, %xmm0
jbe 0xd4a6d
movsd %xmm1, 0x8(%rsp)
movsd %xmm2, (%rsp)
movsd 0x30(%rbx), %xmm0
movaps %xmm0, 0x20(%rsp)
movsd 0x20(%rbx), %xmm1
addsd %xmm4, %xmm1
movsd %xmm1, 0x38(%rsp)
addsd 0x28(%rbx), %xmm4
movsd %xmm4, 0x30(%rsp)
movsd 0x18(%rbx), %xmm0
addsd 0x10896(%rip), %xmm0    # 0xe5260
divsd %xmm1, %xmm0
callq 0x82e0
callq 0xcbe48
movsd 0x38(%rsp), %xmm3
movapd %xmm0, %xmm1
movsd 0x10(%rsp), %xmm2
ucomisd %xmm3, %xmm2
jbe 0xd49fe
movapd 0x20(%rsp), %xmm0
xorpd 0x10834(%rip), %xmm0    # 0xe5230
jmp 0xd4a2e
movsd %xmm1, 0x18(%rsp)
movsd 0x30(%rsp), %xmm0
ucomisd %xmm0, %xmm2
jbe 0xd4a14
movapd %xmm2, %xmm0
divsd %xmm3, %xmm0
callq 0x82e0
callq 0xcbe48
subsd 0x18(%rsp), %xmm0
movapd 0x20(%rsp), %xmm1
mulsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0x86a0
movsd 0x8(%rsp), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
movsd 0x11cf5(%rip), %xmm1    # 0xe6748
movsd 0x10(%rsp), %xmm0
callq 0x8650
mulsd 0x8(%rsp), %xmm0
movsd (%rsp), %xmm2
xorpd %xmm3, %xmm3
movsd %xmm0, (%rsp)
movsd 0x10(%rbx), %xmm0
ucomisd %xmm3, %xmm0
jbe 0xd4b07
movsd 0x10(%rsp), %xmm1
divsd %xmm2, %xmm1
movsd 0x4d895(%rip), %xmm0    # 0x122328
mulsd %xmm1, %xmm0
addsd 0x107c1(%rip), %xmm0    # 0xe5260
movsd 0x4d889(%rip), %xmm2    # 0x122330
mulsd %xmm1, %xmm2
mulsd %xmm1, %xmm2
addsd %xmm0, %xmm2
movsd 0x4d87d(%rip), %xmm3    # 0x122338
mulsd %xmm1, %xmm3
mulsd %xmm1, %xmm3
mulsd %xmm1, %xmm3
addsd %xmm2, %xmm3
movsd 0x4d86d(%rip), %xmm0    # 0x122340
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
addsd %xmm3, %xmm0
movsd 0x13939(%rip), %xmm1    # 0xe8428
callq 0x8650
mulsd 0x10(%rbx), %xmm0
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movsd 0x4d839(%rip), %xmm1    # 0x122348
movsd %xmm1, 0x8(%rsp)
movsd (%rbx), %xmm0
mulsd %xmm1, %xmm0
callq 0xcbe48
movapd %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
mulsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
mulsd 0x11b28(%rip), %xmm1    # 0xe6668
mulsd (%rsp), %xmm1
movsd %xmm1, (%rsp)
movsd 0x8(%rsp), %xmm1
mulsd (%rbx), %xmm1
movsd %xmm1, 0x8(%rsp)
movsd 0x11be6(%rip), %xmm1    # 0xe6748
callq 0x8650
mulsd 0x8(%rsp), %xmm0
mulsd 0x40(%rbx), %xmm0
addsd (%rsp), %xmm0
addq $0x40, %rsp
popq %rbx
retq