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

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

  pin->chiz_size = 0;

  /* 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_z_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->chiz_size)) != 1,
                 pin->error_message,
                 "could not read the initial integer of number of lines in line %i in file '%s' \n",
                 headlines,chi_z_file);

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

  for(index_z=0;index_z<pin->chiz_size;++index_z){
    /* Read coefficients */
    class_test(fscanf(fA,"%lg %lg %lg %lg %lg %lg",
                      &(pin->chiz_table[index_z*(2*pin->dep_size+1)+0]), //z
                      &(pin->chiz_table[index_z*(2*pin->dep_size+1)+1+pin->index_dep_heat]), //heat
                      &(pin->chiz_table[index_z*(2*pin->dep_size+1)+1+pin->index_dep_lya]), //lya
                      &(pin->chiz_table[index_z*(2*pin->dep_size+1)+1+pin->index_dep_ionH]), //ionH
                      &(pin->chiz_table[index_z*(2*pin->dep_size+1)+1+pin->index_dep_ionHe]), //ionHe
                      &(pin->chiz_table[index_z*(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_z+headlines,chi_z_file);
  }

  fclose(fA);

  /* Spline in one dimension */
  for(index_dep=0;index_dep<pin->dep_size;++index_dep){
    class_call(array_spline(pin->chiz_table,
                            2*pin->dep_size+1,
                            pin->chiz_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, 0x510(%rax)
movq 0x3c48(%rsp), %rdi
leaq 0x51a2c(%rip), %rsi     # 0x1f0c37
callq 0x8410
movq %rax, 0x3c40(%rsp)
cmpq $0x0, 0x3c40(%rsp)
jne 0x19f290
leaq 0x3020(%rsp), %rdi
movq 0x3c48(%rsp), %rcx
leaq 0x35796(%rip), %rsi     # 0x1d49d0
leaq 0x529d6(%rip), %rdx     # 0x1f1c17
leaq 0x357bd(%rip), %r8      # 0x1d4a05
movb $0x0, %al
callq 0x5b9c0
movq 0x3c50(%rsp), %rdi
addq $0x570, %rdi            # imm = 0x570
leaq 0x3020(%rsp), %r8
leaq 0x32dc7(%rip), %rsi     # 0x1d2034
leaq 0x6e89b(%rip), %rdx     # 0x20db0f
movl $0x4d7, %ecx            # imm = 0x4D7
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3c64(%rsp)
jmp 0x19f886
jmp 0x19f292
leaq 0x3840(%rsp), %rdi
movq 0x3c40(%rsp), %rdx
movl $0x3ff, %esi            # imm = 0x3FF
callq 0x8530
cmpq $0x0, %rax
je 0x19f4bb
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 0x19f2fd
movq 0x3838(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x3838(%rsp)
jmp 0x19f2d7
movq 0x3838(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x27, %eax
jle 0x19f4b6
leaq 0x3840(%rsp), %rdi
movq 0x3c50(%rsp), %rdx
addq $0x510, %rdx            # imm = 0x510
leaq 0x41b87(%rip), %rsi     # 0x1e0eb6
movb $0x0, %al
callq 0x83b0
cmpl $0x1, %eax
je 0x19f3ca
leaq 0x2820(%rsp), %rdi
movl 0x3834(%rsp), %edx
movq 0x3c48(%rsp), %rcx
leaq 0x6e62e(%rip), %rsi     # 0x20d98b
movb $0x0, %al
callq 0x5b9c0
leaq 0x2020(%rsp), %rdi
leaq 0x2820(%rsp), %rcx
leaq 0x32d07(%rip), %rsi     # 0x1d2082
leaq 0x6e7ac(%rip), %rdx     # 0x20db2e
movb $0x0, %al
callq 0x5b9c0
movq 0x3c50(%rsp), %rdi
addq $0x570, %rdi            # imm = 0x570
leaq 0x2020(%rsp), %r8
leaq 0x32c8d(%rip), %rsi     # 0x1d2034
leaq 0x6e761(%rip), %rdx     # 0x20db0f
movl $0x4ed, %ecx            # imm = 0x4ED
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3c64(%rsp)
jmp 0x19f886
movq 0x3c50(%rsp), %rax
movl 0x54c(%rax), %eax
shll %eax
addl $0x1, %eax
movq 0x3c50(%rsp), %rcx
imull 0x510(%rcx), %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x8460
movq %rax, %rcx
movq 0x3c50(%rsp), %rax
movq %rcx, 0x508(%rax)
movq 0x3c50(%rsp), %rax
cmpq $0x0, 0x508(%rax)
jne 0x19f4b4
movq 0x3c50(%rsp), %rax
movl 0x54c(%rax), %eax
shll %eax
addl $0x1, %eax
movq 0x3c50(%rsp), %rcx
imull 0x510(%rcx), %eax
cltq
shlq $0x3, %rax
movl %eax, 0x201c(%rsp)
leaq 0x1810(%rsp), %rdi
movl 0x201c(%rsp), %ecx
leaq 0x32b9f(%rip), %rsi     # 0x1d2004
leaq 0x6e6eb(%rip), %rdx     # 0x20db57
movb $0x0, %al
callq 0x5b9c0
movq 0x3c50(%rsp), %rdi
addq $0x570, %rdi            # imm = 0x570
leaq 0x1810(%rsp), %r8
leaq 0x32ba3(%rip), %rsi     # 0x1d2034
leaq 0x6e677(%rip), %rdx     # 0x20db0f
movl $0x4f2, %ecx            # imm = 0x4F2
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3c64(%rsp)
jmp 0x19f886
jmp 0x19f4bb
jmp 0x19f292
movl $0x0, 0x3830(%rsp)
movl 0x3830(%rsp), %eax
movq 0x3c50(%rsp), %rcx
cmpl 0x510(%rcx), %eax
jge 0x19f74f
movq 0x3c40(%rsp), %rdi
movq 0x3c50(%rsp), %rax
movq 0x508(%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 0x508(%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 0x508(%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 0x508(%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 0x508(%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 0x508(%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 0x6e4db(%rip), %rsi     # 0x20db67
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x8690
cmpl $0x6, %eax
je 0x19f737
leaq 0x1010(%rsp), %rdi
movl 0x3830(%rsp), %edx
addl 0x3834(%rsp), %edx
movq 0x3c48(%rsp), %rcx
leaq 0x6e34c(%rip), %rsi     # 0x20da16
movb $0x0, %al
callq 0x5b9c0
leaq 0x810(%rsp), %rdi
leaq 0x1010(%rsp), %rcx
leaq 0x3299a(%rip), %rsi     # 0x1d2082
leaq 0x6e490(%rip), %rdx     # 0x20db7f
movb $0x0, %al
callq 0x5b9c0
movq 0x3c50(%rsp), %rdi
addq $0x570, %rdi            # imm = 0x570
leaq 0x810(%rsp), %r8
leaq 0x32920(%rip), %rsi     # 0x1d2034
leaq 0x6e3f4(%rip), %rdx     # 0x20db0f
movl $0x503, %ecx            # imm = 0x503
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3c64(%rsp)
jmp 0x19f886
jmp 0x19f739
movl 0x3830(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3830(%rsp)
jmp 0x19f4c6
movq 0x3c40(%rsp), %rdi
callq 0x83c0
movl $0x0, 0x382c(%rsp)
movl 0x382c(%rsp), %eax
movq 0x3c50(%rsp), %rcx
cmpl 0x54c(%rcx), %eax
jge 0x19f87b
movq 0x3c50(%rsp), %rax
movq 0x508(%rax), %rdi
movq 0x3c50(%rsp), %rax
movl 0x54c(%rax), %esi
shll %esi
addl $0x1, %esi
movq 0x3c50(%rsp), %rax
movl 0x510(%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 0x19f863
leaq 0x10(%rsp), %rdi
movq 0x3c50(%rsp), %rcx
addq $0x570, %rcx            # imm = 0x570
leaq 0x32bbe(%rip), %rsi     # 0x1d23d8
leaq 0x6e51e(%rip), %rdx     # 0x20dd3f
movb $0x0, %al
callq 0x5b9c0
movq 0x3c50(%rsp), %rdi
addq $0x570, %rdi            # imm = 0x570
leaq 0x10(%rsp), %r8
leaq 0x327f1(%rip), %rsi     # 0x1d2034
leaq 0x6e2c5(%rip), %rdx     # 0x20db0f
movl $0x513, %ecx            # imm = 0x513
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3c64(%rsp)
jmp 0x19f886
jmp 0x19f865
movl 0x382c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x382c(%rsp)
jmp 0x19f767
movl $0x0, 0x3c64(%rsp)
movl 0x3c64(%rsp), %eax
addq $0x3c68, %rsp           # imm = 0x3C68
retq
nopw %cs:(%rax,%rax)