// File: /workspace/github_c_makefile_star2_O0/deplinenoise[P]tundra/src/Main.cpp
// Function: InitOptions(t2::DriverOptions*, int*, char***)
static bool InitOptions(t2::DriverOptions* options, int* argc, char*** argv)
{
  int opt = 1;
  char* option_base = (char*) options;

  while (opt < *argc)
  {
    bool        found         = false;
    const char *opt_str       = (*argv)[opt];
    int         advance_count = 0;

    if ('-' != opt_str[0])
      break;

    if (opt_str[1] != '-')
    {
      const char* opt_arg = opt + 1 < *argc ? (*argv)[opt + 1] : nullptr;

      if (opt_str[2])
      {
        fprintf(stderr, "bad option: %s\n", opt_str);
        return false;
      }

      for (size_t i = 0; !found && i < ARRAY_SIZE(g_OptionTemplates); ++i)
      {
        const OptionTemplate* templ = g_OptionTemplates + i;

        if (opt_str[1] == templ->m_ShortName)
        {
          found = true;
          advance_count = AssignOptionValue(option_base, templ, opt_arg, true);
        }
      }
    }
    else
    {
      const char *equals  = strchr(opt_str, '=');
      size_t      optlen  = equals ? equals - opt_str - 2 : strlen(opt_str + 2);
      const char *opt_arg = equals ? equals + 1 : nullptr;

      for (size_t i = 0; !found && i < ARRAY_SIZE(g_OptionTemplates); ++i)
      {
        const OptionTemplate* templ = g_OptionTemplates + i;

        if (strlen(templ->m_LongName) == optlen && 0 == memcmp(opt_str + 2, templ->m_LongName, optlen))
        {
          found = true;
          advance_count = AssignOptionValue(option_base, templ, opt_arg, false);
        }
      }
    }

    if (0 == advance_count)
      return false;

    if (!found)
    {
      fprintf(stderr, "unrecognized option: %s\n", opt_str);
      return false;
    }

    opt += advance_count;
  }

  *argc -= opt;
  *argv += opt;

  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x1, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movl -0x24(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x4267
movb $0x0, -0x31(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movq -0x40(%rbp), %rax
movsbl (%rax), %ecx
movl $0x2d, %eax
cmpl %ecx, %eax
je 0x3fe8
jmp 0x4267
movq -0x40(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x2d, %eax
je 0x40f1
movl -0x24(%rbp), %eax
addl $0x1, %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x4024
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x90(%rbp)
jmp 0x402f
xorl %eax, %eax
movq %rax, -0x90(%rbp)
jmp 0x402f
movq -0x90(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %rax
cmpb $0x0, 0x2(%rax)
je 0x4069
movq 0x2af85(%rip), %rax     # 0x2efd0
movq (%rax), %rdi
movq -0x40(%rbp), %rdx
leaq 0x1f447(%rip), %rsi     # 0x234a0
movb $0x0, %al
callq 0x3470
movb $0x0, -0x1(%rbp)
jmp 0x428f
movq $0x0, -0x58(%rbp)
xorl %eax, %eax
testb $0x1, -0x31(%rbp)
movb %al, -0x91(%rbp)
jne 0x408d
cmpq $0x14, -0x58(%rbp)
setb %al
movb %al, -0x91(%rbp)
movb -0x91(%rbp), %al
testb $0x1, %al
jne 0x4099
jmp 0x40ec
leaq 0x2a9f0(%rip), %rax     # 0x2ea90
imulq $0x28, -0x58(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x40(%rbp), %rax
movsbl 0x1(%rax), %eax
movq -0x60(%rbp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x40dc
movb $0x1, -0x31(%rbp)
movq -0x30(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq -0x50(%rbp), %rdx
movl $0x1, %ecx
callq 0x4470
movl %eax, -0x44(%rbp)
jmp 0x40de
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x4071
jmp 0x4224
movq -0x40(%rbp), %rdi
movl $0x3d, %esi
callq 0x3130
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
je 0x4122
movq -0x68(%rbp), %rax
movq -0x40(%rbp), %rcx
subq %rcx, %rax
subq $0x2, %rax
movq %rax, -0xa0(%rbp)
jmp 0x4136
movq -0x40(%rbp), %rdi
addq $0x2, %rdi
callq 0x3150
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x68(%rbp)
je 0x4159
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa8(%rbp)
jmp 0x4164
xorl %eax, %eax
movq %rax, -0xa8(%rbp)
jmp 0x4164
movq -0xa8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq $0x0, -0x80(%rbp)
xorl %eax, %eax
testb $0x1, -0x31(%rbp)
movb %al, -0xa9(%rbp)
jne 0x4193
cmpq $0x14, -0x80(%rbp)
setb %al
movb %al, -0xa9(%rbp)
movb -0xa9(%rbp), %al
testb $0x1, %al
jne 0x41a2
jmp 0x4222
leaq 0x2a8e7(%rip), %rax     # 0x2ea90
imulq $0x28, -0x80(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3150
cmpq -0x70(%rbp), %rax
jne 0x420f
movq -0x40(%rbp), %rdi
addq $0x2, %rdi
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x70(%rbp), %rdx
callq 0x3160
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x420f
movb $0x1, -0x31(%rbp)
movq -0x30(%rbp), %rdi
movq -0x88(%rbp), %rsi
movq -0x78(%rbp), %rdx
xorl %ecx, %ecx
callq 0x4470
movl %eax, -0x44(%rbp)
jmp 0x4211
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
jmp 0x4177
jmp 0x4224
xorl %eax, %eax
cmpl -0x44(%rbp), %eax
jne 0x4231
movb $0x0, -0x1(%rbp)
jmp 0x428f
testb $0x1, -0x31(%rbp)
jne 0x4259
movq 0x2ad92(%rip), %rax     # 0x2efd0
movq (%rax), %rdi
movq -0x40(%rbp), %rdx
leaq 0x1f264(%rip), %rsi     # 0x234b0
movb $0x0, %al
callq 0x3470
movb $0x0, -0x1(%rbp)
jmp 0x428f
movl -0x44(%rbp), %eax
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
jmp 0x3fa6
movl -0x24(%rbp), %edx
movq -0x18(%rbp), %rax
movl (%rax), %ecx
subl %edx, %ecx
movl %ecx, (%rax)
movl -0x24(%rbp), %edx
movq -0x20(%rbp), %rax
movq (%rax), %rcx
movslq %edx, %rdx
shlq $0x3, %rdx
addq %rdx, %rcx
movq %rcx, (%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax)