// File: /workspace/github_c_makefile_star2_O1/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 0x235f3(%rip), %xmm0    # 0xf5bc0
movsd (%rsi), %xmm1
mulsd %xmm0, %xmm1
divsd 0x234db(%rip), %xmm1    # 0xf5ab8
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 0x20073(%rip), %xmm1    # 0xf2680
mulsd 0x234ab(%rip), %xmm1    # 0xf5ac0
divsd 0x219ab(%rip), %xmm1    # 0xf3fc8
divsd 0x234a3(%rip), %xmm1    # 0xf5ac8
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 0xd27a7
movq %rax, %r13
movq %r14, 0x8(%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 0xd2be1
movslq 0x5ac(%rbx), %r12
leaq (,%r12,8), %rdi
callq 0x8460
movq %rax, 0x588(%rbx)
testq %rax, %rax
je 0xd27ed
testl %r12d, %r12d
jle 0xd273e
movslq 0x510(%rbx), %r13
movq %r13, %r14
shlq $0x3, %r13
xorl %ebp, %ebp
movq %r13, %rdi
callq 0x8460
movq 0x588(%rbx), %rcx
movq %rax, (%rcx,%rbp,8)
movq 0x588(%rbx), %rax
cmpq $0x0, (%rax,%rbp,8)
je 0xd2934
incq %rbp
cmpq %rbp, %r12
jne 0xd2711
leaq 0xc0(%rbx), %r12
cmpl $0x1, 0x624(%rbx)
jne 0xd2833
movq %r15, %rdi
movq %r12, %rsi
callq 0xd2ccc
testl %eax, %eax
je 0xd2833
addq $0x630, %rbx            # imm = 0x630
leaq 0x1ec7d(%rip), %rsi     # 0xf13f0
leaq 0x590a4(%rip), %rdx     # 0x12b81e
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x1e8a1(%rip), %rsi     # 0xf1034
leaq 0x5a356(%rip), %rdx     # 0x12caf0
movq %rbx, %rdi
movl $0x61, %ecx
jmp 0xd2bc0
shll $0x3, %r12d
leaq 0x1e852(%rip), %rsi     # 0xf1004
leaq 0x59023(%rip), %rdx     # 0x12b7dc
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x630, %rbx            # imm = 0x630
leaq 0x1e85b(%rip), %rsi     # 0xf1034
leaq 0x5a310(%rip), %rdx     # 0x12caf0
movq %rbx, %rdi
movl $0x3d, %ecx
jmp 0xd2bc0
shll $0x3, %r12d
leaq 0x1e80c(%rip), %rsi     # 0xf1004
leaq 0x58fea(%rip), %rdx     # 0x12b7e9
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x630, %rbx            # imm = 0x630
leaq 0x1e815(%rip), %rsi     # 0xf1034
leaq 0x5a2ca(%rip), %rdx     # 0x12caf0
movq %rbx, %rdi
movl $0x56, %ecx
jmp 0xd2bc0
cmpl $0x1, 0x160(%rbx)
jne 0xd2891
leaq 0x164(%rbx), %rdx
movq %r12, %rsi
callq 0xd35c5
testl %eax, %eax
je 0xd2891
addq $0x630, %rbx            # imm = 0x630
leaq 0x1eb93(%rip), %rsi     # 0xf13f0
leaq 0x58ff1(%rip), %rdx     # 0x12b855
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x1e7b7(%rip), %rsi     # 0xf1034
leaq 0x5a26c(%rip), %rdx     # 0x12caf0
movq %rbx, %rdi
movl $0x6a, %ecx
jmp 0xd2bc0
movslq 0x60c(%rbx), %r15
leaq (,%r15,8), %rdi
callq 0x8460
movq %rax, 0x5f0(%rbx)
testq %rax, %rax
je 0xd297b
movl 0x264(%rbx), %eax
cmpl $0x6, %eax
je 0xd2a1a
cmpl $0x5, %eax
je 0xd29c1
cmpl $0x2, %eax
jne 0xd2a6f
movq 0x8(%rsp), %rdx
addq $0x408, %rdx            # imm = 0x408
movq %r12, %rsi
callq 0xd38d3
testl %eax, %eax
je 0xd2a6f
addq $0x630, %rbx            # imm = 0x630
leaq 0x1eaf0(%rip), %rsi     # 0xf13f0
leaq 0x58f8f(%rip), %rdx     # 0x12b896
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x1e714(%rip), %rsi     # 0xf1034
leaq 0x5a1c9(%rip), %rdx     # 0x12caf0
movq %rbx, %rdi
movl $0x78, %ecx
jmp 0xd2bc0
leal (,%r14,8), %ecx
leaq 0x1e6c1(%rip), %rsi     # 0xf1004
leaq 0x58eb4(%rip), %rdx     # 0x12b7fe
leaq 0x10(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
addq $0x630, %rbx            # imm = 0x630
leaq 0x1e6cd(%rip), %rsi     # 0xf1034
leaq 0x5a182(%rip), %rdx     # 0x12caf0
movq %rbx, %rdi
movl $0x5a, %ecx
jmp 0xd2bc0
shll $0x3, %r15d
leaq 0x1e67e(%rip), %rsi     # 0xf1004
leaq 0x58f00(%rip), %rdx     # 0x12b88d
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movl %r15d, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x630, %rbx            # imm = 0x630
leaq 0x1e687(%rip), %rsi     # 0xf1034
leaq 0x5a13c(%rip), %rdx     # 0x12caf0
movq %rbx, %rdi
movl $0x71, %ecx
jmp 0xd2bc0
leaq 0x368(%rbx), %rdx
movq %r12, %rsi
callq 0xd38d3
testl %eax, %eax
je 0xd2a6f
addq $0x630, %rbx            # imm = 0x630
leaq 0x1ea0a(%rip), %rsi     # 0xf13f0
leaq 0x58ee3(%rip), %rdx     # 0x12b8d0
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x1e62e(%rip), %rsi     # 0xf1034
leaq 0x5a0e3(%rip), %rdx     # 0x12caf0
movq %rbx, %rdi
movl $0x7e, %ecx
jmp 0xd2bc0
leaq 0x268(%rbx), %rdx
movq %r12, %rsi
callq 0xd3c65
testl %eax, %eax
je 0xd2a6f
addq $0x630, %rbx            # imm = 0x630
leaq 0x1e9b5(%rip), %rsi     # 0xf13f0
leaq 0x58ec7(%rip), %rdx     # 0x12b909
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x1e5d9(%rip), %rsi     # 0xf1034
leaq 0x5a08e(%rip), %rdx     # 0x12caf0
movq %rbx, %rdi
movl $0x84, %ecx
jmp 0xd2bc0
movslq 0x60c(%rbx), %r14
leaq (,%r14,8), %r15
movq %r15, %rdi
callq 0x8460
movq %rax, 0x5e8(%rbx)
testq %rax, %rax
je 0xd2b38
testl %r14d, %r14d
jle 0xd2ad8
movslq 0x510(%rbx), %r13
movq %r13, %r12
shlq $0x3, %r12
xorl %ebp, %ebp
movq %r12, %rdi
callq 0x8460
movq 0x5e8(%rbx), %rcx
movq %rax, (%rcx,%rbp,8)
movq 0x5e8(%rbx), %rax
cmpq $0x0, (%rax,%rbp,8)
je 0xd2b7e
incq %rbp
cmpq %rbp, %r14
jne 0xd2aab
movq %r15, %rdi
callq 0x8460
movq %rax, %rcx
movq %rax, 0x610(%rbx)
xorl %eax, %eax
testq %rcx, %rcx
jne 0xd2bcf
shll $0x3, %r14d
leaq 0x1e504(%rip), %rsi     # 0xf1004
leaq 0x58e72(%rip), %rdx     # 0x12b979
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movl %r14d, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x630, %rbx            # imm = 0x630
leaq 0x1e50d(%rip), %rsi     # 0xf1034
leaq 0x59fc2(%rip), %rdx     # 0x12caf0
movq %rbx, %rdi
movl $0x94, %ecx
jmp 0xd2b79
shll $0x3, %r14d
leaq 0x1e4c1(%rip), %rsi     # 0xf1004
leaq 0x58df8(%rip), %rdx     # 0x12b942
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movl %r14d, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x630, %rbx            # imm = 0x630
leaq 0x1e4ca(%rip), %rsi     # 0xf1034
leaq 0x59f7f(%rip), %rdx     # 0x12caf0
movq %rbx, %rdi
movl $0x8b, %ecx
movq %r15, %r8
jmp 0xd2bc3
leal (,%r13,8), %ecx
leaq 0x1e477(%rip), %rsi     # 0xf1004
leaq 0x58dc4(%rip), %rdx     # 0x12b958
leaq 0x10(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
addq $0x630, %rbx            # imm = 0x630
leaq 0x1e483(%rip), %rsi     # 0xf1034
leaq 0x59f38(%rip), %rdx     # 0x12caf0
movq %rbx, %rdi
movl $0x8f, %ecx
movq %r14, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %eax
addq $0x818, %rsp            # imm = 0x818
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq