// File: /workspace/github_cpp_makefile_star2_O2/tonymugen[P]sampleSNPs/varfiles.cpp
// Function: sampFiles::TpedFileI::_famCopy(std::basic_fstream<char, std::char_traits<char>>&)
void TpedFileI::_famCopy(fstream &fam){
	if (_tfamFile.is_open()) {
        _tfamFile.close();
    }
    string tfamName = _fileStub + ".tfam";
    try {
        _tfamFile.open(tfamName.c_str(), ios::in);
		if (!_tfamFile.is_open()) {
			cerr << "ERROR: failed to open .tfam file " << tfamName << " for input" << endl;
			exit(2);
		}

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

    }
    if (!fam.is_open()) {
        throw string("Output .fam filestream not open");
    }

    const size_t bufSize = BUF_SIZE;
    char *buf;
    try {
        buf = new char[bufSize];
    } catch (bad_alloc& error) {
        cerr << "ERROR: failed to allocate buffer in TpedFile::_famCopy(): " << error.what() << endl;
        exit(4);
    }

    while (_tfamFile) {
        _tfamFile.read(buf, bufSize);
        fam.write(buf, _tfamFile.gcount());
    }
    _tfamFile.close();
    delete [] buf;

}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rsi, %r14
movq %rdi, %r15
leaq 0x240(%rdi), %rbx
leaq 0x2c0(%rdi), %r12
movq %r12, %rdi
callq 0x40b0
testb %al, %al
je 0xf1e5
movq %rbx, %rdi
callq 0x4050
leaq 0x450(%r15), %rsi
leaq 0x5a4c(%rip), %rdx      # 0x14c3f
leaq 0x20(%rsp), %r13
movq %r13, %rdi
callq 0x5e08
movq (%r13), %rsi
pushq $0x8
popq %rdx
movq %rbx, %rdi
callq 0x4280
movq %r12, %rdi
callq 0x40b0
testb %al, %al
je 0xf2a6
leaq 0x80(%r14), %rdi
callq 0x40b0
testb %al, %al
je 0xf2e4
movl $0xa00000, %edi         # imm = 0xA00000
callq 0x4030
movq %rax, %r12
addq $0x10, %r14
movq 0x240(%r15), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x260(%r15,%rax)
jne 0xf27e
movl $0xa00000, %edx         # imm = 0xA00000
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4340
movq 0x248(%r15), %rdx
movq %r14, %rdi
movq %r12, %rsi
callq 0x4390
jmp 0xf244
movq %rbx, %rdi
callq 0x4050
movq %r12, %rdi
callq 0x4370
leaq 0x20(%rsp), %rdi
callq 0x4558
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0xcd43(%rip), %rdi      # 0x1bff0
leaq 0x5991(%rip), %rsi      # 0x14c45
callq 0x42a0
leaq 0x20(%rsp), %rsi
movq %rax, %rdi
callq 0x4270
leaq 0x529f(%rip), %rsi      # 0x1456c
movq %rax, %rdi
callq 0x42a0
movq %rax, %rdi
callq 0x4140
pushq $0x2
jmp 0xf37c
pushq $0x20
popq %rdi
callq 0x4150
movq %rax, %r14
leaq 0x551e(%rip), %rsi      # 0x14814
movq %rsp, %rdx
movq %rax, %rdi
callq 0x5d1e
leaq 0xc5c0(%rip), %rsi      # 0x1b8c8
movq 0xccb1(%rip), %rdx      # 0x1bfc0
movq %r14, %rdi
callq 0x44a0
jmp 0xf437
movq %rax, %rbx
movq %r14, %rdi
callq 0x4200
jmp 0xf43a
jmp 0xf437
movq %rax, %rbx
cmpl $0x2, %edx
jne 0xf43a
movq %rbx, %rdi
callq 0x4110
movq %rax, %rbx
movq 0xcca1(%rip), %rdi      # 0x1bff0
leaq 0x59a8(%rip), %rsi      # 0x14cfe
callq 0x42a0
movq %rax, %r14
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq %r14, %rdi
movq %rax, %rsi
callq 0x42a0
movq %rax, %rdi
callq 0x4140
pushq $0x4
popq %rdi
callq 0x4310
movq %rax, %rbx
callq 0x4470
jmp 0xf43a
movq %rax, %rbx
cmpl $0x1, %edx
jne 0xf43a
movq %rbx, %rdi
callq 0x4110
movq %rax, %rbx
movq 0xcc43(%rip), %rdi      # 0x1bff0
leaq 0x58b3(%rip), %rsi      # 0x14c67
callq 0x42a0
leaq 0x20(%rsp), %rsi
movq %rax, %rdi
callq 0x4270
leaq 0x5630(%rip), %rsi      # 0x149fd
movq %rax, %rdi
callq 0x42a0
movq %rax, %r14
movq 0x18(%rbx), %rsi
movl 0x10(%rbx), %edx
movq (%rsi), %rax
movq %rsp, %rdi
callq *0x20(%rax)
movq %rsp, %rsi
movq %r14, %rdi
callq 0x4270
movq %rax, %rdi
callq 0x41c0
movq %rsp, %rdi
callq 0x4558
leaq 0x5408(%rip), %rdi      # 0x14812
callq 0x4250
pushq $0x1
jmp 0xf37c
movq %rax, %rbx
movq %rsp, %rdi
callq 0x4558
jmp 0xf428
jmp 0xf425
movq %rax, %rbx
callq 0x4470
jmp 0xf43a
movq %rax, %rdi
callq 0x6194
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x4558
movq %rbx, %rdi
callq 0x44d0