// File: chrissimpkins[P]octopus/src/io.cpp
// Function: IO::is_file_good()
bool IO::is_file_good() {
	//if the path variable is assigned in constructor
	if (!path.empty()){
		try{
			ifstream infile(path);
			if (infile.good()){
				infile.close();
				return true;
			}
			else{
				throw runtime_error("Unable to open the file " + path);
			}
		}
		catch(...){
			print_error("Unable to open the file '" + path + "'. Please confirm that it exists.");
			exit(EXIT_FAILURE);
		}
	}
	//otherwise use the ipath from constructor
	else if (!ipath.empty()) {
		try{
			ifstream infile(ipath);
			if (infile.good()){
				infile.close();
				return true;
			}
			else{
				throw runtime_error("Unable to open the file " + path);
			}
		}
		catch (...){
			print_error("Unable to open the file '" + ipath + "'. Please confirm that it exists.");
			exit(EXIT_FAILURE);
		}
	}
	else{
		throw runtime_error("Missing a file path for the file.");
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x530, %rsp            # imm = 0x530
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x508(%rbp)
callq 0x34c0
testb $0x1, %al
jne 0x10346
movq -0x508(%rbp), %rsi
leaq -0x218(%rbp), %rdi
movl $0x8, %edx
callq 0x3490
jmp 0x10131
movq -0x218(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x218(%rbp,%rax), %rdi
callq 0x34d0
movb %al, -0x509(%rbp)
jmp 0x10151
movb -0x509(%rbp), %al
testb $0x1, %al
jne 0x1015d
jmp 0x101ae
leaq -0x218(%rbp), %rdi
callq 0x3070
jmp 0x1016b
movb $0x1, -0x1(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x3090
jmp 0x105f1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x10274
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x10268
movb $0x1, -0x249(%rbp)
movl $0x10, %edi
callq 0x3160
movq -0x508(%rbp), %rdx
movq %rax, -0x518(%rbp)
leaq 0x3537(%rip), %rsi      # 0x1370b
leaq -0x248(%rbp), %rdi
callq 0xca10
jmp 0x101e2
movq -0x518(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x34a0
jmp 0x101f7
movq -0x518(%rbp), %rdi
movb $0x0, -0x249(%rbp)
movq 0x7de4(%rip), %rsi      # 0x17ff0
movq 0x7d9d(%rip), %rdx      # 0x17fb0
callq 0x34e0
jmp 0x10613
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x1024f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x31b0
testb $0x1, -0x249(%rbp)
jne 0x1025a
jmp 0x10266
movq -0x518(%rbp), %rdi
callq 0x3200
jmp 0x10268
leaq -0x218(%rbp), %rdi
callq 0x3090
movq -0x220(%rbp), %rdi
callq 0x3100
movq -0x508(%rbp), %rdx
leaq 0x3496(%rip), %rsi      # 0x13724
leaq -0x290(%rbp), %rdi
callq 0xca10
jmp 0x1029c
leaq 0x349b(%rip), %rdx      # 0x1373e
leaq -0x270(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0xc9c0
jmp 0x102b8
leaq -0x270(%rbp), %rdi
callq 0xc960
jmp 0x102c6
leaq -0x270(%rbp), %rdi
callq 0x31b0
leaq -0x290(%rbp), %rdi
callq 0x31b0
movl $0x1, %edi
callq 0x33b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x1033a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x1032e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x270(%rbp), %rdi
callq 0x31b0
leaq -0x290(%rbp), %rdi
callq 0x31b0
callq 0x34b0
jmp 0x10341
jmp 0x105ff
movq -0x508(%rbp), %rdi
addq $0x20, %rdi
callq 0x34c0
testb $0x1, %al
jne 0x10592
movq -0x508(%rbp), %rsi
addq $0x20, %rsi
leaq -0x498(%rbp), %rdi
movl $0x8, %edx
callq 0x3490
jmp 0x1037c
movq -0x498(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x498(%rbp,%rax), %rdi
callq 0x34d0
movb %al, -0x519(%rbp)
jmp 0x1039c
movb -0x519(%rbp), %al
testb $0x1, %al
jne 0x103a8
jmp 0x103f9
leaq -0x498(%rbp), %rdi
callq 0x3070
jmp 0x103b6
movb $0x1, -0x1(%rbp)
leaq -0x498(%rbp), %rdi
callq 0x3090
jmp 0x105f1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x104bf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x104b3
movb $0x1, -0x4b9(%rbp)
movl $0x10, %edi
callq 0x3160
movq -0x508(%rbp), %rdx
movq %rax, -0x528(%rbp)
leaq 0x32ec(%rip), %rsi      # 0x1370b
leaq -0x4b8(%rbp), %rdi
callq 0xca10
jmp 0x1042d
movq -0x528(%rbp), %rdi
leaq -0x4b8(%rbp), %rsi
callq 0x34a0
jmp 0x10442
movq -0x528(%rbp), %rdi
movb $0x0, -0x4b9(%rbp)
movq 0x7b99(%rip), %rsi      # 0x17ff0
movq 0x7b52(%rip), %rdx      # 0x17fb0
callq 0x34e0
jmp 0x10613
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x1049a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x4b8(%rbp), %rdi
callq 0x31b0
testb $0x1, -0x4b9(%rbp)
jne 0x104a5
jmp 0x104b1
movq -0x528(%rbp), %rdi
callq 0x3200
jmp 0x104b3
leaq -0x498(%rbp), %rdi
callq 0x3090
movq -0x220(%rbp), %rdi
callq 0x3100
movq -0x508(%rbp), %rdx
addq $0x20, %rdx
leaq 0x3247(%rip), %rsi      # 0x13724
leaq -0x500(%rbp), %rdi
callq 0xca10
jmp 0x104eb
leaq 0x324c(%rip), %rdx      # 0x1373e
leaq -0x4e0(%rbp), %rdi
leaq -0x500(%rbp), %rsi
callq 0xc9c0
jmp 0x10507
leaq -0x4e0(%rbp), %rdi
callq 0xc960
jmp 0x10515
leaq -0x4e0(%rbp), %rdi
callq 0x31b0
leaq -0x500(%rbp), %rdi
callq 0x31b0
movl $0x1, %edi
callq 0x33b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x10589
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x1057d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x4e0(%rbp), %rdi
callq 0x31b0
leaq -0x500(%rbp), %rdi
callq 0x31b0
callq 0x34b0
jmp 0x10590
jmp 0x105ff
movl $0x10, %edi
callq 0x3160
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x530(%rbp)
leaq 0x31b0(%rip), %rsi      # 0x13760
callq 0x30f0
jmp 0x105b7
movq -0x530(%rbp), %rdi
movq 0x7a2b(%rip), %rsi      # 0x17ff0
movq 0x79e4(%rip), %rdx      # 0x17fb0
callq 0x34e0
movq -0x530(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
callq 0x3200
jmp 0x105ff
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x530, %rsp            # imm = 0x530
popq %rbp
retq
movq -0x220(%rbp), %rdi
callq 0x3500
movq %rax, %rdi
callq 0xe750
nopw %cs:(%rax,%rax)