// File: /workspace/github_c_makefile_star2_O1/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 $0x58, %rsp
movl %edx, -0x2c(%rbp)
movq %rsi, -0x38(%rbp)
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x6e8d
movq $0x0, -0x48(%rbp)
movq (%rbx), %rsi
movq %rbx, %rdi
callq 0x77be
movq -0x38(%rbp), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x7076
movq %rbx, -0x78(%rbp)
xorl %eax, %eax
movl $0x1, %r13d
xorl %ecx, %ecx
movl -0x2c(%rbp), %esi
movq (%rdi), %rdx
movb (%rdx,%rax), %r14b
cmpb $0xa, %r14b
sete %bl
andb %sil, %bl
jne 0x7008
movzbl %r14b, %r15d
movsbl %r15b, %r12d
movl %ecx, %eax
leaq 0xbc38(%rip), %rcx      # 0x12b18
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl %r12d, %edi
callq 0x2060
movq -0x38(%rbp), %rdi
movl -0x2c(%rbp), %esi
xorl %ecx, %ecx
jmp 0x6f3a
movl $0x2, %ecx
cmpb $0x22, %r14b
je 0x7008
movb %r14b, -0x70(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x7a40
movl $0x4, %ecx
jmp 0x7001
movl %r12d, %edi
callq 0x2060
movq -0x38(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl $0x1, %ecx
testl %eax, %eax
jne 0x7008
cmpl $0x22, %r15d
je 0x6f77
cmpl $0x5c, %r15d
jne 0x6f81
movl $0x3, %ecx
jmp 0x7008
cmpl $0x66, %r15d
je 0x6fe8
cmpl $0x6e, %r15d
je 0x6fe3
cmpl $0x74, %r15d
leaq -0x70(%rbp), %rsi
jne 0x6fef
movb $0x9, %r14b
jmp 0x6fef
movl $0x4, %ecx
jmp 0x7008
movl %r12d, %edi
callq 0x2060
testl %eax, %eax
je 0x701e
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
leaq -0x60(%rbp), %r14
movq %r14, -0x70(%rbp)
leaq -0x70(%rbp), %r15
movq %r15, %rdi
callq 0x6d42
movq -0x78(%rbp), %rdi
movq %r15, %rsi
callq 0x758a
movq -0x50(%rbp), %rax
cmpq %rax, -0x48(%rbp)
je 0x6fc7
movq %rax, -0x48(%rbp)
movq -0x70(%rbp), %rdi
cmpq %r14, %rdi
je 0x6fdc
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2230
movl $0x1, %ecx
jmp 0x7001
movb $0xa, %r14b
jmp 0x6feb
movb $0xc, %r14b
leaq -0x70(%rbp), %rsi
movb %r14b, -0x70(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x7a40
movl $0x2, %ecx
movl -0x2c(%rbp), %esi
movq -0x38(%rbp), %rdi
testb %bl, %bl
jne 0x7031
movl %r13d, %eax
incl %r13d
cmpq %rax, 0x8(%rdi)
ja 0x6eb8
jmp 0x7031
movb %r14b, -0x70(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x7a40
jmp 0x6ffc
addl $-0x2, %ecx
cmpl $0x3, %ecx
movq -0x78(%rbp), %rbx
ja 0x7076
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
leaq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %r14
movq %r14, (%rdi)
callq 0x6d42
leaq -0x70(%rbp), %rsi
movq %rbx, %rdi
callq 0x758a
movq -0x70(%rbp), %rdi
cmpq %r14, %rdi
je 0x7076
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2230
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x708b
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x2230
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x70be
jmp 0x70a0
jmp 0x70be
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %r14, %rdi
je 0x70c1
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2230
jmp 0x70c1
jmp 0x70be
jmp 0x70be
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x70d6
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x2230
movq %rbx, %rdi
callq 0x23c0