// File: 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
movq %rsp, %rbp
subq $0xd0, %rsp
movw %dx, %ax
movw %si, %cx
movq %rdi, -0x10(%rbp)
movw %cx, -0x12(%rbp)
movw %ax, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0x32570
testb $0x1, %al
jne 0x18906
jmp 0x18a60
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x56d4c(%rip), %rdi     # 0x6f664
callq 0xd590
testb $0x1, %al
jne 0x18923
jmp 0x18934
movzwl -0x14(%rbp), %ecx
xorl %eax, %eax
subl %ecx, %eax
movw %ax, -0x2(%rbp)
jmp 0x19105
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x56d20(%rip), %rdi     # 0x6f666
callq 0xd590
testb $0x1, %al
jne 0x18951
jmp 0x18978
movl $0x8, %edi
callq 0x8200
movq %rax, %rdi
leaq 0x56d27(%rip), %rax     # 0x6f68c
movq %rax, (%rdi)
movq 0x855f9(%rip), %rsi     # 0x9df68
xorl %eax, %eax
movl %eax, %edx
callq 0x86e0
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x56cec(%rip), %rdi     # 0x6f676
callq 0xd590
testb $0x1, %al
jne 0x18995
jmp 0x189bc
movl $0x8, %edi
callq 0x8200
movq %rax, %rdi
leaq 0x56d15(%rip), %rax     # 0x6f6be
movq %rax, (%rdi)
movq 0x855b5(%rip), %rsi     # 0x9df68
xorl %eax, %eax
movl %eax, %edx
callq 0x86e0
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x56ca0(%rip), %rdi     # 0x6f66e
callq 0xd590
testb $0x1, %al
jne 0x189d9
jmp 0x189e9
movzwl -0x14(%rbp), %eax
xorl $-0x1, %eax
movw %ax, -0x2(%rbp)
jmp 0x19105
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x56c75(%rip), %rdi     # 0x6f670
callq 0xd590
testb $0x1, %al
jne 0x18a06
jmp 0x18a27
cmpw $0x0, -0x14(%rbp)
setne %dl
xorb $-0x1, %dl
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movw %ax, -0x2(%rbp)
jmp 0x19105
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x56c29(%rip), %rdi     # 0x6f662
callq 0xd590
testb $0x1, %al
jne 0x18a44
jmp 0x18a51
movzwl -0x14(%rbp), %eax
movw %ax, -0x2(%rbp)
jmp 0x19105
jmp 0x18a53
jmp 0x18a55
jmp 0x18a57
jmp 0x18a59
jmp 0x18a5b
jmp 0x1904f
movq -0xa8(%rbp), %rdi
callq 0x32590
testb $0x1, %al
jne 0x18a75
jmp 0x1904d
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x56bdb(%rip), %rdi     # 0x6f662
callq 0xd590
testb $0x1, %al
jne 0x18a92
jmp 0x18aa5
movzwl -0x12(%rbp), %eax
movzwl -0x14(%rbp), %ecx
addl %ecx, %eax
movw %ax, -0x2(%rbp)
jmp 0x19105
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x56bad(%rip), %rdi     # 0x6f664
callq 0xd590
testb $0x1, %al
jne 0x18ac2
jmp 0x18ad5
movzwl -0x12(%rbp), %eax
movzwl -0x14(%rbp), %ecx
subl %ecx, %eax
movw %ax, -0x2(%rbp)
jmp 0x19105
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x56b7f(%rip), %rdi     # 0x6f666
callq 0xd590
testb $0x1, %al
jne 0x18af2
jmp 0x18b06
movzwl -0x12(%rbp), %eax
movzwl -0x14(%rbp), %ecx
imull %ecx, %eax
movw %ax, -0x2(%rbp)
jmp 0x19105
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x56b50(%rip), %rdi     # 0x6f668
callq 0xd590
testb $0x1, %al
jne 0x18b26
jmp 0x18bd4
movzwl -0x14(%rbp), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x18bc0
leaq -0x39(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x8760
movq -0xb0(%rbp), %rdx
leaq 0x56b9b(%rip), %rsi     # 0x6f6ed
leaq -0x38(%rbp), %rdi
callq 0xced0
jmp 0x18b5d
movq -0xa8(%rbp), %rax
movl 0x8(%rax), %esi
leaq -0x38(%rbp), %rdi
callq 0x6d9e0
jmp 0x18b72
leaq -0x38(%rbp), %rdi
callq 0x8848
leaq -0x39(%rbp), %rdi
callq 0x8460
movw $0xffff, -0x2(%rbp)     # imm = 0xFFFF
jmp 0x19105
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x18bb2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x8848
leaq -0x39(%rbp), %rdi
callq 0x8460
jmp 0x19112
movzwl -0x12(%rbp), %eax
movzwl -0x14(%rbp), %ecx
cltd
idivl %ecx
movw %ax, -0x2(%rbp)
jmp 0x19105
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x56a84(%rip), %rdi     # 0x6f66a
callq 0xd590
testb $0x1, %al
jne 0x18bf4
jmp 0x18ca5
movzwl -0x14(%rbp), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x18c8e
leaq -0x71(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0x8760
movq -0xb8(%rbp), %rdx
leaq 0x56acd(%rip), %rsi     # 0x6f6ed
leaq -0x70(%rbp), %rdi
callq 0xced0
jmp 0x18c2b
movq -0xa8(%rbp), %rax
movl 0x8(%rax), %esi
leaq -0x70(%rbp), %rdi
callq 0x6d9e0
jmp 0x18c40
leaq -0x70(%rbp), %rdi
callq 0x8848
leaq -0x71(%rbp), %rdi
callq 0x8460
movw $0xffff, -0x2(%rbp)     # imm = 0xFFFF
jmp 0x19105
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x18c80
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x8848
leaq -0x71(%rbp), %rdi
callq 0x8460
jmp 0x19112
movzwl -0x12(%rbp), %eax
movzwl -0x14(%rbp), %ecx
cltd
idivl %ecx
movw %dx, %ax
movw %ax, -0x2(%rbp)
jmp 0x19105
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x569cb(%rip), %rdi     # 0x6f682
callq 0xd590
testb $0x1, %al
jne 0x18cc2
jmp 0x18ce9
movl $0x8, %edi
callq 0x8200
movq %rax, %rdi
leaq 0x56a37(%rip), %rax     # 0x6f70d
movq %rax, (%rdi)
movq 0x85288(%rip), %rsi     # 0x9df68
xorl %eax, %eax
movl %eax, %edx
callq 0x86e0
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x5697b(%rip), %rdi     # 0x6f676
callq 0xd590
testb $0x1, %al
jne 0x18d06
jmp 0x18d19
movzwl -0x12(%rbp), %eax
movzwl -0x14(%rbp), %ecx
andl %ecx, %eax
movw %ax, -0x2(%rbp)
jmp 0x19105
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x56948(%rip), %rdi     # 0x6f673
callq 0xd590
testb $0x1, %al
jne 0x18d36
jmp 0x18d49
movzwl -0x12(%rbp), %eax
movzwl -0x14(%rbp), %ecx
orl %ecx, %eax
movw %ax, -0x2(%rbp)
jmp 0x19105
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x56911(%rip), %rdi     # 0x6f66c
callq 0xd590
testb $0x1, %al
jne 0x18d66
jmp 0x18d79
movzwl -0x12(%rbp), %eax
movzwl -0x14(%rbp), %ecx
xorl %ecx, %eax
movw %ax, -0x2(%rbp)
jmp 0x19105
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x568e7(%rip), %rdi     # 0x6f672
callq 0xd590
testb $0x1, %al
jne 0x18d96
jmp 0x18dcf
movb $0x1, %al
cmpw $0x0, -0x12(%rbp)
movb %al, -0xb9(%rbp)
jne 0x18db3
cmpw $0x0, -0x14(%rbp)
setne %al
movb %al, -0xb9(%rbp)
movb -0xb9(%rbp), %dl
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movw %ax, -0x2(%rbp)
jmp 0x19105
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x56894(%rip), %rdi     # 0x6f675
callq 0xd590
testb $0x1, %al
jne 0x18dec
jmp 0x18e25
xorl %eax, %eax
cmpw $0x0, -0x12(%rbp)
movb %al, -0xba(%rbp)
je 0x18e09
cmpw $0x0, -0x14(%rbp)
setne %al
movb %al, -0xba(%rbp)
movb -0xba(%rbp), %dl
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movw %ax, -0x2(%rbp)
jmp 0x19105
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x56850(%rip), %rdi     # 0x6f687
callq 0xd590
testb $0x1, %al
jne 0x18e42
jmp 0x18e5f
movzwl -0x12(%rbp), %edx
movzwl -0x14(%rbp), %esi
xorl %eax, %eax
movl $0x1, %ecx
cmpl %esi, %edx
cmovll %ecx, %eax
movw %ax, -0x2(%rbp)
jmp 0x19105
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x56807(%rip), %rdi     # 0x6f678
callq 0xd590
testb $0x1, %al
jne 0x18e7c
jmp 0x18e99
movzwl -0x12(%rbp), %edx
movzwl -0x14(%rbp), %esi
xorl %eax, %eax
movl $0x1, %ecx
cmpl %esi, %edx
cmovlel %ecx, %eax
movw %ax, -0x2(%rbp)
jmp 0x19105
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x567df(%rip), %rdi     # 0x6f68a
callq 0xd590
testb $0x1, %al
jne 0x18eb6
jmp 0x18ed3
movzwl -0x12(%rbp), %edx
movzwl -0x14(%rbp), %esi
xorl %eax, %eax
movl $0x1, %ecx
cmpl %esi, %edx
cmovgl %ecx, %eax
movw %ax, -0x2(%rbp)
jmp 0x19105
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x56796(%rip), %rdi     # 0x6f67b
callq 0xd590
testb $0x1, %al
jne 0x18ef0
jmp 0x18f0d
movzwl -0x12(%rbp), %edx
movzwl -0x14(%rbp), %esi
xorl %eax, %eax
movl $0x1, %ecx
cmpl %esi, %edx
cmovgel %ecx, %eax
movw %ax, -0x2(%rbp)
jmp 0x19105
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x5675f(%rip), %rdi     # 0x6f67e
callq 0xd590
testb $0x1, %al
jne 0x18f2a
jmp 0x18f47
movzwl -0x12(%rbp), %edx
movzwl -0x14(%rbp), %esi
xorl %eax, %eax
movl $0x1, %ecx
cmpl %esi, %edx
cmovel %ecx, %eax
movw %ax, -0x2(%rbp)
jmp 0x19105
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x56728(%rip), %rdi     # 0x6f681
callq 0xd590
testb $0x1, %al
jne 0x18f64
jmp 0x18f81
movzwl -0x12(%rbp), %edx
movzwl -0x14(%rbp), %esi
xorl %eax, %eax
movl $0x1, %ecx
cmpl %esi, %edx
cmovnel %ecx, %eax
movw %ax, -0x2(%rbp)
jmp 0x19105
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x566f1(%rip), %rdi     # 0x6f684
callq 0xd590
testb $0x1, %al
jne 0x18f9e
jmp 0x18fc5
movl $0x8, %edi
callq 0x8200
movq %rax, %rdi
leaq 0x5678a(%rip), %rax     # 0x6f73c
movq %rax, (%rdi)
movq 0x84fac(%rip), %rsi     # 0x9df68
xorl %eax, %eax
movl %eax, %edx
callq 0x86e0
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x566af(%rip), %rdi     # 0x6f686
callq 0xd590
testb $0x1, %al
jne 0x18fe2
jmp 0x18ff5
movzwl -0x12(%rbp), %eax
movzwl -0x14(%rbp), %ecx
shll %cl, %eax
movw %ax, -0x2(%rbp)
jmp 0x19105
movq -0xa8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x56682(%rip), %rdi     # 0x6f689
callq 0xd590
testb $0x1, %al
jne 0x19012
jmp 0x19025
movzwl -0x12(%rbp), %eax
movzwl -0x14(%rbp), %ecx
sarl %cl, %eax
movw %ax, -0x2(%rbp)
jmp 0x19105
jmp 0x19027
jmp 0x19029
jmp 0x1902b
jmp 0x1902d
jmp 0x1902f
jmp 0x19031
jmp 0x19033
jmp 0x19035
jmp 0x19037
jmp 0x19039
jmp 0x1903b
jmp 0x1903d
jmp 0x1903f
jmp 0x19041
jmp 0x19043
jmp 0x19045
jmp 0x19047
jmp 0x19049
jmp 0x1904b
jmp 0x1904d
jmp 0x1904f
movb $0x1, -0x99(%rbp)
movl $0x20, %edi
callq 0x8200
movq -0xa8(%rbp), %rdx
movq %rax, -0xc8(%rbp)
addq $0x10, %rdx
leaq 0x566e5(%rip), %rsi     # 0x6f75e
leaq -0x98(%rbp), %rdi
callq 0xdc30
jmp 0x19087
movq -0xc8(%rbp), %rdi
leaq 0x566dc(%rip), %rdx     # 0x6f771
leaq -0x98(%rbp), %rsi
callq 0xe020
jmp 0x190a3
movq -0xc8(%rbp), %rdi
movb $0x0, -0x99(%rbp)
leaq 0x83f68(%rip), %rsi     # 0x9d020
movq 0x84eb1(%rip), %rdx     # 0x9df70
callq 0x86e0
jmp 0x1911b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x190ec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x8848
testb $0x1, -0x99(%rbp)
jne 0x190f7
jmp 0x19103
movq -0xc8(%rbp), %rdi
callq 0x8320
jmp 0x19112
movw -0x2(%rbp), %ax
addq $0xd0, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x8750
nopl (%rax,%rax)