// File: /workspace/github_cpp_makefile_star2_O3/craigbarstow[P]cmd-line-text-editor/text_editor.cc
// Function: copy_line(text_ed&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool copy_line (text_ed & T, string cl) { //Copy area between two given line numbers (inclusive) to after a third given line number if three numbers are given. If only two integers are given, move the line at the first position to after the position given by the second integer
  bool error_state=false;
  string aline,M_string,N_string,O_string;
  int i = 0,m=0,n=0,o=0,p=1,m_start, m_end, n_start, n_end, o_start, o_end, number, count=0;
  if (cl.find_first_not_of(" ",1)!=string::npos){ //section to isolate the first integer from the string entered into the command line
    m_start= cl.find_first_not_of(" ",1);
    m_end = cl.find_first_of(" ", m_start)-2;
    M_string=cl.substr(m_start,m_end);
    if (!(istringstream(M_string) >> m)) { //if the substring representing the first integer cannot be converted to an integer, toggle the error state to true
      error_state=true;
      m=1;
    } else {count++;} //increment count to show one integer is present
    if (cl.find_first_not_of(" ", m_end+2)!=string::npos){ //section to isolate the second integer from the string entered into the command line
      n_start = cl.find_first_not_of(" ", m_end+2);
      n_end = cl.find_first_of(" ",n_start);
      N_string=cl.substr(n_start,n_end);
      if (!(istringstream(N_string) >> n)){ //if the substring representing the second integer cannot be converted to an integer, toggle the error state to true
	error_state=true;
      } else {count++;} //increment count to show that two integers are present
      if (cl.find_first_not_of(" ", n_end+1)!=string::npos) { //section to isolate the third integer from the string entered into the command line
	  o_start = cl.find_first_not_of(" ", n_end+1);
	  o_end = cl.find_first_of("",o_start);
	  O_string=cl.substr(o_start,o_end);
	  if (istringstream(O_string) >> o){ //if substring can be converted to an integer, increment count to show a third integer is present
	    count++; 
	  } 
	}
    }
    //SECTION TO MAKE SURE INTEGERS MAKE SENSE
    if (m<1){ //if first integer is less than 1, toggle error state to true
      error_state=true;
    }
    if (n>T.get_last_line()) { //if second int is greater than document length, toggle error state
      error_state=true;
    }
    if (n<1) { //if second it is less than one, toggle error state to true
      error_state=true;
    }
    if (count==3) {
      if (n<m) { //if three integers are present and the first 
	error_state = true;
      }
      if (o<=0) { //if the third integer is less than three, toggle error state to true
	error_state = true;
      }
      if (o>T.get_last_line()) { //if third integer is greater than document length, reset it
	o=T.get_last_line();
      }
    }
    if (!error_state) { 
      if (count==3){ //if three integers are present, copy lines from the start position to the end position to after the given location
	T.copy_lines(m,n,o);
       }
      else if (count==2) { //if two integers are present, copy the line given by the first position to after the position denoted by the second integer
	T.copy_lines(m,m,n);
      }	
      return true; //return true if error state is false
    } else {
      return false; //return false if error state is true
    }
  }
  return false; //return false if nothing is found after the initial 'c' substring in the input string
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rsi, %r14
movq %rdi, -0x40(%rbp)
leaq -0xb0(%rbp), %r13
movq %r13, -0x10(%r13)
xorl %r15d, %r15d
movq %r15, -0x8(%r13)
movb %r15b, (%r13)
leaq -0x90(%rbp), %rax
movq %rax, -0x10(%rax)
movq %r15, -0x8(%rax)
movb %r15b, (%rax)
leaq -0x70(%rbp), %rax
movq %rax, -0x10(%rax)
movq %r15, -0x8(%rax)
movb %r15b, (%rax)
leaq -0x50(%rbp), %rax
movq %rax, -0x10(%rax)
movq %r15, -0x8(%rax)
movb %r15b, (%rax)
movl %r15d, -0x2c(%rbp)
movl %r15d, -0x34(%rbp)
movl %r15d, -0x30(%rbp)
leaq 0x38e6(%rip), %rsi      # 0x73ce
movl $0x1, %edx
movl $0x1, %ecx
movq %r14, %rdi
callq 0x2210
cmpq $-0x1, %rax
je 0x3ed0
leaq 0x38c3(%rip), %r15      # 0x73ce
movl $0x1, %edx
movl $0x1, %ecx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2210
movslq %eax, %r12
movl $0x1, %ecx
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x21e0
movq %rax, %r15
shlq $0x20, %r15
movabsq $-0x200000000, %rcx     # imm = 0xFFFFFFFE00000000
addq %r15, %rcx
sarq $0x20, %rcx
leaq -0x240(%rbp), %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x2160
leaq -0xa0(%rbp), %rdi
leaq -0x240(%rbp), %r12
movq %r12, %rsi
callq 0x2190
movq (%r12), %rdi
leaq -0x230(%rbp), %rax
cmpq %rax, %rdi
je 0x3b95
movq -0x230(%rbp), %rsi
incq %rsi
callq 0x2140
leaq -0x240(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
movl $0x8, %edx
callq 0x2200
leaq -0x240(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x20c0
leaq -0x240(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movb -0x220(%rbp,%rax), %bl
movq 0x63e7(%rip), %rsi      # 0x9fc0
callq 0x21c0
leaq -0x1c8(%rbp), %rdi
callq 0x2080
xorl %r12d, %r12d
testb $0x5, %bl
je 0x3bfd
movl $0x1, -0x2c(%rbp)
movb $0x1, %bl
jmp 0x3c05
movl $0x1, %r12d
xorl %ebx, %ebx
sarq $0x20, %r15
leaq 0x37be(%rip), %rsi      # 0x73ce
movl $0x1, %ecx
movq %r14, %rdi
movq %r15, %rdx
callq 0x2210
cmpq $-0x1, %rax
je 0x3e37
movl %r12d, -0x38(%rbp)
leaq 0x3799(%rip), %r12      # 0x73ce
movl $0x1, %ecx
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x2210
movslq %eax, %r13
movl $0x1, %ecx
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x21e0
movq %rax, %r15
movslq %r15d, %rcx
leaq -0x240(%rbp), %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x2160
leaq -0x80(%rbp), %rdi
leaq -0x240(%rbp), %r12
movq %r12, %rsi
callq 0x2190
movq (%r12), %rdi
leaq -0x230(%rbp), %rax
cmpq %rax, %rdi
je 0x3ca8
movq -0x230(%rbp), %rsi
incq %rsi
callq 0x2140
leaq -0x240(%rbp), %rdi
leaq -0x80(%rbp), %rsi
movl $0x8, %edx
callq 0x2200
leaq -0x240(%rbp), %rdi
leaq -0x34(%rbp), %rsi
callq 0x20c0
shlq $0x20, %r15
leaq -0x1c8(%rbp), %r12
movq -0x78(%r12), %rax
movq -0x18(%rax), %rax
xorl %r13d, %r13d
testb $0x5, -0x220(%rbp,%rax)
sete %r13b
movq 0x62c9(%rip), %rsi      # 0x9fc0
movzbl %bl, %eax
movl $0x1, %ebx
cmovel %eax, %ebx
leaq -0x240(%rbp), %rdi
callq 0x21c0
movq %r12, %rdi
callq 0x2080
addl %r13d, -0x38(%rbp)
movabsq $0x100000000, %r12      # imm = 0x100000000
addq %r15, %r12
sarq $0x20, %r12
leaq 0x369c(%rip), %rsi      # 0x73ce
movl $0x1, %ecx
movq %r14, %rdi
movq %r12, %rdx
callq 0x2210
cmpq $-0x1, %rax
je 0x3e2c
leaq 0x367b(%rip), %rsi      # 0x73ce
movl $0x1, %ecx
movq %r14, %rdi
movq %r12, %rdx
callq 0x2210
movslq %eax, %r15
leaq 0x3662(%rip), %rsi      # 0x73cf
movq %r14, %rdi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x21e0
movslq %eax, %rcx
leaq -0x240(%rbp), %rdi
movq %r14, %rsi
movq %r15, %rdx
leaq -0xb0(%rbp), %r13
callq 0x2160
leaq -0x60(%rbp), %rdi
leaq -0x240(%rbp), %r14
movq %r14, %rsi
callq 0x2190
movq (%r14), %rdi
leaq -0x230(%rbp), %rax
cmpq %rax, %rdi
movl -0x38(%rbp), %r12d
je 0x3dcb
movq -0x230(%rbp), %rsi
incq %rsi
callq 0x2140
leaq -0x240(%rbp), %rdi
leaq -0x60(%rbp), %rsi
movl $0x8, %edx
callq 0x2200
leaq -0x240(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x20c0
leaq -0x240(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movl -0x220(%rbp,%rax), %r14d
andl $0x5, %r14d
movq 0x61af(%rip), %rsi      # 0x9fc0
callq 0x21c0
leaq -0x1c8(%rbp), %rdi
callq 0x2080
cmpl $0x1, %r14d
adcl $0x0, %r12d
jmp 0x3e37
leaq -0xb0(%rbp), %r13
movl -0x38(%rbp), %r12d
movl -0x2c(%rbp), %r15d
movl -0x34(%rbp), %r14d
movq -0x40(%rbp), %rdi
callq 0x66a4
testl %r15d, %r15d
movzbl %bl, %ebx
movl $0x1, %edx
cmovlel %edx, %ebx
cmpl %eax, %r14d
movl -0x34(%rbp), %ecx
cmovgl %edx, %ebx
testl %ecx, %ecx
cmovlel %edx, %ebx
cmpl $0x3, %r12d
jne 0x3ead
cmpl -0x2c(%rbp), %ecx
setl %r14b
movl -0x30(%rbp), %r12d
testl %r12d, %r12d
setle %r15b
movq -0x40(%rbp), %rdi
callq 0x66a4
cmpl %eax, %r12d
jle 0x3e96
movq -0x40(%rbp), %rdi
callq 0x66a4
movl %eax, -0x30(%rbp)
orb %r14b, %r15b
orb %bl, %r15b
testb $0x1, %r15b
jne 0x3eb1
movl -0x2c(%rbp), %esi
movl -0x34(%rbp), %edx
movl -0x30(%rbp), %ecx
jmp 0x3ec4
testb %bl, %bl
je 0x3eb6
xorl %r15d, %r15d
jmp 0x3ed0
movb $0x1, %r15b
cmpl $0x2, %r12d
jne 0x3ed0
movl -0x2c(%rbp), %esi
movl %esi, %edx
movb $0x1, %r15b
movq -0x40(%rbp), %rdi
callq 0x6aa6
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x3ee9
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x3f02
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x3f24
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0xc0(%rbp), %rdi
cmpq %r13, %rdi
je 0x3f3f
movq -0xb0(%rbp), %rsi
incq %rsi
callq 0x2140
movl %r15d, %eax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3f60
jmp 0x3f88
jmp 0x3f88
jmp 0x3f60
jmp 0x3f88
jmp 0x3f88
movq %rax, %rbx
movq 0x6056(%rip), %rsi      # 0x9fc0
leaq -0x240(%rbp), %rdi
callq 0x21c0
leaq -0x1c8(%rbp), %rdi
callq 0x2080
jmp 0x3f8b
jmp 0x3f88
jmp 0x3f88
movq %rax, %rbx
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x3fa4
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x3fbd
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x3fdf
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0xc0(%rbp), %rdi
leaq -0xb0(%rbp), %rax
cmpq %rax, %rdi
je 0x4001
movq -0xb0(%rbp), %rsi
incq %rsi
callq 0x2140
movq %rbx, %rdi
callq 0x2260