// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x1
popq %rbp
leaq 0x14(%rsp), %r9
movl %ebp, %r8d
movsd %xmm0, 0x8(%rsp)
pushq %r15
pushq $0x1
pushq %rax
callq 0x1604b
addq $0x20, %rsp
cmpl $0x1, %eax
jne 0xca232
leaq 0x1b1ef(%rip), %rsi     # 0xe53f0
leaq 0x55f07(%rip), %rdx     # 0x12010f
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x1ae13(%rip), %rsi     # 0xe5034
leaq 0x55f82(%rip), %rdx     # 0x1201aa
movq %r15, %rdi
movl $0x3a6, %ecx            # imm = 0x3A6
jmp 0xca2b1
movl 0x4c0(%r14), %esi
movq 0x498(%r14), %rdi
movq 0x4b0(%r14), %rdx
movq 0x4b8(%r14), %rcx
subq $0x8, %rsp
leaq 0x18(%rsp), %rax
pushq $0x1
popq %rbp
leaq 0x14(%rsp), %r9
movl %ebp, %r8d
movsd 0x8(%rsp), %xmm0
pushq %r15
pushq $0x1
pushq %rax
callq 0x1604b
addq $0x20, %rsp
cmpl $0x1, %eax
jne 0xca2c0
leaq 0x1b16e(%rip), %rsi     # 0xe53f0
leaq 0x55f40(%rip), %rdx     # 0x1201c9
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x1ad92(%rip), %rsi     # 0xe5034
leaq 0x55f01(%rip), %rdx     # 0x1201aa
movq %r15, %rdi
movl $0x3b3, %ecx            # imm = 0x3B3
movq %rbx, %r8
xorl %eax, %eax
callq 0x2e014
jmp 0xca387
movsd 0x68(%r14), %xmm1
mulsd 0x1ba4a(%rip), %xmm1    # 0xe5d18
movsd 0x18(%rsp), %xmm0
ucomisd %xmm0, %xmm1
xorpd %xmm1, %xmm1
jae 0xca381
movsd 0x10(%rsp), %xmm3
xorpd %xmm2, %xmm2
ucomisd %xmm3, %xmm2
jae 0xca381
movsd 0x488(%r14), %xmm1
ucomisd (%rsp), %xmm1
xorpd %xmm1, %xmm1
ja 0xca381
mulsd 0x551ee(%rip), %xmm3    # 0x11f500
movsd %xmm3, (%rsp)
movsd 0x1c419(%rip), %xmm1    # 0xe6738
callq 0x8650
mulsd (%rsp), %xmm0
movsd 0x410(%r14), %xmm1
movsd 0x490(%r14), %xmm2
movsd 0x1af1d(%rip), %xmm3    # 0xe5260
subsd %xmm2, %xmm3
movsd 0x10(%rsp), %xmm4
movsd 0x551b3(%rip), %xmm5    # 0x11f508
addsd %xmm4, %xmm5
mulsd %xmm3, %xmm5
mulsd 0x551ab(%rip), %xmm2    # 0x11f510
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