// File: /workspace/github_cpp_makefile_star2_O1/jliesch[P]ofxget/clap/src/cmdline.cc
// Function: CmdLine::parse(int, char**)
void CmdLine::parse(int argc, char* argv[])
{
  CmdArg*            cmd;
  CmdArgListIterator it;

  for (int i = 1; i < argc; i++)
    {
      char* arg = argv[i];
      bool found = false;
      for (it = _cmdList.begin(); (it != _cmdList.end())&& !found; it++)
	{
	  cmd = *it;
	  char cmdWord[512], cmdChar[512];
	  sprintf(cmdWord, "-%s", cmd->getKeyword());
	  sprintf(cmdChar, "-%c", cmd->getOptChar());
	  if (!strcmp(arg, cmdWord) || !strcmp(arg, cmdChar))
	    {
	      cmd->setFound();
	      if (!cmd->getValue(&i, argc, argv))
		{
		  cout << "Error: switch -" << cmd->getKeyword()
		       << " must take an argument" << endl;
		  usage();
		}
	      else
		{
		  cmd->setValFound();
		}
	      found = true;
	    }
	}
      if (!found)
	{
	  cout << "Warning: argument \"" << arg
	       << "\" looks strange, ignoring." << endl;
	}
    }
  
  for (it = _cmdList.begin(); it != _cmdList.end(); it++)
    {
      cmd = *it;
      if (!cmd->isOpt()) // i.e required
	if (!cmd->isFound())
	  {
	    cout << "Error: the switch -" << cmd->getKeyword()
		 << " must be supplied" << endl;
	    usage();
	  }
      
      if (cmd->isFound() && !cmd->isValOpt()) // i.e need value
	if (!cmd->isValFound())
	  {
	    cout << "Error: the switch -" << cmd->getKeyword()
		 << " must take a vlue" << endl;
	    usage();
	  }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x428, %rsp            # imm = 0x428
movq %rdx, 0x18(%rsp)
movq %rdi, 0x8(%rsp)
movl $0x1, 0x10(%rsp)
movl %esi, 0x14(%rsp)
cmpl $0x2, %esi
jl 0x1c87e
movl $0x1, %eax
movq 0x2a876(%rip), %r15     # 0x46f80
leaq 0x220(%rsp), %r13
leaq 0x20(%rsp), %rbx
cltq
movq 0x18(%rsp), %rcx
movq (%rcx,%rax,8), %r12
movq 0x8(%rsp), %rax
movq (%rax), %r14
cmpq %rax, %r14
je 0x1c7e6
xorl %ebp, %ebp
movq 0x10(%r14), %r15
movq %r15, %rdi
callq 0x1abca
movq %r13, %rdi
leaq 0x15f61(%rip), %rsi     # 0x326ac
movq %rax, %rdx
xorl %eax, %eax
callq 0x6700
movq %r15, %rdi
callq 0x1abc6
movsbl %al, %edx
movq %rbx, %rdi
leaq 0x15f46(%rip), %rsi     # 0x326b0
xorl %eax, %eax
callq 0x6700
movq %r12, %rdi
movq %r13, %rsi
callq 0x6590
testl %eax, %eax
je 0x1c78f
movq %r12, %rdi
movq %rbx, %rsi
callq 0x6590
testl %eax, %eax
jne 0x1c7c1
movq %r15, %rdi
callq 0x1ac02
movq (%r15), %rax
movq %r15, %rdi
leaq 0x10(%rsp), %rsi
movl 0x14(%rsp), %edx
movq 0x18(%rsp), %rcx
callq *0x10(%rax)
testb %al, %al
je 0x1c8ef
movq %r15, %rdi
callq 0x1ac0e
movb $0x1, %bpl
movq (%r14), %r14
cmpq 0x8(%rsp), %r14
je 0x1c7d5
testb $0x1, %bpl
je 0x1c735
testb $0x1, %bpl
movq 0x2a7a0(%rip), %r15     # 0x46f80
jne 0x1c86a
movl $0x13, %edx
movq %r15, %rdi
leaq 0x15ee6(%rip), %rsi     # 0x326db
callq 0x6690
testq %r12, %r12
je 0x1c817
movq %r12, %rdi
callq 0x6270
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x6690
jmp 0x1c82f
movq (%r15), %rax
movq -0x18(%rax), %rax
leaq (%r15,%rax), %rdi
movl 0x20(%r15,%rax), %esi
orl $0x1, %esi
callq 0x67b0
movl $0x1a, %edx
movq %r15, %rdi
leaq 0x15eb1(%rip), %rsi     # 0x326ef
callq 0x6690
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x6730
movsbl %al, %esi
movq %r15, %rdi
callq 0x63c0
movq %rax, %rdi
callq 0x6340
movl 0x10(%rsp), %eax
incl %eax
movl %eax, 0x10(%rsp)
cmpl 0x14(%rsp), %eax
jl 0x1c717
movq 0x8(%rsp), %rax
movq (%rax), %r14
cmpq %rax, %r14
je 0x1c8dd
movq 0x10(%r14), %rbx
movq %rbx, %rdi
callq 0x1abea
testb %al, %al
jne 0x1c8ab
movq %rbx, %rdi
callq 0x1ac08
testb %al, %al
je 0x1c992
movq %rbx, %rdi
callq 0x1ac08
testb %al, %al
je 0x1c8d3
movq %rbx, %rdi
callq 0x1abf0
testb %al, %al
jne 0x1c8d3
movq %rbx, %rdi
callq 0x1ac14
testb %al, %al
je 0x1c9d4
movq (%r14), %r14
cmpq 0x8(%rsp), %r14
jne 0x1c88b
addq $0x428, %rsp            # imm = 0x428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2a68a(%rip), %rbx     # 0x46f80
leaq 0x15db7(%rip), %rsi     # 0x326b4
movl $0xf, %edx
movq %rbx, %rdi
callq 0x6690
movq %r15, %rdi
callq 0x1abca
testq %rax, %rax
jne 0x1c930
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x67b0
jmp 0x1c94d
movq %rax, %r14
movq %rax, %rdi
callq 0x6270
movq 0x2a63e(%rip), %rdi     # 0x46f80
movq %r14, %rsi
movq %rax, %rdx
callq 0x6690
leaq 0x15d70(%rip), %rsi     # 0x326c4
movl $0x16, %edx
movq %rbx, %rdi
callq 0x6690
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x6730
movsbl %al, %esi
movq %rbx, %rdi
callq 0x63c0
movq %rax, %rdi
callq 0x6340
movq 0x8(%rsp), %rdi
callq 0x1c35e
movq 0x2a5e7(%rip), %r14     # 0x46f80
leaq 0x15d6a(%rip), %rsi     # 0x3270a
movl $0x13, %edx
movq %r14, %rdi
callq 0x6690
movq %rbx, %rdi
callq 0x1abca
testq %rax, %rax
jne 0x1ca16
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x67b0
jmp 0x1ca33
movq 0x2a5a5(%rip), %r14     # 0x46f80
leaq 0x15d28(%rip), %rsi     # 0x3270a
movl $0x13, %edx
movq %r14, %rdi
callq 0x6690
movq %rbx, %rdi
callq 0x1abca
testq %rax, %rax
jne 0x1ca3c
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x67b0
jmp 0x1ca59
movq %rax, %rbx
movq %rax, %rdi
callq 0x6270
movq 0x2a558(%rip), %rdi     # 0x46f80
movq %rbx, %rsi
movq %rax, %rdx
callq 0x6690
leaq 0x15ce4(%rip), %rsi     # 0x3271e
jmp 0x1ca60
movq %rax, %rbx
movq %rax, %rdi
callq 0x6270
movq 0x2a532(%rip), %rdi     # 0x46f80
movq %rbx, %rsi
movq %rax, %rdx
callq 0x6690
leaq 0x15cd0(%rip), %rsi     # 0x32730
movl $0x11, %edx
movq %r14, %rdi
callq 0x6690
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x6730
movsbl %al, %esi
movq %r14, %rdi
jmp 0x1c97b