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

  /** - Define local variables */
  int last_index_back;
  double mass, f;
  double dMdt, f_em;

  /** - Interpolate the PBH mass evolution */
  class_call(array_interpolate_spline(pin->PBH_table_z,
                                      pin->Nz_PBH,
                                      pin->PBH_table_mass,
                                      pin->PBH_table_mass_dd,
                                      1,
                                      z,
                                      &last_index_back,
                                      &mass,                                                        // [g]
                                      1,
                                      pin->error_message),
             pin->error_message,
             pin->error_message);

  class_call(array_interpolate_spline(pin->PBH_table_z,
                                      pin->Nz_PBH,
                                      pin->PBH_table_F,
                                      pin->PBH_table_F_dd,
                                      1,
                                      z,
                                      &last_index_back,
                                      &f,                                                           // [-]
                                      1,
                                      pin->error_message),
             pin->error_message,
             pin->error_message);

  /** - Calculate injection rates */
  if(mass <= 0.0001*pin->PBH_evaporation_mass || f <= 0 || z < pin->PBH_z_evaporation){
    *energy_rate = 0.;                                                                                // [J/(m^3 s)]
  }
  else {
    dMdt=5.34e25*f*pow(mass,-2.);                                                                     // [g/s]
    f_em = 0.55*pin->PBH_QCD_activation+(1-pin->PBH_QCD_activation)*(f-6.*0.147)/f;                   // [-]
    *energy_rate = pin->rho_cdm*pin->PBH_evaporation_fraction*f_em*dMdt/pin->PBH_evaporation_mass;    // [J/(m^3 s)]
  }

  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x828, %rsp            # imm = 0x828
movq %rsi, %rbx
movq %rdi, %r14
movl 0x4c0(%rdi), %esi
movq 0x498(%rdi), %rdi
movq 0x4a0(%r14), %rdx
movq 0x4a8(%r14), %rcx
leaq 0x570(%r14), %r15
subq $0x8, %rsp
leaq 0x20(%rsp), %rax
movl $0x1, %ebp
leaq 0x14(%rsp), %r9
movl $0x1, %r8d
movsd %xmm0, 0x8(%rsp)
pushq %r15
pushq $0x1
pushq %rax
callq 0x18071
addq $0x20, %rsp
cmpl $0x1, %eax
jne 0xd1a95
leaq 0x1c98f(%rip), %rsi     # 0xee3f0
leaq 0x577f7(%rip), %rdx     # 0x12925f
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x1c5b3(%rip), %rsi     # 0xee034
leaq 0x57872(%rip), %rdx     # 0x1292fa
movq %r15, %rdi
movl $0x3a6, %ecx            # imm = 0x3A6
jmp 0xd1b19
movl 0x4c0(%r14), %esi
movq 0x498(%r14), %rdi
movq 0x4b0(%r14), %rdx
movq 0x4b8(%r14), %rcx
subq $0x8, %rsp
leaq 0x18(%rsp), %rax
movl $0x1, %ebp
leaq 0x14(%rsp), %r9
movl $0x1, %r8d
movsd 0x8(%rsp), %xmm0
pushq %r15
pushq $0x1
pushq %rax
callq 0x18071
addq $0x20, %rsp
cmpl $0x1, %eax
jne 0xd1b28
leaq 0x1c906(%rip), %rsi     # 0xee3f0
leaq 0x57828(%rip), %rdx     # 0x129319
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x1c52a(%rip), %rsi     # 0xee034
leaq 0x577e9(%rip), %rdx     # 0x1292fa
movq %r15, %rdi
movl $0x3b3, %ecx            # imm = 0x3B3
movq %rbx, %r8
xorl %eax, %eax
callq 0x30af0
jmp 0xd1bef
movsd 0x68(%r14), %xmm1
mulsd 0x1d202(%rip), %xmm1    # 0xeed38
movsd 0x18(%rsp), %xmm0
ucomisd %xmm0, %xmm1
xorpd %xmm1, %xmm1
jae 0xd1be9
movsd 0x10(%rsp), %xmm3
xorpd %xmm2, %xmm2
ucomisd %xmm3, %xmm2
jae 0xd1be9
movsd 0x488(%r14), %xmm1
ucomisd (%rsp), %xmm1
xorpd %xmm1, %xmm1
ja 0xd1be9
mulsd 0x56ad6(%rip), %xmm3    # 0x128650
movsd %xmm3, (%rsp)
movsd 0x1dbd9(%rip), %xmm1    # 0xef760
callq 0x8620
mulsd (%rsp), %xmm0
movsd 0x410(%r14), %xmm1
movsd 0x490(%r14), %xmm2
movsd 0x1c6b5(%rip), %xmm3    # 0xee260
subsd %xmm2, %xmm3
movsd 0x10(%rsp), %xmm4
movsd 0x56a9b(%rip), %xmm5    # 0x128658
addsd %xmm4, %xmm5
mulsd %xmm3, %xmm5
mulsd 0x56a93(%rip), %xmm2    # 0x128660
divsd %xmm4, %xmm5
addsd %xmm5, %xmm2
mulsd 0x60(%r14), %xmm1
mulsd %xmm2, %xmm1
mulsd %xmm0, %xmm1
divsd 0x68(%r14), %xmm1
movsd %xmm1, (%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x828, %rsp            # imm = 0x828
popq %rbx
popq %r14
popq %r15
popq %rbp
retq