// File: /workspace/github_cpp_makefile_star2_O1/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 0x12da0
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 0x7720
leaq 0x5e71(%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 0x12e8d
leaq 0x80(%r14), %rdi
callq 0x40a0
testb %al, %al
je 0x12ee4
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 0x12e57
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 0x12e1d
movq %rbx, %rdi
callq 0x4060
movq %r12, %rdi
callq 0x4380
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x12e7e
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 0xd15c(%rip), %rdi      # 0x1fff0
leaq 0x5daa(%rip), %rsi      # 0x18c45
movl $0x21, %edx
callq 0x42f0
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0xd13a(%rip), %rdi      # 0x1fff0
callq 0x42f0
movq %rax, %rbx
leaq 0x56a7(%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)
movb $0x1, %r15b
leaq 0x5912(%rip), %rsi      # 0x18814
leaq 0x592a(%rip), %rdx      # 0x18833
movq %r14, %rdi
callq 0x7b72
xorl %r15d, %r15d
leaq 0xc9a5(%rip), %rsi      # 0x1f8c0
movq 0xd09e(%rip), %rdx      # 0x1ffc0
movq %r14, %rdi
callq 0x44b0
jmp 0x13079
movq %rax, %rbx
cmpl $0x2, %edx
jne 0x1307c
movq %rbx, %rdi
callq 0x4110
movq %rax, %rbx
movq 0xd0a3(%rip), %rdi      # 0x1fff0
leaq 0x5daa(%rip), %rsi      # 0x18cfe
movl $0x3a, %edx
callq 0x42f0
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq 0xd082(%rip), %rdi      # 0x1fff0
movq %rax, %rsi
callq 0x42a0
movq %rax, %rdi
callq 0x4130
movl $0x4, %edi
callq 0x4320
movq %rax, %rbx
callq 0x4480
jmp 0x1307c
movq %rax, %rbx
testb %r15b, %r15b
je 0x1307c
movq %r14, %rdi
callq 0x41f0
jmp 0x1307c
jmp 0x13079
movq %rax, %rbx
cmpl $0x1, %edx
jne 0x1307c
movq %rbx, %rdi
callq 0x4110
movq %rax, %rbx
movq 0xd01f(%rip), %rdi      # 0x1fff0
leaq 0x5c8f(%rip), %rsi      # 0x18c67
movl $0x1e, %edx
callq 0x42f0
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0xcffd(%rip), %rdi      # 0x1fff0
callq 0x42f0
movq %rax, %r14
leaq 0x59fb(%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 0x1306a
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x42d0
jmp 0x1306a
jmp 0x13067
movq %rax, %rbx
callq 0x4480
jmp 0x1307c
movq %rax, %rdi
callq 0x7714
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x13093
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42d0
movq %rbx, %rdi
callq 0x44e0
nop