// File: /workspace/github_c_makefile_star2_O2/PoulinV[P]AxiCLASS/build/../external/heating/injection.c
// Function: injection_rate_PBH_evaporation_mass_evolution
int injection_rate_PBH_evaporation_mass_evolution(struct background * pba,
                                                  struct injection * pin){

  /** - Define local variables */
  double * pvecback_loop;
  int last_index_back_loop;
  int i_step;
  double current_mass, current_pbh_temperature;
  double f_EM, f_nu, f_q, f_pi, f_bos, f;
  double loop_z, time_now, time_prev, dt, dlnz, lnz_ini;

  /** - Set initial parameters */
  current_mass = pin->PBH_evaporation_mass;                                                         // [g]
  pin->PBH_z_evaporation = 0;
  lnz_ini = log(1+pin->z_initial);
  dlnz = lnz_ini/(pin->Nz_PBH-1);
  loop_z = pin->z_initial*1.0001;
  time_prev = 0.;                                                                                   // [s]

  /** - Alloate local variables */
  class_alloc(pvecback_loop,
              pba->bg_size*sizeof(double),
              pin->error_message);

  /** - Alloate variables for PBH mass evolution */
  class_alloc(pin->PBH_table_z,
              pin->Nz_PBH*sizeof(double),
              pin->error_message);
  class_alloc(pin->PBH_table_mass,
              pin->Nz_PBH*sizeof(double),
              pin->error_message);
  class_alloc(pin->PBH_table_mass_dd,
              pin->Nz_PBH*sizeof(double),
              pin->error_message);
  class_alloc(pin->PBH_table_F,
              pin->Nz_PBH*sizeof(double),
              pin->error_message);
  class_alloc(pin->PBH_table_F_dd,
              pin->Nz_PBH*sizeof(double),
              pin->error_message);

  /** - Fill tables with PBH mass evolution */
  /* For the parametrization of F(M) we follow PRD44 (1991) 376 with
   * the additional modification that we dress the "free QCD-particles"
   * (gluons and quarks) with an sigmoid-activation function (in log10-space:
   * Mean at 0.3 GeV and a width of 0.1*"order of magnitude") and the hadrons
   * with (1 - activation) to take the QCD-phase transition into account
   * and to be in agreement with PRD41 (1990) 3052, where the Ansatz is taken
   * that a black hole emmits those particles which appear elementary at the
   * given energy. */
  for(i_step = 0; i_step<pin->Nz_PBH; i_step++) {

    /** - Find value of f(M) */
    current_pbh_temperature = 1.06e13/current_mass;                                                 // [GeV]
    pin->PBH_QCD_activation = 1./(1.+exp(-(log(current_pbh_temperature)-log(0.3))/(log(10.)*0.1))); // [-] see Eq. (4.6) of Stoecker et al. 2018

    f_EM = 2.*0.060                                                                                 // gamma
           +4.*0.142*exp(-(current_mass*5.11e-4)/(4.53*1.06e13))                                    // electron
           +4.*0.142*exp(-(current_mass*0.1037)/(4.53*1.06e13))                                     // muon
           +4.*0.142*exp(-(current_mass*1.777)/(4.53*1.06e13));                                     // tau
    f_nu = 6.*0.147;                                                                                // neutrino
    f_q = (12.*0.142*(exp(-(current_mass*2.2e-3)/(4.53*1.06e13))                                    // u
                      +exp(-(current_mass*4.7e-3)/(4.53*1.06e13))                                   // d
                      +exp(-(current_mass*1.28)/(4.53*1.06e13))                                     // c
                      +exp(-(current_mass*9.6e-2)/(4.53*1.06e13))                                   // s
                      +exp(-(current_mass*173.1)/(4.53*1.06e13))                                    // t
                      +exp(-(current_mass*4.18)/(4.53*1.06e13))                                     // b
                     )
           +16.*0.060*exp(-(current_mass*6e-1)/(6.04*1.06e13))                                      // g
          )*pin->PBH_QCD_activation;
    f_pi = (1.*0.267*exp(-(current_mass*1.350e-1)/(2.66*1.06e13))                                   // pi^0
            +2.*0.267*exp(-(current_mass*1.396e-1)/(2.66*1.06e13))                                  // pi^+
           )*(1-pin->PBH_QCD_activation);
    f_bos = 6.*0.060*exp(-(current_mass*80.39)/(6.04*1.06e13))                                      // W
            +3.*0.060*exp(-(current_mass*91.19)/(6.04*1.06e13))                                     // Z
            +1.*0.267*exp(-(current_mass*125.1)/(2.66*1.06e13));                                   // h
    f = f_EM+f_nu+f_q+f_pi+f_bos;

    /** - Find current time value */
    class_call(background_at_z(pba,
                               loop_z,
                               long_info,
                               inter_normal,
                               &last_index_back_loop,
                               pvecback_loop),
               pba->error_message,
               pin->error_message);
    time_now = pvecback_loop[pba->index_bg_time]/(_c_/_Mpc_over_m_);                                // [s]
    dt = time_now-time_prev;
    time_prev = time_now;

    if (i_step > 0) {
      //TODO :: check this step
      if (current_mass > 0.5*pin->PBH_evaporation_mass){
        current_mass = current_mass-5.34e25*f*pow(current_mass,-2)*dt;                              // [g]
      }
      else {
        if(pin->PBH_z_evaporation == 0){
          pin->PBH_z_evaporation = loop_z;
        }
        current_mass = 0.;
        f = 0.;
      }
    }

    /** - Fill tables */
    pin->PBH_table_z[i_step] = loop_z;
    pin->PBH_table_mass[i_step] = current_mass;                                                     // [g]
    pin->PBH_table_F[i_step] = f;                                                                   // [-]
    loop_z = exp(lnz_ini-dlnz*(i_step+1))-1.;

  }

  /** - Free local variables */
  free(pvecback_loop);

  /** - Spline mass and F(M) evolution in z */
  class_call(array_spline_table_lines(pin->PBH_table_z,
                                      pin->Nz_PBH,
                                      pin->PBH_table_mass,
                                      1,
                                      pin->PBH_table_mass_dd,
                                      _SPLINE_NATURAL_,
                                      pin->error_message),
             pin->error_message,
             pin->error_message);
  class_call(array_spline_table_lines(pin->PBH_table_z,
                                      pin->Nz_PBH,
                                      pin->PBH_table_F,
                                      1,
                                      pin->PBH_table_F_dd,
                                      _SPLINE_NATURAL_,
                                      pin->error_message),
             pin->error_message,
             pin->error_message);

  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x898, %rsp            # imm = 0x898
movq %rsi, %rbx
movsd 0x68(%rsi), %xmm0
movsd %xmm0, 0x10(%rsp)
andq $0x0, 0x488(%rsi)
movq %rdi, %r14
movsd 0x3b0(%rsi), %xmm0
addsd 0x1d523(%rip), %xmm0    # 0xe5260
callq 0x82e0
movapd %xmm0, 0x70(%rsp)
movl 0x4c0(%rbx), %r13d
movsd 0x3b0(%rbx), %xmm0
movsd %xmm0, 0x28(%rsp)
movslq 0x43c(%r14), %r12
leaq (,%r12,8), %rdi
callq 0x8490
testq %rax, %rax
je 0xc82de
movq %rax, %r15
movslq %r13d, %r12
shlq $0x3, %r12
movq %r12, %rdi
callq 0x8490
movq %rax, 0x498(%rbx)
testq %rax, %rax
je 0xc8327
movq %r12, %rdi
callq 0x8490
movq %rax, 0x4a0(%rbx)
testq %rax, %rax
je 0xc8370
movq %r12, %rdi
callq 0x8490
movq %rax, 0x4a8(%rbx)
testq %rax, %rax
je 0xc83b9
movq %r12, %rdi
callq 0x8490
movq %rax, 0x4b0(%rbx)
testq %rax, %rax
je 0xc8402
movq %r12, %rdi
callq 0x8490
movq %rax, 0x4b8(%rbx)
testq %rax, %rax
je 0xc8448
leal -0x1(%r13), %eax
cvtsi2sd %eax, %xmm0
movsd 0x28(%rsp), %xmm1
mulsd 0x575c6(%rip), %xmm1    # 0x11f3d8
movsd %xmm1, 0x28(%rsp)
movapd 0x1d410(%rip), %xmm1    # 0xe5230
xorpd 0x70(%rsp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, 0x80(%rsp)
xorpd %xmm0, %xmm0
xorl %ebp, %ebp
leaq 0x6c(%rsp), %r12
movslq %r13d, %rax
cmpq %rax, %rbp
jge 0xc84ad
movsd %xmm0, 0x38(%rsp)
movsd 0x57588(%rip), %xmm0    # 0x11f3e0
divsd 0x10(%rsp), %xmm0
callq 0x82e0
addsd 0x5757d(%rip), %xmm0    # 0x11f3e8
divsd 0x5757d(%rip), %xmm0    # 0x11f3f0
callq 0x86a0
movsd 0x1d3e0(%rip), %xmm1    # 0xe5260
addsd %xmm1, %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, 0x490(%rbx)
movsd 0x10(%rsp), %xmm0
mulsd 0x5755a(%rip), %xmm0    # 0x11f3f8
movsd 0x5755a(%rip), %xmm1    # 0x11f400
divsd %xmm1, %xmm0
callq 0x86a0
movapd %xmm0, %xmm1
movsd 0x5754d(%rip), %xmm0    # 0x11f408
mulsd %xmm0, %xmm1
addsd 0x21c99(%rip), %xmm1    # 0xe9b60
movsd %xmm1, 0x20(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x57535(%rip), %xmm0    # 0x11f410
divsd 0x5751d(%rip), %xmm0    # 0x11f400
callq 0x86a0
mulsd 0x57518(%rip), %xmm0    # 0x11f408
addsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x5750e(%rip), %xmm0    # 0x11f418
divsd 0x574ee(%rip), %xmm0    # 0x11f400
callq 0x86a0
mulsd 0x574e9(%rip), %xmm0    # 0x11f408
addsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x574e7(%rip), %xmm0    # 0x11f420
divsd 0x574bf(%rip), %xmm0    # 0x11f400
callq 0x86a0
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x574ce(%rip), %xmm0    # 0x11f428
divsd 0x5749e(%rip), %xmm0    # 0x11f400
callq 0x86a0
addsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x574af(%rip), %xmm0    # 0x11f430
divsd 0x57477(%rip), %xmm0    # 0x11f400
callq 0x86a0
addsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x57490(%rip), %xmm0    # 0x11f438
divsd 0x57450(%rip), %xmm0    # 0x11f400
callq 0x86a0
addsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x57471(%rip), %xmm0    # 0x11f440
divsd 0x57429(%rip), %xmm0    # 0x11f400
callq 0x86a0
addsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x57452(%rip), %xmm0    # 0x11f448
divsd 0x57402(%rip), %xmm0    # 0x11f400
callq 0x86a0
addsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x41383(%rip), %xmm0    # 0x1093a0
movsd 0x5742b(%rip), %xmm1    # 0x11f450
divsd %xmm1, %xmm0
callq 0x86a0
mulsd 0x57422(%rip), %xmm0    # 0x11f458
movsd 0x18(%rsp), %xmm1
mulsd 0x5741c(%rip), %xmm1    # 0x11f460
addsd %xmm0, %xmm1
mulsd 0x490(%rbx), %xmm1
movsd %xmm1, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x57404(%rip), %xmm0    # 0x11f468
movsd 0x57404(%rip), %xmm1    # 0x11f470
divsd %xmm1, %xmm0
callq 0x86a0
movsd %xmm0, 0x60(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x573ef(%rip), %xmm0    # 0x11f478
divsd 0x573df(%rip), %xmm0    # 0x11f470
callq 0x86a0
movapd %xmm0, %xmm1
movsd 0x1d1be(%rip), %xmm0    # 0xe5260
subsd 0x490(%rbx), %xmm0
movsd %xmm0, 0x50(%rsp)
mulsd 0x573c8(%rip), %xmm1    # 0x11f480
movsd %xmm1, 0x58(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x573c4(%rip), %xmm0    # 0x11f490
divsd 0x5737c(%rip), %xmm0    # 0x11f450
callq 0x86a0
movsd %xmm0, 0x30(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x573ab(%rip), %xmm0    # 0x11f498
divsd 0x5735b(%rip), %xmm0    # 0x11f450
callq 0x86a0
mulsd 0x5739e(%rip), %xmm0    # 0x11f4a0
movsd %xmm0, 0x48(%rsp)
movsd 0x30(%rsp), %xmm0
mulsd 0x5717a(%rip), %xmm0    # 0x11f290
movsd %xmm0, 0x30(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x5737e(%rip), %xmm0    # 0x11f4a8
divsd 0x5733e(%rip), %xmm0    # 0x11f470
callq 0x86a0
movsd %xmm0, 0x40(%rsp)
movsd 0x20(%rsp), %xmm0
addsd 0x57365(%rip), %xmm0    # 0x11f4b0
movsd %xmm0, 0x20(%rsp)
movq %r14, %rdi
movsd 0x28(%rsp), %xmm0
pushq $0x2
popq %rsi
xorl %edx, %edx
movq %r12, %rcx
movq %r15, %r8
callq 0x585e8
cmpl $0x1, %eax
je 0xc853d
movsd 0x5730d(%rip), %xmm0    # 0x11f488
movsd 0x60(%rsp), %xmm1
mulsd %xmm0, %xmm1
addsd 0x58(%rsp), %xmm1
mulsd 0x50(%rsp), %xmm1
movsd 0x30(%rsp), %xmm2
addsd 0x48(%rsp), %xmm2
movsd 0x40(%rsp), %xmm3
mulsd %xmm0, %xmm3
addsd %xmm2, %xmm3
movsd 0x20(%rsp), %xmm2
addsd 0x18(%rsp), %xmm2
addsd %xmm1, %xmm2
addsd %xmm3, %xmm2
movslq 0x41c(%r14), %rax
movsd (%r15,%rax,8), %xmm3
divsd 0x572e4(%rip), %xmm3    # 0x11f4b8
testq %rbp, %rbp
movsd %xmm3, 0x18(%rsp)
je 0xc8245
movsd 0x68(%rbx), %xmm0
mulsd 0x1dac4(%rip), %xmm0    # 0xe5cb0
movsd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xc824d
subsd 0x38(%rsp), %xmm3
movsd %xmm3, 0x30(%rsp)
movsd 0x10(%rsp), %xmm0
movsd 0x1e526(%rip), %xmm1    # 0xe6738
movsd %xmm2, 0x20(%rsp)
callq 0x8650
movsd 0x20(%rsp), %xmm2
movapd %xmm2, %xmm1
mulsd 0x57291(%rip), %xmm1    # 0x11f4c0
mulsd %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
mulsd 0x30(%rsp), %xmm1
addsd %xmm1, %xmm0
jmp 0xc8273
movsd 0x10(%rsp), %xmm0
jmp 0xc8273
movsd 0x488(%rbx), %xmm0
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
jne 0xc826f
jp 0xc826f
movsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x488(%rbx)
xorpd %xmm0, %xmm0
movq 0x498(%rbx), %rax
movsd 0x28(%rsp), %xmm1
movsd %xmm1, (%rax,%rbp,8)
movq 0x4a0(%rbx), %rax
movsd %xmm0, 0x10(%rsp)
movsd %xmm0, (%rax,%rbp,8)
movq 0x4b0(%rbx), %rax
movsd %xmm2, (%rax,%rbp,8)
incq %rbp
cvtsi2sd %ebp, %xmm0
mulsd 0x80(%rsp), %xmm0
addsd 0x70(%rsp), %xmm0
callq 0x86a0
addsd 0x1d522(%rip), %xmm0    # 0xe57e8
movsd %xmm0, 0x28(%rsp)
movl 0x4c0(%rbx), %r13d
movsd 0x18(%rsp), %xmm0
jmp 0xc7e3e
shll $0x3, %r12d
leaq 0x1cd1b(%rip), %rsi     # 0xe5004
leaq 0x57c2e(%rip), %rdx     # 0x11ff1e
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x2e014
addq $0x570, %rbx            # imm = 0x570
leaq 0x1cd21(%rip), %rsi     # 0xe5034
leaq 0x57c12(%rip), %rdx     # 0x11ff2c
movq %rbx, %rdi
movl $0x311, %ecx            # imm = 0x311
jmp 0xc848c
shll $0x3, %r13d
leaq 0x1ccd2(%rip), %rsi     # 0xe5004
leaq 0x57c21(%rip), %rdx     # 0x11ff5a
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movl %r13d, %ecx
xorl %eax, %eax
callq 0x2e014
addq $0x570, %rbx            # imm = 0x570
leaq 0x1ccd8(%rip), %rsi     # 0xe5034
leaq 0x57bc9(%rip), %rdx     # 0x11ff2c
movq %rbx, %rdi
movl $0x316, %ecx            # imm = 0x316
jmp 0xc848c
shll $0x3, %r13d
leaq 0x1cc89(%rip), %rsi     # 0xe5004
leaq 0x57be9(%rip), %rdx     # 0x11ff6b
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movl %r13d, %ecx
xorl %eax, %eax
callq 0x2e014
addq $0x570, %rbx            # imm = 0x570
leaq 0x1cc8f(%rip), %rsi     # 0xe5034
leaq 0x57b80(%rip), %rdx     # 0x11ff2c
movq %rbx, %rdi
movl $0x319, %ecx            # imm = 0x319
jmp 0xc848c
shll $0x3, %r13d
leaq 0x1cc40(%rip), %rsi     # 0xe5004
leaq 0x57bb4(%rip), %rdx     # 0x11ff7f
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movl %r13d, %ecx
xorl %eax, %eax
callq 0x2e014
addq $0x570, %rbx            # imm = 0x570
leaq 0x1cc46(%rip), %rsi     # 0xe5034
leaq 0x57b37(%rip), %rdx     # 0x11ff2c
movq %rbx, %rdi
movl $0x31c, %ecx            # imm = 0x31C
jmp 0xc848c
shll $0x3, %r13d
leaq 0x1cbf7(%rip), %rsi     # 0xe5004
leaq 0x57b82(%rip), %rdx     # 0x11ff96
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movl %r13d, %ecx
xorl %eax, %eax
callq 0x2e014
addq $0x570, %rbx            # imm = 0x570
leaq 0x1cbfd(%rip), %rsi     # 0xe5034
leaq 0x57aee(%rip), %rdx     # 0x11ff2c
movq %rbx, %rdi
movl $0x31f, %ecx            # imm = 0x31F
jmp 0xc848c
shll $0x3, %r13d
leaq 0x1cbb1(%rip), %rsi     # 0xe5004
leaq 0x57b4d(%rip), %rdx     # 0x11ffa7
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movl %r13d, %ecx
xorl %eax, %eax
callq 0x2e014
addq $0x570, %rbx            # imm = 0x570
leaq 0x1cbb7(%rip), %rsi     # 0xe5034
leaq 0x57aa8(%rip), %rdx     # 0x11ff2c
movq %rbx, %rdi
movl $0x322, %ecx            # imm = 0x322
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x898, %rsp            # imm = 0x898
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
callq 0x8430
movq 0x498(%rbx), %rdi
movq 0x4a0(%rbx), %rdx
movq 0x4a8(%rbx), %r8
leaq 0x570(%rbx), %r14
movq %r14, (%rsp)
pushq $0x1
popq %r15
xorl %ebp, %ebp
movl %r13d, %esi
movl %r15d, %ecx
xorl %r9d, %r9d
callq 0x125a5
cmpl $0x1, %eax
jne 0xc858c
leaq 0x1cef7(%rip), %rsi     # 0xe53f0
leaq 0x57b17(%rip), %rdx     # 0x120017
leaq 0x90(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x1cb18(%rip), %rsi     # 0xe5034
leaq 0x57a09(%rip), %rdx     # 0x11ff2c
movq %r14, %rdi
movl $0x378, %ecx            # imm = 0x378
movq %rbx, %r8
xorl %eax, %eax
callq 0x2e014
movl %r15d, %ebp
jmp 0xc8499
addq $0xd1c, %r14            # imm = 0xD1C
leaq 0x1cea5(%rip), %rsi     # 0xe53f0
leaq 0x57a69(%rip), %rdx     # 0x11ffbb
leaq 0x90(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
addq $0x570, %rbx            # imm = 0x570
leaq 0x1cabf(%rip), %rsi     # 0xe5034
leaq 0x579b0(%rip), %rdx     # 0x11ff2c
movq %rbx, %rdi
movl $0x351, %ecx            # imm = 0x351
movq %r15, %r8
jmp 0xc848f
movl 0x4c0(%rbx), %esi
movq 0x498(%rbx), %rdi
movq 0x4b0(%rbx), %rdx
movq 0x4b8(%rbx), %r8
movq %r14, (%rsp)
pushq $0x1
popq %rbx
movl %ebx, %ecx
xorl %r9d, %r9d
callq 0x125a5
cmpl $0x1, %eax
jne 0xc8499
leaq 0x1ce28(%rip), %rsi     # 0xe53f0
leaq 0x57ac7(%rip), %rdx     # 0x120096
leaq 0x90(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x1ca49(%rip), %rsi     # 0xe5034
leaq 0x5793a(%rip), %rdx     # 0x11ff2c
movq %r14, %rdi
movl $0x381, %ecx            # imm = 0x381
movq %r15, %r8
xorl %eax, %eax
callq 0x2e014
movl %ebx, %ebp
jmp 0xc8499