// File: /workspace/github_cpp_makefile_star2_O3/lagoproject[P]arti/analysis/analysis.cc
// Function: ReadBlock(double*, int)
int ReadBlock(double *block, int type) {
  int read_line_error = 0, check = 0, read_no_error=1;
  bad_block=0;
  for (int row=0; row<block_rows; row++) {
    if (fgets(line,250,fi)!=NULL) {
      do {
        check=sscanf(
          line, "%le %le %le %le %le %le %le\n", 
          &block[block_cols * row + 0], 
          &block[block_cols * row + 1], 
          &block[block_cols * row + 2], 
          &block[block_cols * row + 3], 
          &block[block_cols * row + 4], 
          &block[block_cols * row + 5], 
          &block[block_cols * row + 6]
        );
      } while (check != block_cols && read_line_error++ < read_tries);
      lines++;
      if (read_line_error) {
        cerr << "Error: Bad block (missing elements) at block "<< type << ", row " << row+1 << endl;
        read_no_error=0;
        break;
      }
    }
    else { 
      cerr << "Error: EOF while reading block " << type << " at line " << row+1 << endl;
      read_no_error=0;
      break;
    }
  }
  if (block[0] != chk_block[type]) {
    // if we read the last event, then while we are trying to read the next event header we are actually reading the run_footer, so...
    if (type == 2 && block[0] == chk_block[4]) {
      events=false;
      for (int i=0; i<block_size; i++) 
        run_footer[i] = block[i];
    }
    else {  
      bad_block = 1;
      fprintf(stderr, "Error: Bad block error (unformated) at block %d. First element should be %.5E, and it is %.5E\n", type, chk_block[type], block[0]);
    }
  }
  return read_no_error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, %ebp
movq %rdi, %r15
movl $0x0, 0x6790(%rip)      # 0x7c90
leaq 0x67d9(%rip), %rdi      # 0x7ce0
xorl %r14d, %r14d
movq %r15, 0x8(%rsp)
movl %esi, 0x4(%rsp)
movq 0x3c4e(%rip), %rdx      # 0x5168
movl $0xfa, %esi
callq 0x11b0
testq %rax, %rax
je 0x16e2
movq %r14, 0x10(%rsp)
imulq $0x38, %r14, %rax
leaq (%r15,%rax), %rcx
movq %rcx, 0x20(%rsp)
leaq (%r15,%rax), %rcx
addq $0x8, %rcx
movq %rcx, 0x18(%rsp)
leaq 0x10(%r15,%rax), %r14
leaq 0x18(%r15,%rax), %rbx
leaq (%r15,%rax), %r12
addq $0x20, %r12
leaq (%r15,%rax), %r13
addq $0x28, %r13
leaq (%r15,%rax), %rbp
addq $0x30, %rbp
xorl %r15d, %r15d
subq $0x8, %rsp
leaq 0x6764(%rip), %rdi      # 0x7ce0
leaq 0x1b42(%rip), %rsi      # 0x30c5
movq 0x28(%rsp), %rdx
movq 0x20(%rsp), %rcx
movq %r14, %r8
movq %rbx, %r9
xorl %eax, %eax
pushq %rbp
pushq %r13
pushq %r12
callq 0x10f0
addq $0x20, %rsp
cmpl $0x7, %eax
je 0x15b3
decl %r15d
cmpl $-0xb, %r15d
jne 0x1571
jmp 0x15ec
incq 0x66be(%rip)            # 0x7c78
testl %r15d, %r15d
jne 0x15f3
movq 0x10(%rsp), %r14
incq %r14
cmpq $0x27, %r14
movq 0x8(%rsp), %r15
movl 0x4(%rsp), %ebp
leaq 0x6705(%rip), %rdi      # 0x7ce0
jne 0x1513
movl $0x1, %r14d
jmp 0x1678
incq 0x6685(%rip)            # 0x7c78
movq 0x39f6(%rip), %rbx      # 0x4ff0
leaq 0x1ae1(%rip), %rsi      # 0x30e2
movl $0x2d, %edx
movq %rbx, %rdi
callq 0x1130
movq %rbx, %rdi
movl 0x4(%rsp), %ebp
movl %ebp, %esi
callq 0x11d0
movq %rax, %rbx
leaq 0x1aea(%rip), %rsi      # 0x3110
movl $0x6, %edx
movq %rax, %rdi
callq 0x1130
movq 0x8(%rsp), %r15
movq 0x10(%rsp), %r14
incl %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x11d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10e0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10b0
xorl %r14d, %r14d
movsd (%r15), %xmm1
movslq %ebp, %rax
leaq 0x3a89(%rip), %rcx      # 0x5110
movsd (%rcx,%rax,8), %xmm0
ucomisd %xmm0, %xmm1
jne 0x1694
jnp 0x16d0
cmpl $0x2, %ebp
jne 0x1723
ucomisd 0x3a8b(%rip), %xmm1     # 0x5130
jne 0x1723
jp 0x1723
movb $0x0, 0x3a88(%rip)      # 0x5138
xorl %eax, %eax
leaq 0x5d07(%rip), %rcx      # 0x73c0
movsd (%r15,%rax), %xmm0
movsd %xmm0, (%rax,%rcx)
addq $0x8, %rax
cmpq $0x888, %rax            # imm = 0x888
jne 0x16b9
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x3907(%rip), %rbx      # 0x4ff0
leaq 0x1a27(%rip), %rsi      # 0x3117
movl $0x1f, %edx
movq %rbx, %rdi
callq 0x1130
movq %rbx, %rdi
movl %ebp, %esi
callq 0x11d0
movq %rax, %rbx
leaq 0x1a26(%rip), %rsi      # 0x3137
movl $0x9, %edx
movq %rax, %rdi
callq 0x1130
jmp 0x163d
movl $0x1, 0x6563(%rip)      # 0x7c90
movq 0x389c(%rip), %rax      # 0x4fd0
movq (%rax), %rdi
leaq 0x1a03(%rip), %rsi      # 0x3141
movl %ebp, %edx
movb $0x2, %al
callq 0x1190
jmp 0x16d0