// File: lagoproject[P]arti/analysis/analysis.cc
// Function: ReadDataBlock(double*, int)
int ReadDataBlock(double *block, int blk) {
  int read_line_error = 0, check = 0, read_no_error=1;
  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 data block (missing elements) at data block "<< blk << ", row " << (blk-1)*block_rows+row+1 << endl;
        read_no_error=0;
        break;
      }
    }
    else {
      cerr << "Error: EOF while reading data block " << blk << " at row " << (blk-1)*block_rows+row+1 << endl;
      read_no_error=0;
      break;
    }
    //one more check: if the first element of DataBlock is 7.77778E+07, then there is no secondaries, and we read evt_footer!
    if (block[0] == chk_block[3]) {
      b_data=false;
      for (int i=0; i<block_size; i++) 
        evt_footer[i] = block[i];
    }
  }
  return read_no_error;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x1, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
cmpl $0x27, -0x1c(%rbp)
jge 0x1a80
movq 0x38ec(%rip), %rdx      # 0x5138
leaq 0x645d(%rip), %rdi      # 0x7cb0
movl $0xfa, %esi
callq 0x1150
cmpq $0x0, %rax
je 0x19bf
jmp 0x1869
movq -0x8(%rbp), %rdx
imull $0x7, -0x1c(%rbp), %eax
addl $0x0, %eax
cltq
shlq $0x3, %rax
addq %rax, %rdx
movq -0x8(%rbp), %rcx
imull $0x7, -0x1c(%rbp), %eax
addl $0x1, %eax
cltq
shlq $0x3, %rax
addq %rax, %rcx
movq -0x8(%rbp), %r8
imull $0x7, -0x1c(%rbp), %eax
addl $0x2, %eax
cltq
shlq $0x3, %rax
addq %rax, %r8
movq -0x8(%rbp), %r9
imull $0x7, -0x1c(%rbp), %eax
addl $0x3, %eax
cltq
shlq $0x3, %rax
addq %rax, %r9
movq -0x8(%rbp), %r11
imull $0x7, -0x1c(%rbp), %eax
addl $0x4, %eax
cltq
shlq $0x3, %rax
addq %rax, %r11
movq -0x8(%rbp), %r10
imull $0x7, -0x1c(%rbp), %eax
addl $0x5, %eax
cltq
shlq $0x3, %rax
addq %rax, %r10
movq -0x8(%rbp), %rax
imull $0x7, -0x1c(%rbp), %esi
addl $0x6, %esi
movslq %esi, %rsi
shlq $0x3, %rsi
addq %rsi, %rax
leaq 0x63b3(%rip), %rdi      # 0x7cb0
leaq 0x1875(%rip), %rsi      # 0x3179
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movb $0x0, %al
callq 0x10a0
movl %eax, -0x14(%rbp)
xorl %eax, %eax
cmpl $0x7, -0x14(%rbp)
movb %al, -0x21(%rbp)
je 0x193b
movl -0x10(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x10(%rbp)
cmpl $0xa, %eax
setl %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
testb $0x1, %al
jne 0x1869
movq 0x62fb(%rip), %rax      # 0x7c48
addq $0x1, %rax
movq %rax, 0x62f0(%rip)      # 0x7c48
cmpl $0x0, -0x10(%rbp)
je 0x19bd
movq 0x368b(%rip), %rdi      # 0x4ff0
leaq 0x18e8(%rip), %rsi      # 0x3254
callq 0x10b0
movq %rax, %rdi
movl -0xc(%rbp), %esi
callq 0x1170
movq %rax, %rdi
leaq 0x183e(%rip), %rsi      # 0x31c4
callq 0x10b0
movq %rax, %rdi
movl -0xc(%rbp), %eax
subl $0x1, %eax
imull $0x27, %eax, %esi
addl -0x1c(%rbp), %esi
addl $0x1, %esi
callq 0x1170
movq %rax, %rdi
movq 0x3604(%rip), %rsi      # 0x4fb0
callq 0x10c0
movl $0x0, -0x18(%rbp)
jmp 0x1a80
jmp 0x1a1b
movq 0x362a(%rip), %rdi      # 0x4ff0
leaq 0x18bf(%rip), %rsi      # 0x328c
callq 0x10b0
movq %rax, %rdi
movl -0xc(%rbp), %esi
callq 0x1170
movq %rax, %rdi
leaq 0x18ca(%rip), %rsi      # 0x32b1
callq 0x10b0
movq %rax, %rdi
movl -0xc(%rbp), %eax
subl $0x1, %eax
imull $0x27, %eax, %esi
addl -0x1c(%rbp), %esi
addl $0x1, %esi
callq 0x1170
movq %rax, %rdi
movq 0x35a3(%rip), %rsi      # 0x4fb0
callq 0x10c0
movl $0x0, -0x18(%rbp)
jmp 0x1a80
movq -0x8(%rbp), %rax
movsd (%rax), %xmm0
ucomisd 0x36cd(%rip), %xmm0     # 0x50f8
jne 0x1a70
jp 0x1a70
movb $0x0, 0x36d3(%rip)      # 0x5109
movl $0x0, -0x20(%rbp)
cmpl $0x111, -0x20(%rbp)     # imm = 0x111
jge 0x1a6e
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movslq -0x20(%rbp), %rcx
leaq 0x50a2(%rip), %rax      # 0x6b00
movsd %xmm0, (%rax,%rcx,8)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x1a3d
jmp 0x1a70
jmp 0x1a72
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x183b
movl -0x18(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)