// File: /workspace/github_cpp_makefile_star2_O1/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), %r13
movq %r13, -0x10(%r13)
xorl %r15d, %r15d
movq %r15, -0x8(%r13)
movb %r15b, (%r13)
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, -0x30(%rbp)
movl %r15d, -0x2c(%rbp)
movl %r15d, -0x38(%rbp)
leaq 0x32d0(%rip), %rsi      # 0x73ce
movl $0x1, %edx
movl $0x1, %ecx
movq %r14, %rdi
callq 0x2210
cmpq $-0x1, %rax
je 0x4511
leaq 0x32ad(%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 0x41ab
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 -0x30(%rbp), %rsi
callq 0x20c0
leaq -0x248(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movl -0x228(%rbp,%rax), %ebx
xorl %r12d, %r12d
testb $0x5, %bl
setne %al
movl %eax, -0x3c(%rbp)
sete %r12b
movq 0x5dc1(%rip), %rsi      # 0x9fc0
callq 0x21c0
leaq -0x1d0(%rbp), %rdi
callq 0x2080
sarq $0x20, %r15
leaq 0x31b3(%rip), %rsi      # 0x73ce
movl $0x1, %ecx
movq %r14, %rdi
movq %r15, %rdx
callq 0x2210
cmpq $-0x1, %rax
je 0x4454
movl %r12d, -0x34(%rbp)
leaq 0x318e(%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 0x42b6
movq -0x238(%rbp), %rsi
incq %rsi
callq 0x2140
leaq -0x248(%rbp), %rdi
leaq -0x88(%rbp), %rsi
movl $0x8, %edx
leaq -0xb8(%rbp), %r13
callq 0x2200
leaq -0x248(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x20c0
shlq $0x20, %r15
andl $0x5, %ebx
leaq -0x1d0(%rbp), %r12
movq -0x78(%r12), %rax
movq -0x18(%rax), %rax
xorl %ecx, %ecx
cmpl $0x1, %ebx
adcl $0x1, %ecx
testb $0x5, -0x228(%rbp,%rax)
movq 0x5cad(%rip), %rsi      # 0x9fc0
movl -0x3c(%rbp), %eax
movl $0x0, %edx
movb %al, %dl
movl $0x1, %ebx
cmovel %edx, %ebx
movl -0x34(%rbp), %eax
cmovel %ecx, %eax
movl %eax, -0x34(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x21c0
movq %r12, %rdi
callq 0x2080
movabsq $0x100000000, %r12      # imm = 0x100000000
addq %r15, %r12
sarq $0x20, %r12
leaq 0x3074(%rip), %rsi      # 0x73ce
movl $0x1, %ecx
movq %r14, %rdi
movq %r12, %rdx
callq 0x2210
cmpq $-0x1, %rax
je 0x445d
leaq 0x3053(%rip), %rsi      # 0x73ce
movl $0x1, %ecx
movq %r14, %rdi
movq %r12, %rdx
callq 0x2210
movslq %eax, %r15
leaq 0x303a(%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
movl -0x34(%rbp), %r12d
je 0x43ec
movq -0x238(%rbp), %rsi
incq %rsi
callq 0x2140
leaq -0x248(%rbp), %rdi
leaq -0x68(%rbp), %rsi
movl $0x8, %edx
callq 0x2200
movq -0x48(%rbp), %r15
movl %ebx, %r14d
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), %ebx
andl $0x5, %ebx
movq 0x5b89(%rip), %rsi      # 0x9fc0
callq 0x21c0
leaq -0x1d0(%rbp), %rdi
callq 0x2080
cmpl $0x1, %ebx
adcl $0x0, %r12d
movl %r14d, %ebx
jmp 0x4465
movq -0x48(%rbp), %r15
movl -0x3c(%rbp), %ebx
jmp 0x4465
movq -0x48(%rbp), %r15
movl -0x34(%rbp), %r12d
cmpl $0x0, -0x30(%rbp)
movzbl %bl, %eax
movl $0x1, %ebx
cmovgl %eax, %ebx
cmpl $0x2, %r12d
jg 0x44a5
movl -0x2c(%rbp), %r14d
movq %r15, %rdi
callq 0x66b4
cmpl %eax, %r14d
jle 0x4496
movq %r15, %rdi
callq 0x66b4
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
movzbl %bl, %eax
movl $0x1, %ebx
cmovgl %eax, %ebx
cmpl $0x3, %r12d
jne 0x44d4
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
movzbl %bl, %eax
movl $0x1, %ebx
cmovgel %eax, %ebx
movl -0x38(%rbp), %r14d
testl %r14d, %r14d
jle 0x44d2
movq %r15, %rdi
callq 0x66b4
cmpl %eax, %r14d
jle 0x44d4
movb $0x1, %bl
testb %bl, %bl
je 0x44dd
xorl %r15d, %r15d
jmp 0x4511
cmpl $0x3, %r12d
jne 0x44ef
movl -0x30(%rbp), %esi
leaq -0x38(%rbp), %rax
movl -0x2c(%rbp), %edx
jmp 0x4504
cmpl $0x1, %r12d
je 0x44d8
cmpl $0x2, %r12d
jne 0x450e
leaq -0x2c(%rbp), %rax
movl -0x30(%rbp), %esi
movl %esi, %edx
movl (%rax), %ecx
movq %r15, %rdi
callq 0x6b0c
movb $0x1, %r15b
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x452a
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x4546
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x4568
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0xc8(%rbp), %rdi
cmpq %r13, %rdi
je 0x4583
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 0x45a4
jmp 0x45cc
jmp 0x45cc
jmp 0x45a4
jmp 0x45cc
jmp 0x45cc
movq %rax, %r14
movq 0x5a12(%rip), %rsi      # 0x9fc0
leaq -0x248(%rbp), %rdi
callq 0x21c0
leaq -0x1d0(%rbp), %rdi
callq 0x2080
jmp 0x45cf
jmp 0x45cc
jmp 0x45cc
movq %rax, %r14
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x45e8
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x4604
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x4626
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x4648
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x2140
movq %r14, %rdi
callq 0x2260