// File: /workspace/github_c_makefile_star2_O3/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 $0x1418, %rsp           # imm = 0x1418
movq %rdx, %r14
movq %rsi, %rbx
movl $0x0, 0x4f8(%rsi)
leaq 0x3cfff(%rip), %rsi     # 0x10cda4
movq %rdx, %rdi
callq 0x8400
testq %rax, %rax
je 0xcfe4d
movq %rax, %r15
leaq 0x4f8(%rbx), %rax
movq %rax, (%rsp)
xorl %ebp, %ebp
leaq 0x810(%rsp), %r13
movq %r13, %rdi
movl $0x3ff, %esi            # imm = 0x3FF
movq %r15, %rdx
callq 0x8540
testq %rax, %rax
je 0xcfe99
movq %r13, %rcx
movb (%rcx), %al
incq %rcx
cmpb $0x20, %al
je 0xcfdea
incl %ebp
cmpb $0x28, %al
jl 0xcfdce
leaq 0x2d347(%rip), %rsi     # 0xfd147
leaq 0x810(%rsp), %rdi
movq (%rsp), %rdx
xorl %eax, %eax
callq 0x8390
cmpl $0x1, %eax
jne 0xcff75
movq %rbx, %r13
movslq 0x4f8(%rbx), %rbx
movq %rbx, %rax
shlq $0x3, %rax
leaq (%rax,%rax,2), %rdi
callq 0x8460
movq %rax, 0x500(%r13)
testq %rax, %rax
je 0xd0034
movq %r14, 0x8(%rsp)
jmp 0xcfea7
leaq 0x20b94(%rip), %rsi     # 0xf09e8
leaq 0x3df75(%rip), %rdx     # 0x10ddd0
leaq 0x20bbb(%rip), %r8      # 0xf0a1d
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
addq $0x570, %rbx            # imm = 0x570
leaq 0x1e1b2(%rip), %rsi     # 0xee034
leaq 0x5955c(%rip), %rdx     # 0x1293e5
movq %rbx, %rdi
movl $0x47e, %ecx            # imm = 0x47E
movq %r15, %r8
jmp 0xd007b
movq %r14, 0x8(%rsp)
movq %rbx, %r13
movq (%rsp), %rax
movl (%rax), %ebx
testl %ebx, %ebx
jle 0xcfef2
leaq 0x5973d(%rip), %r12     # 0x1295ef
xorl %r14d, %r14d
xorl %ebx, %ebx
movq 0x500(%r13), %rdx
leaq (%rdx,%r14), %rcx
addq $0x8, %rcx
addq %r14, %rdx
movq %r15, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x8690
cmpl $0x2, %eax
jne 0xcffd5
incq %rbx
movq (%rsp), %rax
movslq (%rax), %rax
addq $0x18, %r14
cmpq %rax, %rbx
jl 0xcfeb7
movq %r15, %rdi
callq 0x83a0
movq 0x500(%r13), %rdi
movl 0x4f8(%r13), %edx
addq $0x570, %r13            # imm = 0x570
xorl %ebp, %ebp
movl $0x3, %esi
xorl %ecx, %ecx
movl $0x1, %r8d
movl $0x2, %r9d
pushq %r13
pushq $0x0
callq 0x1381e
addq $0x10, %rsp
cmpl $0x1, %eax
jne 0xd0087
leaq 0x1e4af(%rip), %rsi     # 0xee3f0
leaq 0x595ec(%rip), %rdx     # 0x129534
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %r13, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x1e0d3(%rip), %rsi     # 0xee034
leaq 0x5947d(%rip), %rdx     # 0x1293e5
movq %r13, %rdi
movl $0x4b7, %ecx            # imm = 0x4B7
jmp 0xd0078
leaq 0x59487(%rip), %rsi     # 0x129403
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movl %ebp, %edx
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x1e0eb(%rip), %rsi     # 0xee082
leaq 0x594b5(%rip), %rdx     # 0x129453
leaq 0xc10(%rsp), %r14
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30af0
addq $0x570, %rbx            # imm = 0x570
leaq 0x1e073(%rip), %rsi     # 0xee034
leaq 0x5941d(%rip), %rdx     # 0x1293e5
movq %rbx, %rdi
movl $0x494, %ecx            # imm = 0x494
jmp 0xd0078
leaq 0x594b2(%rip), %rsi     # 0x12948e
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movl %ebp, %edx
movq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x1e089(%rip), %rsi     # 0xee082
leaq 0x594d7(%rip), %rdx     # 0x1294d7
leaq 0xc10(%rsp), %r14
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30af0
addq $0x570, %r13            # imm = 0x570
leaq 0x1e011(%rip), %rsi     # 0xee034
leaq 0x593bb(%rip), %rdx     # 0x1293e5
movq %r13, %rdi
movl $0x4a7, %ecx            # imm = 0x4A7
jmp 0xd0078
leal (,%rbx,8), %eax
leal (%rax,%rax,2), %ecx
leaq 0x1dfbf(%rip), %rsi     # 0xee004
leaq 0x59432(%rip), %rdx     # 0x12947e
leaq 0x10(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
addq $0x570, %r13            # imm = 0x570
leaq 0x1dfcb(%rip), %rsi     # 0xee034
leaq 0x59375(%rip), %rdx     # 0x1293e5
movq %r13, %rdi
movl $0x499, %ecx            # imm = 0x499
movq %r14, %r8
xorl %eax, %eax
callq 0x30af0
movl $0x1, %ebp
movl %ebp, %eax
addq $0x1418, %rsp           # imm = 0x1418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq