// File: /workspace/github_c_makefile_star2_O3/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 0x5be01(%rip), %r13     # 0x126101
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 0x42a67(%rip), %rsi     # 0x10cda4
movq %rbp, %rdi
callq 0x8400
testq %rax, %rax
je 0xca409
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 0xca455
movq %r14, %rcx
movb (%rcx), %al
incq %rcx
cmpb $0x20, %al
je 0xca37f
incl %r15d
cmpb $0x28, %al
jl 0xca363
leaq 0x368(%rbx), %rdx
leaq 0x43a36(%rip), %rsi     # 0x10ddd3
leaq 0x1020(%rsp), %rdi
leaq 0xc(%rsp), %rcx
xorl %eax, %eax
callq 0x8390
cmpl $0x2, %eax
jne 0xca500
cmpl $0x2, 0xc(%rsp)
jne 0xca561
movslq 0x368(%rbx), %r13
movq %r13, %r14
shlq $0x3, %r14
movq %r14, %rdi
callq 0x8460
movq %rax, 0x370(%rbx)
testq %rax, %rax
je 0xca6a2
movq %r14, %rdi
callq 0x8460
movq %rax, 0xcc8(%rbx)
testq %rax, %rax
je 0xca6e9
movq %rbp, (%rsp)
jmp 0xca460
leaq 0x265d8(%rip), %rsi     # 0xf09e8
leaq 0x5c66b(%rip), %rdx     # 0x126a82
leaq 0x265ff(%rip), %r8      # 0xf0a1d
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rcx
xorl %eax, %eax
callq 0x30af0
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x23bf6(%rip), %rsi     # 0xee034
leaq 0x5c644(%rip), %rdx     # 0x126a89
movq %rbx, %rdi
movl $0x1cb, %ecx            # imm = 0x1CB
movq %r14, %r8
jmp 0xca684
movq %rbp, (%rsp)
movl 0x368(%rbx), %r13d
testl %r13d, %r13d
jle 0xca4f1
leaq 0x5c722(%rip), %r13     # 0x126b92
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 0xca5bf
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 0xca621
movsd 0x10(%rsp), %xmm0
mulsd 0x287f3(%rip), %xmm0    # 0xf2cc8
movq 0xcc8(%rbx), %rax
movsd %xmm0, (%rax,%r14,8)
incq %r14
movslq 0x368(%rbx), %rax
cmpq %rax, %r14
jl 0xca478
movq %r12, %rdi
callq 0x83a0
xorl %eax, %eax
jmp 0xca690
leaq 0x5c5a6(%rip), %rsi     # 0x126aad
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movl %r15d, %edx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x23b5f(%rip), %rsi     # 0xee082
leaq 0x5c5d3(%rip), %rdx     # 0x126afd
leaq 0x820(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x23ae7(%rip), %rsi     # 0xee034
leaq 0x5c535(%rip), %rdx     # 0x126a89
movq %rbx, %rdi
movl $0x1dc, %ecx            # imm = 0x1DC
jmp 0xca681
leaq 0x5c5c7(%rip), %rsi     # 0x126b2f
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0x30af0
leaq 0x23b01(%rip), %rsi     # 0xee082
leaq 0x5c5e3(%rip), %rdx     # 0x126b6b
leaq 0x820(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x23a89(%rip), %rsi     # 0xee034
leaq 0x5c4d7(%rip), %rdx     # 0x126a89
movq %rbx, %rdi
movl $0x1df, %ecx            # imm = 0x1DF
jmp 0xca681
addl %r14d, %r15d
leaq 0x5c5cd(%rip), %rsi     # 0x126b96
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movl %r15d, %edx
movq (%rsp), %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x23a9c(%rip), %rsi     # 0xee082
leaq 0x5c5d3(%rip), %rdx     # 0x126bc0
leaq 0x820(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x23a24(%rip), %rsi     # 0xee034
leaq 0x5c472(%rip), %rdx     # 0x126a89
movq %rbx, %rdi
movl $0x1ec, %ecx            # imm = 0x1EC
jmp 0xca681
addl %r14d, %r15d
leaq 0x5c5ba(%rip), %rsi     # 0x126be5
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movl %r15d, %edx
movq (%rsp), %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x23a3a(%rip), %rsi     # 0xee082
leaq 0x5c5ca(%rip), %rdx     # 0x126c19
leaq 0x820(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x239c2(%rip), %rsi     # 0xee034
leaq 0x5c410(%rip), %rdx     # 0x126a89
movq %rbx, %rdi
movl $0x1f1, %ecx            # imm = 0x1F1
movq %r15, %r8
xorl %eax, %eax
callq 0x30af0
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 0x23953(%rip), %rsi     # 0xee004
leaq 0x5c4bf(%rip), %rdx     # 0x126b77
leaq 0x20(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x2395f(%rip), %rsi     # 0xee034
leaq 0x5c3ad(%rip), %rdx     # 0x126a89
movq %rbx, %rdi
movl $0x1e1, %ecx            # imm = 0x1E1
jmp 0xca44d
leal (,%r13,8), %ecx
leaq 0x2390c(%rip), %rsi     # 0xee004
leaq 0x5c47f(%rip), %rdx     # 0x126b7e
leaq 0x20(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x23918(%rip), %rsi     # 0xee034
leaq 0x5c366(%rip), %rdx     # 0x126a89
movq %rbx, %rdi
movl $0x1e2, %ecx            # imm = 0x1E2
jmp 0xca44d