// File: /workspace/github_cpp_makefile_star2_O2/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, %ebx
movq %rdi, %r14
andl $0x0, 0x7897(%rip)      # 0x8c70
pushq $0x1
popq %rax
movl %eax, (%rsp)
leaq 0x1d51(%rip), %r12      # 0x3137
leaq 0x1d2a(%rip), %r13      # 0x3117
xorl %r15d, %r15d
movq %rdi, 0x8(%rsp)
movl %esi, 0x4(%rsp)
cmpq $0x27, %r15
je 0x152a
movq 0x4d3e(%rip), %rdx      # 0x6148
leaq 0x78af(%rip), %rdi      # 0x8cc0
movl $0xfa, %esi
callq 0x1160
testq %rax, %rax
je 0x14e9
movq %r15, 0x10(%rsp)
imulq $0x38, %r15, %rax
leaq (%r14,%rax), %rcx
movq %rcx, 0x20(%rsp)
leaq (%r14,%rax), %rcx
addq $0x8, %rcx
movq %rcx, 0x18(%rsp)
leaq 0x10(%r14,%rax), %r15
leaq 0x18(%r14,%rax), %rbx
leaq (%r14,%rax), %r12
addq $0x20, %r12
leaq (%r14,%rax), %rbp
addq $0x28, %rbp
addq %rax, %r14
addq $0x30, %r14
xorl %r13d, %r13d
subq $0x8, %rsp
leaq 0x784e(%rip), %rdi      # 0x8cc0
leaq 0x1c4c(%rip), %rsi      # 0x30c5
movq 0x28(%rsp), %rdx
movq 0x20(%rsp), %rcx
movq %r15, %r8
movq %rbx, %r9
xorl %eax, %eax
pushq %r14
pushq %rbp
pushq %r12
callq 0x10b0
addq $0x20, %rsp
cmpl $0x7, %eax
je 0x14ab
incl %r13d
cmpl $0xb, %r13d
jne 0x1467
pushq $0x1
popq %r13
incq 0x77a6(%rip)            # 0x8c58
testl %r13d, %r13d
movq 0x8(%rsp), %r14
movl 0x4(%rsp), %ebx
movq 0x10(%rsp), %r15
jne 0x14db
incq %r15
leaq 0x1c68(%rip), %r12      # 0x3137
leaq 0x1c41(%rip), %r13      # 0x3117
jmp 0x13f9
leaq 0x1c00(%rip), %r13      # 0x30e2
leaq 0x1c27(%rip), %r12      # 0x3110
movq 0x4b00(%rip), %rdi      # 0x5ff0
movq %r13, %rsi
callq 0x10c0
movq %rax, %rdi
movl %ebx, %esi
callq 0x1180
movq %rax, %rdi
movq %r12, %rsi
callq 0x10c0
incl %r15d
movq %rax, %rdi
movl %r15d, %esi
callq 0x1180
movq %rax, %rdi
callq 0x1080
movl $0x0, (%rsp)
movsd (%r14), %xmm1
movslq %ebx, %rax
leaq 0x4bb7(%rip), %rcx      # 0x60f0
movsd (%rcx,%rax,8), %xmm0
ucomisd %xmm0, %xmm1
jne 0x1546
jnp 0x15a4
cmpl $0x2, %ebx
jne 0x1580
ucomisd 0x4bbd(%rip), %xmm1     # 0x6110
jne 0x1580
jp 0x1580
movb $0x0, 0x4bba(%rip)      # 0x6118
xorl %eax, %eax
leaq 0x6e39(%rip), %rcx      # 0x83a0
cmpq $0x888, %rax            # imm = 0x888
je 0x15a4
movsd (%r14,%rax), %xmm0
movsd %xmm0, (%rax,%rcx)
addq $0x8, %rax
jmp 0x1567
movl $0x1, 0x76e6(%rip)      # 0x8c70
movq 0x4a3f(%rip), %rax      # 0x5fd0
movq (%rax), %rdi
leaq 0x1ba6(%rip), %rsi      # 0x3141
movl %ebx, %edx
movb $0x2, %al
callq 0x1140
movl (%rsp), %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq