// File: vssense[P]Compiler/src/front-end/parser.cpp
// Function: GetNumber(Token*, unsigned long*, Buffer*)
bool GetNumber(Token* tokens, size_t* ofs, Buffer* buffer)
{
    assert(tokens);
    assert(ofs);
    assert(buffer);

    for (int i = 0; i < NUM_DIGITS; ++i)
    {
        if (strncmp(buffer->str, DIGITS[i].rus_digit, DIGITS[i].rus_len) == 0)
        {
            VALUE.number = i;
            TYPE         = TYPE_NUMB;
            STR          = buffer->str;

            buffer->str += DIGITS[i].rus_len;
            (*ofs)++;
            return true;
        }

        if (strncmp(buffer->str, DIGITS[i].eng_digit, DIGITS[i].eng_len) == 0)
        {
            VALUE.number = i;
            TYPE         = TYPE_NUMB;
            STR          = buffer->str;

            buffer->str += DIGITS[i].eng_len;
            (*ofs)++;
            return true;
        }
    }

    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x66dd
jmp 0x66fc
leaq 0x505a(%rip), %rdi      # 0xb73e
leaq 0x4d26(%rip), %rsi      # 0xb411
movl $0xae, %edx
leaq 0x4ee1(%rip), %rcx      # 0xb5d8
callq 0x20a0
cmpq $0x0, -0x18(%rbp)
je 0x6705
jmp 0x6724
leaq 0x460d(%rip), %rdi      # 0xad19
leaq 0x4cfe(%rip), %rsi      # 0xb411
movl $0xaf, %edx
leaq 0x4eb9(%rip), %rcx      # 0xb5d8
callq 0x20a0
cmpq $0x0, -0x20(%rbp)
je 0x672d
jmp 0x674c
leaq 0x4ba9(%rip), %rdi      # 0xb2dd
leaq 0x4cd6(%rip), %rsi      # 0xb411
movl $0xb0, %edx
leaq 0x4e91(%rip), %rcx      # 0xb5d8
callq 0x20a0
movl $0x0, -0x24(%rbp)
cmpl $0xb, -0x24(%rbp)
jge 0x68d9
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movslq -0x24(%rbp), %rcx
leaq 0x91d1(%rip), %rax      # 0xf940
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rsi
movslq -0x24(%rbp), %rcx
leaq 0x91bc(%rip), %rax      # 0xf940
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdx
callq 0x2080
cmpl $0x0, %eax
jne 0x6814
movl -0x24(%rbp), %ecx
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rdx
imulq $0x18, (%rdx), %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
imulq $0x18, (%rcx), %rcx
addq %rcx, %rax
movl $0x0, (%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rdx
imulq $0x18, (%rdx), %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movslq -0x24(%rbp), %rcx
leaq 0x9158(%rip), %rax      # 0xf940
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rcx
movq -0x20(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movb $0x1, -0x1(%rbp)
jmp 0x68dd
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movslq -0x24(%rbp), %rcx
leaq 0x911a(%rip), %rax      # 0xf940
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rsi
movslq -0x24(%rbp), %rcx
leaq 0x9104(%rip), %rax      # 0xf940
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rdx
callq 0x2080
cmpl $0x0, %eax
jne 0x68c9
movl -0x24(%rbp), %ecx
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rdx
imulq $0x18, (%rdx), %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
imulq $0x18, (%rcx), %rcx
addq %rcx, %rax
movl $0x0, (%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rdx
imulq $0x18, (%rdx), %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movslq -0x24(%rbp), %rcx
leaq 0x90a0(%rip), %rax      # 0xf940
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rcx
movq -0x20(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movb $0x1, -0x1(%rbp)
jmp 0x68dd
jmp 0x68cb
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x6753
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)