// File: /workspace/github_cpp_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movq %rdi, %r15
leaq 0x240(%rdi), %rbx
leaq 0x2c0(%rdi), %r12
movq %r12, %rdi
callq 0x40a0
testb %al, %al
je 0x12c00
movq %rbx, %rdi
callq 0x4060
leaq 0x18(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq 0x450(%r15), %rsi
movq 0x458(%r15), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %r13
movq %r13, %rdi
callq 0x76e4
leaq 0x6011(%rip), %rsi      # 0x18c3f
movq %r13, %rdi
callq 0x4530
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
movl $0x8, %edx
callq 0x4270
movq %r12, %rdi
callq 0x40a0
testb %al, %al
je 0x12ced
leaq 0x80(%r14), %rdi
callq 0x40a0
testb %al, %al
je 0x12d44
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 0x12cb7
movl $0xa00000, %edx         # imm = 0xA00000
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4350
movq 0x248(%r15), %rdx
movq %r14, %rdi
movq %r12, %rsi
callq 0x4390
jmp 0x12c7d
movq %rbx, %rdi
callq 0x4060
movq %r12, %rdi
callq 0x4380
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x12cde
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42d0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xd2fc(%rip), %rdi      # 0x1fff0
leaq 0x5f4a(%rip), %rsi      # 0x18c45
movl $0x21, %edx
callq 0x42f0
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0xd2da(%rip), %rdi      # 0x1fff0
callq 0x42f0
movq %rax, %rbx
leaq 0x5847(%rip), %rsi      # 0x1856c
movl $0xa, %edx
movq %rax, %rdi
callq 0x42f0
movq %rbx, %rdi
callq 0x4130
movl $0x2, %edi
callq 0x4320
movl $0x20, %edi
callq 0x4140
movq %rax, %r14
addq $0x10, %rax
movq %rax, (%r14)
leaq 0x5ab5(%rip), %rsi      # 0x18814
leaq 0x5acd(%rip), %rdx      # 0x18833
movq %r14, %rdi
callq 0x7b0a
leaq 0xcb4b(%rip), %rsi      # 0x1f8c0
movq 0xd244(%rip), %rdx      # 0x1ffc0
movq %r14, %rdi
callq 0x44b0
jmp 0x12ecf
movq %rax, %rbx
movq %r14, %rdi
callq 0x41f0
jmp 0x12ed2
jmp 0x12ecf
movq %rax, %rbx
cmpl $0x2, %edx
jne 0x12ed2
movq %rbx, %rdi
callq 0x4110
movq %rax, %rbx
movq 0xd234(%rip), %rdi      # 0x1fff0
leaq 0x5f3b(%rip), %rsi      # 0x18cfe
movl $0x3a, %edx
callq 0x42f0
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq 0xd213(%rip), %rdi      # 0x1fff0
movq %rax, %rsi
callq 0x42a0
movq %rax, %rdi
callq 0x4130
movl $0x4, %edi
callq 0x4320
movq %rax, %rbx
callq 0x4480
jmp 0x12ed2
jmp 0x12ecf
movq %rax, %rbx
cmpl $0x1, %edx
jne 0x12ed2
movq %rbx, %rdi
callq 0x4110
movq %rax, %rbx
movq 0xd1c9(%rip), %rdi      # 0x1fff0
leaq 0x5e39(%rip), %rsi      # 0x18c67
movl $0x1e, %edx
callq 0x42f0
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0xd1a7(%rip), %rdi      # 0x1fff0
callq 0x42f0
movq %rax, %r14
leaq 0x5ba5(%rip), %rsi      # 0x189fd
movl $0xc, %edx
movq %rax, %rdi
callq 0x42f0
movq 0x18(%rbx), %rsi
movl 0x10(%rbx), %edx
movq (%rsi), %rax
leaq 0x28(%rsp), %rdi
callq *0x20(%rax)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %r14, %rdi
callq 0x42f0
movq %rax, %rdi
callq 0x41b0
leaq 0x28(%rsp), %rdi
callq 0x4967
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x12ec0
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x42d0
jmp 0x12ec0
jmp 0x12ebd
movq %rax, %rbx
callq 0x4480
jmp 0x12ed2
movq %rax, %rdi
callq 0x76d8
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x12ee9
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42d0
movq %rbx, %rdi
callq 0x44e0
nop