// File: /workspace/github_cpp_makefile_star2_O3/rfotino[P]consolite-compiler/src/syntax.cpp
// Function: OperatorToken::operate(unsigned short, unsigned short) const
uint16_t OperatorToken::operate(uint16_t lhs, uint16_t rhs) const {
  if (isUnary()) {
    if ("-" == _op) {
      return -rhs;
    } else if ("*" == _op) {
      throw "Dereferencing not allowed in constant expression.";
    } else if ("&" == _op) {
      throw "Address-of not allowed in constant expression.";
    } else if ("~" == _op) {
      return ~rhs;
    } else if ("!" == _op) {
      return !rhs ? 1 : 0;
    } else if ("+" == _op) {
      return +rhs;
    }
  } else if (isBinary()) {
    if ("+" == _op) {
      return lhs + rhs;
    } else if ("-" == _op) {
      return lhs - rhs;
    } else if ("*" == _op) {
      return lhs * rhs;
    } else if ("/" == _op) {
      if (0 == rhs) {
        _warn("Division by zero in expression.", _lineNum);
        return 0xffff;
      }
      return lhs / rhs;
    } else if ("%" == _op) {
      if (0 == rhs) {
        _warn("Division by zero in expression.", _lineNum);
        return 0xffff;
      }
      return lhs % rhs;
    } else if ("=" == _op) {
      throw "Assignment not allowed in constant expression.";
    } else if ("&" == _op) {
      return lhs & rhs;
    } else if ("|" == _op) {
      return lhs | rhs;
    } else if ("^" == _op) {
      return lhs ^ rhs;
    } else if ("||" == _op) {
      return lhs || rhs ? 1 : 0;
    } else if ("&&" == _op) {
      return lhs && rhs ? 1 : 0;
    } else if ("<" == _op) {
      return lhs < rhs ? 1 : 0;
    } else if ("<=" == _op) {
      return lhs <= rhs ? 1 : 0;
    } else if (">" == _op) {
      return lhs > rhs ? 1 : 0;
    } else if (">=" == _op) {
      return lhs >= rhs ? 1 : 0;
    } else if ("==" == _op) {
      return lhs == rhs ? 1 : 0;
    } else if ("!=" == _op) {
      return lhs != rhs ? 1 : 0;
    } else if ("[" == _op) {
      throw "Array indexing not yet supported.";
    } else if ("<<" == _op) {
      return lhs << rhs;
    } else if (">>" == _op) {
      return lhs >> rhs;
    }
  }
  throw "Invalid operator '" + _op + "' in expression.";
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movl %edx, %ebx
leaq 0x10(%rdi), %r14
cmpb $0x0, 0x30(%rdi)
je 0xe631
movl %esi, %ebp
movq %rdi, %r15
leaq 0x27172(%rip), %rsi     # 0x355d2
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
je 0xe70b
leaq 0x2715d(%rip), %rsi     # 0x355d4
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
je 0xe719
leaq 0x27148(%rip), %rsi     # 0x355d6
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
je 0xe729
leaq 0x27133(%rip), %rsi     # 0x355d8
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
je 0xe740
leaq 0x2711e(%rip), %rsi     # 0x355da
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
je 0xe753
leaq 0x2711f(%rip), %rsi     # 0x355f2
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
je 0xe8a3
leaq 0x270fc(%rip), %rsi     # 0x355e6
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
je 0xe766
leaq 0x270e2(%rip), %rsi     # 0x355e3
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
je 0xe79e
leaq 0x270c4(%rip), %rsi     # 0x355dc
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
je 0xe7ee
leaq 0x270b3(%rip), %rsi     # 0x355e2
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
je 0xe7f2
leaq 0x2709f(%rip), %rsi     # 0x355e5
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
je 0xe7ff
leaq 0x2709a(%rip), %rsi     # 0x355f7
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
je 0xe81d
leaq 0x27074(%rip), %rsi     # 0x355e8
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
je 0xe82a
leaq 0x2706f(%rip), %rsi     # 0x355fa
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
je 0xe837
leaq 0x27049(%rip), %rsi     # 0x355eb
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
je 0xe844
leaq 0x27035(%rip), %rsi     # 0x355ee
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
je 0xe851
leaq 0x27021(%rip), %rsi     # 0x355f1
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
je 0xe85b
leaq 0x2700d(%rip), %rsi     # 0x355f4
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
je 0xe8b6
leaq 0x26ff8(%rip), %rsi     # 0x355f6
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
je 0xe862
leaq 0x26fe4(%rip), %rsi     # 0x355f9
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
jne 0xe6bb
movzwl %bp, %eax
movl %ebx, %ecx
shrl %cl, %eax
jmp 0xe739
leaq 0x26f9c(%rip), %rsi     # 0x355d4
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
je 0xe712
leaq 0x26f87(%rip), %rsi     # 0x355d6
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
je 0xe86b
leaq 0x26f80(%rip), %rsi     # 0x355e6
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
je 0xe87e
leaq 0x26f61(%rip), %rsi     # 0x355de
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
je 0xe722
leaq 0x26f4c(%rip), %rsi     # 0x355e0
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
je 0xe731
leaq 0x26f27(%rip), %rsi     # 0x355d2
movq %r14, %rdi
callq 0x70c0
testl %eax, %eax
je 0xe810
movl $0x20, %edi
callq 0x7170
movq %rax, %r15
leaq 0x26fff(%rip), %rsi     # 0x356ce
leaq 0x8(%rsp), %rdi
movq %r14, %rdx
callq 0xb692
movb $0x1, %bpl
leaq 0x26ffb(%rip), %rdx     # 0x356e1
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x21864
xorl %ebp, %ebp
leaq 0x3791c(%rip), %rsi     # 0x46018
movq 0x3885d(%rip), %rdx     # 0x46f60
movq %r15, %rdi
callq 0x74c0
addl %ebp, %ebx
jmp 0xe810
negl %ebx
jmp 0xe810
subl %ebx, %ebp
movl %ebp, %ebx
jmp 0xe810
notl %ebx
jmp 0xe810
imull %ebp, %ebx
jmp 0xe810
xorl %eax, %eax
testw %bx, %bx
sete %al
movl %eax, %ebx
jmp 0xe810
testw %bx, %bx
je 0xe76d
movl %ebp, %eax
xorl %edx, %edx
divw %bx
movl %eax, %ebx
jmp 0xe810
testw %bx, %bx
je 0xe7a2
movl %ebp, %eax
xorl %edx, %edx
divw %bx
movl %edx, %ebx
jmp 0xe810
andl %ebp, %ebx
jmp 0xe810
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x26ee0(%rip), %rsi     # 0x3565d
leaq 0x26ef8(%rip), %rdx     # 0x3567c
leaq 0x8(%rsp), %rdi
callq 0xbdee
movl 0x8(%r15), %esi
leaq 0x8(%rsp), %rdi
callq 0x34217
jmp 0xe7d1
orl %ebp, %ebx
jmp 0xe810
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x26eab(%rip), %rsi     # 0x3565d
leaq 0x26ec3(%rip), %rdx     # 0x3567c
leaq 0x8(%rsp), %rdi
callq 0xbdee
movl 0x8(%r15), %esi
leaq 0x8(%rsp), %rdi
callq 0x34217
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0xe7e8
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x72c0
movw $0xffff, %bx            # imm = 0xFFFF
jmp 0xe810
xorl %ebp, %ebx
jmp 0xe810
xorl %eax, %eax
orw %bp, %bx
setne %al
jmp 0xe739
testw %bp, %bp
setne %al
testw %bx, %bx
setne %cl
andb %al, %cl
movzbl %cl, %ebx
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
cmpw %bx, %bp
setb %al
jmp 0xe739
xorl %eax, %eax
cmpw %bx, %bp
setbe %al
jmp 0xe739
xorl %eax, %eax
cmpw %bx, %bp
seta %al
jmp 0xe739
xorl %eax, %eax
cmpw %bx, %bp
setae %al
jmp 0xe739
xorl %eax, %eax
cmpw %bx, %bp
jmp 0xe736
xorl %eax, %eax
cmpw %bx, %bp
jmp 0xe7f7
movl %ebx, %ecx
shll %cl, %ebp
jmp 0xe71b
movl $0x8, %edi
callq 0x7170
leaq 0x26d80(%rip), %rcx     # 0x355fc
jmp 0xe88f
movl $0x8, %edi
callq 0x7170
leaq 0x26d9f(%rip), %rcx     # 0x3562e
movq %rcx, (%rax)
movq 0x386cf(%rip), %rsi     # 0x46f68
movq %rax, %rdi
xorl %edx, %edx
callq 0x74c0
movl $0x8, %edi
callq 0x7170
leaq 0x26dc9(%rip), %rcx     # 0x3567d
jmp 0xe88f
movl $0x8, %edi
callq 0x7170
leaq 0x26de5(%rip), %rcx     # 0x356ac
jmp 0xe88f
jmp 0xe8cd
jmp 0xe8e9
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0xe91e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x72c0
jmp 0xe91e
movq %rax, %rbx
jmp 0xe91e
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xe90c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x72c0
testb %bpl, %bpl
jne 0xe916
jmp 0xe91e
movq %rax, %rbx
movq %r15, %rdi
callq 0x7220
movq %rbx, %rdi
callq 0x74f0