// File: chrissimpkins[P]octopus/src/io.cpp
// Function: IO::get_output_stream(std::basic_ofstream<char, std::char_traits<char>>&)
ofstream& IO::get_output_stream(ofstream& outfilestream){
	if (!path.empty()){
		try{
			outfilestream.open(path);
			if (outfilestream.good()) {
				ofstream& outr = outfilestream;
				return outr;
			}
			else{
				throw runtime_error("File Write Error");
			}
		}
		catch (...) {
			print("Unable to write to the output file " + path);
			exit(EXIT_FAILURE);
		}
	}
	else if (!opath.empty()){
		try{
			outfilestream.open(opath);
			if (outfilestream.good()) {
				ofstream& outr = outfilestream;
				return outr;
			}
			else{
				throw runtime_error("File Write Error");
			}
		}
		catch (...) {
			print("Unable to write to the output file " + opath);
			exit(EXIT_FAILURE);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x80(%rbp)
callq 0x34c0
testb $0x1, %al
jne 0x1177e
movq -0x80(%rbp), %rsi
movq -0x18(%rbp), %rdi
movl $0x10, %edx
callq 0x3150
jmp 0x1166c
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x34d0
movb %al, -0x81(%rbp)
jmp 0x11687
movb -0x81(%rbp), %al
testb $0x1, %al
jne 0x11693
jmp 0x116b6
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x118c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x11712
movl $0x10, %edi
callq 0x3160
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x90(%rbp)
leaq 0x2180(%rip), %rsi      # 0x13854
callq 0x30f0
jmp 0x116db
movq -0x90(%rbp), %rdi
movq 0x6907(%rip), %rsi      # 0x17ff0
movq 0x68c0(%rip), %rdx      # 0x17fb0
callq 0x34e0
jmp 0x118e0
movq -0x90(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
callq 0x3200
movq -0x20(%rbp), %rdi
callq 0x3100
movq -0x80(%rbp), %rdx
leaq 0x213f(%rip), %rsi      # 0x13865
leaq -0x50(%rbp), %rdi
callq 0xca10
jmp 0x11731
leaq -0x50(%rbp), %rdi
callq 0xb550
jmp 0x1173c
leaq -0x50(%rbp), %rdi
callq 0x31b0
movl $0x1, %edi
callq 0x33b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x11772
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x31b0
callq 0x34b0
jmp 0x11779
jmp 0x118cf
movq -0x80(%rbp), %rdi
addq $0x40, %rdi
callq 0x34c0
testb $0x1, %al
jne 0x118be
movq -0x80(%rbp), %rsi
movq -0x18(%rbp), %rdi
addq $0x40, %rsi
movl $0x10, %edx
callq 0x3150
jmp 0x117ab
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x34d0
movb %al, -0x91(%rbp)
jmp 0x117c6
movb -0x91(%rbp), %al
testb $0x1, %al
jne 0x117d2
jmp 0x117f5
movq -0x18(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x118c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x11851
movl $0x10, %edi
callq 0x3160
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xa0(%rbp)
leaq 0x2041(%rip), %rsi      # 0x13854
callq 0x30f0
jmp 0x1181a
movq -0xa0(%rbp), %rdi
movq 0x67c8(%rip), %rsi      # 0x17ff0
movq 0x6781(%rip), %rdx      # 0x17fb0
callq 0x34e0
jmp 0x118e0
movq -0xa0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
callq 0x3200
movq -0x20(%rbp), %rdi
callq 0x3100
movq -0x80(%rbp), %rdx
addq $0x40, %rdx
leaq 0x1ffc(%rip), %rsi      # 0x13865
leaq -0x78(%rbp), %rdi
callq 0xca10
jmp 0x11874
leaq -0x78(%rbp), %rdi
callq 0xb550
jmp 0x1187f
leaq -0x78(%rbp), %rdi
callq 0x31b0
movl $0x1, %edi
callq 0x33b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x118b5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x31b0
callq 0x34b0
jmp 0x118bc
jmp 0x118cf
jmp 0x118c0
ud2
movq -0x8(%rbp), %rax
addq $0xa0, %rsp
popq %rbp
retq
movq -0x20(%rbp), %rdi
callq 0x3500
movq %rax, %rdi
callq 0xe750