// File: /workspace/github_cpp_makefile_star2_O1/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 0x13f19(%rip), %rax     # 0x1c210
testq %rax, %rax
je 0x845c
leaq 0x20(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq $0x0, -0x8(%rcx)
movb $0x0, (%rcx)
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x3, %rcx
incq %rcx
movq %rcx, %rax
shrq $0x3b, %rax
shlq $0x5, %rcx
xorl %edi, %edi
negq %rax
sbbq %rdi, %rdi
orq %rcx, %rdi
callq 0x3030
movq %rax, %r14
movq 0x13ec9(%rip), %rcx     # 0x1c210
movq (%rcx), %rax
cmpq %rax, 0x8(%rcx)
je 0x841e
xorl %ebx, %ebx
leaq 0x10(%rsp), %r15
xorl %r13d, %r13d
movq (%rax,%r13,8), %r12
cmpq $0x0, 0x8(%r12)
jne 0x8376
cmpb $0x0, 0x10(%r12)
je 0x83fd
movb 0x10(%r12), %al
testb %al, %al
je 0x83bf
movq 0x18(%rsp), %rsi
movsbl %al, %r8d
movl $0x1, %ecx
movq %r15, %rdi
xorl %edx, %edx
callq 0x33b0
movq (%r12), %rax
movq %r12, %rdi
callq *0x20(%rax)
testb %al, %al
je 0x83bf
movq 0x18(%rsp), %rsi
movl $0x1, %ecx
movq %r15, %rdi
xorl %edx, %edx
movl $0x3a, %r8d
callq 0x33b0
movslq %ebx, %rbp
shlq $0x5, %rbp
movq 0x8(%r12), %rax
movq %rax, (%r14,%rbp)
movq (%r12), %rax
movq %r12, %rdi
callq *0x20(%rax)
addq %r14, %rbp
incl %ebx
movzbl %al, %eax
movl $0x2, %ecx
subl %eax, %ecx
movl %ecx, 0x8(%rbp)
movq $0x0, 0x10(%rbp)
leal 0x100(%r13), %eax
movl %eax, 0x18(%rbp)
incq %r13
movq 0x13e09(%rip), %rcx     # 0x1c210
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rcx, %r13
jb 0x835e
movq 0x10(%rsp), %r15
leaq 0xc(%rsp), %r8
movl $0x0, (%r8)
movl 0x8(%rsp), %edi
movq 0x30(%rsp), %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x3360
movl %eax, %ebx
testl %eax, %eax
sets %al
cmpl $0x3f, %ebx
sete %cl
orb %al, %cl
je 0x8463
shrl $0x1f, %ebx
jmp 0x84ea
movb $0x1, %bl
jmp 0x850e
movq 0x13b56(%rip), %rbp     # 0x1bfc0
movl %ebx, %r13d
movq 0x13d9c(%rip), %rcx     # 0x1c210
movq (%rcx), %rax
cmpq %rax, 0x8(%rcx)
je 0x84c0
leal -0x100(%r13), %ebx
xorl %r12d, %r12d
movq (%rax,%r12,8), %rdi
cmpl %r12d, %ebx
je 0x8499
movsbl 0x10(%rdi), %eax
cmpl %eax, %r13d
jne 0x84a3
movq (%rbp), %rsi
movq (%rdi), %rax
callq *0x10(%rax)
incq %r12
movq 0x13d63(%rip), %rcx     # 0x1c210
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rcx, %r12
jb 0x8487
movl 0x8(%rsp), %edi
movq 0x30(%rsp), %rsi
movq %r15, %rdx
movq %r14, %rcx
leaq 0xc(%rsp), %r8
callq 0x3360
movl %eax, %ebx
shrl $0x1f, %ebx
testl %eax, %eax
js 0x84ea
movl %eax, %r13d
cmpl $0x3f, %eax
jne 0x846d
movq %r14, %rdi
callq 0x32a0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x850e
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
jmp 0x8525
jmp 0x8525
jmp 0x8525
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq 0x10(%rsp), %rdi
cmpq %rax, %rdi
je 0x8544
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3220
movq %rbx, %rdi
callq 0x3380