// File: /workspace/github_c_makefile_star2_O1/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
movq %rdi, %r14
movsd 0x68(%rsi), %xmm0
movsd %xmm0, 0x10(%rsp)
movq $0x0, 0x488(%rsi)
movsd 0x3b0(%rsi), %xmm0
addsd 0x1e557(%rip), %xmm0    # 0xf1260
callq 0x82c0
movapd %xmm0, 0x70(%rsp)
movslq 0x4c0(%rbx), %r12
movsd 0x3b0(%rbx), %xmm0
movsd %xmm0, 0x28(%rsp)
movslq 0x43c(%r14), %r13
leaq (,%r13,8), %rdi
callq 0x8460
testq %rax, %rax
je 0xd3333
movq %rax, %r15
leaq (,%r12,8), %r13
movq %r13, %rdi
callq 0x8460
movq %rax, 0x498(%rbx)
testq %rax, %rax
je 0xd337c
movq %r13, %rdi
callq 0x8460
movq %rax, 0x4a0(%rbx)
testq %rax, %rax
je 0xd33c5
movq %r13, %rdi
callq 0x8460
movq %rax, 0x4a8(%rbx)
testq %rax, %rax
je 0xd340e
movq %r13, %rdi
callq 0x8460
movq %rax, 0x4b0(%rbx)
testq %rax, %rax
je 0xd3457
movq %r13, %rdi
callq 0x8460
movq %rax, 0x4b8(%rbx)
testq %rax, %rax
je 0xd349d
movl 0x4c0(%rbx), %r13d
testl %r13d, %r13d
jle 0xd32b2
decl %r12d
cvtsi2sd %r12d, %xmm1
movsd 0x28(%rsp), %xmm0
mulsd 0x58709(%rip), %xmm0    # 0x12b4f8
movapd 0x1e439(%rip), %xmm2    # 0xf1230
xorpd 0x70(%rsp), %xmm2
divsd %xmm1, %xmm2
movapd %xmm2, 0x80(%rsp)
xorpd %xmm1, %xmm1
xorl %ebp, %ebp
leaq 0x6c(%rsp), %r12
movsd %xmm0, 0x28(%rsp)
movsd %xmm1, 0x38(%rsp)
movsd 0x586d7(%rip), %xmm0    # 0x12b500
divsd 0x10(%rsp), %xmm0
callq 0x82c0
addsd 0x586cc(%rip), %xmm0    # 0x12b508
divsd 0x586cc(%rip), %xmm0    # 0x12b510
callq 0x8670
movsd 0x1e40f(%rip), %xmm1    # 0xf1260
addsd %xmm1, %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, 0x490(%rbx)
movsd 0x10(%rsp), %xmm0
mulsd 0x586a9(%rip), %xmm0    # 0x12b518
movsd 0x586a9(%rip), %xmm1    # 0x12b520
divsd %xmm1, %xmm0
callq 0x8670
movapd %xmm0, %xmm1
movsd 0x5869c(%rip), %xmm0    # 0x12b528
mulsd %xmm0, %xmm1
addsd 0x22dd8(%rip), %xmm1    # 0xf5c70
movsd %xmm1, 0x20(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x58684(%rip), %xmm0    # 0x12b530
divsd 0x5866c(%rip), %xmm0    # 0x12b520
callq 0x8670
mulsd 0x58667(%rip), %xmm0    # 0x12b528
addsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x5865d(%rip), %xmm0    # 0x12b538
divsd 0x5863d(%rip), %xmm0    # 0x12b520
callq 0x8670
mulsd 0x58638(%rip), %xmm0    # 0x12b528
addsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x58636(%rip), %xmm0    # 0x12b540
divsd 0x5860e(%rip), %xmm0    # 0x12b520
callq 0x8670
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x5861d(%rip), %xmm0    # 0x12b548
divsd 0x585ed(%rip), %xmm0    # 0x12b520
callq 0x8670
addsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x585fe(%rip), %xmm0    # 0x12b550
divsd 0x585c6(%rip), %xmm0    # 0x12b520
callq 0x8670
addsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x585df(%rip), %xmm0    # 0x12b558
divsd 0x5859f(%rip), %xmm0    # 0x12b520
callq 0x8670
addsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x585c0(%rip), %xmm0    # 0x12b560
divsd 0x58578(%rip), %xmm0    # 0x12b520
callq 0x8670
addsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x585a1(%rip), %xmm0    # 0x12b568
divsd 0x58551(%rip), %xmm0    # 0x12b520
callq 0x8670
addsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x424d2(%rip), %xmm0    # 0x1154c0
movsd 0x5857a(%rip), %xmm1    # 0x12b570
divsd %xmm1, %xmm0
callq 0x8670
mulsd 0x58571(%rip), %xmm0    # 0x12b578
movsd 0x18(%rsp), %xmm1
mulsd 0x5856b(%rip), %xmm1    # 0x12b580
addsd %xmm0, %xmm1
mulsd 0x490(%rbx), %xmm1
movsd %xmm1, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x58553(%rip), %xmm0    # 0x12b588
movsd 0x58553(%rip), %xmm1    # 0x12b590
divsd %xmm1, %xmm0
callq 0x8670
movsd %xmm0, 0x60(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x5853e(%rip), %xmm0    # 0x12b598
divsd 0x5852e(%rip), %xmm0    # 0x12b590
callq 0x8670
movapd %xmm0, %xmm1
movsd 0x1e1ed(%rip), %xmm0    # 0xf1260
subsd 0x490(%rbx), %xmm0
movsd %xmm0, 0x50(%rsp)
mulsd 0x58517(%rip), %xmm1    # 0x12b5a0
movsd %xmm1, 0x58(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x58513(%rip), %xmm0    # 0x12b5b0
divsd 0x584cb(%rip), %xmm0    # 0x12b570
callq 0x8670
movsd %xmm0, 0x30(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x584fa(%rip), %xmm0    # 0x12b5b8
divsd 0x584aa(%rip), %xmm0    # 0x12b570
callq 0x8670
mulsd 0x584ed(%rip), %xmm0    # 0x12b5c0
movsd %xmm0, 0x48(%rsp)
movsd 0x30(%rsp), %xmm0
mulsd 0x582c9(%rip), %xmm0    # 0x12b3b0
movsd %xmm0, 0x30(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x584cd(%rip), %xmm0    # 0x12b5c8
divsd 0x5848d(%rip), %xmm0    # 0x12b590
callq 0x8670
movsd %xmm0, 0x40(%rsp)
movsd 0x20(%rsp), %xmm0
addsd 0x584b4(%rip), %xmm0    # 0x12b5d0
movsd %xmm0, 0x20(%rsp)
movq %r14, %rdi
movsd 0x28(%rsp), %xmm0
movl $0x2, %esi
xorl %edx, %edx
movq %r12, %rcx
movq %r15, %r8
callq 0x5ea8c
cmpl $0x1, %eax
je 0xd3576
movsd 0x5845a(%rip), %xmm0    # 0x12b5a8
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 0x58431(%rip), %xmm3    # 0x12b5d8
testq %rbp, %rbp
movsd %xmm3, 0x18(%rsp)
je 0xd3218
movsd 0x68(%rbx), %xmm0
mulsd 0x1eb11(%rip), %xmm0    # 0xf1cd0
movsd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xd3226
subsd 0x38(%rsp), %xmm3
movsd %xmm3, 0x30(%rsp)
movsd 0x10(%rsp), %xmm0
movsd 0x1f573(%rip), %xmm1    # 0xf2758
movsd %xmm2, 0x20(%rsp)
callq 0x8620
movsd 0x20(%rsp), %xmm2
movapd %xmm2, %xmm1
mulsd 0x583de(%rip), %xmm1    # 0x12b5e0
mulsd %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
mulsd 0x30(%rsp), %xmm1
addsd %xmm1, %xmm0
jmp 0xd321e
movsd 0x10(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
jmp 0xd324c
movsd 0x488(%rbx), %xmm0
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
movsd 0x28(%rsp), %xmm1
jne 0xd3248
jp 0xd3248
movsd %xmm1, 0x488(%rbx)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x498(%rbx), %rax
movsd %xmm1, (%rax,%rbp,8)
movq 0x4a0(%rbx), %rax
movsd %xmm0, (%rax,%rbp,8)
movq 0x4b0(%rbx), %rax
movsd %xmm2, (%rax,%rbp,8)
incq %rbp
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
mulsd 0x80(%rsp), %xmm0
addsd 0x70(%rsp), %xmm0
callq 0x8670
addsd 0x1e54c(%rip), %xmm0    # 0xf17e8
movslq 0x4c0(%rbx), %r13
cmpq %r13, %rbp
movsd 0x18(%rsp), %xmm1
jl 0xd2e15
movq %r15, %rdi
callq 0x8410
movq 0x498(%rbx), %rdi
movq 0x4a0(%rbx), %rdx
movq 0x4a8(%rbx), %r8
leaq 0x570(%rbx), %r14
movq %r14, (%rsp)
xorl %ebp, %ebp
movl %r13d, %esi
movl $0x1, %ecx
xorl %r9d, %r9d
callq 0x14191
cmpl $0x1, %eax
jne 0xd3504
leaq 0x1e0f4(%rip), %rsi     # 0xf13f0
leaq 0x58e34(%rip), %rdx     # 0x12c137
leaq 0x90(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x1dd15(%rip), %rsi     # 0xf1034
leaq 0x58d26(%rip), %rdx     # 0x12c04c
movq %r14, %rdi
movl $0x378, %ecx            # imm = 0x378
jmp 0xd356e
shll $0x3, %r13d
leaq 0x1dcc6(%rip), %rsi     # 0xf1004
leaq 0x58cf9(%rip), %rdx     # 0x12c03e
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movl %r13d, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x570, %rbx            # imm = 0x570
leaq 0x1dccc(%rip), %rsi     # 0xf1034
leaq 0x58cdd(%rip), %rdx     # 0x12c04c
movq %rbx, %rdi
movl $0x311, %ecx            # imm = 0x311
jmp 0xd34e1
shll $0x3, %r12d
leaq 0x1dc7d(%rip), %rsi     # 0xf1004
leaq 0x58cec(%rip), %rdx     # 0x12c07a
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x570, %rbx            # imm = 0x570
leaq 0x1dc83(%rip), %rsi     # 0xf1034
leaq 0x58c94(%rip), %rdx     # 0x12c04c
movq %rbx, %rdi
movl $0x316, %ecx            # imm = 0x316
jmp 0xd34e1
shll $0x3, %r12d
leaq 0x1dc34(%rip), %rsi     # 0xf1004
leaq 0x58cb4(%rip), %rdx     # 0x12c08b
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x570, %rbx            # imm = 0x570
leaq 0x1dc3a(%rip), %rsi     # 0xf1034
leaq 0x58c4b(%rip), %rdx     # 0x12c04c
movq %rbx, %rdi
movl $0x319, %ecx            # imm = 0x319
jmp 0xd34e1
shll $0x3, %r12d
leaq 0x1dbeb(%rip), %rsi     # 0xf1004
leaq 0x58c7f(%rip), %rdx     # 0x12c09f
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x570, %rbx            # imm = 0x570
leaq 0x1dbf1(%rip), %rsi     # 0xf1034
leaq 0x58c02(%rip), %rdx     # 0x12c04c
movq %rbx, %rdi
movl $0x31c, %ecx            # imm = 0x31C
jmp 0xd34e1
shll $0x3, %r12d
leaq 0x1dba2(%rip), %rsi     # 0xf1004
leaq 0x58c4d(%rip), %rdx     # 0x12c0b6
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x570, %rbx            # imm = 0x570
leaq 0x1dba8(%rip), %rsi     # 0xf1034
leaq 0x58bb9(%rip), %rdx     # 0x12c04c
movq %rbx, %rdi
movl $0x31f, %ecx            # imm = 0x31F
jmp 0xd34e1
shll $0x3, %r12d
leaq 0x1db5c(%rip), %rsi     # 0xf1004
leaq 0x58c18(%rip), %rdx     # 0x12c0c7
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x570, %rbx            # imm = 0x570
leaq 0x1db62(%rip), %rsi     # 0xf1034
leaq 0x58b73(%rip), %rdx     # 0x12c04c
movq %rbx, %rdi
movl $0x322, %ecx            # imm = 0x322
movq %r14, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %ebp
movl %ebp, %eax
addq $0x898, %rsp            # imm = 0x898
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x4c0(%rbx), %esi
movq 0x498(%rbx), %rdi
movq 0x4b0(%rbx), %rdx
movq 0x4b8(%rbx), %r8
movq %r14, (%rsp)
movl $0x1, %ecx
xorl %r9d, %r9d
callq 0x14191
cmpl $0x1, %eax
jne 0xd34f0
leaq 0x1deb4(%rip), %rsi     # 0xf13f0
leaq 0x58c73(%rip), %rdx     # 0x12c1b6
leaq 0x90(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x1dad5(%rip), %rsi     # 0xf1034
leaq 0x58ae6(%rip), %rdx     # 0x12c04c
movq %r14, %rdi
movl $0x381, %ecx            # imm = 0x381
movq %rbx, %r8
jmp 0xd34e4
addq $0xd1c, %r14            # imm = 0xD1C
leaq 0x1de6c(%rip), %rsi     # 0xf13f0
leaq 0x58b50(%rip), %rdx     # 0x12c0db
leaq 0x90(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x570, %rbx            # imm = 0x570
leaq 0x1da86(%rip), %rsi     # 0xf1034
leaq 0x58a97(%rip), %rdx     # 0x12c04c
movq %rbx, %rdi
movl $0x351, %ecx            # imm = 0x351
movq %r15, %r8
jmp 0xd34e4