// File: /workspace/github_cpp_makefile_star2_O1/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, -0x38(%rbp)
leaq -0x88(%rbp), %r13
movq %r13, -0x10(%r13)
xorl %r15d, %r15d
movq %r15, -0x8(%r13)
movb %r15b, (%r13)
leaq -0x68(%rbp), %rax
movq %rax, -0x10(%rax)
movq %r15, -0x8(%rax)
movb %r15b, (%rax)
leaq -0x48(%rbp), %rax
movq %rax, -0x10(%rax)
movq %r15, -0x8(%rax)
movb %r15b, (%rax)
movl %r15d, -0x2c(%rbp)
movl %r15d, -0x30(%rbp)
leaq 0x3c53(%rip), %rsi      # 0x73ce
movl $0x1, %edx
movl $0x1, %ecx
movq %r14, %rdi
callq 0x2210
cmpq $-0x1, %rax
je 0x39fd
leaq 0x3c30(%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 -0x218(%rbp), %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x2160
leaq -0x78(%rbp), %rdi
leaq -0x218(%rbp), %r12
movq %r12, %rsi
callq 0x2190
movq (%r12), %rdi
leaq -0x208(%rbp), %rax
cmpq %rax, %rdi
je 0x3825
movq -0x208(%rbp), %rsi
incq %rsi
callq 0x2140
leaq -0x218(%rbp), %rdi
leaq -0x78(%rbp), %rsi
movl $0x8, %edx
callq 0x2200
leaq -0x218(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x20c0
leaq -0x218(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movl -0x1f8(%rbp,%rax), %r13d
xorl %r12d, %r12d
testb $0x5, %r13b
setne %bl
sete %r12b
movq 0x674b(%rip), %rsi      # 0x9fc0
callq 0x21c0
leaq -0x1a0(%rbp), %rdi
callq 0x2080
sarq $0x20, %r15
leaq 0x3b3d(%rip), %rsi      # 0x73ce
movl $0x1, %ecx
movq %r14, %rdi
movq %r15, %rdx
callq 0x2210
cmpq $-0x1, %rax
je 0x3996
leaq 0x3b1c(%rip), %rsi      # 0x73ce
movl $0x1, %ecx
movq %r14, %rdi
movq %r15, %rdx
callq 0x2210
movslq %eax, %r15
leaq 0x3b03(%rip), %rsi      # 0x73cf
movq %r14, %rdi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x21e0
movslq %eax, %rcx
leaq -0x218(%rbp), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2160
leaq -0x58(%rbp), %rdi
leaq -0x218(%rbp), %r14
movq %r14, %rsi
callq 0x2190
movq (%r14), %rdi
leaq -0x208(%rbp), %rax
cmpq %rax, %rdi
je 0x391f
movq -0x208(%rbp), %rsi
incq %rsi
callq 0x2140
leaq -0x218(%rbp), %rdi
leaq -0x58(%rbp), %rsi
movl $0x8, %edx
callq 0x2200
leaq -0x218(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x20c0
andl $0x5, %r13d
leaq -0x1a0(%rbp), %r14
movq -0x78(%r14), %rax
movq -0x18(%rax), %rax
xorl %ecx, %ecx
cmpl $0x1, %r13d
adcl $0x1, %ecx
testb $0x5, -0x1f8(%rbp,%rax)
movq 0x6651(%rip), %rsi      # 0x9fc0
movl $0x0, %eax
movb %bl, %al
movl $0x1, %ebx
cmovel %eax, %ebx
cmovel %ecx, %r12d
leaq -0x218(%rbp), %rdi
callq 0x21c0
movq %r14, %rdi
callq 0x2080
movl -0x2c(%rbp), %eax
testl %eax, %eax
movzbl %bl, %ecx
movl $0x1, %ebx
cmovgl %ecx, %ebx
cmpl $0x2, %r12d
leaq -0x88(%rbp), %r13
jne 0x39cc
movl -0x30(%rbp), %r14d
cmpl %eax, %r14d
jl 0x39ca
movq -0x38(%rbp), %rdi
callq 0x66b4
cmpl %eax, %r14d
jle 0x39cc
movb $0x1, %bl
testb %bl, %bl
je 0x39d5
xorl %r15d, %r15d
jmp 0x39fd
cmpl $0x2, %r12d
jne 0x39e3
movl -0x2c(%rbp), %esi
movl -0x30(%rbp), %edx
jmp 0x39f1
movb $0x1, %r15b
cmpl $0x1, %r12d
jne 0x39fd
movl -0x2c(%rbp), %esi
movl %esi, %edx
movb $0x1, %r15b
movq -0x38(%rbp), %rdi
callq 0x6a12
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x3a16
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x3a2f
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0x98(%rbp), %rdi
cmpq %r13, %rdi
je 0x3a4a
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x2140
movl %r15d, %eax
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3a8d
jmp 0x3a67
jmp 0x3a8d
jmp 0x3a8d
movq %rax, %r14
movq 0x654f(%rip), %rsi      # 0x9fc0
leaq -0x218(%rbp), %rdi
callq 0x21c0
leaq -0x1a0(%rbp), %rdi
callq 0x2080
jmp 0x3a90
jmp 0x3a8d
movq %rax, %r14
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x3aa9
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x3ac2
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x3ae4
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x2140
movq %r14, %rdi
callq 0x2260