// File: chrissimpkins[P]octopus/src/io.cpp
// Function: IO::get_lines[abi:cxx11](int, int, std::basic_ifstream<char, std::char_traits<char>>&)
string& IO::get_lines(int startposition, int number_of_lines, ifstream& infile){
	if (startposition == THE_BEGINNING) {
		if (number_of_lines == 1){
			//return a single line from the file
			try{
				// if first line requested, get it and define inputstring class string with the line of text
				std::getline(infile, inputstring);
			}
			catch (...){
				print("Unable to read the first line from the input file");
				exit(EXIT_FAILURE);
			}
		}
		else {
			// return n requested lines from the file
			int linenumber = 0;
			//confirm that there are at least as many lines as the user requested
			while(! infile.eof()) {
				std::getline(infile, tempstring);
				++linenumber;
				inputstring += tempstring + "\n";
				if (linenumber == number_of_lines){
					string& isr = inputstring;
					return isr;
				}
			}
			//if did not return with above code, there were not as many lines in the file as the user requested
			//so return the entire file string
			inputstring = tempstring;
			string& isr = inputstring;
			return isr;
		}
	}
	else if (startposition == THE_END) {

	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x90(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x11122
cmpl $0x1, -0x18(%rbp)
jne 0x11025
movq -0x90(%rbp), %rsi
movq -0x20(%rbp), %rdi
addq $0x60, %rsi
callq 0x3060
jmp 0x10f7e
jmp 0x11020
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movq -0x28(%rbp), %rdi
callq 0x3100
leaq -0x51(%rbp), %rdi
movq %rdi, -0x98(%rbp)
callq 0x3510
movq -0x98(%rbp), %rdx
leaq 0x2813(%rip), %rsi      # 0x137c9
leaq -0x50(%rbp), %rdi
callq 0xb580
jmp 0x10fc1
leaq -0x50(%rbp), %rdi
callq 0xb550
jmp 0x10fcc
leaq -0x50(%rbp), %rdi
callq 0x31b0
leaq -0x51(%rbp), %rdi
callq 0x3350
movl $0x1, %edi
callq 0x33b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x1100b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x31b0
leaq -0x51(%rbp), %rdi
callq 0x3350
callq 0x34b0
jmp 0x1101b
jmp 0x1113b
jmp 0x11120
movl $0x0, -0x58(%rbp)
movq -0x20(%rbp), %rdi
movq (%rdi), %rax
addq -0x18(%rax), %rdi
callq 0x3530
xorb $-0x1, %al
testb $0x1, %al
jne 0x11047
jmp 0x110e7
movq -0x90(%rbp), %rsi
movq -0x20(%rbp), %rdi
subq $-0x80, %rsi
movq %rsi, -0xa8(%rbp)
callq 0x3060
movq -0xa8(%rbp), %rsi
movl -0x58(%rbp), %eax
incl %eax
movl %eax, -0x58(%rbp)
leaq 0x1dfe(%rip), %rdx      # 0x12e76
leaq -0x78(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
callq 0xce10
movq -0x90(%rbp), %rdi
movq -0xa0(%rbp), %rsi
addq $0x60, %rdi
callq 0x33e0
jmp 0x110a1
leaq -0x78(%rbp), %rdi
callq 0x31b0
movl -0x58(%rbp), %eax
cmpl -0x18(%rbp), %eax
jne 0x110e2
movq -0x90(%rbp), %rax
addq $0x60, %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1112e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x31b0
jmp 0x1113b
jmp 0x1102c
movq -0x90(%rbp), %rdi
movq %rdi, %rsi
addq $0x80, %rsi
addq $0x60, %rdi
callq 0x3030
movq -0x90(%rbp), %rax
addq $0x60, %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1112e
jmp 0x1112c
cmpl $0x1, -0x14(%rbp)
jne 0x1112a
jmp 0x1112a
jmp 0x1112c
ud2
movq -0x8(%rbp), %rax
addq $0xb0, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x3500
movq %rax, %rdi
callq 0xe750
nopl (%rax)