// File: tonymugen[P]sampleSNPs/varfiles.cpp
// Function: sampFiles::TpedFileO::open()
void TpedFileO::open(){
	string tfamName = _fileStub + ".tfam";

	try {
		_varFile.open(_fileName.c_str(), ios::out);
		if (!_varFile.is_open()) {
			cerr << "ERROR: failed to open .tped file " << _fileName << " for output" << endl;
			exit(2);
		}

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

	}

	try {
		_tfamFile.open(tfamName.c_str(), ios::out);
		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 output: " << error.code().message() << flush;
		perror(" ");
		exit(1);

	}

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rsi
movq %rsi, -0x98(%rbp)
addq $0x450, %rsi            # imm = 0x450
leaq 0x800f(%rip), %rdx      # 0x23c27
leaq -0x28(%rbp), %rdi
callq 0x7920
movq -0x98(%rbp), %rdi
movq %rdi, %rax
addq $0x8, %rax
movq %rax, -0x90(%rbp)
addq $0x218, %rdi            # imm = 0x218
callq 0x4140
movq -0x90(%rbp), %rdi
movq %rax, %rsi
movl $0x10, %edx
callq 0x42f0
jmp 0x1bc58
movq -0x98(%rbp), %rdi
addq $0x8, %rdi
callq 0x45e0
movb %al, -0x99(%rbp)
jmp 0x1bc70
movb -0x99(%rbp), %al
testb $0x1, %al
jne 0x1bde4
jmp 0x1bc80
movq 0x10369(%rip), %rdi     # 0x2bff0
leaq 0x8093(%rip), %rsi      # 0x23d21
callq 0x4310
movq %rax, -0xa8(%rbp)
jmp 0x1bc9c
movq -0xa8(%rbp), %rdi
movq -0x98(%rbp), %rsi
addq $0x218, %rsi            # imm = 0x218
callq 0x42e0
movq %rax, -0xb0(%rbp)
jmp 0x1bcbf
movq -0xb0(%rbp), %rdi
leaq 0x79fd(%rip), %rsi      # 0x236ca
callq 0x4310
movq %rax, -0xb8(%rbp)
jmp 0x1bcdb
movq -0xb8(%rbp), %rdi
movq 0x102c7(%rip), %rsi     # 0x2bfb0
callq 0x4350
jmp 0x1bcf0
movl $0x2, %edi
callq 0x4400
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1c00f
movq -0x30(%rbp), %rdi
callq 0x4130
movq %rax, -0x40(%rbp)
movq 0x102c6(%rip), %rdi     # 0x2bff0
leaq 0x8031(%rip), %rsi      # 0x23d62
callq 0x4310
movq %rax, -0xc0(%rbp)
jmp 0x1bd3f
movq -0xc0(%rbp), %rdi
movq -0x98(%rbp), %rsi
addq $0x218, %rsi            # imm = 0x218
callq 0x42e0
movq %rax, -0xc8(%rbp)
jmp 0x1bd62
movq -0xc8(%rbp), %rdi
leaq 0x7966(%rip), %rsi      # 0x236d6
callq 0x4310
movq %rax, -0xd0(%rbp)
jmp 0x1bd7e
movq -0x40(%rbp), %rdi
callq 0x1ee90
movq %rax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x1eeb0
jmp 0x1bd95
movq -0xd0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x42e0
movq %rax, -0xd8(%rbp)
jmp 0x1bdae
movq -0xd8(%rbp), %rdi
movq 0x1020c(%rip), %rsi     # 0x2bfc8
callq 0x4350
jmp 0x1bdc3
leaq -0x60(%rbp), %rdi
callq 0x46d8
leaq 0x7a27(%rip), %rdi      # 0x237fa
callq 0x42a0
jmp 0x1bdda
movl $0x1, %edi
callq 0x4400
jmp 0x1be15
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x1be09
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x46d8
callq 0x4580
jmp 0x1be10
jmp 0x1c00f
movq -0x98(%rbp), %rax
addq $0x240, %rax            # imm = 0x240
movq %rax, -0xe0(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x4140
movq -0xe0(%rbp), %rdi
movq %rax, %rsi
movl $0x10, %edx
callq 0x42f0
jmp 0x1be48
movq -0x98(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
callq 0x45e0
movb %al, -0xe1(%rbp)
jmp 0x1be63
movb -0xe1(%rbp), %al
testb $0x1, %al
jne 0x1bfcc
jmp 0x1be73
movq 0x10176(%rip), %rdi     # 0x2bff0
leaq 0x7dac(%rip), %rsi      # 0x23c2d
callq 0x4310
movq %rax, -0xf0(%rbp)
jmp 0x1be8f
movq -0xf0(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x42e0
movq %rax, -0xf8(%rbp)
jmp 0x1bea8
movq -0xf8(%rbp), %rdi
leaq 0x769e(%rip), %rsi      # 0x23554
callq 0x4310
movq %rax, -0x100(%rbp)
jmp 0x1bec4
movq -0x100(%rbp), %rdi
movq 0x100de(%rip), %rsi     # 0x2bfb0
callq 0x4350
jmp 0x1bed9
movl $0x2, %edi
callq 0x4400
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1c00f
movq -0x30(%rbp), %rdi
callq 0x4130
movq %rax, -0x68(%rbp)
movq 0x100dd(%rip), %rdi     # 0x2bff0
leaq 0x7d35(%rip), %rsi      # 0x23c4f
callq 0x4310
movq %rax, -0x108(%rbp)
jmp 0x1bf28
movq -0x108(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x42e0
movq %rax, -0x110(%rbp)
jmp 0x1bf41
movq -0x110(%rbp), %rdi
leaq 0x7787(%rip), %rsi      # 0x236d6
callq 0x4310
movq %rax, -0x118(%rbp)
jmp 0x1bf5d
movq -0x68(%rbp), %rdi
callq 0x1ee90
movq %rax, %rsi
leaq -0x88(%rbp), %rdi
callq 0x1eeb0
jmp 0x1bf77
movq -0x118(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x42e0
movq %rax, -0x120(%rbp)
jmp 0x1bf93
movq -0x120(%rbp), %rdi
movq 0x10027(%rip), %rsi     # 0x2bfc8
callq 0x4350
jmp 0x1bfa8
leaq -0x88(%rbp), %rdi
callq 0x46d8
leaq 0x783f(%rip), %rdi      # 0x237fa
callq 0x42a0
jmp 0x1bfc2
movl $0x1, %edi
callq 0x4400
jmp 0x1bffd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x1bff4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x46d8
callq 0x4580
jmp 0x1bffb
jmp 0x1c00f
leaq -0x28(%rbp), %rdi
callq 0x46d8
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0x46d8
movq -0x30(%rbp), %rdi
callq 0x4610
movq %rax, %rdi
callq 0x82c0
nopl (%rax)