// File: /workspace/github_c_makefile_star2_O2/PoulinV[P]AxiCLASS/build/../external/heating/injection.c
// Function: injection_read_feff_from_file
int injection_read_feff_from_file(struct precision* ppr,
                                  struct injection* pin,
                                  char* f_eff_file){

  /** - Define local variables */
  FILE * fA;
  char line[_LINE_LENGTH_MAX_];
  char * left;
  int headlines = 0;
  int index_z;

  pin->feff_z_size = 0;

  /** - Read file header */
  /* The file is assumed to contain:
   *    - The number of lines of the file
   *    - The columns ( z, f(z) ) where f(z) represents the "effective" fraction of energy deposited
   *      into the medium  at redshift z, in presence of halo formation. */
  class_open(fA, f_eff_file, "r", pin->error_message);

  while (fgets(line,_LINE_LENGTH_MAX_-1,fA) != NULL) {
    headlines++;

    /* Eliminate blank spaces at beginning of line */
    left=line;
    while (left[0]==' ') {
      left++;
    }

    /* Check that the line is neither blank nor a comment. In ASCII, left[0]>39 means that first non-blank charachter might
       be the beginning of some data (it is not a newline, a #, a %, etc.) */
    if (left[0] > 39) {

      /* If the line contains data, we must interprete it. If num_lines == 0 , the current line must contain
         its value. Otherwise, it must contain (xe , chi_heat, chi_Lya, chi_H, chi_He, chi_lowE). */

      /* Read num_lines, infer size of arrays and allocate them */
      class_test(sscanf(line,"%d",&(pin->feff_z_size)) != 1,
                 pin->error_message,
                 "could not read the initial integer of number of lines in line %i in file '%s' \n",
                 headlines,f_eff_file);

      /* (z, f, ddf)*/
      class_alloc(pin->feff_table,
                  3*pin->feff_z_size*sizeof(double),
                  pin->error_message);
      break;
    }
  }

  /** - Read file */
  for(index_z=0;index_z<pin->feff_z_size;++index_z){
    /* Read coefficients */
    class_test(fscanf(fA,"%lg %lg",
                      &(pin->feff_table[index_z*3+0]),  // z
                      &(pin->feff_table[index_z*3+1])   // f_eff(z)
                     ) != 2,
               pin->error_message,
               "could not read value of parameters coefficients in line %i in file '%s'\n",
               headlines,f_eff_file);
  }

  fclose(fA);

  /** - Spline file contents */
  /* Spline in one dimension */
  class_call(array_spline(pin->feff_table,
                          3,
                          pin->feff_z_size,
                          0,
                          1,
                          2,
                          _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 $0x1428, %rsp           # imm = 0x1428
movq %rdx, %r12
movq %rsi, %rbx
andl $0x0, 0x4f8(%rsi)
leaq 0x3b634(%rip), %rsi     # 0x103c64
movq %rdx, %rdi
callq 0x8420
testq %rax, %rax
je 0xc877c
movq %rax, %r15
leaq 0x4f8(%rbx), %rax
movq %rax, 0x10(%rsp)
xorl %ebp, %ebp
leaq 0x820(%rsp), %r13
movq %r13, %rdi
movl $0x3ff, %esi            # imm = 0x3FF
movq %r15, %rdx
callq 0x8570
testq %rax, %rax
je 0xc86c5
movq %r13, %rcx
movb (%rcx), %al
incq %rcx
cmpb $0x20, %al
je 0xc8672
incl %ebp
cmpb $0x28, %al
jl 0xc865a
leaq 0x2b987(%rip), %rsi     # 0xf400f
leaq 0x820(%rsp), %rdi
movq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x83b0
cmpl $0x1, %eax
jne 0xc8858
movslq 0x4f8(%rbx), %r14
imulq $0x18, %r14, %rdi
callq 0x8490
movq %rax, 0x500(%rbx)
testq %rax, %rax
je 0xc88b5
movq %r12, 0x18(%rsp)
movq %rbx, %r12
pushq $-0x1
popq %r14
leaq 0x57dc7(%rip), %r13     # 0x12049f
xorl %ecx, %ecx
movq 0x10(%rsp), %rax
movslq (%rax), %rax
incq %r14
cmpq %rax, %r14
jge 0xc87c8
leaq 0x18(%rcx), %rbx
movq 0x500(%r12), %rax
leaq (%rax,%rcx), %rdx
addq %rax, %rcx
addq $0x8, %rcx
movq %r15, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x86c0
movq %rbx, %rcx
cmpl $0x2, %eax
je 0xc86da
leaq 0x57c1d(%rip), %rsi     # 0x12033e
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movl %ebp, %edx
movq 0x18(%rsp), %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x1c944(%rip), %rsi     # 0xe5082
leaq 0x57c42(%rip), %rdx     # 0x120387
leaq 0xc20(%rsp), %r14
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x2e014
addq $0x570, %r12            # imm = 0x570
leaq 0x1c8cc(%rip), %rsi     # 0xe5034
leaq 0x57b26(%rip), %rdx     # 0x120295
movq %r12, %rdi
movl $0x4a7, %ecx            # imm = 0x4A7
jmp 0xc88f3
leaq 0x1f225(%rip), %rsi     # 0xe79a8
leaq 0x3c4e6(%rip), %rdx     # 0x104c70
leaq 0x1f24c(%rip), %r8      # 0xe79dd
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x2e014
addq $0x570, %rbx            # imm = 0x570
leaq 0x1c883(%rip), %rsi     # 0xe5034
leaq 0x57add(%rip), %rdx     # 0x120295
movq %rbx, %rdi
movl $0x47e, %ecx            # imm = 0x47E
movq %r15, %r8
jmp 0xc88f6
movq %r15, %rdi
callq 0x83c0
movq 0x500(%r12), %rdi
movl 0x4f8(%r12), %edx
addq $0x570, %r12            # imm = 0x570
andl $0x0, (%rsp)
movq %r12, 0x8(%rsp)
pushq $0x3
popq %rsi
xorl %r14d, %r14d
pushq $0x1
popq %rbp
pushq $0x2
popq %r9
xorl %ecx, %ecx
movl %ebp, %r8d
callq 0x11b09
cmpl $0x1, %eax
jne 0xc8901
leaq 0x1cbd9(%rip), %rsi     # 0xe53f0
leaq 0x57bc6(%rip), %rdx     # 0x1203e4
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x1c7fd(%rip), %rsi     # 0xe5034
leaq 0x57a57(%rip), %rdx     # 0x120295
movq %r12, %rdi
movl $0x4b7, %ecx            # imm = 0x4B7
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
movl %ebp, %r14d
jmp 0xc8901
leaq 0x57a54(%rip), %rsi     # 0x1202b3
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movl %ebp, %edx
movq %r12, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x1c808(%rip), %rsi     # 0xe5082
leaq 0x57a82(%rip), %rdx     # 0x120303
leaq 0xc20(%rsp), %r14
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x2e014
addq $0x570, %rbx            # imm = 0x570
leaq 0x1c790(%rip), %rsi     # 0xe5034
leaq 0x579ea(%rip), %rdx     # 0x120295
movq %rbx, %rdi
movl $0x494, %ecx            # imm = 0x494
jmp 0xc88f3
imull $0x18, %r14d, %ecx
leaq 0x1c744(%rip), %rsi     # 0xe5004
leaq 0x57a67(%rip), %rdx     # 0x12032e
leaq 0x20(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x570, %rbx            # imm = 0x570
leaq 0x1c750(%rip), %rsi     # 0xe5034
leaq 0x579aa(%rip), %rdx     # 0x120295
movq %rbx, %rdi
movl $0x499, %ecx            # imm = 0x499
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %r14
movl %r14d, %eax
addq $0x1428, %rsp           # imm = 0x1428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq