// File: Lut99[P]RayTracer/src/lib/include/cxxopts.hpp
// Function: void cxxopts::values::integer_parser<unsigned int>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned int&)
void
    integer_parser(const std::string& text, T& value)
    {
      std::smatch match;
      std::regex_match(text, match, integer_pattern);

      if (match.length() == 0)
      {
        throw_or_mimic<argument_incorrect_type>(text);
      }

      if (match.length(4) > 0)
      {
        value = 0;
        return;
      }

      using US = typename std::make_unsigned<T>::type;

      constexpr bool is_signed = std::numeric_limits<T>::is_signed;
      const bool negative = match.length(1) > 0;
      const uint8_t base = match.length(2) > 0 ? 16 : 10;

      auto value_match = match[3];

      US result = 0;

      for (auto iter = value_match.first; iter != value_match.second; ++iter)
      {
        US digit = 0;

        if (*iter >= '0' && *iter <= '9')
        {
          digit = static_cast<US>(*iter - '0');
        }
        else if (base == 16 && *iter >= 'a' && *iter <= 'f')
        {
          digit = static_cast<US>(*iter - 'a' + 10);
        }
        else if (base == 16 && *iter >= 'A' && *iter <= 'F')
        {
          digit = static_cast<US>(*iter - 'A' + 10);
        }
        else
        {
          throw_or_mimic<argument_incorrect_type>(text);
        }

        const US next = static_cast<US>(result * base + digit);
        if (result > next)
        {
          throw_or_mimic<argument_incorrect_type>(text);
        }

        result = next;
      }

      detail::check_signed_range<T>(negative, result, text);

      if (negative)
      {
        value = checked_negate<T>(result,
          text,
          std::integral_constant<bool, is_signed>());
      }
      else
      {
        value = static_cast<T>(result);
      }
    }

// Assembly:
subq $0xb8, %rsp
movq %rdi, 0xb0(%rsp)
movq %rsi, 0xa8(%rsp)
leaq 0x88(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x115060
movq 0x30(%rsp), %rsi
movq 0xb0(%rsp), %rdi
leaq 0x98203(%rip), %rdx     # 0x1acf40
xorl %ecx, %ecx
callq 0x1150a0
jmp 0x114d46
xorl %eax, %eax
movl %eax, %esi
leaq 0x88(%rsp), %rdi
callq 0x115100
movq %rax, 0x28(%rsp)
jmp 0x114d5e
movq 0x28(%rsp), %rax
cmpq $0x0, %rax
jne 0x114d9d
movq 0xb0(%rsp), %rdi
callq 0x115130
jmp 0x114d78
jmp 0x114d9d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x80(%rsp)
movl %eax, 0x7c(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x1152e0
jmp 0x115044
leaq 0x88(%rsp), %rdi
movl $0x4, %esi
callq 0x115100
movq %rax, 0x20(%rsp)
jmp 0x114db6
movq 0x20(%rsp), %rax
cmpq $0x0, %rax
jle 0x114ddc
movq 0xa8(%rsp), %rax
movl $0x0, (%rax)
movl $0x1, 0x78(%rsp)
jmp 0x11502f
movb $0x0, 0x77(%rsp)
leaq 0x88(%rsp), %rdi
movl $0x1, %esi
callq 0x115100
movq %rax, 0x18(%rsp)
jmp 0x114dfa
movq 0x18(%rsp), %rax
testq %rax, %rax
setg 0x76(%rsp)
leaq 0x88(%rsp), %rdi
movl $0x2, %esi
callq 0x115100
movq %rax, 0x10(%rsp)
jmp 0x114e20
movq 0x10(%rsp), %rax
testq %rax, %rax
movl $0x10, %ecx
movl $0xa, %eax
cmovgl %ecx, %eax
movb %al, 0x75(%rsp)
leaq 0x88(%rsp), %rdi
movl $0x3, %esi
callq 0x1151a0
movq %rax, 0x8(%rsp)
jmp 0x114e52
movq 0x8(%rsp), %rax
movq (%rax), %rcx
movq %rcx, 0x58(%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x60(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x68(%rsp)
movl $0x0, 0x54(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x48(%rsp)
leaq 0x58(%rsp), %rsi
addq $0x8, %rsi
leaq 0x48(%rsp), %rdi
callq 0x115210
testb $0x1, %al
jne 0x114e9f
jmp 0x114fcd
movl $0x0, 0x44(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x115250
movsbl (%rax), %eax
cmpl $0x30, %eax
jl 0x114ee4
leaq 0x48(%rsp), %rdi
callq 0x115250
movsbl (%rax), %eax
cmpl $0x39, %eax
jg 0x114ee4
leaq 0x48(%rsp), %rdi
callq 0x115250
movsbl (%rax), %eax
subl $0x30, %eax
movl %eax, 0x44(%rsp)
jmp 0x114f87
movzbl 0x75(%rsp), %eax
cmpl $0x10, %eax
jne 0x114f2b
leaq 0x48(%rsp), %rdi
callq 0x115250
movsbl (%rax), %eax
cmpl $0x61, %eax
jl 0x114f2b
leaq 0x48(%rsp), %rdi
callq 0x115250
movsbl (%rax), %eax
cmpl $0x66, %eax
jg 0x114f2b
leaq 0x48(%rsp), %rdi
callq 0x115250
movsbl (%rax), %eax
subl $0x61, %eax
addl $0xa, %eax
movl %eax, 0x44(%rsp)
jmp 0x114f85
movzbl 0x75(%rsp), %eax
cmpl $0x10, %eax
jne 0x114f72
leaq 0x48(%rsp), %rdi
callq 0x115250
movsbl (%rax), %eax
cmpl $0x41, %eax
jl 0x114f72
leaq 0x48(%rsp), %rdi
callq 0x115250
movsbl (%rax), %eax
cmpl $0x46, %eax
jg 0x114f72
leaq 0x48(%rsp), %rdi
callq 0x115250
movsbl (%rax), %eax
subl $0x41, %eax
addl $0xa, %eax
movl %eax, 0x44(%rsp)
jmp 0x114f83
movq 0xb0(%rsp), %rdi
callq 0x115130
jmp 0x114f81
jmp 0x114f83
jmp 0x114f85
jmp 0x114f87
movl 0x54(%rsp), %eax
movzbl 0x75(%rsp), %ecx
imull %ecx, %eax
addl 0x44(%rsp), %eax
movl %eax, 0x40(%rsp)
movl 0x54(%rsp), %eax
cmpl 0x40(%rsp), %eax
jbe 0x114fb6
movq 0xb0(%rsp), %rdi
callq 0x115130
jmp 0x114fb4
jmp 0x114fb6
movl 0x40(%rsp), %eax
movl %eax, 0x54(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x115260
jmp 0x114e83
movl 0x54(%rsp), %esi
movq 0xb0(%rsp), %rdx
movzbl 0x76(%rsp), %edi
andl $0x1, %edi
callq 0x115280
jmp 0x114fe8
testb $0x1, 0x76(%rsp)
je 0x115019
movq 0xb0(%rsp), %rsi
leaq 0x54(%rsp), %rdi
callq 0x1152c0
movq %rax, (%rsp)
jmp 0x115007
movq (%rsp), %rax
movl (%rax), %ecx
movq 0xa8(%rsp), %rax
movl %ecx, (%rax)
jmp 0x115027
movl 0x54(%rsp), %ecx
movq 0xa8(%rsp), %rax
movl %ecx, (%rax)
movl $0x0, 0x78(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x1152e0
addq $0xb8, %rsp
retq
movq 0x80(%rsp), %rdi
callq 0xd0a10
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)