// File: chrissimpkins[P]octopus/src/io.cpp
// Function: IO::read_file[abi:cxx11]()
string& IO::read_file(){
	//if the path variable is assigned in constructor
	if (!path.empty()){
		try{
			ifstream infile(path);
			if (infile.good()){
				// define the input string from the calling function with the reference that was passed in
				ifstream& inr = infile;
				get_string(inr);
				string& isr = inputstring;
				infile.close();
				return isr;
			}
			else{
				throw runtime_error("Unable to open the input file " + path);
			}
		}
		catch(...){
			print_error("Unable to open the input file " + path);
		}
	}
	//otherwise use the ipath from constructor
	else if (!ipath.empty()) {
		try{
			ifstream infile(ipath);
			if (infile.good()){
				// define the input string from the calling function with the reference that was passed in
				ifstream& inr = infile;
				get_string(inr);
				string& isr = inputstring;
				infile.close();
				return isr;
			}
			else{
				throw runtime_error("Unable to open the input file " + path);
			}
		}
		catch (...){
			print_error("Unable to open the input file " + path);
		}
	}
	else{
		throw runtime_error("Missing a file path for the input file.");
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x510, %rsp            # imm = 0x510
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x4e8(%rbp)
callq 0x34c0
testb $0x1, %al
jne 0x1086d
movq -0x4e8(%rbp), %rsi
leaq -0x218(%rbp), %rdi
movl $0x8, %edx
callq 0x3490
jmp 0x10661
movq -0x218(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x218(%rbp,%rax), %rdi
callq 0x34d0
movb %al, -0x4e9(%rbp)
jmp 0x10681
movb -0x4e9(%rbp), %al
testb $0x1, %al
jne 0x10690
jmp 0x1071d
movq -0x4e8(%rbp), %rdi
leaq -0x218(%rbp), %rax
movq %rax, -0x230(%rbp)
movq -0x230(%rbp), %rsi
callq 0x10b30
jmp 0x106b3
movq -0x4e8(%rbp), %rax
addq $0x60, %rax
movq %rax, -0x238(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x3070
jmp 0x106d3
movq -0x238(%rbp), %rax
movq %rax, -0x8(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x3090
jmp 0x10b0f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x107e3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x107d7
movb $0x1, -0x259(%rbp)
movl $0x10, %edi
callq 0x3160
movq -0x4e8(%rbp), %rdx
movq %rax, -0x4f8(%rbp)
leaq 0x303f(%rip), %rsi      # 0x13782
leaq -0x258(%rbp), %rdi
callq 0xca10
jmp 0x10751
movq -0x4f8(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x34a0
jmp 0x10766
movq -0x4f8(%rbp), %rdi
movb $0x0, -0x259(%rbp)
movq 0x7875(%rip), %rsi      # 0x17ff0
movq 0x782e(%rip), %rdx      # 0x17fb0
callq 0x34e0
jmp 0x10b30
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x107be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x258(%rbp), %rdi
callq 0x31b0
testb $0x1, -0x259(%rbp)
jne 0x107c9
jmp 0x107d5
movq -0x4f8(%rbp), %rdi
callq 0x3200
jmp 0x107d7
leaq -0x218(%rbp), %rdi
callq 0x3090
movq -0x220(%rbp), %rdi
callq 0x3100
movq -0x4e8(%rbp), %rdx
leaq 0x2f85(%rip), %rsi      # 0x13782
leaq -0x280(%rbp), %rdi
callq 0xca10
jmp 0x1080b
leaq -0x280(%rbp), %rdi
callq 0xc960
jmp 0x10819
leaq -0x280(%rbp), %rdi
callq 0x31b0
callq 0x34b0
jmp 0x10b0d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x10861
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x280(%rbp), %rdi
callq 0x31b0
callq 0x34b0
jmp 0x10868
jmp 0x10b1c
movq -0x4e8(%rbp), %rdi
addq $0x20, %rdi
callq 0x34c0
testb $0x1, %al
jne 0x10aac
movq -0x4e8(%rbp), %rsi
addq $0x20, %rsi
leaq -0x488(%rbp), %rdi
movl $0x8, %edx
callq 0x3490
jmp 0x108a3
movq -0x488(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x488(%rbp,%rax), %rdi
callq 0x34d0
movb %al, -0x4f9(%rbp)
jmp 0x108c3
movb -0x4f9(%rbp), %al
testb $0x1, %al
jne 0x108d2
jmp 0x1095f
movq -0x4e8(%rbp), %rdi
leaq -0x488(%rbp), %rax
movq %rax, -0x490(%rbp)
movq -0x490(%rbp), %rsi
callq 0x10b30
jmp 0x108f5
movq -0x4e8(%rbp), %rax
addq $0x60, %rax
movq %rax, -0x498(%rbp)
leaq -0x488(%rbp), %rdi
callq 0x3070
jmp 0x10915
movq -0x498(%rbp), %rax
movq %rax, -0x8(%rbp)
leaq -0x488(%rbp), %rdi
callq 0x3090
jmp 0x10b0f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x10a25
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x10a19
movb $0x1, -0x4b9(%rbp)
movl $0x10, %edi
callq 0x3160
movq -0x4e8(%rbp), %rdx
movq %rax, -0x508(%rbp)
leaq 0x2dfd(%rip), %rsi      # 0x13782
leaq -0x4b8(%rbp), %rdi
callq 0xca10
jmp 0x10993
movq -0x508(%rbp), %rdi
leaq -0x4b8(%rbp), %rsi
callq 0x34a0
jmp 0x109a8
movq -0x508(%rbp), %rdi
movb $0x0, -0x4b9(%rbp)
movq 0x7633(%rip), %rsi      # 0x17ff0
movq 0x75ec(%rip), %rdx      # 0x17fb0
callq 0x34e0
jmp 0x10b30
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x10a00
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 0x10a0b
jmp 0x10a17
movq -0x508(%rbp), %rdi
callq 0x3200
jmp 0x10a19
leaq -0x488(%rbp), %rdi
callq 0x3090
movq -0x220(%rbp), %rdi
callq 0x3100
movq -0x4e8(%rbp), %rdx
leaq 0x2d43(%rip), %rsi      # 0x13782
leaq -0x4e0(%rbp), %rdi
callq 0xca10
jmp 0x10a4d
leaq -0x4e0(%rbp), %rdi
callq 0xc960
jmp 0x10a5b
leaq -0x4e0(%rbp), %rdi
callq 0x31b0
callq 0x34b0
jmp 0x10b0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x10aa3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x4e0(%rbp), %rdi
callq 0x31b0
callq 0x34b0
jmp 0x10aaa
jmp 0x10b1c
movl $0x10, %edi
callq 0x3160
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x510(%rbp)
leaq 0x2cd7(%rip), %rsi      # 0x137a1
callq 0x30f0
jmp 0x10ad1
movq -0x510(%rbp), %rdi
movq 0x7511(%rip), %rsi      # 0x17ff0
movq 0x74ca(%rip), %rdx      # 0x17fb0
callq 0x34e0
movq -0x510(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
callq 0x3200
jmp 0x10b1c
jmp 0x10b0d
ud2
movq -0x8(%rbp), %rax
addq $0x510, %rsp            # imm = 0x510
popq %rbp
retq
movq -0x220(%rbp), %rdi
callq 0x3500
movq %rax, %rdi
callq 0xe750