// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../external/heating/injection.c
// Function: injection_energy_injection_at_z
int injection_energy_injection_at_z(struct injection* pin,
                                    double z,
                                    double* dEdt_inj){

  /** - Define local variable */
  double dEdt, rate;
  double h,a,b;
  int index_inj;

  /* Initialize local variables */
  dEdt = 0.;

  /** - Test if the values are already within the table */
  if(z > pin->filled_until_z){
    /* If the value is already within the table, just interpolate */
    class_call(array_spline_hunt(pin->z_table,
                                 pin->z_size,
                                 z,
                                 &(pin->last_index_z_inj),
                                 &h,&a,&b,
                                 pin->error_message),
             pin->error_message,
             pin->error_message);
    /* (Linearly) interpolate within the table */
    for(index_inj=0; index_inj<pin->inj_size; ++index_inj){
      dEdt += pin->injection_table[index_inj][pin->last_index_z_inj]*a+pin->injection_table[index_inj][pin->last_index_z_inj+1]*b;
    }

    *dEdt_inj = dEdt;

  }

  else {
    /** - Exotic energy injection mechanisms */
    /* DM annihilation */
    if(pin->has_DM_ann == _TRUE_){
      class_call(injection_rate_DM_annihilation(pin,
                                                z,
                                                &rate),
                 pin->error_message,
                 pin->error_message);
      if(pin->to_store == _TRUE_){
        pin->injection_table[pin->index_inj_DM_ann][pin->index_z_store] = rate;
      }
      dEdt += rate;
    }

    /* DM decay */
    if(pin->has_DM_dec == _TRUE_){
      class_call(injection_rate_DM_decay(pin,
                                         z,
                                         &rate),
                 pin->error_message,
                 pin->error_message);
      if(pin->to_store == _TRUE_){
        pin->injection_table[pin->index_inj_DM_dec][pin->index_z_store] = rate;
      }
      dEdt += rate;
    }

    /* PBH evaporation */
    if(pin->has_PBH_eva == _TRUE_){
      class_call(injection_rate_PBH_evaporation(pin,
                                                z,
                                                &rate),
                 pin->error_message,
                 pin->error_message);
      if(pin->to_store == _TRUE_){
        pin->injection_table[pin->index_inj_PBH_eva][pin->index_z_store] = rate;
      }
      dEdt += rate;
    }

    /* PBH matter acctretion */
    if(pin->has_PBH_acc == _TRUE_){
      class_call(injection_rate_PBH_accretion(pin,
                                              z,
                                              &rate),
                 pin->error_message,
                 pin->error_message);
      if(pin->to_store == _TRUE_){
        pin->injection_table[pin->index_inj_PBH_acc][pin->index_z_store] = rate;
      }
      dEdt += rate;
    }

    /** Total energy injection */
    if(pin->to_store == _TRUE_){
      pin->injection_table[pin->index_inj_tot][pin->index_z_store] = dEdt;

      class_test(pin->index_z_store < pin->filled_until_index_z-1,
                 pin->error_message,
                 "Skipping too far ahead in z_table. Check that the injection and thermodynamics modules agree in their z sampling.");
    }

    *dEdt_inj = dEdt;

  }

  return _SUCCESS_;
}

// Assembly:
subq $0x3868, %rsp           # imm = 0x3868
movq %rdi, 0x3858(%rsp)
movsd %xmm0, 0x3850(%rsp)
movq %rsi, 0x3848(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x3840(%rsp)
movsd 0x3850(%rsp), %xmm0
movq 0x3858(%rsp), %rax
ucomisd 0x468(%rax), %xmm0
jbe 0x1a0476
movq 0x3858(%rsp), %rax
movq 0x448(%rax), %rdi
movq 0x3858(%rsp), %rax
movl 0x450(%rax), %esi
movsd 0x3850(%rsp), %xmm0
movq 0x3858(%rsp), %rdx
addq $0x478, %rdx            # imm = 0x478
movq 0x3858(%rsp), %rax
addq $0x570, %rax            # imm = 0x570
leaq 0x3830(%rsp), %rcx
leaq 0x3828(%rsp), %r8
leaq 0x3820(%rsp), %r9
movq %rax, (%rsp)
callq 0x27de0
cmpl $0x1, %eax
jne 0x1a0391
leaq 0x3010(%rsp), %rdi
movq 0x3858(%rsp), %rcx
addq $0x570, %rcx            # imm = 0x570
leaq 0x32096(%rip), %rsi     # 0x1d23d8
leaq 0x6cd8a(%rip), %rdx     # 0x20d0d3
movb $0x0, %al
callq 0x5b9c0
movq 0x3858(%rsp), %rdi
addq $0x570, %rdi            # imm = 0x570
leaq 0x3010(%rsp), %r8
leaq 0x31cc6(%rip), %rsi     # 0x1d2034
leaq 0x6cdc6(%rip), %rdx     # 0x20d13b
movl $0x18a, %ecx            # imm = 0x18A
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3864(%rsp)
jmp 0x1a09c2
movl $0x0, 0x381c(%rsp)
movl 0x381c(%rsp), %eax
movq 0x3858(%rsp), %rcx
cmpl 0x4ec(%rcx), %eax
jge 0x1a045c
movq 0x3858(%rsp), %rax
movq 0x4c8(%rax), %rax
movslq 0x381c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x3858(%rsp), %rcx
movslq 0x478(%rcx), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x3828(%rsp), %xmm2
movq 0x3858(%rsp), %rax
movq 0x4c8(%rax), %rax
movslq 0x381c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x3858(%rsp), %rcx
movl 0x478(%rcx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd 0x3820(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
addsd 0x3840(%rsp), %xmm0
movsd %xmm0, 0x3840(%rsp)
movl 0x381c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x381c(%rsp)
jmp 0x1a039c
movsd 0x3840(%rsp), %xmm0
movq 0x3848(%rsp), %rax
movsd %xmm0, (%rax)
jmp 0x1a09b7
movq 0x3858(%rsp), %rax
cmpl $0x1, 0x55c(%rax)
jne 0x1a0586
movq 0x3858(%rsp), %rdi
movsd 0x3850(%rsp), %xmm0
leaq 0x3838(%rsp), %rsi
callq 0x1a1a00
cmpl $0x1, %eax
jne 0x1a051b
leaq 0x2810(%rsp), %rdi
movq 0x3858(%rsp), %rcx
addq $0x570, %rcx            # imm = 0x570
leaq 0x31f0c(%rip), %rsi     # 0x1d23d8
leaq 0x6cc88(%rip), %rdx     # 0x20d15b
movb $0x0, %al
callq 0x5b9c0
movq 0x3858(%rsp), %rdi
addq $0x570, %rdi            # imm = 0x570
leaq 0x2810(%rsp), %r8
leaq 0x31b3c(%rip), %rsi     # 0x1d2034
leaq 0x6cc3c(%rip), %rdx     # 0x20d13b
movl $0x19c, %ecx            # imm = 0x19C
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3864(%rsp)
jmp 0x1a09c2
movq 0x3858(%rsp), %rax
cmpl $0x1, 0x56c(%rax)
jne 0x1a056b
movsd 0x3838(%rsp), %xmm0
movq 0x3858(%rsp), %rax
movq 0x4c8(%rax), %rax
movq 0x3858(%rsp), %rcx
movslq 0x4d8(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq 0x3858(%rsp), %rcx
movslq 0x480(%rcx), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0x3838(%rsp), %xmm0
addsd 0x3840(%rsp), %xmm0
movsd %xmm0, 0x3840(%rsp)
movq 0x3858(%rsp), %rax
cmpl $0x1, 0x560(%rax)
jne 0x1a0696
movq 0x3858(%rsp), %rdi
movsd 0x3850(%rsp), %xmm0
leaq 0x3838(%rsp), %rsi
callq 0x1a1d80
cmpl $0x1, %eax
jne 0x1a062b
leaq 0x2010(%rsp), %rdi
movq 0x3858(%rsp), %rcx
addq $0x570, %rcx            # imm = 0x570
leaq 0x31dfc(%rip), %rsi     # 0x1d23d8
leaq 0x6cba6(%rip), %rdx     # 0x20d189
movb $0x0, %al
callq 0x5b9c0
movq 0x3858(%rsp), %rdi
addq $0x570, %rdi            # imm = 0x570
leaq 0x2010(%rsp), %r8
leaq 0x31a2c(%rip), %rsi     # 0x1d2034
leaq 0x6cb2c(%rip), %rdx     # 0x20d13b
movl $0x1a9, %ecx            # imm = 0x1A9
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3864(%rsp)
jmp 0x1a09c2
movq 0x3858(%rsp), %rax
cmpl $0x1, 0x56c(%rax)
jne 0x1a067b
movsd 0x3838(%rsp), %xmm0
movq 0x3858(%rsp), %rax
movq 0x4c8(%rax), %rax
movq 0x3858(%rsp), %rcx
movslq 0x4dc(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq 0x3858(%rsp), %rcx
movslq 0x480(%rcx), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0x3838(%rsp), %xmm0
addsd 0x3840(%rsp), %xmm0
movsd %xmm0, 0x3840(%rsp)
movq 0x3858(%rsp), %rax
cmpl $0x1, 0x564(%rax)
jne 0x1a07a6
movq 0x3858(%rsp), %rdi
movsd 0x3850(%rsp), %xmm0
leaq 0x3838(%rsp), %rsi
callq 0x1a1e10
cmpl $0x1, %eax
jne 0x1a073b
leaq 0x1810(%rsp), %rdi
movq 0x3858(%rsp), %rcx
addq $0x570, %rcx            # imm = 0x570
leaq 0x31cec(%rip), %rsi     # 0x1d23d8
leaq 0x6cabd(%rip), %rdx     # 0x20d1b0
movb $0x0, %al
callq 0x5b9c0
movq 0x3858(%rsp), %rdi
addq $0x570, %rdi            # imm = 0x570
leaq 0x1810(%rsp), %r8
leaq 0x3191c(%rip), %rsi     # 0x1d2034
leaq 0x6ca1c(%rip), %rdx     # 0x20d13b
movl $0x1b6, %ecx            # imm = 0x1B6
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3864(%rsp)
jmp 0x1a09c2
movq 0x3858(%rsp), %rax
cmpl $0x1, 0x56c(%rax)
jne 0x1a078b
movsd 0x3838(%rsp), %xmm0
movq 0x3858(%rsp), %rax
movq 0x4c8(%rax), %rax
movq 0x3858(%rsp), %rcx
movslq 0x4e0(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq 0x3858(%rsp), %rcx
movslq 0x480(%rcx), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0x3838(%rsp), %xmm0
addsd 0x3840(%rsp), %xmm0
movsd %xmm0, 0x3840(%rsp)
movq 0x3858(%rsp), %rax
cmpl $0x1, 0x568(%rax)
jne 0x1a08b6
movq 0x3858(%rsp), %rdi
movsd 0x3850(%rsp), %xmm0
leaq 0x3838(%rsp), %rsi
callq 0x1a2180
cmpl $0x1, %eax
jne 0x1a084b
leaq 0x1010(%rsp), %rdi
movq 0x3858(%rsp), %rcx
addq $0x570, %rcx            # imm = 0x570
leaq 0x31bdc(%rip), %rsi     # 0x1d23d8
leaq 0x6c9db(%rip), %rdx     # 0x20d1de
movb $0x0, %al
callq 0x5b9c0
movq 0x3858(%rsp), %rdi
addq $0x570, %rdi            # imm = 0x570
leaq 0x1010(%rsp), %r8
leaq 0x3180c(%rip), %rsi     # 0x1d2034
leaq 0x6c90c(%rip), %rdx     # 0x20d13b
movl $0x1c3, %ecx            # imm = 0x1C3
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3864(%rsp)
jmp 0x1a09c2
movq 0x3858(%rsp), %rax
cmpl $0x1, 0x56c(%rax)
jne 0x1a089b
movsd 0x3838(%rsp), %xmm0
movq 0x3858(%rsp), %rax
movq 0x4c8(%rax), %rax
movq 0x3858(%rsp), %rcx
movslq 0x4e4(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq 0x3858(%rsp), %rcx
movslq 0x480(%rcx), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0x3838(%rsp), %xmm0
addsd 0x3840(%rsp), %xmm0
movsd %xmm0, 0x3840(%rsp)
movq 0x3858(%rsp), %rax
cmpl $0x1, 0x56c(%rax)
jne 0x1a09a2
movsd 0x3840(%rsp), %xmm0
movq 0x3858(%rsp), %rax
movq 0x4c8(%rax), %rax
movq 0x3858(%rsp), %rcx
movslq 0x4e8(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq 0x3858(%rsp), %rcx
movslq 0x480(%rcx), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq 0x3858(%rsp), %rax
movl 0x480(%rax), %eax
movq 0x3858(%rsp), %rcx
movl 0x460(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x1a09a0
leaq 0x810(%rsp), %rdi
leaq 0x6c8ce(%rip), %rsi     # 0x20d20a
movb $0x0, %al
callq 0x5b9c0
leaq 0x10(%rsp), %rdi
leaq 0x810(%rsp), %rcx
leaq 0x3172b(%rip), %rsi     # 0x1d2082
leaq 0x6c744(%rip), %rdx     # 0x20d0a2
movb $0x0, %al
callq 0x5b9c0
movq 0x3858(%rsp), %rdi
addq $0x570, %rdi            # imm = 0x570
leaq 0x10(%rsp), %r8
leaq 0x316b4(%rip), %rsi     # 0x1d2034
leaq 0x6c7b4(%rip), %rdx     # 0x20d13b
movl $0x1d0, %ecx            # imm = 0x1D0
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3864(%rsp)
jmp 0x1a09c2
jmp 0x1a09a2
movsd 0x3840(%rsp), %xmm0
movq 0x3848(%rsp), %rax
movsd %xmm0, (%rax)
movl $0x0, 0x3864(%rsp)
movl 0x3864(%rsp), %eax
addq $0x3868, %rsp           # imm = 0x3868
retq
nopw %cs:(%rax,%rax)