// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x3c58, %rsp           # imm = 0x3C58
movq %rdi, 0x3c48(%rsp)
movq %rsi, 0x3c40(%rsp)
movq %rdx, 0x3c38(%rsp)
movl $0x0, 0x3824(%rsp)
movq 0x3c40(%rsp), %rax
movl $0x0, 0x4f8(%rax)
movq 0x3c38(%rsp), %rdi
leaq 0x525fc(%rip), %rsi     # 0x1f0c37
callq 0x8410
movq %rax, 0x3c30(%rsp)
cmpq $0x0, 0x3c30(%rsp)
jne 0x19e6c0
leaq 0x3020(%rsp), %rdi
movq 0x3c38(%rsp), %rcx
leaq 0x36366(%rip), %rsi     # 0x1d49d0
leaq 0x535a6(%rip), %rdx     # 0x1f1c17
leaq 0x3638d(%rip), %r8      # 0x1d4a05
movb $0x0, %al
callq 0x5b9c0
movq 0x3c40(%rsp), %rdi
addq $0x570, %rdi            # imm = 0x570
leaq 0x3020(%rsp), %r8
leaq 0x33997(%rip), %rsi     # 0x1d2034
leaq 0x6f2c9(%rip), %rdx     # 0x20d96d
movl $0x47e, %ecx            # imm = 0x47E
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3c54(%rsp)
jmp 0x19eac3
jmp 0x19e6c2
leaq 0x3830(%rsp), %rdi
movq 0x3c30(%rsp), %rdx
movl $0x3ff, %esi            # imm = 0x3FF
callq 0x8530
cmpq $0x0, %rax
je 0x19e8c5
movl 0x3824(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3824(%rsp)
leaq 0x3830(%rsp), %rax
movq %rax, 0x3828(%rsp)
movq 0x3828(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x20, %eax
jne 0x19e72d
movq 0x3828(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x3828(%rsp)
jmp 0x19e707
movq 0x3828(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x27, %eax
jle 0x19e8c0
leaq 0x3830(%rsp), %rdi
movq 0x3c40(%rsp), %rdx
addq $0x4f8, %rdx            # imm = 0x4F8
leaq 0x42757(%rip), %rsi     # 0x1e0eb6
movb $0x0, %al
callq 0x83b0
cmpl $0x1, %eax
je 0x19e7fa
leaq 0x2820(%rsp), %rdi
movl 0x3824(%rsp), %edx
movq 0x3c38(%rsp), %rcx
leaq 0x6f1fe(%rip), %rsi     # 0x20d98b
movb $0x0, %al
callq 0x5b9c0
leaq 0x2020(%rsp), %rdi
leaq 0x2820(%rsp), %rcx
leaq 0x338d7(%rip), %rsi     # 0x1d2082
leaq 0x6f229(%rip), %rdx     # 0x20d9db
movb $0x0, %al
callq 0x5b9c0
movq 0x3c40(%rsp), %rdi
addq $0x570, %rdi            # imm = 0x570
leaq 0x2020(%rsp), %r8
leaq 0x3385d(%rip), %rsi     # 0x1d2034
leaq 0x6f18f(%rip), %rdx     # 0x20d96d
movl $0x494, %ecx            # imm = 0x494
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3c54(%rsp)
jmp 0x19eac3
movq 0x3c40(%rsp), %rax
imull $0x3, 0x4f8(%rax), %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x8460
movq %rax, %rcx
movq 0x3c40(%rsp), %rax
movq %rcx, 0x500(%rax)
movq 0x3c40(%rsp), %rax
cmpq $0x0, 0x500(%rax)
jne 0x19e8be
movq 0x3c40(%rsp), %rax
imull $0x3, 0x4f8(%rax), %eax
cltq
shlq $0x3, %rax
movl %eax, 0x201c(%rsp)
leaq 0x1810(%rsp), %rdi
movl 0x201c(%rsp), %ecx
leaq 0x33795(%rip), %rsi     # 0x1d2004
leaq 0x6f190(%rip), %rdx     # 0x20da06
movb $0x0, %al
callq 0x5b9c0
movq 0x3c40(%rsp), %rdi
addq $0x570, %rdi            # imm = 0x570
leaq 0x1810(%rsp), %r8
leaq 0x33799(%rip), %rsi     # 0x1d2034
leaq 0x6f0cb(%rip), %rdx     # 0x20d96d
movl $0x499, %ecx            # imm = 0x499
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3c54(%rsp)
jmp 0x19eac3
jmp 0x19e8c5
jmp 0x19e6c2
movl $0x0, 0x3820(%rsp)
movl 0x3820(%rsp), %eax
movq 0x3c40(%rsp), %rcx
cmpl 0x4f8(%rcx), %eax
jge 0x19e9f3
movq 0x3c30(%rsp), %rdi
movq 0x3c40(%rsp), %rax
movq 0x500(%rax), %rdx
imull $0x3, 0x3820(%rsp), %eax
addl $0x0, %eax
cltq
shlq $0x3, %rax
addq %rax, %rdx
movq 0x3c40(%rsp), %rax
movq 0x500(%rax), %rcx
imull $0x3, 0x3820(%rsp), %eax
addl $0x1, %eax
cltq
shlq $0x3, %rax
addq %rax, %rcx
leaq 0x6f237(%rip), %rsi     # 0x20db77
movb $0x0, %al
callq 0x8690
cmpl $0x2, %eax
je 0x19e9db
leaq 0x1010(%rsp), %rdi
movl 0x3824(%rsp), %edx
movq 0x3c38(%rsp), %rcx
leaq 0x6f0a8(%rip), %rsi     # 0x20da16
movb $0x0, %al
callq 0x5b9c0
leaq 0x810(%rsp), %rdi
leaq 0x1010(%rsp), %rcx
leaq 0x336f6(%rip), %rsi     # 0x1d2082
leaq 0x6f0cc(%rip), %rdx     # 0x20da5f
movb $0x0, %al
callq 0x5b9c0
movq 0x3c40(%rsp), %rdi
addq $0x570, %rdi            # imm = 0x570
leaq 0x810(%rsp), %r8
leaq 0x3367c(%rip), %rsi     # 0x1d2034
leaq 0x6efae(%rip), %rdx     # 0x20d96d
movl $0x4a7, %ecx            # imm = 0x4A7
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3c54(%rsp)
jmp 0x19eac3
jmp 0x19e9dd
movl 0x3820(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3820(%rsp)
jmp 0x19e8d0
movq 0x3c30(%rsp), %rdi
callq 0x83c0
movq 0x3c40(%rsp), %rax
movq 0x500(%rax), %rdi
movq 0x3c40(%rsp), %rax
movl 0x4f8(%rax), %edx
movq 0x3c40(%rsp), %rax
addq $0x570, %rax            # imm = 0x570
movl $0x3, %esi
xorl %ecx, %ecx
movl $0x1, %r8d
movl $0x2, %r9d
movl $0x0, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x1b340
cmpl $0x1, %eax
jne 0x19eab8
leaq 0x10(%rsp), %rdi
movq 0x3c40(%rsp), %rcx
addq $0x570, %rcx            # imm = 0x570
leaq 0x33969(%rip), %rsi     # 0x1d23d8
leaq 0x6f046(%rip), %rdx     # 0x20dabc
movb $0x0, %al
callq 0x5b9c0
movq 0x3c40(%rsp), %rdi
addq $0x570, %rdi            # imm = 0x570
leaq 0x10(%rsp), %r8
leaq 0x3359c(%rip), %rsi     # 0x1d2034
leaq 0x6eece(%rip), %rdx     # 0x20d96d
movl $0x4b7, %ecx            # imm = 0x4B7
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3c54(%rsp)
jmp 0x19eac3
movl $0x0, 0x3c54(%rsp)
movl 0x3c54(%rsp), %eax
addq $0x3c58, %rsp           # imm = 0x3C58
retq
nopw %cs:(%rax,%rax)