// File: /workspace/github_c_makefile_star2_O1/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 0x3c797(%rip), %rsi     # 0x10fd84
movq %rdx, %rdi
callq 0x8400
testq %rax, %rax
je 0xd36d7
movq %rax, %r15
leaq 0x4f8(%rbx), %r12
xorl %ebp, %ebp
leaq 0x810(%rsp), %r13
movq %r13, %rdi
movl $0x3ff, %esi            # imm = 0x3FF
movq %r15, %rdx
callq 0x8540
testq %rax, %rax
je 0xd3723
movq %r13, %rcx
movb (%rcx), %al
incq %rcx
cmpb $0x20, %al
je 0xd362e
incl %ebp
cmpb $0x28, %al
jl 0xd3612
leaq 0x2cadb(%rip), %rsi     # 0x10011f
leaq 0x810(%rsp), %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x8390
cmpl $0x1, %eax
jne 0xd37f6
movq %r14, 0x8(%rsp)
movq %rbx, %r14
movslq 0x4f8(%rbx), %rbx
leaq (,%rbx,8), %rax
leaq (%rax,%rax,2), %rdi
callq 0x8460
movq %r14, %r13
movq %rax, 0x500(%r14)
testq %rax, %rax
jne 0xd372b
shll $0x3, %ebx
leal (%rbx,%rbx,2), %ecx
leaq 0x1d965(%rip), %rsi     # 0xf1004
leaq 0x58da8(%rip), %rdx     # 0x12c44e
leaq 0x10(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
addq $0x570, %r13            # imm = 0x570
leaq 0x1d971(%rip), %rsi     # 0xf1034
leaq 0x58ceb(%rip), %rdx     # 0x12c3b5
movq %r13, %rdi
movl $0x499, %ecx            # imm = 0x499
jmp 0xd38b0
leaq 0x202fa(%rip), %rsi     # 0xf39d8
leaq 0x3d69b(%rip), %rdx     # 0x110d80
leaq 0x20321(%rip), %r8      # 0xf3a0d
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x570, %rbx            # imm = 0x570
leaq 0x1d928(%rip), %rsi     # 0xf1034
leaq 0x58ca2(%rip), %rdx     # 0x12c3b5
movq %rbx, %rdi
movl $0x47e, %ecx            # imm = 0x47E
movq %r15, %r8
jmp 0xd38b3
movq %r14, 0x8(%rsp)
movq %rbx, %r13
cmpl $0x0, (%r12)
jle 0xd3773
xorl %r14d, %r14d
xorl %ebx, %ebx
movq 0x500(%r13), %rdx
leaq (%rdx,%r14), %rcx
addq $0x8, %rcx
addq %r14, %rdx
movq %r15, %rdi
leaq 0x58e6c(%rip), %rsi     # 0x12c5bf
xorl %eax, %eax
callq 0x8690
cmpl $0x2, %eax
jne 0xd3853
incq %rbx
movslq (%r12), %rax
addq $0x18, %r14
cmpq %rax, %rbx
jl 0xd3737
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 0x136a5
addq $0x10, %rsp
cmpl $0x1, %eax
jne 0xd38bf
leaq 0x1dc2e(%rip), %rsi     # 0xf13f0
leaq 0x58d3b(%rip), %rdx     # 0x12c504
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %r13, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x1d852(%rip), %rsi     # 0xf1034
leaq 0x58bcc(%rip), %rdx     # 0x12c3b5
movq %r13, %rdi
movl $0x4b7, %ecx            # imm = 0x4B7
jmp 0xd38b0
leaq 0x58bd6(%rip), %rsi     # 0x12c3d3
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movl %ebp, %edx
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x1d86a(%rip), %rsi     # 0xf1082
leaq 0x58c04(%rip), %rdx     # 0x12c423
leaq 0xc10(%rsp), %r14
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x570, %rbx            # imm = 0x570
leaq 0x1d7f2(%rip), %rsi     # 0xf1034
leaq 0x58b6c(%rip), %rdx     # 0x12c3b5
movq %rbx, %rdi
movl $0x494, %ecx            # imm = 0x494
jmp 0xd38b0
leaq 0x58c04(%rip), %rsi     # 0x12c45e
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movl %ebp, %edx
movq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x1d80b(%rip), %rsi     # 0xf1082
leaq 0x58c29(%rip), %rdx     # 0x12c4a7
leaq 0xc10(%rsp), %r14
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x570, %r13            # imm = 0x570
leaq 0x1d793(%rip), %rsi     # 0xf1034
leaq 0x58b0d(%rip), %rdx     # 0x12c3b5
movq %r13, %rdi
movl $0x4a7, %ecx            # imm = 0x4A7
movq %r14, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %ebp
movl %ebp, %eax
addq $0x1418, %rsp           # imm = 0x1418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq