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

  /** Define local variables */
  FILE * fA;
  char line[_LINE_LENGTH_MAX_];
  char * left;
  int headlines = 0;
  int index_x,index_dep;

  pin->chix_size = 0;

  /** - Read file header */
  /* The file is assumed to contain:
   *    - The number of lines of the file
   *    - The columns (xe , chi_heat, chi_Lya, chi_H, chi_He, chi_lowE) where chi_i represents the
   *      branching ratio at redshift z into different injection/ionization channels i */

  class_open(fA, chi_x_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->chix_size)) != 1,
                 pin->error_message,
                 "could not read the initial integer of number of lines in line %i in file '%s' \n",
                 headlines, chi_x_file);

      /* (z, chi_i)*/
      class_alloc(pin->chix_table,
                  (2*pin->dep_size+1)*pin->chix_size*sizeof(double),
                  pin->error_message);
      break;
    }
  }

  /** - Read file */
  for(index_x = 0; index_x < pin->chix_size;++index_x){
    /* Read coefficients */
    class_test(fscanf(fA,"%lg %lg %lg %lg %lg %lg",
                      &(pin->chix_table[index_x*(2*pin->dep_size+1)+0]), //x
                      &(pin->chix_table[index_x*(2*pin->dep_size+1)+1+pin->index_dep_heat]), //heat
                      &(pin->chix_table[index_x*(2*pin->dep_size+1)+1+pin->index_dep_lya]), //lya
                      &(pin->chix_table[index_x*(2*pin->dep_size+1)+1+pin->index_dep_ionH]), //ionH
                      &(pin->chix_table[index_x*(2*pin->dep_size+1)+1+pin->index_dep_ionHe]), //ionHe
                      &(pin->chix_table[index_x*(2*pin->dep_size+1)+1+pin->index_dep_lowE])  //lowE
                     )!= 6,
               pin->error_message,
               "could not read value of parameters coefficients in line %i in file '%s'\n",
               index_x+headlines,chi_x_file);
  }

  fclose(fA);

  /** - Spline file contents */
  /* Spline in one dimension */
  for(index_dep=0;index_dep<pin->dep_size;++index_dep){
    class_call(array_spline(pin->chix_table,
                            2*pin->dep_size+1,
                            pin->chix_size,
                            0,
                            1+index_dep,
                            1+index_dep+pin->dep_size,
                            _SPLINE_NATURAL_,
                            pin->error_message),
               pin->error_message,
               pin->error_message);
  }

  return _SUCCESS_;
}

// Assembly:
subq $0x3c68, %rsp           # imm = 0x3C68
movq %rdi, 0x3c58(%rsp)
movq %rsi, 0x3c50(%rsp)
movq %rdx, 0x3c48(%rsp)
movl $0x0, 0x3834(%rsp)
movq 0x3c50(%rsp), %rax
movl $0x0, 0x520(%rax)
movq 0x3c48(%rsp), %rdi
leaq 0x5210c(%rip), %rsi     # 0x1f0c37
callq 0x8410
movq %rax, 0x3c40(%rsp)
cmpq $0x0, 0x3c40(%rsp)
jne 0x19ebb0
leaq 0x3020(%rsp), %rdi
movq 0x3c48(%rsp), %rcx
leaq 0x35e76(%rip), %rsi     # 0x1d49d0
leaq 0x530b6(%rip), %rdx     # 0x1f1c17
leaq 0x35e9d(%rip), %r8      # 0x1d4a05
movb $0x0, %al
callq 0x5b9c0
movq 0x3c50(%rsp), %rdi
addq $0x570, %rdi            # imm = 0x570
leaq 0x3020(%rsp), %r8
leaq 0x334a7(%rip), %rsi     # 0x1d2034
leaq 0x6f22e(%rip), %rdx     # 0x20ddc2
movl $0x535, %ecx            # imm = 0x535
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3c64(%rsp)
jmp 0x19f1a6
jmp 0x19ebb2
leaq 0x3840(%rsp), %rdi
movq 0x3c40(%rsp), %rdx
movl $0x3ff, %esi            # imm = 0x3FF
callq 0x8530
cmpq $0x0, %rax
je 0x19eddb
movl 0x3834(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3834(%rsp)
leaq 0x3840(%rsp), %rax
movq %rax, 0x3838(%rsp)
movq 0x3838(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x20, %eax
jne 0x19ec1d
movq 0x3838(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x3838(%rsp)
jmp 0x19ebf7
movq 0x3838(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x27, %eax
jle 0x19edd6
leaq 0x3840(%rsp), %rdi
movq 0x3c50(%rsp), %rdx
addq $0x520, %rdx            # imm = 0x520
leaq 0x42267(%rip), %rsi     # 0x1e0eb6
movb $0x0, %al
callq 0x83b0
cmpl $0x1, %eax
je 0x19ecea
leaq 0x2820(%rsp), %rdi
movl 0x3834(%rsp), %edx
movq 0x3c48(%rsp), %rcx
leaq 0x6ed0e(%rip), %rsi     # 0x20d98b
movb $0x0, %al
callq 0x5b9c0
leaq 0x2020(%rsp), %rdi
leaq 0x2820(%rsp), %rcx
leaq 0x333e7(%rip), %rsi     # 0x1d2082
leaq 0x6f13f(%rip), %rdx     # 0x20dde1
movb $0x0, %al
callq 0x5b9c0
movq 0x3c50(%rsp), %rdi
addq $0x570, %rdi            # imm = 0x570
leaq 0x2020(%rsp), %r8
leaq 0x3336d(%rip), %rsi     # 0x1d2034
leaq 0x6f0f4(%rip), %rdx     # 0x20ddc2
movl $0x54b, %ecx            # imm = 0x54B
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3c64(%rsp)
jmp 0x19f1a6
movq 0x3c50(%rsp), %rax
movl 0x54c(%rax), %eax
shll %eax
addl $0x1, %eax
movq 0x3c50(%rsp), %rcx
imull 0x520(%rcx), %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x8460
movq %rax, %rcx
movq 0x3c50(%rsp), %rax
movq %rcx, 0x518(%rax)
movq 0x3c50(%rsp), %rax
cmpq $0x0, 0x518(%rax)
jne 0x19edd4
movq 0x3c50(%rsp), %rax
movl 0x54c(%rax), %eax
shll %eax
addl $0x1, %eax
movq 0x3c50(%rsp), %rcx
imull 0x520(%rcx), %eax
cltq
shlq $0x3, %rax
movl %eax, 0x201c(%rsp)
leaq 0x1810(%rsp), %rdi
movl 0x201c(%rsp), %ecx
leaq 0x3327f(%rip), %rsi     # 0x1d2004
leaq 0x6f07e(%rip), %rdx     # 0x20de0a
movb $0x0, %al
callq 0x5b9c0
movq 0x3c50(%rsp), %rdi
addq $0x570, %rdi            # imm = 0x570
leaq 0x1810(%rsp), %r8
leaq 0x33283(%rip), %rsi     # 0x1d2034
leaq 0x6f00a(%rip), %rdx     # 0x20ddc2
movl $0x550, %ecx            # imm = 0x550
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3c64(%rsp)
jmp 0x19f1a6
jmp 0x19eddb
jmp 0x19ebb2
movl $0x0, 0x3830(%rsp)
movl 0x3830(%rsp), %eax
movq 0x3c50(%rsp), %rcx
cmpl 0x520(%rcx), %eax
jge 0x19f06f
movq 0x3c40(%rsp), %rdi
movq 0x3c50(%rsp), %rax
movq 0x518(%rax), %rdx
movl 0x3830(%rsp), %eax
movq 0x3c50(%rsp), %rcx
movl 0x54c(%rcx), %ecx
shll %ecx
addl $0x1, %ecx
imull %ecx, %eax
addl $0x0, %eax
cltq
shlq $0x3, %rax
addq %rax, %rdx
movq 0x3c50(%rsp), %rax
movq 0x518(%rax), %rcx
movl 0x3830(%rsp), %eax
movq 0x3c50(%rsp), %rsi
movl 0x54c(%rsi), %esi
shll %esi
addl $0x1, %esi
imull %esi, %eax
addl $0x1, %eax
movq 0x3c50(%rsp), %rsi
addl 0x538(%rsi), %eax
cltq
shlq $0x3, %rax
addq %rax, %rcx
movq 0x3c50(%rsp), %rax
movq 0x518(%rax), %r8
movl 0x3830(%rsp), %eax
movq 0x3c50(%rsp), %rsi
movl 0x54c(%rsi), %esi
shll %esi
addl $0x1, %esi
imull %esi, %eax
addl $0x1, %eax
movq 0x3c50(%rsp), %rsi
addl 0x544(%rsi), %eax
cltq
shlq $0x3, %rax
addq %rax, %r8
movq 0x3c50(%rsp), %rax
movq 0x518(%rax), %r9
movl 0x3830(%rsp), %eax
movq 0x3c50(%rsp), %rsi
movl 0x54c(%rsi), %esi
shll %esi
addl $0x1, %esi
imull %esi, %eax
addl $0x1, %eax
movq 0x3c50(%rsp), %rsi
addl 0x53c(%rsi), %eax
cltq
shlq $0x3, %rax
addq %rax, %r9
movq 0x3c50(%rsp), %rax
movq 0x518(%rax), %r10
movl 0x3830(%rsp), %eax
movq 0x3c50(%rsp), %rsi
movl 0x54c(%rsi), %esi
shll %esi
addl $0x1, %esi
imull %esi, %eax
addl $0x1, %eax
movq 0x3c50(%rsp), %rsi
addl 0x540(%rsi), %eax
cltq
shlq $0x3, %rax
addq %rax, %r10
movq 0x3c50(%rsp), %rax
movq 0x518(%rax), %rax
movl 0x3830(%rsp), %esi
movq 0x3c50(%rsp), %r11
movl 0x54c(%r11), %r11d
shll %r11d
addl $0x1, %r11d
imull %r11d, %esi
addl $0x1, %esi
movq 0x3c50(%rsp), %r11
addl 0x548(%r11), %esi
movslq %esi, %rsi
shlq $0x3, %rsi
addq %rsi, %rax
leaq 0x6ebbb(%rip), %rsi     # 0x20db67
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x8690
cmpl $0x6, %eax
je 0x19f057
leaq 0x1010(%rsp), %rdi
movl 0x3830(%rsp), %edx
addl 0x3834(%rsp), %edx
movq 0x3c48(%rsp), %rcx
leaq 0x6ea2c(%rip), %rsi     # 0x20da16
movb $0x0, %al
callq 0x5b9c0
leaq 0x810(%rsp), %rdi
leaq 0x1010(%rsp), %rcx
leaq 0x3307a(%rip), %rsi     # 0x1d2082
leaq 0x6ee0b(%rip), %rdx     # 0x20de1a
movb $0x0, %al
callq 0x5b9c0
movq 0x3c50(%rsp), %rdi
addq $0x570, %rdi            # imm = 0x570
leaq 0x810(%rsp), %r8
leaq 0x33000(%rip), %rsi     # 0x1d2034
leaq 0x6ed87(%rip), %rdx     # 0x20ddc2
movl $0x562, %ecx            # imm = 0x562
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3c64(%rsp)
jmp 0x19f1a6
jmp 0x19f059
movl 0x3830(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3830(%rsp)
jmp 0x19ede6
movq 0x3c40(%rsp), %rdi
callq 0x83c0
movl $0x0, 0x382c(%rsp)
movl 0x382c(%rsp), %eax
movq 0x3c50(%rsp), %rcx
cmpl 0x54c(%rcx), %eax
jge 0x19f19b
movq 0x3c50(%rsp), %rax
movq 0x518(%rax), %rdi
movq 0x3c50(%rsp), %rax
movl 0x54c(%rax), %esi
shll %esi
addl $0x1, %esi
movq 0x3c50(%rsp), %rax
movl 0x520(%rax), %edx
movl 0x382c(%rsp), %r8d
addl $0x1, %r8d
movl 0x382c(%rsp), %r9d
addl $0x1, %r9d
movq 0x3c50(%rsp), %rax
addl 0x54c(%rax), %r9d
movq 0x3c50(%rsp), %rax
addq $0x570, %rax            # imm = 0x570
xorl %ecx, %ecx
movl $0x0, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x1b340
cmpl $0x1, %eax
jne 0x19f183
leaq 0x10(%rsp), %rdi
movq 0x3c50(%rsp), %rcx
addq $0x570, %rcx            # imm = 0x570
leaq 0x3329e(%rip), %rsi     # 0x1d23d8
leaq 0x6ee99(%rip), %rdx     # 0x20dfda
movb $0x0, %al
callq 0x5b9c0
movq 0x3c50(%rsp), %rdi
addq $0x570, %rdi            # imm = 0x570
leaq 0x10(%rsp), %r8
leaq 0x32ed1(%rip), %rsi     # 0x1d2034
leaq 0x6ec58(%rip), %rdx     # 0x20ddc2
movl $0x573, %ecx            # imm = 0x573
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3c64(%rsp)
jmp 0x19f1a6
jmp 0x19f185
movl 0x382c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x382c(%rsp)
jmp 0x19f087
movl $0x0, 0x3c64(%rsp)
movl 0x3c64(%rsp), %eax
addq $0x3c68, %rsp           # imm = 0x3C68
retq
nopw %cs:(%rax,%rax)