// File: /workspace/github_cpp_makefile_star2_O2/craigbarstow[P]cmd-line-text-editor/text_editor.cc
// Function: delete_line(text_ed&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool delete_line (text_ed & T, string cl) { //delete lines between two given line positions. If only one position is given, delete just that line
  bool error_state=false;
  string aline,M_string,N_string;
  int i = 0,m=0,n=0,p=1,m_start, m_end, n_start, n_end,number, count=0;
  if (cl.find_first_not_of(" ",1)!=string::npos){ //if first integer is part of substring isolate it
    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 representing first integer can't be converted to integer form, toggle error state to true
      error_state=true;
    } else {count++;} //else, increment count to show that first integer is present
    if (cl.find_first_not_of(" ", m_end+2)!=string::npos){ //if second integer is part of substring isolate it
      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 representing second integer can't be converted to int form, toggle error state to true
	error_state=true;
      } else {count++;} //increment count to show that second integer is present
    }
    //section to make sure the integer values are reasonable
    if (m<=0){ //if integer value of starting position is less 1, toggle error
      error_state=true;
    }
    if (count==2) { //if two integers are present, if second is less than first, or if first is greater than document length, toggle error state
      if (n<m || n>T.get_last_line()) {
	error_state=true;
      }
    }
    if (!error_state) {
      if (count==2){ //if two integers are present, delete the lines between them
	T.delete_lines(m,n);
      }
      else if (count==1) { //if one integer is present, delete just that line
	T.delete_lines(m,m);
      }
    } else {
      return false; //return false if something other than 1 or two integers are present
    } return true; //if !error_state
  }
  return false; //return false if nothing is found after the 'd' statement in the command line, or if error state is true
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
movq %rsi, %r14
movq %rdi, %rbx
leaq -0x90(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %r15d, %r15d
movb %r15b, (%rax)
leaq -0x70(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
leaq -0x50(%rbp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
movb %r15b, (%rax)
andl $0x0, -0x34(%rbp)
movb %r15b, (%rcx)
andl $0x0, -0x30(%rbp)
leaq 0x33e0(%rip), %rsi      # 0x63ce
pushq $0x1
popq %rdx
movq %r14, %rdi
callq 0x2120
cmpq $-0x1, %rax
je 0x31fd
movq %rbx, -0x40(%rbp)
leaq 0x33c0(%rip), %r15      # 0x63ce
pushq $0x1
popq %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2120
movslq %eax, %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x2100
movq %rax, %r15
shlq $0x20, %r15
movabsq $-0x200000000, %rcx     # imm = 0xFFFFFFFE00000000
addq %r15, %rcx
sarq $0x20, %rcx
leaq -0x220(%rbp), %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x21a0
leaq -0x80(%rbp), %r12
leaq -0x220(%rbp), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x21c0
movq %r13, %rdi
callq 0x20d0
leaq -0x220(%rbp), %rdi
pushq $0x8
popq %rdx
movq %r12, %rsi
callq 0x2220
leaq -0x220(%rbp), %rdi
leaq -0x34(%rbp), %rsi
callq 0x2130
leaq -0x220(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movl -0x200(%rbp,%rax), %ebx
xorl %r13d, %r13d
xorl %r12d, %r12d
testb $0x5, %bl
setne -0x29(%rbp)
sete %r12b
callq 0x20e0
sarq $0x20, %r15
leaq 0x3301(%rip), %rsi      # 0x63ce
movq %r14, %rdi
movq %r15, %rdx
callq 0x2120
cmpq $-0x1, %rax
je 0x319b
leaq 0x32e5(%rip), %rsi      # 0x63ce
movq %r14, %rdi
movq %r15, %rdx
callq 0x2120
movslq %eax, %r15
leaq 0x32d1(%rip), %rsi      # 0x63cf
movq %r14, %rdi
movq %r15, %rdx
callq 0x2100
movslq %eax, %rcx
leaq -0x220(%rbp), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x21a0
leaq -0x60(%rbp), %r14
leaq -0x220(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x21c0
movq %r15, %rdi
callq 0x20d0
leaq -0x220(%rbp), %rdi
pushq $0x8
popq %rdx
movq %r14, %rsi
callq 0x2220
leaq -0x220(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x2130
pushq $0x1
popq %r14
andl $0x5, %ebx
leaq -0x220(%rbp), %rdi
movq (%rdi), %rax
xorl %ecx, %ecx
cmpl $0x1, %ebx
adcl $0x1, %ecx
movq -0x18(%rax), %rax
testb $0x5, -0x200(%rbp,%rax)
movb -0x29(%rbp), %al
movb %al, %r13b
cmovnel %r14d, %r13d
cmovel %ecx, %r12d
callq 0x20e0
movl %r13d, %eax
jmp 0x31a2
movb -0x29(%rbp), %al
pushq $0x1
popq %r14
movl -0x34(%rbp), %esi
testl %esi, %esi
movzbl %al, %ebx
cmovlel %r14d, %ebx
cmpl $0x2, %r12d
jne 0x31da
movl -0x30(%rbp), %r14d
cmpl %esi, %r14d
jl 0x31de
movq -0x40(%rbp), %r12
movq %r12, %rdi
callq 0x5182
cmpl %eax, %r14d
jg 0x31de
testb %bl, %bl
jne 0x31de
movl -0x34(%rbp), %esi
movl -0x30(%rbp), %edx
jmp 0x31f2
testb %bl, %bl
je 0x31e3
xorl %r15d, %r15d
jmp 0x31fd
movb $0x1, %r15b
movl %esi, %edx
cmpl $0x1, %r12d
movq -0x40(%rbp), %r12
jne 0x31fd
movb $0x1, %r15b
movq %r12, %rdi
callq 0x53ce
leaq -0x60(%rbp), %rdi
callq 0x20d0
leaq -0x80(%rbp), %rdi
callq 0x20d0
leaq -0xa0(%rbp), %rdi
callq 0x20d0
movl %r15d, %eax
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x324b
jmp 0x3238
jmp 0x324b
jmp 0x324b
movq %rax, %rbx
leaq -0x220(%rbp), %rdi
callq 0x20e0
jmp 0x324e
jmp 0x324b
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x20d0
leaq -0x80(%rbp), %rdi
callq 0x20d0
leaq -0xa0(%rbp), %rdi
callq 0x20d0
movq %rbx, %rdi
callq 0x2260