// File: /workspace/github_c_makefile_star2_O3/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
movq %rsi, %r15
movq %rdi, %r14
movl $0x0, 0x544(%rdx)
movq $0x0, 0x530(%rdx)
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 0x23eaf(%rip), %xmm0    # 0xf2bf0
movsd (%rsi), %xmm1
mulsd %xmm0, %xmm1
divsd 0x23d97(%rip), %xmm1    # 0xf2ae8
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 0x208ff(%rip), %xmm1    # 0xef680
mulsd 0x23d67(%rip), %xmm1    # 0xf2af0
divsd 0x22247(%rip), %xmm1    # 0xf0fd8
divsd 0x23d5f(%rip), %xmm1    # 0xf2af8
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 0x8460
movq %rax, 0x508(%rbx)
testq %rax, %rax
je 0xcef1b
movq %rax, %r13
movq %r14, (%rsp)
leaq 0x530(%rbx), %r14
movq 0xf10(%rbx), %rsi
movq %rax, %rdi
movq %rbp, %rdx
callq 0x82d0
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)
xorl %eax, %eax
movl %eax, 0x62c(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movl %eax, 0x10(%r14)
movq %rbx, %rdi
callq 0xcf358
movslq 0x5ac(%rbx), %r12
leaq (,%r12,8), %rdi
callq 0x8460
movq %rax, 0x588(%rbx)
testq %rax, %rax
je 0xcef61
testl %r12d, %r12d
jle 0xceeb2
movq %rax, %r13
movslq 0x510(%rbx), %rbp
movq %rbp, 0x8(%rsp)
shlq $0x3, %rbp
xorl %r14d, %r14d
movq %rbp, %rdi
callq 0x8460
movq %rax, (%r13,%r14,8)
movq 0x588(%rbx), %r13
cmpq $0x0, (%r13,%r14,8)
je 0xcf0a7
incq %r14
cmpq %r14, %r12
jne 0xcee8a
leaq 0xc0(%rbx), %r12
cmpl $0x1, 0x624(%rbx)
jne 0xcefa7
movq %r15, %rdi
movq %r12, %rsi
callq 0xcf443
testl %eax, %eax
je 0xcefa7
addq $0x630, %rbx            # imm = 0x630
leaq 0x1f509(%rip), %rsi     # 0xee3f0
leaq 0x59960(%rip), %rdx     # 0x12884e
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x1f12d(%rip), %rsi     # 0xee034
leaq 0x5ac12(%rip), %rdx     # 0x129b20
movq %rbx, %rdi
movl $0x61, %ecx
jmp 0xcf337
shll $0x3, %r12d
leaq 0x1f0de(%rip), %rsi     # 0xee004
leaq 0x598df(%rip), %rdx     # 0x12880c
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x30af0
addq $0x630, %rbx            # imm = 0x630
leaq 0x1f0e7(%rip), %rsi     # 0xee034
leaq 0x5abcc(%rip), %rdx     # 0x129b20
movq %rbx, %rdi
movl $0x3d, %ecx
jmp 0xcf337
shll $0x3, %r12d
leaq 0x1f098(%rip), %rsi     # 0xee004
leaq 0x598a6(%rip), %rdx     # 0x128819
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x30af0
addq $0x630, %rbx            # imm = 0x630
leaq 0x1f0a1(%rip), %rsi     # 0xee034
leaq 0x5ab86(%rip), %rdx     # 0x129b20
movq %rbx, %rdi
movl $0x56, %ecx
jmp 0xcf337
cmpl $0x1, 0x160(%rbx)
jne 0xcf005
leaq 0x164(%rbx), %rdx
movq %r12, %rsi
callq 0xcfd7d
testl %eax, %eax
je 0xcf005
addq $0x630, %rbx            # imm = 0x630
leaq 0x1f41f(%rip), %rsi     # 0xee3f0
leaq 0x598ad(%rip), %rdx     # 0x128885
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x1f043(%rip), %rsi     # 0xee034
leaq 0x5ab28(%rip), %rdx     # 0x129b20
movq %rbx, %rdi
movl $0x6a, %ecx
jmp 0xcf337
movslq 0x60c(%rbx), %r15
leaq (,%r15,8), %rdi
callq 0x8460
movq %rax, 0x5f0(%rbx)
testq %rax, %rax
je 0xcf0f2
movl 0x264(%rbx), %eax
cmpl $0x6, %eax
je 0xcf191
cmpl $0x5, %eax
je 0xcf138
cmpl $0x2, %eax
jne 0xcf1e6
movq (%rsp), %rdx
addq $0x408, %rdx            # imm = 0x408
movq %r12, %rsi
callq 0xd009b
testl %eax, %eax
je 0xcf1e6
addq $0x630, %rbx            # imm = 0x630
leaq 0x1f37d(%rip), %rsi     # 0xee3f0
leaq 0x5984c(%rip), %rdx     # 0x1288c6
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x1efa1(%rip), %rsi     # 0xee034
leaq 0x5aa86(%rip), %rdx     # 0x129b20
movq %rbx, %rdi
movl $0x78, %ecx
jmp 0xcf337
movq 0x8(%rsp), %rax
leal (,%rax,8), %ecx
leaq 0x1ef4a(%rip), %rsi     # 0xee004
leaq 0x5976d(%rip), %rdx     # 0x12882e
leaq 0x10(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
addq $0x630, %rbx            # imm = 0x630
leaq 0x1ef56(%rip), %rsi     # 0xee034
leaq 0x5aa3b(%rip), %rdx     # 0x129b20
movq %rbx, %rdi
movl $0x5a, %ecx
jmp 0xcf337
shll $0x3, %r15d
leaq 0x1ef07(%rip), %rsi     # 0xee004
leaq 0x597b9(%rip), %rdx     # 0x1288bd
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movl %r15d, %ecx
xorl %eax, %eax
callq 0x30af0
addq $0x630, %rbx            # imm = 0x630
leaq 0x1ef10(%rip), %rsi     # 0xee034
leaq 0x5a9f5(%rip), %rdx     # 0x129b20
movq %rbx, %rdi
movl $0x71, %ecx
jmp 0xcf337
leaq 0x368(%rbx), %rdx
movq %r12, %rsi
callq 0xd009b
testl %eax, %eax
je 0xcf1e6
addq $0x630, %rbx            # imm = 0x630
leaq 0x1f293(%rip), %rsi     # 0xee3f0
leaq 0x5979c(%rip), %rdx     # 0x128900
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x1eeb7(%rip), %rsi     # 0xee034
leaq 0x5a99c(%rip), %rdx     # 0x129b20
movq %rbx, %rdi
movl $0x7e, %ecx
jmp 0xcf337
leaq 0x268(%rbx), %rdx
movq %r12, %rsi
callq 0xd0438
testl %eax, %eax
je 0xcf1e6
addq $0x630, %rbx            # imm = 0x630
leaq 0x1f23e(%rip), %rsi     # 0xee3f0
leaq 0x59780(%rip), %rdx     # 0x128939
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x1ee62(%rip), %rsi     # 0xee034
leaq 0x5a947(%rip), %rdx     # 0x129b20
movq %rbx, %rdi
movl $0x84, %ecx
jmp 0xcf337
movslq 0x60c(%rbx), %r14
leaq (,%r14,8), %r15
movq %r15, %rdi
callq 0x8460
movq %rax, 0x5e8(%rbx)
testq %rax, %rax
je 0xcf2ac
testl %r14d, %r14d
jle 0xcf24c
movq %rax, %r12
movslq 0x510(%rbx), %r13
movq %r13, (%rsp)
shlq $0x3, %r13
xorl %ebp, %ebp
movq %r13, %rdi
callq 0x8460
movq %rax, (%r12,%rbp,8)
movq 0x5e8(%rbx), %r12
cmpq $0x0, (%r12,%rbp,8)
je 0xcf2f2
incq %rbp
cmpq %rbp, %r14
jne 0xcf226
movq %r15, %rdi
callq 0x8460
movq %rax, %rcx
movq %rax, 0x610(%rbx)
xorl %eax, %eax
testq %rcx, %rcx
jne 0xcf346
shll $0x3, %r14d
leaq 0x1ed90(%rip), %rsi     # 0xee004
leaq 0x5972e(%rip), %rdx     # 0x1289a9
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movl %r14d, %ecx
xorl %eax, %eax
callq 0x30af0
addq $0x630, %rbx            # imm = 0x630
leaq 0x1ed99(%rip), %rsi     # 0xee034
leaq 0x5a87e(%rip), %rdx     # 0x129b20
movq %rbx, %rdi
movl $0x94, %ecx
jmp 0xcf2ed
shll $0x3, %r14d
leaq 0x1ed4d(%rip), %rsi     # 0xee004
leaq 0x596b4(%rip), %rdx     # 0x128972
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movl %r14d, %ecx
xorl %eax, %eax
callq 0x30af0
addq $0x630, %rbx            # imm = 0x630
leaq 0x1ed56(%rip), %rsi     # 0xee034
leaq 0x5a83b(%rip), %rdx     # 0x129b20
movq %rbx, %rdi
movl $0x8b, %ecx
movq %r15, %r8
jmp 0xcf33a
movq (%rsp), %rax
leal (,%rax,8), %ecx
leaq 0x1ed00(%rip), %rsi     # 0xee004
leaq 0x5967d(%rip), %rdx     # 0x128988
leaq 0x10(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
addq $0x630, %rbx            # imm = 0x630
leaq 0x1ed0c(%rip), %rsi     # 0xee034
leaq 0x5a7f1(%rip), %rdx     # 0x129b20
movq %rbx, %rdi
movl $0x8f, %ecx
movq %r14, %r8
xorl %eax, %eax
callq 0x30af0
movl $0x1, %eax
addq $0x818, %rsp            # imm = 0x818
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq