// File: /workspace/github_cpp_makefile_star2_O2/rfotino[P]consolite-compiler/src/syntax.cpp
// Function: LiteralToken::parse(AtomToken const&)
bool LiteralToken::parse(const AtomToken& token) {
  _lineNum = token.line();
  if (std::regex_match(token.str(), std::regex("^0[xX][0-9a-fA-F]+$"))) {
    // Matched hex
    _value = 0;
    for (size_t i = 2; i < token.str().size(); i++) {
      char c = token.str().at(i);
      uint8_t hexVal =
        ('0' <= c && c <= '9') ? (c - '0') :
        ('a' <= c && c <= 'f') ? (c - 'a' + 10) : (c - 'A' + 10);
      _value = (_value * 16) + hexVal;
    }
  } else if (std::regex_match(token.str(), std::regex("^0[bB][01]+$"))) {
    // Matched binary
    _value = 0;
    for (size_t i = 2; i < token.str().size(); i++) {
      _value = (_value * 2) + (token.str().at(i) - '0');
    }
  } else if (std::regex_match(token.str(), std::regex("^[0-9]+$"))) {
    // Matched decimal
    _value = 0;
    for (size_t i = 0; i < token.str().size(); i++) {
      char c = token.str().at(i);
      uint8_t decVal = c - '0';
      _value = (_value * 10) + decVal;
    }
  } else {
    return false;
  }
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movl 0x8(%rsi), %eax
movl %eax, 0x8(%rdi)
addq $0x10, %rbx
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x73e0
leaq 0x1dff2(%rip), %rsi     # 0x295a8
leaq 0x28(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x18254
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
xorl %edx, %edx
callq 0x1823d
movl %eax, %ebp
leaq 0x28(%rsp), %rdi
callq 0x182ba
leaq 0x8(%rsp), %rdi
callq 0x75c8
testb %bpl, %bpl
je 0xb677
andw $0x0, 0xc(%r14)
pushq $0x2
popq %r15
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x73e0
movq 0x10(%rsp), %r13
movq %r12, %rdi
callq 0x75c8
cmpq %r13, %r15
jae 0xb7dd
movq %r12, %rdi
movq %rbx, %rsi
callq 0x73e0
movq %r12, %rdi
movq %r15, %rsi
callq 0x7590
movb (%rax), %r13b
movq %r12, %rdi
callq 0x75c8
leal -0x30(%r13), %eax
cmpb $0xa, %al
jb 0xb661
leal -0x61(%r13), %eax
cmpb $0x5, %al
ja 0xb65a
addb $-0x57, %r13b
jmp 0xb65e
addb $-0x37, %r13b
movl %r13d, %eax
movl 0xc(%r14), %ecx
shll $0x4, %ecx
movzbl %al, %eax
addl %ecx, %eax
movw %ax, 0xc(%r14)
incq %r15
jmp 0xb602
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x73e0
leaq 0x1df31(%rip), %rsi     # 0x295bc
leaq 0x28(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x18254
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
xorl %edx, %edx
callq 0x1823d
movl %eax, %ebp
leaq 0x28(%rsp), %rdi
callq 0x182ba
leaq 0x8(%rsp), %rdi
callq 0x75c8
testb %bpl, %bpl
je 0xb72b
andw $0x0, 0xc(%r14)
pushq $0x2
popq %r15
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x73e0
movq 0x10(%rsp), %r13
movq %r12, %rdi
callq 0x75c8
cmpq %r13, %r15
jae 0xb7dd
movzwl 0xc(%r14), %r13d
movq %r12, %rdi
movq %rbx, %rsi
callq 0x73e0
movq %r12, %rdi
movq %r15, %rsi
callq 0x7590
movsbl (%rax), %eax
leal (%rax,%r13,2), %eax
addl $-0x30, %eax
movw %ax, 0xc(%r14)
movq %r12, %rdi
callq 0x75c8
incq %r15
jmp 0xb6d3
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x73e0
leaq 0x1de8a(%rip), %rsi     # 0x295c9
leaq 0x28(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x18254
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
xorl %edx, %edx
callq 0x1823d
movl %eax, %ebp
leaq 0x28(%rsp), %rdi
callq 0x182ba
leaq 0x8(%rsp), %rdi
callq 0x75c8
testb %bpl, %bpl
je 0xb7ee
andw $0x0, 0xc(%r14)
xorl %r15d, %r15d
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x73e0
movq 0x10(%rsp), %r13
movq %r12, %rdi
callq 0x75c8
cmpq %r13, %r15
jae 0xb7dd
movq %r12, %rdi
movq %rbx, %rsi
callq 0x73e0
movq %r12, %rdi
movq %r15, %rsi
callq 0x7590
movb (%rax), %bpl
movq %r12, %rdi
callq 0x75c8
addb $-0x30, %bpl
imull $0xa, 0xc(%r14), %eax
movzbl %bpl, %ecx
addl %eax, %ecx
movw %cx, 0xc(%r14)
incq %r15
jmp 0xb786
movb $0x1, %al
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0xb7df
jmp 0xb7fa
jmp 0xb80f
jmp 0xb7fa
jmp 0xb80f
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x182ba
jmp 0xb812
jmp 0xb80f
jmp 0xb80f
jmp 0xb80f
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x75c8
movq %rbx, %rdi
callq 0x7510