// File: /workspace/github_c_makefile_star2_O3/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 $0x8a8, %rsp            # imm = 0x8A8
movq %rsi, %rbx
movq %rdi, %rbp
movsd 0x68(%rsi), %xmm0
movsd %xmm0, 0x10(%rsp)
movq $0x0, 0x488(%rsi)
movsd 0x3b0(%rsi), %xmm0
addsd 0x1ede0(%rip), %xmm0    # 0xee260
callq 0x82c0
movapd %xmm0, 0x80(%rsp)
movl 0x4c0(%rbx), %r13d
movsd 0x3b0(%rbx), %xmm0
movsd %xmm0, 0x28(%rsp)
movslq 0x43c(%rbp), %r14
leaq (,%r14,8), %rdi
callq 0x8460
movq %rax, 0x38(%rsp)
testq %rax, %rax
je 0xcfae0
movslq %r13d, %r15
shlq $0x3, %r15
movq %r15, %rdi
callq 0x8460
movq %rax, 0x498(%rbx)
testq %rax, %rax
je 0xcfb2c
movq %rax, %r12
movq %rbp, 0x40(%rsp)
movq %r15, %rdi
callq 0x8460
movq %rax, 0x4a0(%rbx)
testq %rax, %rax
je 0xcfb75
movq %rax, %rbp
movq %r15, %rdi
callq 0x8460
movq %rax, 0x4a8(%rbx)
testq %rax, %rax
je 0xcfbbe
movq %rax, %r14
movq %r15, %rdi
callq 0x8460
movq %rax, 0x4b0(%rbx)
testq %rax, %rax
je 0xcfc07
movq %r15, %rdi
callq 0x8460
movq %rax, 0x4b8(%rbx)
testq %rax, %rax
je 0xcfc50
testl %r13d, %r13d
jle 0xcfa5e
decl %r13d
cvtsi2sd %r13d, %xmm1
movsd 0x28(%rsp), %xmm0
mulsd 0x58fb7(%rip), %xmm0    # 0x128528
movapd 0x1ecb7(%rip), %xmm2    # 0xee230
xorpd 0x80(%rsp), %xmm2
divsd %xmm1, %xmm2
movapd %xmm2, 0x90(%rsp)
xorpd %xmm1, %xmm1
xorl %r14d, %r14d
leaq 0x7c(%rsp), %r12
movq 0x40(%rsp), %r15
movq 0x38(%rsp), %rbp
movsd %xmm0, 0x28(%rsp)
movsd %xmm1, 0x48(%rsp)
movsd 0x58f77(%rip), %xmm0    # 0x128530
divsd 0x10(%rsp), %xmm0
callq 0x82c0
addsd 0x58f6c(%rip), %xmm0    # 0x128538
divsd 0x58f6c(%rip), %xmm0    # 0x128540
callq 0x8670
movsd 0x1ec7f(%rip), %xmm1    # 0xee260
addsd %xmm1, %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, 0x490(%rbx)
movsd 0x10(%rsp), %xmm0
mulsd 0x58f49(%rip), %xmm0    # 0x128548
movsd 0x58f49(%rip), %xmm1    # 0x128550
divsd %xmm1, %xmm0
callq 0x8670
movapd %xmm0, %xmm1
movsd 0x58f3c(%rip), %xmm0    # 0x128558
mulsd %xmm0, %xmm1
addsd 0x23670(%rip), %xmm1    # 0xf2c98
movsd %xmm1, 0x20(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x58f24(%rip), %xmm0    # 0x128560
divsd 0x58f0c(%rip), %xmm0    # 0x128550
callq 0x8670
mulsd 0x58f07(%rip), %xmm0    # 0x128558
addsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x58efd(%rip), %xmm0    # 0x128568
divsd 0x58edd(%rip), %xmm0    # 0x128550
callq 0x8670
mulsd 0x58ed8(%rip), %xmm0    # 0x128558
addsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x58ed6(%rip), %xmm0    # 0x128570
divsd 0x58eae(%rip), %xmm0    # 0x128550
callq 0x8670
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x58ebd(%rip), %xmm0    # 0x128578
divsd 0x58e8d(%rip), %xmm0    # 0x128550
callq 0x8670
addsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x58e9e(%rip), %xmm0    # 0x128580
divsd 0x58e66(%rip), %xmm0    # 0x128550
callq 0x8670
addsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x58e7f(%rip), %xmm0    # 0x128588
divsd 0x58e3f(%rip), %xmm0    # 0x128550
callq 0x8670
addsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x58e60(%rip), %xmm0    # 0x128590
divsd 0x58e18(%rip), %xmm0    # 0x128550
callq 0x8670
addsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x58e41(%rip), %xmm0    # 0x128598
divsd 0x58df1(%rip), %xmm0    # 0x128550
callq 0x8670
addsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x42d82(%rip), %xmm0    # 0x112500
movsd 0x58e1a(%rip), %xmm1    # 0x1285a0
divsd %xmm1, %xmm0
callq 0x8670
mulsd 0x58e11(%rip), %xmm0    # 0x1285a8
movsd 0x18(%rsp), %xmm1
mulsd 0x58e0b(%rip), %xmm1    # 0x1285b0
addsd %xmm0, %xmm1
mulsd 0x490(%rbx), %xmm1
movsd %xmm1, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x58df3(%rip), %xmm0    # 0x1285b8
movsd 0x58df3(%rip), %xmm1    # 0x1285c0
divsd %xmm1, %xmm0
callq 0x8670
movsd %xmm0, 0x70(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x58dde(%rip), %xmm0    # 0x1285c8
divsd 0x58dce(%rip), %xmm0    # 0x1285c0
callq 0x8670
movapd %xmm0, %xmm1
movsd 0x1ea5d(%rip), %xmm0    # 0xee260
subsd 0x490(%rbx), %xmm0
movsd %xmm0, 0x60(%rsp)
mulsd 0x58db7(%rip), %xmm1    # 0x1285d0
movsd %xmm1, 0x68(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x58db3(%rip), %xmm0    # 0x1285e0
divsd 0x58d6b(%rip), %xmm0    # 0x1285a0
callq 0x8670
movsd %xmm0, 0x30(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x58d9a(%rip), %xmm0    # 0x1285e8
divsd 0x58d4a(%rip), %xmm0    # 0x1285a0
callq 0x8670
mulsd 0x58d8d(%rip), %xmm0    # 0x1285f0
movsd %xmm0, 0x58(%rsp)
movsd 0x30(%rsp), %xmm0
mulsd 0x58b69(%rip), %xmm0    # 0x1283e0
movsd %xmm0, 0x30(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x58d6d(%rip), %xmm0    # 0x1285f8
divsd 0x58d2d(%rip), %xmm0    # 0x1285c0
callq 0x8670
movsd %xmm0, 0x50(%rsp)
movsd 0x20(%rsp), %xmm0
addsd 0x58d54(%rip), %xmm0    # 0x128600
movsd %xmm0, 0x20(%rsp)
movq %r15, %rdi
movsd 0x28(%rsp), %xmm0
movl $0x2, %esi
xorl %edx, %edx
movq %r12, %rcx
movq %rbp, %r8
callq 0x5c3a8
cmpl $0x1, %eax
je 0xcfd11
movsd 0x58cfa(%rip), %xmm0    # 0x1285d8
movsd 0x70(%rsp), %xmm1
mulsd %xmm0, %xmm1
addsd 0x68(%rsp), %xmm1
mulsd 0x60(%rsp), %xmm1
movsd 0x30(%rsp), %xmm2
addsd 0x58(%rsp), %xmm2
movsd 0x50(%rsp), %xmm3
mulsd %xmm0, %xmm3
addsd %xmm2, %xmm3
movsd 0x20(%rsp), %xmm2
addsd 0x18(%rsp), %xmm2
addsd %xmm1, %xmm2
addsd %xmm3, %xmm2
movslq 0x41c(%r15), %rax
movsd (%rbp,%rax,8), %xmm3
divsd 0x58cd1(%rip), %xmm3    # 0x128608
testq %r14, %r14
movsd %xmm3, 0x18(%rsp)
je 0xcf9a8
movsd 0x68(%rbx), %xmm0
mulsd 0x1f381(%rip), %xmm0    # 0xeecd0
movsd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xcf9b6
subsd 0x48(%rsp), %xmm3
movsd %xmm3, 0x30(%rsp)
movsd 0x10(%rsp), %xmm0
movsd 0x1fdeb(%rip), %xmm1    # 0xef760
movsd %xmm2, 0x20(%rsp)
callq 0x8620
movsd 0x20(%rsp), %xmm2
movapd %xmm2, %xmm1
mulsd 0x58c7e(%rip), %xmm1    # 0x128610
mulsd %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
mulsd 0x30(%rsp), %xmm1
addsd %xmm1, %xmm0
jmp 0xcf9ae
movsd 0x10(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
jmp 0xcf9dc
movsd 0x488(%rbx), %xmm0
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
movsd 0x28(%rsp), %xmm1
jne 0xcf9d8
jp 0xcf9d8
movsd %xmm1, 0x488(%rbx)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x498(%rbx), %rax
movsd %xmm1, (%rax,%r14,8)
movq 0x4a0(%rbx), %rax
movsd %xmm0, (%rax,%r14,8)
movq 0x4b0(%rbx), %rax
movsd %xmm2, (%rax,%r14,8)
incq %r14
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
mulsd 0x90(%rsp), %xmm0
addsd 0x80(%rsp), %xmm0
callq 0x8670
addsd 0x1edb5(%rip), %xmm0    # 0xee7e8
movslq 0x4c0(%rbx), %r13
cmpq %r13, %r14
movsd 0x18(%rsp), %xmm1
jl 0xcf5a5
movq 0x498(%rbx), %r12
movq 0x4a0(%rbx), %rbp
movq 0x4a8(%rbx), %r14
movq 0x38(%rsp), %rdi
callq 0x8410
leaq 0x570(%rbx), %rax
movq %rax, 0x10(%rsp)
movq %rax, (%rsp)
xorl %r15d, %r15d
movq %r12, %rdi
movl %r13d, %esi
movq %rbp, %rdx
movl $0x1, %ecx
movq %r14, %r8
xorl %r9d, %r9d
callq 0x142a8
cmpl $0x1, %eax
jne 0xcfc99
leaq 0x1e94c(%rip), %rsi     # 0xee3f0
leaq 0x596bc(%rip), %rdx     # 0x129167
leaq 0xa0(%rsp), %rbx
movq %rbx, %rdi
movq 0x10(%rsp), %r14
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x1e568(%rip), %rsi     # 0xee034
leaq 0x595a9(%rip), %rdx     # 0x12907c
movq %r14, %rdi
movl $0x378, %ecx            # imm = 0x378
jmp 0xcfd0c
shll $0x3, %r14d
leaq 0x1e519(%rip), %rsi     # 0xee004
leaq 0x5957c(%rip), %rdx     # 0x12906e
leaq 0xa0(%rsp), %r15
movq %r15, %rdi
movl %r14d, %ecx
xorl %eax, %eax
callq 0x30af0
addq $0x570, %rbx            # imm = 0x570
leaq 0x1e51f(%rip), %rsi     # 0xee034
leaq 0x59560(%rip), %rdx     # 0x12907c
movq %rbx, %rdi
movl $0x311, %ecx            # imm = 0x311
movq %r15, %r8
jmp 0xcfd5b
shll $0x3, %r13d
leaq 0x1e4cd(%rip), %rsi     # 0xee004
leaq 0x5956c(%rip), %rdx     # 0x1290aa
leaq 0xa0(%rsp), %r14
movq %r14, %rdi
movl %r13d, %ecx
xorl %eax, %eax
callq 0x30af0
addq $0x570, %rbx            # imm = 0x570
leaq 0x1e4d3(%rip), %rsi     # 0xee034
leaq 0x59514(%rip), %rdx     # 0x12907c
movq %rbx, %rdi
movl $0x316, %ecx            # imm = 0x316
jmp 0xcfd58
shll $0x3, %r13d
leaq 0x1e484(%rip), %rsi     # 0xee004
leaq 0x59534(%rip), %rdx     # 0x1290bb
leaq 0xa0(%rsp), %r14
movq %r14, %rdi
movl %r13d, %ecx
xorl %eax, %eax
callq 0x30af0
addq $0x570, %rbx            # imm = 0x570
leaq 0x1e48a(%rip), %rsi     # 0xee034
leaq 0x594cb(%rip), %rdx     # 0x12907c
movq %rbx, %rdi
movl $0x319, %ecx            # imm = 0x319
jmp 0xcfd58
shll $0x3, %r13d
leaq 0x1e43b(%rip), %rsi     # 0xee004
leaq 0x594ff(%rip), %rdx     # 0x1290cf
leaq 0xa0(%rsp), %r14
movq %r14, %rdi
movl %r13d, %ecx
xorl %eax, %eax
callq 0x30af0
addq $0x570, %rbx            # imm = 0x570
leaq 0x1e441(%rip), %rsi     # 0xee034
leaq 0x59482(%rip), %rdx     # 0x12907c
movq %rbx, %rdi
movl $0x31c, %ecx            # imm = 0x31C
jmp 0xcfd58
shll $0x3, %r13d
leaq 0x1e3f2(%rip), %rsi     # 0xee004
leaq 0x594cd(%rip), %rdx     # 0x1290e6
leaq 0xa0(%rsp), %r14
movq %r14, %rdi
movl %r13d, %ecx
xorl %eax, %eax
callq 0x30af0
addq $0x570, %rbx            # imm = 0x570
leaq 0x1e3f8(%rip), %rsi     # 0xee034
leaq 0x59439(%rip), %rdx     # 0x12907c
movq %rbx, %rdi
movl $0x31f, %ecx            # imm = 0x31F
jmp 0xcfd58
shll $0x3, %r13d
leaq 0x1e3a9(%rip), %rsi     # 0xee004
leaq 0x59495(%rip), %rdx     # 0x1290f7
leaq 0xa0(%rsp), %r14
movq %r14, %rdi
movl %r13d, %ecx
xorl %eax, %eax
callq 0x30af0
addq $0x570, %rbx            # imm = 0x570
leaq 0x1e3af(%rip), %rsi     # 0xee034
leaq 0x593f0(%rip), %rdx     # 0x12907c
movq %rbx, %rdi
movl $0x322, %ecx            # imm = 0x322
jmp 0xcfd58
movl 0x4c0(%rbx), %esi
movq 0x498(%rbx), %rdi
movq 0x4b0(%rbx), %rdx
movq 0x4b8(%rbx), %r8
movq 0x10(%rsp), %r14
movq %r14, (%rsp)
movl $0x1, %ecx
xorl %r9d, %r9d
callq 0x142a8
cmpl $0x1, %eax
jne 0xcfd68
leaq 0x1e716(%rip), %rsi     # 0xee3f0
leaq 0x59505(%rip), %rdx     # 0x1291e6
leaq 0xa0(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x1e337(%rip), %rsi     # 0xee034
leaq 0x59378(%rip), %rdx     # 0x12907c
movq %r14, %rdi
movl $0x381, %ecx            # imm = 0x381
movq %rbx, %r8
jmp 0xcfd5b
addq $0xd1c, %r15            # imm = 0xD1C
leaq 0x1e6d1(%rip), %rsi     # 0xee3f0
leaq 0x593e5(%rip), %rdx     # 0x12910b
leaq 0xa0(%rsp), %r14
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30af0
addq $0x570, %rbx            # imm = 0x570
leaq 0x1e2eb(%rip), %rsi     # 0xee034
leaq 0x5932c(%rip), %rdx     # 0x12907c
movq %rbx, %rdi
movl $0x351, %ecx            # imm = 0x351
movq %r14, %r8
xorl %eax, %eax
callq 0x30af0
movl $0x1, %r15d
movl %r15d, %eax
addq $0x8a8, %rsp            # imm = 0x8A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq