// File: /workspace/github_c_makefile_star2_O2/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 0x5a2cd(%rip), %r13     # 0x11cfb1
xorl %r15d, %r15d
xorl %edi, %edi
xorl %esi, %esi
movq %r13, %rdx
movq %r14, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x8580
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 0x8580
leaq 0x40f43(%rip), %rsi     # 0x103c64
movq %rbp, %rdi
callq 0x8420
testq %rax, %rax
je 0xc2e77
movq %rax, %r12
andl $0x0, 0xc20(%rbx)
leaq 0x1020(%rsp), %r14
movq %r14, %rdi
movl $0x3ff, %esi            # imm = 0x3FF
movq %r12, %rdx
callq 0x8570
testq %rax, %rax
je 0xc2de4
movq %r14, %rcx
movb (%rcx), %al
incq %rcx
cmpb $0x20, %al
je 0xc2d60
incl %r15d
cmpb $0x28, %al
jl 0xc2d44
leaq 0x368(%rbx), %rdx
leaq 0x41ef5(%rip), %rsi     # 0x104c73
leaq 0x1020(%rsp), %rdi
leaq 0x4(%rsp), %rcx
xorl %eax, %eax
callq 0x83b0
cmpl $0x2, %eax
jne 0xc2ec3
cmpl $0x2, 0x4(%rsp)
jne 0xc2ffc
movslq 0x368(%rbx), %r13
movq %r13, %r14
shlq $0x3, %r14
movq %r14, %rdi
callq 0x8490
movq %rax, 0x370(%rbx)
testq %rax, %rax
je 0xc3074
movq %r14, %rdi
callq 0x8490
movq %rax, 0xcc8(%rbx)
testq %rax, %rax
je 0xc30bb
movq %rbp, 0x8(%rsp)
leaq 0x5ac52(%rip), %r13     # 0x11da42
leaq 0x18(%rsp), %rbp
xorl %r14d, %r14d
movslq 0x368(%rbx), %rax
cmpq %rax, %r14
jge 0xc2f24
movq %r12, %rdi
movq %r13, %rsi
movq %rbp, %rdx
xorl %eax, %eax
callq 0x86c0
cmpl $0x1, %eax
jne 0xc2f33
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 0x86c0
cmpl $0x1, %eax
jne 0xc2f99
movsd 0x10(%rsp), %xmm0
mulsd 0x26d2b(%rip), %xmm0    # 0xe9b90
movq 0xcc8(%rbx), %rax
movsd %xmm0, (%rax,%r14,8)
incq %r14
jmp 0xc2df8
leaq 0x24b2a(%rip), %rsi     # 0xe79a8
leaq 0x5aaad(%rip), %rdx     # 0x11d932
leaq 0x24b51(%rip), %r8      # 0xe79dd
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rcx
xorl %eax, %eax
callq 0x2e014
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x22188(%rip), %rsi     # 0xe5034
leaq 0x5aa86(%rip), %rdx     # 0x11d939
movq %rbx, %rdi
movl $0x1cb, %ecx            # imm = 0x1CB
movq %r14, %r8
jmp 0xc3058
leaq 0x5aa93(%rip), %rsi     # 0x11d95d
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movl %r15d, %edx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x2219c(%rip), %rsi     # 0xe5082
leaq 0x5aac0(%rip), %rdx     # 0x11d9ad
leaq 0x820(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x22124(%rip), %rsi     # 0xe5034
leaq 0x5aa22(%rip), %rdx     # 0x11d939
movq %rbx, %rdi
movl $0x1dc, %ecx            # imm = 0x1DC
jmp 0xc3055
movq %r12, %rdi
callq 0x83c0
xorl %eax, %eax
jmp 0xc3062
addl %r14d, %r15d
leaq 0x5ab09(%rip), %rsi     # 0x11da46
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movl %r15d, %edx
movq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x22127(%rip), %rsi     # 0xe5082
leaq 0x5ab0e(%rip), %rdx     # 0x11da70
leaq 0x820(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x220af(%rip), %rsi     # 0xe5034
leaq 0x5a9ad(%rip), %rdx     # 0x11d939
movq %rbx, %rdi
movl $0x1ec, %ecx            # imm = 0x1EC
jmp 0xc3055
addl %r14d, %r15d
leaq 0x5aaf2(%rip), %rsi     # 0x11da95
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movl %r15d, %edx
movq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x220c1(%rip), %rsi     # 0xe5082
leaq 0x5ab01(%rip), %rdx     # 0x11dac9
leaq 0x820(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x22049(%rip), %rsi     # 0xe5034
leaq 0x5a947(%rip), %rdx     # 0x11d939
movq %rbx, %rdi
movl $0x1f1, %ecx            # imm = 0x1F1
jmp 0xc3055
leaq 0x5a9dc(%rip), %rsi     # 0x11d9df
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0x2e014
leaq 0x22066(%rip), %rsi     # 0xe5082
leaq 0x5a9f8(%rip), %rdx     # 0x11da1b
leaq 0x820(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x21fee(%rip), %rsi     # 0xe5034
leaq 0x5a8ec(%rip), %rdx     # 0x11d939
movq %rbx, %rdi
movl $0x1df, %ecx            # imm = 0x1DF
movq %r15, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rax
addq $0x1428, %rsp           # imm = 0x1428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leal (,%r13,8), %ecx
leaq 0x21f81(%rip), %rsi     # 0xe5004
leaq 0x5a99d(%rip), %rdx     # 0x11da27
leaq 0x20(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x21f8d(%rip), %rsi     # 0xe5034
leaq 0x5a88b(%rip), %rdx     # 0x11d939
movq %rbx, %rdi
movl $0x1e1, %ecx            # imm = 0x1E1
jmp 0xc2ebb
leal (,%r13,8), %ecx
leaq 0x21f3a(%rip), %rsi     # 0xe5004
leaq 0x5a95d(%rip), %rdx     # 0x11da2e
leaq 0x20(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x21f46(%rip), %rsi     # 0xe5034
leaq 0x5a844(%rip), %rdx     # 0x11d939
movq %rbx, %rdi
movl $0x1e2, %ecx            # imm = 0x1E2
jmp 0xc2ebb