// File: /workspace/github_c_makefile_star2_O0/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:
subq $0xb8, %rsp
movsd %xmm0, 0xb0(%rsp)
movq %rdi, 0xa8(%rsp)
movq 0xa8(%rsp), %rax
movsd 0x30(%rax), %xmm0
movsd %xmm0, 0x68(%rsp)
movsd 0x1dfd5(%rip), %xmm0    # 0x1d2248
addsd 0xb0(%rsp), %xmm0
movsd %xmm0, 0x88(%rsp)
movq 0xa8(%rsp), %rax
movsd 0x1dfb3(%rip), %xmm0    # 0x1d2248
addsd 0x18(%rax), %xmm0
movsd %xmm0, 0x80(%rsp)
movq 0xa8(%rsp), %rax
movsd 0x1df95(%rip), %xmm0    # 0x1d2248
addsd 0x20(%rax), %xmm0
movsd %xmm0, 0x78(%rsp)
movq 0xa8(%rsp), %rax
movsd 0x1df7a(%rip), %xmm0    # 0x1d2248
addsd 0x38(%rax), %xmm0
movsd %xmm0, 0x60(%rsp)
movq 0xa8(%rsp), %rax
movsd 0x1df5f(%rip), %xmm0    # 0x1d2248
addsd 0x28(%rax), %xmm0
movsd %xmm0, 0x70(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0xa0(%rsp)
movq 0xa8(%rsp), %rax
movsd 0x8(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x1b453b
movsd 0x88(%rsp), %xmm0
ucomisd 0x78(%rsp), %xmm0
jbe 0x1b43a7
movq 0xa8(%rsp), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x58(%rsp)
movsd 0x68(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, 0x50(%rsp)
movsd 0x80(%rsp), %xmm0
divsd 0x78(%rsp), %xmm0
callq 0x82f0
callq 0x1a5650
movaps %xmm0, %xmm1
movsd 0x50(%rsp), %xmm0
mulsd %xmm1, %xmm0
callq 0x8670
movaps %xmm0, %xmm1
movsd 0x58(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0xa0(%rsp)
jmp 0x1b4500
movsd 0x88(%rsp), %xmm0
ucomisd 0x70(%rsp), %xmm0
jbe 0x1b4461
movq 0xa8(%rsp), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x48(%rsp)
movsd 0x68(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
movsd 0x80(%rsp), %xmm0
divsd 0x78(%rsp), %xmm0
callq 0x82f0
callq 0x1a5650
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0x88(%rsp), %xmm0
divsd 0x78(%rsp), %xmm0
callq 0x82f0
callq 0x1a5650
movsd 0x38(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x40(%rsp), %xmm0
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
callq 0x8670
movaps %xmm0, %xmm1
movsd 0x48(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0xa0(%rsp)
jmp 0x1b44fe
movq 0xa8(%rsp), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x68(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x80(%rsp), %xmm0
divsd 0x78(%rsp), %xmm0
callq 0x82f0
callq 0x1a5650
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x70(%rsp), %xmm0
divsd 0x78(%rsp), %xmm0
callq 0x82f0
callq 0x1a5650
movsd 0x20(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x28(%rsp), %xmm0
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
callq 0x8670
movaps %xmm0, %xmm1
movsd 0x30(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0xa0(%rsp)
jmp 0x1b4500
movsd 0xa0(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x88(%rsp), %xmm0
movsd 0x1f178(%rip), %xmm1    # 0x1d3698
callq 0x8610
movaps %xmm0, %xmm1
movsd 0x18(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0xa0(%rsp)
movq 0xa8(%rsp), %rax
movsd 0x10(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x1b4655
movsd 0x88(%rsp), %xmm0
divsd 0x60(%rsp), %xmm0
movsd %xmm0, 0x98(%rsp)
movsd 0x98(%rsp), %xmm1
movsd 0x5b40a(%rip), %xmm0    # 0x20f988
mulsd %xmm0, %xmm1
movsd 0x1dcbe(%rip), %xmm0    # 0x1d2248
addsd %xmm0, %xmm1
movsd 0x5b3ea(%rip), %xmm0    # 0x20f980
mulsd 0x98(%rsp), %xmm0
movsd 0x98(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0x5b3c0(%rip), %xmm1    # 0x20f978
mulsd 0x98(%rsp), %xmm1
mulsd 0x98(%rsp), %xmm1
movsd 0x98(%rsp), %xmm2
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd 0x5b38d(%rip), %xmm0    # 0x20f970
mulsd 0x98(%rsp), %xmm0
mulsd 0x98(%rsp), %xmm0
mulsd 0x98(%rsp), %xmm0
movsd 0x98(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0x20ea9(%rip), %xmm1    # 0x1d54c0
callq 0x8610
movsd %xmm0, 0x90(%rsp)
movq 0xa8(%rsp), %rax
movsd 0x10(%rax), %xmm0
movsd 0x90(%rsp), %xmm2
movsd 0xa0(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0xa0(%rsp)
movq 0xa8(%rsp), %rax
movsd 0x5b32b(%rip), %xmm0    # 0x20f990
mulsd (%rax), %xmm0
callq 0x1a5650
mulsd 0x88(%rsp), %xmm0
mulsd 0x88(%rsp), %xmm0
mulsd 0x88(%rsp), %xmm0
movsd 0x1f017(%rip), %xmm1    # 0x1d36a8
mulsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0xa0(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0xa8(%rsp), %rax
movsd 0x5b2d6(%rip), %xmm0    # 0x20f990
mulsd (%rax), %xmm0
movsd %xmm0, (%rsp)
movsd 0x1db7d(%rip), %xmm0    # 0x1d2248
addsd 0xb0(%rsp), %xmm0
movsd 0x1efbc(%rip), %xmm1    # 0x1d3698
callq 0x8610
movsd (%rsp), %xmm1
movsd 0x8(%rsp), %xmm2
movaps %xmm0, %xmm3
movsd 0x10(%rsp), %xmm0
mulsd %xmm3, %xmm1
movq 0xa8(%rsp), %rax
mulsd 0x40(%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
addq $0xb8, %rsp
retq
nopw %cs:(%rax,%rax)