// File: /workspace/github_cpp_makefile_star2_O3/hzeller[P]gcode-multi-shell-extrude/config-values.cc
// Function: SetParametersFromCommandline(int, char**)
bool SetParametersFromCommandline(int argc, char *argv[]) {
  if (sRegisteredParameters == NULL)
    return true;

  std::string optstring;
  struct option *long_options = new option [ sRegisteredParameters->size() + 1 ];
  int opt_idx = 0;
  for (size_t i = 0; i < sRegisteredParameters->size(); ++i) {
    const Parameter *const p = (*sRegisteredParameters)[i];
    if (p->option_name == NULL && p->option_char == 0) {
      continue;
    }
    if (p->option_char != 0) {
      optstring.append(1, p->option_char);
      if (p->RequiresValue()) optstring.append(1, ':');
    }
    struct option *opt = &long_options[opt_idx++];
    opt->name = p->option_name;
    opt->has_arg = p->RequiresValue() ? 1 : 2;
    opt->flag = NULL;
    opt->val = i + 256;
  }
  const char *optstr = optstring.c_str();
  bool success = true;
  int opt;
  int arg_idx = 0;
  while ((opt = getopt_long(argc, argv, optstr, long_options, &arg_idx)) >= 0) {
    if (opt == '?') {
      success = false;
      break;
    }
    for (size_t i = 0; i < sRegisteredParameters->size(); ++i) {
      Parameter *const p = (*sRegisteredParameters)[i];
      if (opt == p->option_char || opt == (int) (i + 256)) {
        p->FromString(optarg);
      }
    }
  }
  delete [] long_options;
  return success;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, 0x30(%rsp)
movl %edi, 0x8(%rsp)
movq 0x1425b(%rip), %rbp     # 0x1c210
testq %rbp, %rbp
je 0x811a
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
movq $0x0, -0x8(%r12)
movb $0x0, (%r12)
movq (%rbp), %r15
movq 0x8(%rbp), %rbx
movq %rbx, %rax
subq %r15, %rax
sarq $0x3, %rax
incq %rax
movq %rax, %rcx
shrq $0x3b, %rcx
shlq $0x5, %rax
xorl %edi, %edi
negq %rcx
sbbq %rdi, %rdi
orq %rax, %rdi
callq 0x3030
movq %rax, %r14
cmpq %r15, %rbx
je 0x80e1
xorl %ebx, %ebx
xorl %r13d, %r13d
movq (%r15,%r13,8), %r12
cmpq $0x0, 0x8(%r12)
movb 0x10(%r12), %al
je 0x802e
testb %al, %al
jne 0x8036
jmp 0x807a
testb %al, %al
je 0x80c5
movq 0x18(%rsp), %rsi
movsbl %al, %r8d
movl $0x1, %ecx
leaq 0x10(%rsp), %rdi
xorl %edx, %edx
callq 0x33b0
movq (%r12), %rax
movq %r12, %rdi
callq *0x20(%rax)
testb %al, %al
je 0x807a
movq 0x18(%rsp), %rsi
movl $0x1, %ecx
leaq 0x10(%rsp), %rdi
xorl %edx, %edx
movl $0x3a, %r8d
callq 0x33b0
movslq %ebx, %r15
shlq $0x5, %r15
movq 0x8(%r12), %rax
movq %rax, (%r14,%r15)
movq (%r12), %rax
movq %r12, %rdi
callq *0x20(%rax)
addq %r14, %r15
incl %ebx
movzbl %al, %eax
movl $0x2, %ecx
subl %eax, %ecx
movl %ecx, 0x8(%r15)
movq $0x0, 0x10(%r15)
leal 0x100(%r13), %eax
movl %eax, 0x18(%r15)
movq 0x1414f(%rip), %rbp     # 0x1c210
movq (%rbp), %r15
incq %r13
movq 0x8(%rbp), %rax
subq %r15, %rax
sarq $0x3, %rax
cmpq %rax, %r13
jb 0x8017
movq 0x10(%rsp), %r12
leaq 0xc(%rsp), %r8
movl $0x0, (%r8)
movl 0x8(%rsp), %edi
movq 0x30(%rsp), %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x3360
movl %eax, %ebx
testl %eax, %eax
sets %al
cmpl $0x3f, %ebx
sete %cl
orb %al, %cl
je 0x8121
shrl $0x1f, %ebx
jmp 0x81a8
movb $0x1, %bl
jmp 0x81cc
movq 0x13e98(%rip), %rbp     # 0x1bfc0
movl %ebx, %r13d
movq 0x140de(%rip), %rax     # 0x1c210
movq (%rax), %rcx
cmpq %rcx, 0x8(%rax)
je 0x817e
leal -0x100(%r13), %ebx
xorl %r15d, %r15d
movq (%rcx,%r15,8), %rdi
cmpl %r15d, %ebx
je 0x8157
movsbl 0x10(%rdi), %edx
cmpl %edx, %r13d
jne 0x816b
movq (%rbp), %rsi
movq (%rdi), %rax
callq *0x10(%rax)
movq 0x140a8(%rip), %rax     # 0x1c210
movq (%rax), %rcx
incq %r15
movq 0x8(%rax), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %rdx, %r15
jb 0x8145
movl 0x8(%rsp), %edi
movq 0x30(%rsp), %rsi
movq %r12, %rdx
movq %r14, %rcx
leaq 0xc(%rsp), %r8
callq 0x3360
movl %eax, %ebx
shrl $0x1f, %ebx
testl %eax, %eax
js 0x81a8
movl %eax, %r13d
cmpl $0x3f, %eax
jne 0x812b
movq %r14, %rdi
callq 0x32a0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x81cc
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3220
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x81ee
jmp 0x81e6
jmp 0x81e6
movq %rax, %rbx
leaq 0x20(%rsp), %r12
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x8205
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3220
movq %rbx, %rdi
callq 0x3380
nop