// File: /workspace/github_cpp_makefile_star2_O3/craigbarstow[P]cmd-line-text-editor/text_editor.cc
// Function: move_line(text_ed&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool move_line (text_ed & T, string cl) {
  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 substring representing the first integer from the given string
    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 substring cant be converted to an integer, toggle error state to true
      error_state=true;
    } else {count++;} //if it can, increment count to show first integer is present
    if (cl.find_first_not_of(" ", m_end+2)!=string::npos){ //section to isolate the substring representing the second integer from the given string
      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 substring cant be converted to an integer, toggle error state to true
	error_state=true;
      } else {count++;} //if it can be, increment count to show second integer is present
      if (cl.find_first_not_of(" ", n_end+1)!=string::npos) { //section to isolate the substring representing the third integer from the given string
	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 third integer is present
	  count++;
	} 
      }
    }
    //SECTION TO MAKE SURE THE INTEGERS MAKE SENSE
    if (m<=0){ //if first integer is less than 1, toggle error state to true
      error_state=true;
    }
    if (count<=2){
      if (n>T.get_last_line()) { //if second int is greater than document length, reset it
	n=T.get_last_line();
      }
      if (n<=0) { //if second it is less than zero, 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 || o>T.get_last_line()) { //if the third integer is less than three, toggle error state to true
	error_state = true;
      }
    }
    if (!error_state) {
      if (count==3){ //if three integers are present, move the lines from the first to the second integer to after the position given by the third integer
	T.move_lines(m,n,o);
       } else if (count==2) { //if two integers are present, move the first line to after the position given by the second
	T.move_lines(m,m,n); //n+1
      }	else if (count==1) {
	return false;  //return false if only one integer is found
      }
      return true; //if error state is false, return true
    }
  }
  return false; //if error state is true or the first integer isnt found, return false
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rsi, %r14
movq %rdi, -0x48(%rbp)
leaq -0xb8(%rbp), %rax
movq %rax, -0x10(%rax)
xorl %r15d, %r15d
movq %r15, -0x8(%rax)
movb %r15b, (%rax)
leaq -0x98(%rbp), %rax
movq %rax, -0x10(%rax)
movq %r15, -0x8(%rax)
movb %r15b, (%rax)
leaq -0x78(%rbp), %rax
movq %rax, -0x10(%rax)
movq %r15, -0x8(%rax)
movb %r15b, (%rax)
leaq -0x58(%rbp), %rax
movq %rax, -0x10(%rax)
movq %r15, -0x8(%rax)
movb %r15b, (%rax)
movl %r15d, -0x38(%rbp)
movl %r15d, -0x2c(%rbp)
movl %r15d, -0x3c(%rbp)
leaq 0x3352(%rip), %rsi      # 0x73ce
movl $0x1, %edx
movl $0x1, %ecx
movq %r14, %rdi
callq 0x2210
cmpq $-0x1, %rax
je 0x4485
leaq 0x332f(%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 -0x248(%rbp), %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x2160
leaq -0xa8(%rbp), %rdi
leaq -0x248(%rbp), %r12
movq %r12, %rsi
callq 0x2190
movq (%r12), %rdi
leaq -0x238(%rbp), %rax
cmpq %rax, %rdi
je 0x4129
movq -0x238(%rbp), %rsi
incq %rsi
callq 0x2140
leaq -0x248(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
movl $0x8, %edx
callq 0x2200
leaq -0x248(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x20c0
leaq -0x248(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movl -0x228(%rbp,%rax), %eax
xorl %ebx, %ebx
xorl %r12d, %r12d
movl %eax, -0x40(%rbp)
testb $0x5, %al
setne %r13b
sete %r12b
movq 0x5e41(%rip), %rsi      # 0x9fc0
callq 0x21c0
leaq -0x1d0(%rbp), %rdi
callq 0x2080
sarq $0x20, %r15
leaq 0x3233(%rip), %rsi      # 0x73ce
movl $0x1, %ecx
movq %r14, %rdi
movq %r15, %rdx
callq 0x2210
cmpq $-0x1, %rax
je 0x43c7
movl %r13d, -0x34(%rbp)
movl %r12d, -0x30(%rbp)
leaq 0x320a(%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 -0x248(%rbp), %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x2160
leaq -0x88(%rbp), %rdi
leaq -0x248(%rbp), %r12
movq %r12, %rsi
callq 0x2190
movq (%r12), %rdi
leaq -0x238(%rbp), %rax
cmpq %rax, %rdi
je 0x423a
movq -0x238(%rbp), %rsi
incq %rsi
callq 0x2140
leaq -0x248(%rbp), %rdi
leaq -0x88(%rbp), %rsi
movl $0x8, %edx
callq 0x2200
leaq -0x248(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x20c0
shlq $0x20, %r15
movl -0x40(%rbp), %r12d
andl $0x5, %r12d
leaq -0x248(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movl -0x228(%rbp,%rax), %r13d
movq 0x5d35(%rip), %rsi      # 0x9fc0
callq 0x21c0
leaq -0x1d0(%rbp), %rdi
callq 0x2080
xorl %eax, %eax
cmpl $0x1, %r12d
adcl $0x1, %eax
testb $0x5, %r13b
movl -0x34(%rbp), %ecx
movb %cl, %bl
movl $0x1, %ecx
cmovel %ebx, %ecx
movl %ecx, -0x34(%rbp)
movl -0x30(%rbp), %ecx
cmovel %eax, %ecx
movl %ecx, -0x30(%rbp)
movabsq $0x100000000, %r12      # imm = 0x100000000
addq %r15, %r12
sarq $0x20, %r12
leaq 0x30f4(%rip), %rsi      # 0x73ce
movl $0x1, %ecx
movq %r14, %rdi
movq %r12, %rdx
callq 0x2210
cmpq $-0x1, %rax
je 0x43bf
leaq 0x30d3(%rip), %rsi      # 0x73ce
movl $0x1, %ecx
movq %r14, %rdi
movq %r12, %rdx
callq 0x2210
movslq %eax, %r15
leaq 0x30ba(%rip), %rsi      # 0x73cf
movq %r14, %rdi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x21e0
movslq %eax, %rcx
leaq -0x248(%rbp), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2160
leaq -0x68(%rbp), %rdi
leaq -0x248(%rbp), %r14
movq %r14, %rsi
callq 0x2190
movq (%r14), %rdi
leaq -0x238(%rbp), %rax
cmpq %rax, %rdi
je 0x4368
movq -0x238(%rbp), %rsi
incq %rsi
callq 0x2140
leaq -0x248(%rbp), %rdi
leaq -0x68(%rbp), %rsi
movl $0x8, %edx
callq 0x2200
leaq -0x248(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
callq 0x20c0
leaq -0x248(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movb -0x228(%rbp,%rax), %bl
movq 0x5c17(%rip), %rsi      # 0x9fc0
callq 0x21c0
leaq -0x1d0(%rbp), %rdi
callq 0x2080
testb $0x5, %bl
je 0x442a
movl -0x30(%rbp), %r12d
movl -0x34(%rbp), %r13d
cmpl $0x0, -0x38(%rbp)
movzbl %r13b, %eax
movl $0x1, %ebx
cmovgl %eax, %ebx
movl -0x2c(%rbp), %r14d
movq -0x48(%rbp), %rdi
callq 0x66a4
cmpl %eax, %r14d
jle 0x43f7
movq -0x48(%rbp), %rdi
callq 0x66a4
movl %eax, -0x2c(%rbp)
jmp 0x43fa
movl -0x2c(%rbp), %eax
xorl %r15d, %r15d
testl %eax, %eax
jle 0x4485
testb %bl, %bl
jne 0x4485
cmpl $0x1, %r12d
je 0x4482
cmpl $0x2, %r12d
jne 0x4425
movl -0x38(%rbp), %esi
movl %esi, %edx
movq -0x48(%rbp), %rdi
movl %eax, %ecx
callq 0x6afc
movb $0x1, %r15b
jmp 0x4485
orl -0x40(%rbp), %r13d
movl -0x38(%rbp), %r14d
testl %r14d, %r14d
movzbl -0x34(%rbp), %eax
movl $0x1, %ebx
cmovgl %eax, %ebx
testb $0x5, %r13b
je 0x4450
movl -0x30(%rbp), %r12d
incl %r12d
jmp 0x43d7
movl -0x3c(%rbp), %r12d
testl %r12d, %r12d
jle 0x4482
movl -0x2c(%rbp), %r13d
movq -0x48(%rbp), %rdi
callq 0x66a4
xorl %r15d, %r15d
cmpl %eax, %r12d
jg 0x4485
cmpl %r14d, %r13d
jl 0x4485
testb %bl, %bl
jne 0x4485
movl -0x38(%rbp), %esi
movl -0x2c(%rbp), %edx
movl -0x3c(%rbp), %eax
jmp 0x441a
xorl %r15d, %r15d
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x449e
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x44ba
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x44dc
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x44fe
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x2140
movl %r15d, %eax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x451f
jmp 0x4547
jmp 0x4547
jmp 0x451f
jmp 0x4547
jmp 0x4547
movq %rax, %r14
movq 0x5a97(%rip), %rsi      # 0x9fc0
leaq -0x248(%rbp), %rdi
callq 0x21c0
leaq -0x1d0(%rbp), %rdi
callq 0x2080
jmp 0x454a
jmp 0x4547
jmp 0x4547
movq %rax, %r14
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x4563
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x457f
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x45a1
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x45c3
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x2140
movq %r14, %rdi
callq 0x2260