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

  /** Define local variables */
  int index_k,index_z;
  FILE * infile;
  DetectorFileName br_file;
  char line[_LINE_LENGTH_MAX_];
  char * left;
  int headlines = 0;

  /** Open file */
  class_sprintf(br_file,"%s/%s_branching_ratios.dat", ppr->sd_external_path, psd->sd_detector_name);
  class_open(infile, br_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->br_exact_Nz, &psd->E_vec_size) != 2,
                 psd->error_message,
                 "could not header (number of lines, number of multipoles) at line %i in file '%s' \n",headlines,br_file);

      class_alloc(psd->br_exact_z, psd->br_exact_Nz*sizeof(double), psd->error_message);
      class_alloc(psd->f_g_exact, psd->br_exact_Nz*sizeof(double), psd->error_message);
      class_alloc(psd->f_y_exact, psd->br_exact_Nz*sizeof(double), psd->error_message);
      class_alloc(psd->f_mu_exact, psd->br_exact_Nz*sizeof(double), psd->error_message);

      class_alloc(psd->E_vec, psd->br_exact_Nz*psd->E_vec_size*sizeof(double), psd->error_message);
      break;
    }
  }

  /** Read parameters */
  for (index_z=0; index_z<psd->br_exact_Nz; ++index_z){
    class_test(fscanf(infile, "%le",
                      &(psd->br_exact_z[index_z]))!=1,                                // [-]
               psd->error_message,
               "Could not read z at line %i in file '%s'",index_z+headlines,br_file);
    class_test(fscanf(infile, "%le",
                      &(psd->f_g_exact[index_z]))!=1,                                 // [-]
               psd->error_message,
               "Could not read f_g at line %i in file '%s'",index_z+headlines,br_file);
    class_test(fscanf(infile, "%le",
                      &(psd->f_y_exact[index_z]))!=1,                                 // [-]
               psd->error_message,
               "Could not read f_y at line %i in file '%s'",index_z+headlines,br_file);
    class_test(fscanf(infile,"%le",
                      &(psd->f_mu_exact[index_z]))!=1,                                // [-]
               psd->error_message,
               "Could not read f_mu at line %i in file '%s'",index_z+headlines,br_file);
    for (index_k=0; index_k<psd->E_vec_size; ++index_k){
      class_test(fscanf(infile,"%le",
                        &(psd->E_vec[index_k*psd->br_exact_Nz+index_z]))!=1,           // [-]
                 psd->error_message,
                 "Could not read E vector at line %i in file '%s'",index_z+headlines,br_file);
    }
  }

  fclose(infile);

  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1688, %rsp           # imm = 0x1688
movq %rsi, %rbx
leaq 0x928(%rdi), %r15
leaq 0x26c(%rsi), %r12
leaq 0x5c576(%rip), %r13     # 0x12a541
xorl %r14d, %r14d
xorl %edi, %edi
xorl %esi, %esi
movq %r13, %rdx
movq %r15, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x8550
incl %eax
movslq %eax, %rsi
leaq 0x10(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rdx
movq %r15, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x8550
leaq 0x41d7e(%rip), %rsi     # 0x10fd84
movq %rbp, %rdi
callq 0x8400
testq %rax, %rax
je 0xce229
movq %rax, %r15
leaq 0xc20(%rbx), %r12
movl $0x0, 0xc20(%rbx)
leaq 0x1280(%rsp), %r13
movq %r13, %rdi
movl $0x3ff, %esi            # imm = 0x3FF
movq %r15, %rdx
callq 0x8540
testq %rax, %rax
je 0xce11f
movq %r13, %rcx
movb (%rcx), %al
incq %rcx
cmpb $0x20, %al
je 0xce04f
incl %r14d
cmpb $0x28, %al
jl 0xce033
leaq 0xc68(%rbx), %rcx
leaq 0x42d16(%rip), %rsi     # 0x110d83
leaq 0x1280(%rsp), %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x8390
cmpl $0x2, %eax
jne 0xce277
movslq 0xc20(%rbx), %r13
leaq (,%r13,8), %rbp
movq %rbp, %rdi
callq 0x8460
movq %rax, 0xc18(%rbx)
testq %rax, %rax
je 0xce346
movq %rbp, %rdi
callq 0x8460
movq %rax, 0xc28(%rbx)
testq %rax, %rax
je 0xce38f
movq %rbp, %rdi
callq 0x8460
movq %rax, 0xc38(%rbx)
testq %rax, %rax
je 0xce3d8
movq %rbp, %rdi
callq 0x8460
movq %rax, 0xc48(%rbx)
testq %rax, %rax
je 0xce5c5
movslq 0xc68(%rbx), %rbp
imulq %r13, %rbp
leaq (,%rbp,8), %rdi
callq 0x8460
movq %rax, 0xc58(%rbx)
testq %rax, %rax
je 0xce60b
movq %r12, 0x8(%rsp)
cmpl $0x0, (%r12)
jle 0xce21a
leaq 0x5ba34(%rip), %r13     # 0x129b6a
xorl %r12d, %r12d
leaq (,%r12,8), %rbp
movq 0xc18(%rbx), %rdx
addq %rbp, %rdx
movq %r15, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x8690
cmpl $0x1, %eax
jne 0xce421
movq 0xc28(%rbx), %rdx
addq %rbp, %rdx
movq %r15, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x8690
cmpl $0x1, %eax
jne 0xce48a
movq 0xc38(%rbx), %rdx
addq %rbp, %rdx
movq %r15, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x8690
cmpl $0x1, %eax
jne 0xce4f3
addq 0xc48(%rbx), %rbp
movq %r15, %rdi
movq %r13, %rsi
movq %rbp, %rdx
xorl %eax, %eax
callq 0x8690
cmpl $0x1, %eax
jne 0xce55c
cmpl $0x0, 0xc68(%rbx)
jle 0xce206
xorl %ebp, %ebp
movl 0xc20(%rbx), %eax
imull %ebp, %eax
addl %r12d, %eax
movslq %eax, %rdx
shlq $0x3, %rdx
addq 0xc58(%rbx), %rdx
movq %r15, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x8690
cmpl $0x1, %eax
jne 0xce2dd
incl %ebp
cmpl 0xc68(%rbx), %ebp
jl 0xce1cc
incq %r12
movq 0x8(%rsp), %rax
movslq (%rax), %rax
cmpq %rax, %r12
jl 0xce139
movq %r15, %rdi
callq 0x83a0
xorl %eax, %eax
jmp 0xce65c
leaq 0x257a8(%rip), %rsi     # 0xf39d8
leaq 0x5b823(%rip), %rdx     # 0x129a5a
leaq 0x257cf(%rip), %r8      # 0xf3a0d
leaq 0x280(%rsp), %r14
leaq 0x10(%rsp), %rcx
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x22dd1(%rip), %rsi     # 0xf1034
leaq 0x5c2f2(%rip), %rdx     # 0x12a55c
movq %rbx, %rdi
movl $0x591, %ecx            # imm = 0x591
jmp 0xce64d
leaq 0x5c2f7(%rip), %rsi     # 0x12a575
leaq 0x280(%rsp), %r15
leaq 0x10(%rsp), %rcx
movq %r15, %rdi
movl %r14d, %edx
xorl %eax, %eax
callq 0x30c2c
leaq 0x22de3(%rip), %rsi     # 0xf1082
leaq 0x5c322(%rip), %rdx     # 0x12a5c8
leaq 0xa80(%rsp), %r14
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x22d6b(%rip), %rsi     # 0xf1034
leaq 0x5c28c(%rip), %rdx     # 0x12a55c
movq %rbx, %rdi
movl $0x5a2, %ecx            # imm = 0x5A2
jmp 0xce64d
addl %r12d, %r14d
leaq 0x5c4e9(%rip), %rsi     # 0x12a7d0
leaq 0x280(%rsp), %r15
leaq 0x10(%rsp), %rcx
movq %r15, %rdi
movl %r14d, %edx
xorl %eax, %eax
callq 0x30c2c
leaq 0x22d7a(%rip), %rsi     # 0xf1082
leaq 0x5c4f1(%rip), %rdx     # 0x12a800
leaq 0xa80(%rsp), %r14
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x22d02(%rip), %rsi     # 0xf1034
leaq 0x5c223(%rip), %rdx     # 0x12a55c
movq %rbx, %rdi
movl $0x5c4, %ecx            # imm = 0x5C4
jmp 0xce64d
shll $0x3, %r13d
leaq 0x22cb3(%rip), %rsi     # 0xf1004
leaq 0x5c2af(%rip), %rdx     # 0x12a607
leaq 0x280(%rsp), %r14
movq %r14, %rdi
movl %r13d, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x22cb9(%rip), %rsi     # 0xf1034
leaq 0x5c1da(%rip), %rdx     # 0x12a55c
movq %rbx, %rdi
movl $0x5a4, %ecx            # imm = 0x5A4
jmp 0xce64d
shll $0x3, %r13d
leaq 0x22c6a(%rip), %rsi     # 0xf1004
leaq 0x5c276(%rip), %rdx     # 0x12a617
leaq 0x280(%rsp), %r14
movq %r14, %rdi
movl %r13d, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x22c70(%rip), %rsi     # 0xf1034
leaq 0x5c191(%rip), %rdx     # 0x12a55c
movq %rbx, %rdi
movl $0x5a5, %ecx            # imm = 0x5A5
jmp 0xce64d
shll $0x3, %r13d
leaq 0x22c21(%rip), %rsi     # 0xf1004
leaq 0x5c23c(%rip), %rdx     # 0x12a626
leaq 0x280(%rsp), %r14
movq %r14, %rdi
movl %r13d, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x22c27(%rip), %rsi     # 0xf1034
leaq 0x5c148(%rip), %rdx     # 0x12a55c
movq %rbx, %rdi
movl $0x5a6, %ecx            # imm = 0x5A6
jmp 0xce64d
addl %r12d, %r14d
leaq 0x5c225(%rip), %rsi     # 0x12a650
leaq 0x280(%rsp), %r15
leaq 0x10(%rsp), %rcx
movq %r15, %rdi
movl %r14d, %edx
xorl %eax, %eax
callq 0x30c2c
leaq 0x22c36(%rip), %rsi     # 0xf1082
leaq 0x5c226(%rip), %rdx     # 0x12a679
leaq 0xa80(%rsp), %r14
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x22bbe(%rip), %rsi     # 0xf1034
leaq 0x5c0df(%rip), %rdx     # 0x12a55c
movq %rbx, %rdi
movl $0x5b3, %ecx            # imm = 0x5B3
jmp 0xce64d
addl %r12d, %r14d
leaq 0x5c21b(%rip), %rsi     # 0x12a6af
leaq 0x280(%rsp), %r15
leaq 0x10(%rsp), %rcx
movq %r15, %rdi
movl %r14d, %edx
xorl %eax, %eax
callq 0x30c2c
leaq 0x22bcd(%rip), %rsi     # 0xf1082
leaq 0x5c21e(%rip), %rdx     # 0x12a6da
leaq 0xa80(%rsp), %r14
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x22b55(%rip), %rsi     # 0xf1034
leaq 0x5c076(%rip), %rdx     # 0x12a55c
movq %rbx, %rdi
movl $0x5b7, %ecx            # imm = 0x5B7
jmp 0xce64d
addl %r12d, %r14d
leaq 0x5c212(%rip), %rsi     # 0x12a70f
leaq 0x280(%rsp), %r15
leaq 0x10(%rsp), %rcx
movq %r15, %rdi
movl %r14d, %edx
xorl %eax, %eax
callq 0x30c2c
leaq 0x22b64(%rip), %rsi     # 0xf1082
leaq 0x5c215(%rip), %rdx     # 0x12a73a
leaq 0xa80(%rsp), %r14
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x22aec(%rip), %rsi     # 0xf1034
leaq 0x5c00d(%rip), %rdx     # 0x12a55c
movq %rbx, %rdi
movl $0x5bb, %ecx            # imm = 0x5BB
jmp 0xce64d
addl %r12d, %r14d
leaq 0x5c209(%rip), %rsi     # 0x12a76f
leaq 0x280(%rsp), %r15
leaq 0x10(%rsp), %rcx
movq %r15, %rdi
movl %r14d, %edx
xorl %eax, %eax
callq 0x30c2c
leaq 0x22afb(%rip), %rsi     # 0xf1082
leaq 0x5c20d(%rip), %rdx     # 0x12a79b
leaq 0xa80(%rsp), %r14
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x22a83(%rip), %rsi     # 0xf1034
leaq 0x5bfa4(%rip), %rdx     # 0x12a55c
movq %rbx, %rdi
movl $0x5bf, %ecx            # imm = 0x5BF
jmp 0xce64d
shll $0x3, %r13d
leaq 0x22a34(%rip), %rsi     # 0xf1004
leaq 0x5c05e(%rip), %rdx     # 0x12a635
leaq 0x280(%rsp), %r14
movq %r14, %rdi
movl %r13d, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x22a3a(%rip), %rsi     # 0xf1034
leaq 0x5bf5b(%rip), %rdx     # 0x12a55c
movq %rbx, %rdi
movl $0x5a7, %ecx            # imm = 0x5A7
jmp 0xce64d
shll $0x3, %ebp
leaq 0x229ef(%rip), %rsi     # 0xf1004
leaq 0x5c029(%rip), %rdx     # 0x12a645
leaq 0x280(%rsp), %r14
movq %r14, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x30c2c
addq $0x1602, %rbx           # imm = 0x1602
leaq 0x229f6(%rip), %rsi     # 0xf1034
leaq 0x5bf17(%rip), %rdx     # 0x12a55c
movq %rbx, %rdi
movl $0x5a9, %ecx            # imm = 0x5A9
movq %r14, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %eax
addq $0x1688, %rsp           # imm = 0x1688
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq