// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/arglist.cpp
// Function: ArgList::Set(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool)
void ArgList::Set( const String& line, bool untilNewLine )
{
  enum State
  {
    LINE_START,
    LINE_SPACE,
    LINE_ARG,
    LINE_ESCAPED,
    LINE_QUOTED,
    LINE_QUOTEDESCAPED
  };
  State state;
  CharVector curArg;

  state = LINE_START;
  curArg.clear();
  mArgs.clear();

  for(unsigned int index = 0; index < line.size(); ++index )
  {
    int ch = line[index];

    if(untilNewLine && ch == '\n' )
    {
      break;
    }

    switch( state )
    {
ProcessCharNormally:  // I know, a goto.  But it was convenient. ;)
    case LINE_ARG:
      if( ch == '"' )
      {
        state = LINE_QUOTED;
      }
      else if( ch == '\\' )
      {
        state = LINE_ESCAPED;
      }
      else if( isspace( ch ) )
      {
        String foo( &curArg[0], curArg.size() );
        mArgs.push_back( foo );
        curArg.clear();
        state = LINE_SPACE;
      }
      else
      {
        curArg.push_back( ch );
      }
      break;
      
    case LINE_START:
      if( !isspace( ch ) )
      {
        state = LINE_ARG;
        goto ProcessCharNormally;
      }
      break;
      
    case LINE_SPACE:
      if( !isspace( ch ) )
      {
        state = LINE_ARG;
        goto ProcessCharNormally;
      }
      break;
      
    case LINE_QUOTED:
      if( ch == '"' )
      {
        state = LINE_ARG;
      }
// Don't process escape characters inside quoted strings!!!
//      else if( ch == '\\' )
//      {
//        state = LINE_QUOTEDESCAPED;
//      }
      else
      {
        curArg.push_back( ch );
      }
      break;
      
    case LINE_ESCAPED:
      ch = TranslateEscapedChar( ch );
      state = LINE_ARG;
      curArg.push_back( ch );
      break;
      
    case LINE_QUOTEDESCAPED:
      ch = TranslateEscapedChar( ch );
      state = LINE_QUOTED;
      curArg.push_back( ch );
      break;
    }
  }

  switch( state )
  {
  case LINE_ARG:
  case LINE_QUOTED:
  case LINE_ESCAPED:
  case LINE_QUOTEDESCAPED:
    {
    String foo( &curArg[0], curArg.size() );
    mArgs.push_back( foo );
    }
    break;
    
  case LINE_START:
  case LINE_SPACE:
    break;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, -0x44(%rbp)
movq %rsi, %r15
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %rax
movaps %xmm0, (%rax)
andq $0x0, 0x10(%rax)
movq %rdi, -0x70(%rbp)
callq 0x651a
xorl %ecx, %ecx
xorl %r13d, %r13d
movl %r13d, %r13d
cmpq %r13, 0x8(%r15)
jbe 0x6148
movq (%r15), %rax
movb (%rax,%r13), %r12b
cmpb $0x0, -0x44(%rbp)
je 0x603a
cmpb $0xa, %r12b
je 0x6148
movzbl %r12b, %r14d
movsbl %r14b, %ebx
movl %ecx, %eax
leaq 0xaacd(%rip), %rcx      # 0x10b18
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl %ebx, %edi
callq 0x2060
xorl %ecx, %ecx
jmp 0x608e
pushq $0x2
popq %rcx
cmpb $0x22, %r12b
je 0x612d
movb %r12b, -0x68(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x6a34
pushq $0x4
jmp 0x612c
movl %ebx, %edi
callq 0x2060
pushq $0x1
popq %rcx
testl %eax, %eax
jne 0x612d
pushq $0x4
popq %rcx
cmpl $0x22, %r14d
je 0x612d
cmpl $0x5c, %r14d
jne 0x60c4
pushq $0x3
jmp 0x612c
cmpl $0x66, %r14d
je 0x6116
cmpl $0x6e, %r14d
je 0x6111
cmpl $0x74, %r14d
jne 0x6119
movb $0x9, %r12b
jmp 0x6119
movl %ebx, %edi
callq 0x2060
testl %eax, %eax
je 0x6135
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
leaq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0x68(%rbp), %rbx
movq %rbx, %rdi
callq 0x5ed0
movq -0x70(%rbp), %rdi
movq %rbx, %rsi
callq 0x6528
movq -0x40(%rbp), %rax
cmpq %rax, -0x38(%rbp)
je 0x6105
movq %rax, -0x38(%rbp)
movq %rbx, %rdi
callq 0x2120
pushq $0x1
jmp 0x612c
movb $0xa, %r12b
jmp 0x6119
movb $0xc, %r12b
movb %r12b, -0x68(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x6a34
pushq $0x2
popq %rcx
incl %r13d
jmp 0x6016
movb %r12b, -0x68(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x6a34
jmp 0x612a
addl $-0x2, %ecx
cmpl $0x3, %ecx
ja 0x617e
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
leaq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
movq %rax, (%rdi)
callq 0x5ed0
leaq -0x68(%rbp), %rsi
movq -0x70(%rbp), %rdi
callq 0x6528
leaq -0x68(%rbp), %rdi
callq 0x2120
leaq -0x40(%rbp), %rdi
callq 0x6820
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x619c
jmp 0x61ae
jmp 0x61ae
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x2120
jmp 0x61b1
jmp 0x61ae
jmp 0x61ae
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x6820
movq %rbx, %rdi
callq 0x23e0