// File: /workspace/github_c_makefile_star2_O2/PoulinV[P]AxiCLASS/build/../external/heating/injection.c
// Function: injection_init
int injection_init(struct precision * ppr,
                   struct background* pba,
                   struct thermodynamics* pth){

  /** Summary: */

  /** - Define local variable */
  struct injection* pin = &(pth->in);
  int index_inj, index_dep;

  /** - Initialize flags, indices and parameters */
  pin->has_DM_ann = _FALSE_;
  pin->has_DM_dec = _FALSE_;
  pin->has_PBH_eva = _FALSE_;
  pin->has_PBH_acc = _FALSE_;
  pin->last_index_x_chi = 0;
  pin->last_index_z_chi = 0;
  pin->last_index_z_feff = 0;

  /** - Import quantities from other structures */
  /* Precision structure */
  pin->Nz_size = ppr->thermo_Nz_lin;
  pin->z_initial = ppr->thermo_z_initial;
  pin->z_start_chi_approx = ppr->z_start_chi_approx;
  pin->Nz_PBH = ppr->primordial_black_hole_Nz;

  /* Background structure */
  pin->H0 = pba->H0*_c_/_Mpc_over_m_;                                                               // [1/s]
  pin->T_g0 = pba->T_cmb;                                                                           // [K]
  pin->Omega0_b = pba->Omega0_b;                                                                    // [-]
  pin->Omega0_cdm = pba->Omega0_cdm;                                                                // [-]
  pin->rho0_cdm = pba->Omega0_cdm*pow(pin->H0,2)*3/8./_PI_/_G_*_c_*_c_;                             // [J/m^3]

  /* Thermodynamics structure */
  pin->fHe = pth->fHe;                                                                              // [-]
  pin->N_e0 = pth->n_e;                                                                             // [1/m^3]

  /** - Define redshift tables */
  pin->z_size = pth->tt_size;
  class_alloc(pin->z_table,
              pin->z_size*sizeof(double),
              pin->error_message);
  memcpy(pin->z_table,
         pth->z_table,
         pin->z_size*sizeof(double));

  /** - Define additional book-keeping variables for the z table */
  pin->tol_z_table = 1e-10;
  pin->filled_until_index_z = pin->z_size-1;
  pin->filled_until_z = pin->z_table[pin->filled_until_index_z];
  pin->last_index_z_chi = 0;
  pin->last_index_z_feff = 0;
  pin->last_index_z_inj = 0;
  pin->last_index_z = 0;
  pin->index_z_store = 0;

  /** - Define indices of tables */
  pin->to_store = _FALSE_;
  class_call(injection_indices(pth),
             pin->error_message,
             pin->error_message);

  /** - Initialize energy injection table */
  /* Allocate space */
  class_alloc(pin->injection_table,
              pin->inj_size*sizeof(double*),
              pin->error_message);
  for(index_inj=0; index_inj<pin->inj_size; ++index_inj){
    class_alloc(pin->injection_table[index_inj],
                pin->z_size*sizeof(double),
                pin->error_message);
  }

  /* Calculate the PBH mass evolution, if needed */
  if(pin->has_PBH_eva == _TRUE_ ){
    class_call(injection_rate_PBH_evaporation_mass_evolution(pba,pin),
               pin->error_message,
               pin->error_message);
  }

  /** - Initialize injection efficiency */
  /* Read from external file, if needed */
  if(pin->f_eff_type == f_eff_from_file){
    class_call(injection_read_feff_from_file(ppr,pin,
                                             pin->f_eff_file),
               pin->error_message,
               pin->error_message);
  }

  /** - Initialize deposition function */
  /* Allocate space */
  class_alloc(pin->chi,
              pin->dep_size*sizeof(double),
              pin->error_message);

  /* Read from external file, if needed */
  if(pin->chi_type == chi_Galli_file){
    class_call(injection_read_chi_x_from_file(ppr,pin,
                                              ppr->chi_z_Galli),
               pin->error_message,
               pin->error_message);
  }
  else if(pin->chi_type == chi_from_x_file){
    class_call(injection_read_chi_x_from_file(ppr,pin,
                                              pin->chi_x_file),
               pin->error_message,
               pin->error_message);
  }
  else if(pin->chi_type == chi_from_z_file){
    class_call(injection_read_chi_z_from_file(ppr,pin,
                                              pin->chi_z_file),
               pin->error_message,
               pin->error_message);
  }

  /** - Initialize energy deposition table */
  /* Allocate space */
  class_alloc(pin->deposition_table,
              pin->dep_size*sizeof(double*),
              pin->error_message);
  for(index_dep=0; index_dep<pin->dep_size; ++index_dep){
    class_alloc(pin->deposition_table[index_dep],
                pin->z_size*sizeof(double),
                pin->error_message);
  }

  class_alloc(pin->pvecdeposition,
              pin->dep_size*sizeof(double),
              pin->error_message);

  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x818, %rsp            # imm = 0x818
movq %rdx, %rbx
andl $0x0, 0x544(%rdx)
movq %rsi, %r15
andq $0x0, 0x530(%rdx)
movq %rdi, %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x61c(%rdx)
movl 0x1a8(%rdi), %eax
movl %eax, 0x468(%rdx)
movsd 0x190(%rdi), %xmm0
movsd %xmm0, 0x470(%rdx)
movsd 0x508(%rdi), %xmm0
movsd %xmm0, 0x478(%rdx)
movl 0x1d8(%rdi), %eax
movl %eax, 0x580(%rdx)
movsd 0x2247d(%rip), %xmm0    # 0xe9ab0
movsd (%rsi), %xmm1
mulsd %xmm0, %xmm1
divsd 0x22365(%rip), %xmm1    # 0xe99a8
movsd %xmm1, 0x480(%rdx)
movups 0x18(%rsi), %xmm2
movups %xmm2, 0x488(%rdx)
movsd 0x28(%rsi), %xmm2
movsd %xmm2, 0x498(%rdx)
mulsd %xmm1, %xmm1
mulsd %xmm2, %xmm1
mulsd 0x1f0d5(%rip), %xmm1    # 0xe6748
mulsd 0x22335(%rip), %xmm1    # 0xe99b0
divsd 0x20915(%rip), %xmm1    # 0xe7f98
divsd 0x2232d(%rip), %xmm1    # 0xe99b8
mulsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, 0x4a0(%rdx)
movups 0x1000(%rdx), %xmm0
movups %xmm0, 0x4d8(%rdx)
movslq 0xf08(%rdx), %r12
movl %r12d, 0x510(%rdx)
leaq (,%r12,8), %rbp
movq %rbp, %rdi
callq 0x8490
movq %rax, 0x508(%rbx)
testq %rax, %rax
je 0xc77f1
movq %rax, %r13
movq %r14, (%rsp)
leaq 0x530(%rbx), %r14
movq 0xf10(%rbx), %rsi
movq %rax, %rdi
movq %rbp, %rdx
callq 0x82f0
movabsq $0x3ddb7cdfd9d7bdbb, %rax # imm = 0x3DDB7CDFD9D7BDBB
movq %rax, 0x518(%rbx)
leaq -0x1(%r12), %rax
movl %eax, 0x520(%rbx)
movsd -0x8(%r13,%r12,8), %xmm0
movsd %xmm0, 0x528(%rbx)
andl $0x0, 0x62c(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
andl $0x0, 0x10(%r14)
movq %rbx, %rdi
callq 0xc7c1d
movslq 0x5ac(%rbx), %rbp
movq %rbp, %rdi
shlq $0x3, %rdi
callq 0x8490
movq %rax, 0x588(%rbx)
testq %rax, %rax
je 0xc7831
movq %rax, %r13
leaq 0xc0(%rbx), %rax
movq %rax, 0x8(%rsp)
xorl %r14d, %r14d
testl %ebp, %ebp
movl $0x0, %r12d
cmovgl %ebp, %r12d
cmpq %r14, %r12
je 0xc7871
movslq 0x510(%rbx), %rbp
leaq (,%rbp,8), %rdi
callq 0x8490
movq %rax, (%r13,%r14,8)
movq 0x588(%rbx), %r13
cmpq $0x0, (%r13,%r14,8)
leaq 0x1(%r14), %r14
jne 0xc777e
shll $0x3, %ebp
leaq 0x1d847(%rip), %rsi     # 0xe5004
leaq 0x57f1a(%rip), %rdx     # 0x11f6de
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x2e014
addq $0x630, %rbx            # imm = 0x630
leaq 0x1d851(%rip), %rsi     # 0xe5034
leaq 0x591d6(%rip), %rdx     # 0x1209c0
pushq $0x5a
jmp 0xc7a45
shll $0x3, %r12d
leaq 0x1d808(%rip), %rsi     # 0xe5004
leaq 0x57eb9(%rip), %rdx     # 0x11f6bc
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x2e014
addq $0x630, %rbx            # imm = 0x630
leaq 0x1d811(%rip), %rsi     # 0xe5034
leaq 0x59196(%rip), %rdx     # 0x1209c0
pushq $0x3d
jmp 0xc7a45
leal (,%rbp,8), %ecx
leaq 0x1d7c5(%rip), %rsi     # 0xe5004
leaq 0x57e83(%rip), %rdx     # 0x11f6c9
leaq 0x10(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x630, %rbx            # imm = 0x630
leaq 0x1d7d1(%rip), %rsi     # 0xe5034
leaq 0x59156(%rip), %rdx     # 0x1209c0
pushq $0x56
jmp 0xc7a45
cmpl $0x1, 0x624(%rbx)
movq 0x8(%rsp), %r14
jne 0xc78ca
movq %r15, %rdi
movq %r14, %rsi
callq 0xc7d03
testl %eax, %eax
je 0xc78ca
addq $0x630, %rbx            # imm = 0x630
leaq 0x1db54(%rip), %rsi     # 0xe53f0
leaq 0x57e5b(%rip), %rdx     # 0x11f6fe
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x1d778(%rip), %rsi     # 0xe5034
leaq 0x590fd(%rip), %rdx     # 0x1209c0
pushq $0x61
jmp 0xc7a45
cmpl $0x1, 0x160(%rbx)
jne 0xc7922
leaq 0x164(%rbx), %rdx
movq %r14, %rsi
callq 0xc860b
testl %eax, %eax
je 0xc7922
addq $0x630, %rbx            # imm = 0x630
leaq 0x1dafc(%rip), %rsi     # 0xe53f0
leaq 0x57e3a(%rip), %rdx     # 0x11f735
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x1d720(%rip), %rsi     # 0xe5034
leaq 0x590a5(%rip), %rdx     # 0x1209c0
pushq $0x6a
jmp 0xc7a45
movslq 0x60c(%rbx), %r15
leaq (,%r15,8), %rdi
callq 0x8490
movq %rax, 0x5f0(%rbx)
testq %rax, %rax
je 0xc79ba
movl 0x264(%rbx), %eax
cmpl $0x6, %eax
je 0xc7a68
cmpl $0x5, %eax
je 0xc79f7
cmpl $0x2, %eax
jne 0xc7aba
movq (%rsp), %rdx
addq $0x408, %rdx            # imm = 0x408
movq %r14, %rsi
callq 0xc8916
testl %eax, %eax
je 0xc7aba
addq $0x630, %rbx            # imm = 0x630
leaq 0x1da64(%rip), %rsi     # 0xe53f0
leaq 0x57de3(%rip), %rdx     # 0x11f776
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x1d688(%rip), %rsi     # 0xe5034
leaq 0x5900d(%rip), %rdx     # 0x1209c0
pushq $0x78
jmp 0xc7a45
shll $0x3, %r15d
leaq 0x1d63f(%rip), %rsi     # 0xe5004
leaq 0x57da1(%rip), %rdx     # 0x11f76d
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movl %r15d, %ecx
xorl %eax, %eax
callq 0x2e014
addq $0x630, %rbx            # imm = 0x630
leaq 0x1d648(%rip), %rsi     # 0xe5034
leaq 0x58fcd(%rip), %rdx     # 0x1209c0
pushq $0x71
jmp 0xc7a45
leaq 0x368(%rbx), %rdx
movq %r14, %rsi
callq 0xc8916
testl %eax, %eax
je 0xc7aba
addq $0x630, %rbx            # imm = 0x630
leaq 0x1d9d4(%rip), %rsi     # 0xe53f0
leaq 0x57d8d(%rip), %rdx     # 0x11f7b0
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x1d5f8(%rip), %rsi     # 0xe5034
leaq 0x58f7d(%rip), %rdx     # 0x1209c0
pushq $0x7e
popq %rcx
movq %rbx, %rdi
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rax
addq $0x818, %rsp            # imm = 0x818
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x268(%rbx), %rdx
movq %r14, %rsi
callq 0xc8c97
testl %eax, %eax
je 0xc7aba
addq $0x630, %rbx            # imm = 0x630
leaq 0x1d967(%rip), %rsi     # 0xe53f0
leaq 0x57d59(%rip), %rdx     # 0x11f7e9
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x1d58b(%rip), %rsi     # 0xe5034
leaq 0x58f10(%rip), %rdx     # 0x1209c0
movq %rbx, %rdi
movl $0x84, %ecx
jmp 0xc7a49
movslq 0x60c(%rbx), %r12
movq %r12, %r14
shlq $0x3, %r14
movq %r14, %rdi
callq 0x8490
movq %rax, 0x5e8(%rbx)
testq %rax, %rax
je 0xc7b6f
movq %rax, %r15
xorl %r13d, %r13d
testl %r12d, %r12d
movl $0x0, %ebp
movq %r12, (%rsp)
cmovgl %r12d, %ebp
cmpq %r13, %rbp
je 0xc7bb6
movslq 0x510(%rbx), %r12
leaq (,%r12,8), %rdi
callq 0x8490
movq %rax, (%r15,%r13,8)
movq 0x5e8(%rbx), %r15
cmpq $0x0, (%r15,%r13,8)
leaq 0x1(%r13), %r13
jne 0xc7af6
shll $0x3, %r12d
leaq 0x1d4d0(%rip), %rsi     # 0xe5004
leaq 0x57cfd(%rip), %rdx     # 0x11f838
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x2e014
addq $0x630, %rbx            # imm = 0x630
leaq 0x1d4d9(%rip), %rsi     # 0xe5034
leaq 0x58e5e(%rip), %rdx     # 0x1209c0
movq %rbx, %rdi
movl $0x8f, %ecx
jmp 0xc7a49
leal (,%r12,8), %ecx
leaq 0x1d486(%rip), %rsi     # 0xe5004
leaq 0x57c9d(%rip), %rdx     # 0x11f822
leaq 0x10(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x630, %rbx            # imm = 0x630
leaq 0x1d492(%rip), %rsi     # 0xe5034
leaq 0x58e17(%rip), %rdx     # 0x1209c0
movq %rbx, %rdi
movl $0x8b, %ecx
jmp 0xc7a49
movq %r14, %rdi
callq 0x8490
movq %rax, %rcx
movq %rax, 0x610(%rbx)
xorl %eax, %eax
testq %rcx, %rcx
jne 0xc7a56
movq (%rsp), %rax
leal (,%rax,8), %ecx
leaq 0x1d41f(%rip), %rsi     # 0xe5004
leaq 0x57c6d(%rip), %rdx     # 0x11f859
leaq 0x10(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x630, %rbx            # imm = 0x630
leaq 0x1d42b(%rip), %rsi     # 0xe5034
leaq 0x58db0(%rip), %rdx     # 0x1209c0
movq %rbx, %rdi
movl $0x94, %ecx
jmp 0xc7a49