// File: /workspace/github_cpp_makefile_star2_O3/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 -0x48(%rbp), %r12
movq %r12, -0x10(%r12)
xorl %r15d, %r15d
movq %r15, -0x8(%r12)
movb %r15b, (%r12)
leaq -0x68(%rbp), %rax
movq %rax, -0x10(%rax)
movq %r15, -0x8(%rax)
movb %r15b, (%rax)
leaq -0x88(%rbp), %r13
movq %r13, -0x10(%r13)
movq %r15, -0x8(%r13)
movb %r15b, (%r13)
movl %r15d, -0x2c(%rbp)
movl %r15d, -0x30(%rbp)
leaq 0x3c9f(%rip), %rsi      # 0x73ce
movl $0x1, %edx
movl $0x1, %ecx
movq %r14, %rdi
callq 0x2210
cmpq $-0x1, %rax
je 0x3985
leaq 0x3c7c(%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), %rbx
cmpq %rbx, %rdi
je 0x37d9
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), %r12d
movq 0x67a5(%rip), %rsi      # 0x9fc0
callq 0x21c0
leaq -0x1a0(%rbp), %rdi
callq 0x2080
sarq $0x20, %r15
leaq 0x3b97(%rip), %rsi      # 0x73ce
movl $0x1, %ecx
movq %r14, %rdi
movq %r15, %rdx
callq 0x2210
cmpq $-0x1, %rax
je 0x392a
leaq 0x3b76(%rip), %rsi      # 0x73ce
movl $0x1, %ecx
movq %r14, %rdi
movq %r15, %rdx
callq 0x2210
movslq %eax, %r15
leaq 0x3b5d(%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 -0x98(%rbp), %rdi
leaq -0x218(%rbp), %r14
movq %r14, %rsi
callq 0x2190
movq (%r14), %rdi
cmpq %rbx, %rdi
je 0x38c1
movq -0x208(%rbp), %rsi
incq %rsi
callq 0x2140
leaq -0x218(%rbp), %rdi
leaq -0x98(%rbp), %rsi
movl $0x8, %edx
callq 0x2200
leaq -0x218(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x20c0
leaq -0x218(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movb -0x1f8(%rbp,%rax), %bl
movq 0x66bb(%rip), %rsi      # 0x9fc0
callq 0x21c0
leaq -0x1a0(%rbp), %rdi
callq 0x2080
testb $0x5, %bl
jne 0x3921
testb $0x5, %r12b
je 0x395a
xorl %r15d, %r15d
leaq -0x48(%rbp), %r12
jmp 0x3985
andl $0x5, %r12d
sete %al
movl -0x2c(%rbp), %esi
testl %esi, %esi
setg %r15b
andb %al, %r15b
testl %esi, %esi
jle 0x3924
movl %esi, %edx
testl %r12d, %r12d
leaq -0x48(%rbp), %r12
jne 0x3985
movb $0x1, %r15b
movq -0x38(%rbp), %rdi
callq 0x6a02
jmp 0x3985
movl -0x2c(%rbp), %r14d
movl -0x30(%rbp), %ebx
cmpl %r14d, %ebx
leaq -0x48(%rbp), %r12
jl 0x3982
movq -0x38(%rbp), %rdi
callq 0x66a4
testl %r14d, %r14d
setle %cl
cmpl %eax, %ebx
setg %al
orb %cl, %al
je 0x39e3
xorl %r15d, %r15d
movq -0x98(%rbp), %rdi
cmpq %r13, %rdi
je 0x39a0
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x39b9
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0x58(%rbp), %rdi
cmpq %r12, %rdi
je 0x39ce
movq -0x48(%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
movl -0x2c(%rbp), %esi
movl -0x30(%rbp), %edx
jmp 0x394c
jmp 0x3a1c
jmp 0x39f6
jmp 0x3a1c
jmp 0x3a1c
movq %rax, %r14
movq 0x65c0(%rip), %rsi      # 0x9fc0
leaq -0x218(%rbp), %rdi
callq 0x21c0
leaq -0x1a0(%rbp), %rdi
callq 0x2080
jmp 0x3a1f
jmp 0x3a1c
movq %rax, %r14
movq -0x98(%rbp), %rdi
cmpq %r13, %rdi
je 0x3a3a
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x3a53
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x2140
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x3a6c
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x2140
movq %r14, %rdi
callq 0x2260