// File: /workspace/github_c_makefile_star2_O1/PoulinV[P]AxiCLASS/build/../source/distortions.c
// Function: distortions_read_detector_noisefile
int distortions_read_detector_noisefile(struct precision * ppr,
                                        struct distortions * psd){

  /** Define local variables */
  int index_x;
  double nu_temp,delta_Ic_temp;
  FILE * infile;
  char line[_LINE_LENGTH_MAX_];
  char * left;
  int headlines = 0;
  int numcols;

  /** Open file */
  class_sprintf(psd->sd_detector_noise_file,"%s/%s",ppr->sd_external_path,psd->sd_detector_file_name);
  class_open(infile, psd->sd_detector_noise_file, "r", psd->error_message);

  /** Read header */
  psd->br_exact_Nz = 0;
  while (fgets(line,_LINE_LENGTH_MAX_-1,infile) != NULL) {
    headlines++;

    /* Eliminate blank spaces at beginning of line */
    left=line;
    while (left[0]==' ') {
      left++;
    }

    if (left[0] > 39) {
      /** Read number of lines, infer size of arrays and allocate them */
      class_test(sscanf(line,"%d %d", &psd->x_size, &numcols) != 2,
                 psd->error_message,
                 "could not header (number of lines, number of columns) at line %i in file '%s' \n",headlines,psd->sd_detector_noise_file);
      class_test(numcols !=2,
                 psd->error_message,
                 "Incorrect number of columns in the detector noise file '%s'",psd->sd_detector_noise_file);

      class_alloc(psd->x, psd->x_size*sizeof(double), psd->error_message);
      class_alloc(psd->delta_Ic_array, psd->x_size*sizeof(double), psd->error_message);
      break;
    }
  }

  /** Read parameters */
  for (index_x=0; index_x<psd->x_size; ++index_x){
    class_test(fscanf(infile, "%le",
                      &(nu_temp))!=1,                                                 // [-]
               psd->error_message,
               "Could not read nu at line %i in file '%s'",index_x+headlines,psd->sd_detector_noise_file);
    psd->x[index_x] = nu_temp/psd->x_to_nu;
    class_test(fscanf(infile, "%le",
                      &(delta_Ic_temp))!=1,                            // [-]
               psd->error_message,
               "Could not read delta_Ic(nu) at line %i in file '%s'",index_x+headlines,psd->sd_detector_noise_file);
    psd->delta_Ic_array[index_x] = delta_Ic_temp*1e-26;
  }

  fclose(infile);

  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1428, %rsp           # imm = 0x1428
movq %rsi, %rbx
leaq 0x928(%rdi), %r14
leaq 0x8(%rsi), %r12
leaq 0x5b561(%rip), %r13     # 0x1290d9
xorl %r15d, %r15d
xorl %edi, %edi
xorl %esi, %esi
movq %r13, %rdx
movq %r14, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x8550
leaq 0x390(%rbx), %rbp
incl %eax
movslq %eax, %rsi
movq %rbp, %rdi
movq %r13, %rdx
movq %r14, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x8550
leaq 0x421cf(%rip), %rsi     # 0x10fd84
movq %rbp, %rdi
callq 0x8400
testq %rax, %rax
je 0xcdd24
movq %rax, %r12
movl $0x0, 0xc20(%rbx)
leaq 0x1020(%rsp), %r14
movq %r14, %rdi
movl $0x3ff, %esi            # imm = 0x3FF
movq %r12, %rdx
callq 0x8540
testq %rax, %rax
je 0xcdc7b
movq %r14, %rcx
movb (%rcx), %al
incq %rcx
cmpb $0x20, %al
je 0xcdbf7
incl %r15d
cmpb $0x28, %al
jl 0xcdbdb
leaq 0x368(%rbx), %rdx
leaq 0x4316e(%rip), %rsi     # 0x110d83
leaq 0x1020(%rsp), %rdi
leaq 0x4(%rsp), %rcx
xorl %eax, %eax
callq 0x8390
cmpl $0x2, %eax
jne 0xcdd70
cmpl $0x2, 0x4(%rsp)
jne 0xcddd1
movslq 0x368(%rbx), %r13
movq %r13, %r14
shlq $0x3, %r14
movq %r14, %rdi
callq 0x8460
movq %rax, 0x370(%rbx)
testq %rax, %rax
je 0xcdf14
movq %r14, %rdi
callq 0x8460
movq %rax, 0xcc8(%rbx)
testq %rax, %rax
je 0xcdf5b
movq %rbp, 0x8(%rsp)
cmpl $0x0, 0x368(%rbx)
jle 0xcdd15
leaq 0x5bed6(%rip), %r13     # 0x129b6a
leaq 0x18(%rsp), %rbp
xorl %r14d, %r14d
movq %r12, %rdi
movq %r13, %rsi
movq %rbp, %rdx
xorl %eax, %eax
callq 0x8690
cmpl $0x1, %eax
jne 0xcde2f
movsd 0x18(%rsp), %xmm0
divsd 0x380(%rbx), %xmm0
movq 0x370(%rbx), %rax
movsd %xmm0, (%rax,%r14,8)
movq %r12, %rdi
movq %r13, %rsi
leaq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x8690
cmpl $0x1, %eax
jne 0xcde92
movsd 0x10(%rsp), %xmm0
mulsd 0x27fa7(%rip), %xmm0    # 0xf5ca0
movq 0xcc8(%rbx), %rax
movsd %xmm0, (%rax,%r14,8)
incq %r14
movslq 0x368(%rbx), %rax
cmpq %rax, %r14
jl 0xcdc9c
movq %r12, %rdi
callq 0x83a0
xorl %eax, %eax
jmp 0xcdf02
leaq 0x25cad(%rip), %rsi     # 0xf39d8
leaq 0x5bd28(%rip), %rdx     # 0x129a5a
leaq 0x25cd4(%rip), %r8      # 0xf3a0d
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x232db(%rip), %rsi     # 0xf1034
leaq 0x5bd01(%rip), %rdx     # 0x129a61
movq %rbx, %rdi
movl $0x1cb, %ecx            # imm = 0x1CB
movq %r14, %r8
jmp 0xcdef6
leaq 0x5bd0e(%rip), %rsi     # 0x129a85
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movl %r15d, %edx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x232ef(%rip), %rsi     # 0xf1082
leaq 0x5bd3b(%rip), %rdx     # 0x129ad5
leaq 0x820(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x23277(%rip), %rsi     # 0xf1034
leaq 0x5bc9d(%rip), %rdx     # 0x129a61
movq %rbx, %rdi
movl $0x1dc, %ecx            # imm = 0x1DC
jmp 0xcdef3
leaq 0x5bd2f(%rip), %rsi     # 0x129b07
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0x30c2c
leaq 0x23291(%rip), %rsi     # 0xf1082
leaq 0x5bd4b(%rip), %rdx     # 0x129b43
leaq 0x820(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x23219(%rip), %rsi     # 0xf1034
leaq 0x5bc3f(%rip), %rdx     # 0x129a61
movq %rbx, %rdi
movl $0x1df, %ecx            # imm = 0x1DF
jmp 0xcdef3
addl %r14d, %r15d
leaq 0x5bd35(%rip), %rsi     # 0x129b6e
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movl %r15d, %edx
movq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x2322b(%rip), %rsi     # 0xf1082
leaq 0x5bd3a(%rip), %rdx     # 0x129b98
leaq 0x820(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x231b3(%rip), %rsi     # 0xf1034
leaq 0x5bbd9(%rip), %rdx     # 0x129a61
movq %rbx, %rdi
movl $0x1ec, %ecx            # imm = 0x1EC
jmp 0xcdef3
addl %r14d, %r15d
leaq 0x5bd21(%rip), %rsi     # 0x129bbd
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movl %r15d, %edx
movq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x231c8(%rip), %rsi     # 0xf1082
leaq 0x5bd30(%rip), %rdx     # 0x129bf1
leaq 0x820(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x23150(%rip), %rsi     # 0xf1034
leaq 0x5bb76(%rip), %rdx     # 0x129a61
movq %rbx, %rdi
movl $0x1f1, %ecx            # imm = 0x1F1
movq %r15, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %eax
addq $0x1428, %rsp           # imm = 0x1428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leal (,%r13,8), %ecx
leaq 0x230e1(%rip), %rsi     # 0xf1004
leaq 0x5bc25(%rip), %rdx     # 0x129b4f
leaq 0x20(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x230ed(%rip), %rsi     # 0xf1034
leaq 0x5bb13(%rip), %rdx     # 0x129a61
movq %rbx, %rdi
movl $0x1e1, %ecx            # imm = 0x1E1
jmp 0xcdd68
leal (,%r13,8), %ecx
leaq 0x2309a(%rip), %rsi     # 0xf1004
leaq 0x5bbe5(%rip), %rdx     # 0x129b56
leaq 0x20(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x230a6(%rip), %rsi     # 0xf1034
leaq 0x5bacc(%rip), %rdx     # 0x129a61
movq %rbx, %rdi
movl $0x1e2, %ecx            # imm = 0x1E2
jmp 0xcdd68