// File: tonymugen[P]sampleSNPs/varfiles.cpp
// Function: sampFiles::BedFileI::_numLines()
uint64_t BedFileI::_numLines(){
    if (!_nCols) {
        _nCols = _famLines();
    }
    if (_varFile.is_open()) {
        _varFile.close();
    }
    try {
        _varFile.open(_fileName.c_str(), ios::in | ios::binary | ios::ate);
		if (!_varFile.is_open()) {
			cerr << "ERROR: failed to open file " << _fileName << " for input" << endl;
			exit(2);
		}

    } catch (system_error &error) {
        cerr << "ERROR: cannot open binary file " << _fileName << " for output: " << error.code().message() << flush;
        perror(" ");
        exit(1);

    }
    uint64_t Nbed = (_nCols/4UL) + static_cast<uint64_t>( (_nCols%4UL) > 0UL );
    uint64_t N = static_cast<uint64_t>(_varFile.tellg()) - 3UL; // 3 is the number of magic bytes
    if (N % Nbed) {
        cerr << "ERROR: total file size " << N << " not divisible by the number of compressed colums " << Nbed << " in BedFile _numLines()" << endl;
        exit(7);
    }
    _varFile.close();

    return N/Nbed;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
cmpq $0x0, 0x238(%rax)
jne 0xba18
movq -0x68(%rbp), %rdi
callq 0xbd40
movq %rax, %rcx
movq -0x68(%rbp), %rax
movq %rcx, 0x238(%rax)
movq -0x68(%rbp), %rdi
addq $0x8, %rdi
callq 0x45e0
testb $0x1, %al
jne 0xba2b
jmp 0xba38
movq -0x68(%rbp), %rdi
addq $0x8, %rdi
callq 0x4060
movq -0x68(%rbp), %rdi
movq %rdi, %rax
addq $0x8, %rax
movq %rax, -0x80(%rbp)
addq $0x218, %rdi            # imm = 0x218
callq 0x4140
movq %rax, -0x78(%rbp)
movl $0x8, %edi
movl $0x4, %esi
callq 0x1ee70
movl %eax, -0x6c(%rbp)
jmp 0xba6b
movl -0x6c(%rbp), %edi
movl $0x2, %esi
callq 0x1ee70
movl %eax, -0x84(%rbp)
jmp 0xba80
movl -0x84(%rbp), %edx
movq -0x78(%rbp), %rsi
movq -0x80(%rbp), %rdi
callq 0x42f0
jmp 0xba95
movq -0x68(%rbp), %rdi
addq $0x8, %rdi
callq 0x45e0
movb %al, -0x85(%rbp)
jmp 0xbaaa
movb -0x85(%rbp), %al
testb $0x1, %al
jne 0xbc18
jmp 0xbaba
movq 0x2052f(%rip), %rdi     # 0x2bff0
leaq 0x17a70(%rip), %rsi     # 0x23538
callq 0x4310
movq %rax, -0x90(%rbp)
jmp 0xbad6
movq -0x90(%rbp), %rdi
movq -0x68(%rbp), %rsi
addq $0x218, %rsi            # imm = 0x218
callq 0x42e0
movq %rax, -0x98(%rbp)
jmp 0xbaf6
movq -0x98(%rbp), %rdi
leaq 0x17a50(%rip), %rsi     # 0x23554
callq 0x4310
movq %rax, -0xa0(%rbp)
jmp 0xbb12
movq -0xa0(%rbp), %rdi
movq 0x20490(%rip), %rsi     # 0x2bfb0
callq 0x4350
jmp 0xbb27
movl $0x2, %edi
callq 0x4400
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0xbd2f
movq -0x10(%rbp), %rdi
callq 0x4130
movq %rax, -0x20(%rbp)
movq 0x2048f(%rip), %rdi     # 0x2bff0
leaq 0x179f7(%rip), %rsi     # 0x2355f
callq 0x4310
movq %rax, -0xa8(%rbp)
jmp 0xbb76
movq -0xa8(%rbp), %rdi
movq -0x68(%rbp), %rsi
addq $0x218, %rsi            # imm = 0x218
callq 0x42e0
movq %rax, -0xb0(%rbp)
jmp 0xbb96
movq -0xb0(%rbp), %rdi
leaq 0x17b32(%rip), %rsi     # 0x236d6
callq 0x4310
movq %rax, -0xb8(%rbp)
jmp 0xbbb2
movq -0x20(%rbp), %rdi
callq 0x1ee90
movq %rax, %rsi
leaq -0x40(%rbp), %rdi
callq 0x1eeb0
jmp 0xbbc9
movq -0xb8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x42e0
movq %rax, -0xc0(%rbp)
jmp 0xbbe2
movq -0xc0(%rbp), %rdi
movq 0x203d8(%rip), %rsi     # 0x2bfc8
callq 0x4350
jmp 0xbbf7
leaq -0x40(%rbp), %rdi
callq 0x46d8
leaq 0x17bf3(%rip), %rdi     # 0x237fa
callq 0x42a0
jmp 0xbc0e
movl $0x1, %edi
callq 0x4400
jmp 0xbc49
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0xbc3d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x46d8
callq 0x4580
jmp 0xbc44
jmp 0xbd2f
movq -0x68(%rbp), %rdi
movq 0x238(%rdi), %rax
shrq $0x2, %rax
movq 0x238(%rdi), %rcx
andq $0x3, %rcx
cmpq $0x0, %rcx
seta %cl
andb $0x1, %cl
movzbl %cl, %ecx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
addq $0x8, %rdi
callq 0x45f0
movq %rax, -0x60(%rbp)
movq %rdx, -0x58(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x1ef00
subq $0x3, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x48(%rbp)
cmpq $0x0, %rdx
je 0xbd0d
movq 0x2033e(%rip), %rdi     # 0x2bff0
leaq 0x17a61(%rip), %rsi     # 0x2371a
callq 0x4310
movq %rax, %rdi
movq -0x50(%rbp), %rsi
callq 0x40d0
movq %rax, %rdi
leaq 0x17a5e(%rip), %rsi     # 0x23732
callq 0x4310
movq %rax, %rdi
movq -0x48(%rbp), %rsi
callq 0x40d0
movq %rax, %rdi
leaq 0x17a76(%rip), %rsi     # 0x23765
callq 0x4310
movq %rax, %rdi
movq 0x202b2(%rip), %rsi     # 0x2bfb0
callq 0x4350
movl $0x7, %edi
callq 0x4400
movq -0x68(%rbp), %rdi
addq $0x8, %rdi
callq 0x4060
movq -0x50(%rbp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x48(%rbp)
addq $0xc0, %rsp
popq %rbp
retq
movq -0x10(%rbp), %rdi
callq 0x4610
movq %rax, %rdi
callq 0x82c0