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

    for (int i = 0; i < NUM_OPERATORS; ++i)
    {
        if (strncmp(buffer->str, OPERATORS[i].rus_name, OPERATORS[i].rus_len) == 0)
        {
            VALUE.op = i;
            TYPE     = TYPE_OP;
            STR      = buffer->str;

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

        if (OPERATORS[i].eng_name != nullptr)
        {
            if (strncmp(buffer->str, OPERATORS[i].eng_name, OPERATORS[i].eng_len) == 0)
            {
                VALUE.op = i;
                TYPE     = TYPE_OP;
                STR      = buffer->str;

                buffer->str += OPERATORS[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 0x690d
jmp 0x692c
leaq 0x4e2a(%rip), %rdi      # 0xb73e
leaq 0x4af6(%rip), %rsi      # 0xb411
movl $0xd0, %edx
leaq 0x4cdd(%rip), %rcx      # 0xb604
callq 0x20a0
cmpq $0x0, -0x18(%rbp)
je 0x6935
jmp 0x6954
leaq 0x43dd(%rip), %rdi      # 0xad19
leaq 0x4ace(%rip), %rsi      # 0xb411
movl $0xd1, %edx
leaq 0x4cb5(%rip), %rcx      # 0xb604
callq 0x20a0
cmpq $0x0, -0x20(%rbp)
je 0x695d
jmp 0x697c
leaq 0x4979(%rip), %rdi      # 0xb2dd
leaq 0x4aa6(%rip), %rsi      # 0xb411
movl $0xd2, %edx
leaq 0x4c8d(%rip), %rcx      # 0xb604
callq 0x20a0
movl $0x0, -0x24(%rbp)
cmpl $0x19, -0x24(%rbp)
jge 0x6b28
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movslq -0x24(%rbp), %rcx
leaq 0x9101(%rip), %rax      # 0xfaa0
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rsi
movslq -0x24(%rbp), %rcx
leaq 0x90ec(%rip), %rax      # 0xfaa0
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdx
callq 0x2080
cmpl $0x0, %eax
jne 0x6a44
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 $0x2, (%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 0x9088(%rip), %rax      # 0xfaa0
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 0x6b2c
movslq -0x24(%rbp), %rcx
leaq 0x9051(%rip), %rax      # 0xfaa0
shlq $0x5, %rcx
addq %rcx, %rax
cmpq $0x0, 0x10(%rax)
je 0x6b18
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movslq -0x24(%rbp), %rcx
leaq 0x902d(%rip), %rax      # 0xfaa0
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rsi
movslq -0x24(%rbp), %rcx
leaq 0x9017(%rip), %rax      # 0xfaa0
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rdx
callq 0x2080
cmpl $0x0, %eax
jne 0x6b16
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 $0x2, (%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 0x8fb3(%rip), %rax      # 0xfaa0
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 0x6b2c
jmp 0x6b18
jmp 0x6b1a
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x6983
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)