// File: /workspace/github_cpp_makefile_star2_O2/rfotino[P]consolite-compiler/src/syntax.cpp
// Function: ExprToken::_validate()
bool ExprToken::_validate() {
  std::stack<std::string> operands;
  for (auto token : _postfix) {
    auto op = std::dynamic_pointer_cast<OperatorToken>(token);
    if (std::dynamic_pointer_cast<LiteralToken>(token) ||
        std::dynamic_pointer_cast<FunctionCallToken>(token)) {
      operands.push("rvalue");
    } else if (std::dynamic_pointer_cast<GlobalVarToken>(token) ||
               std::dynamic_pointer_cast<ParamToken>(token) ||
               std::dynamic_pointer_cast<LocalVarToken>(token)) {
      operands.push("lvalue");
    } else if (nullptr != op) {
      std::string rhs = operands.top();
      operands.pop();
      std::string lhs;
      if (op->isBinary()) {
        lhs = operands.top();
        operands.pop();
      }
      std::string result;
      if ("=" == op->str()) {
        if ("rvalue" == lhs) {
          _error("Can't assign to an rvalue in expression.", op->line());
          return false;
        }
        result = "rvalue";
      } else if ("*" == op->str() && op->isUnary()) {
        result = "lvalue";
      } else if ("&" == op->str() && op->isUnary()) {
        if ("lvalue" != rhs) {
          _error("Can't get address of an rvalue in expression.",
                 op->line());
          return false;
        }
        result = "rvalue";
      } else if ("[" == op->str()) {
        result = "lvalue";
      } else {
        result = "rvalue";
      }
      operands.push(result);
    }
  }
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdi, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x9bde
movq 0x10(%rbx), %r15
movq 0x18(%rbx), %rax
movq %rax, 0x70(%rsp)
leaq 0x68(%rsp), %r12
leaq 0x60(%rsp), %rbp
leaq 0x78(%rsp), %r14
leaq 0x98(%rsp), %r13
leaq 0x20(%rsp), %rbx
cmpq 0x70(%rsp), %r15
je 0x10453
movq %rbp, %rdi
movq %r15, %rsi
callq 0x18b56
leaq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0x183d8
movq %r14, %rdi
movq %rbp, %rsi
callq 0x1845a
cmpq $0x0, 0x78(%rsp)
je 0x10059
leaq 0x80(%rsp), %rdi
callq 0x7a34
jmp 0x1008c
leaq 0x40(%rsp), %rdi
movq %rbp, %rsi
callq 0x184af
movq 0x40(%rsp), %r12
leaq 0x48(%rsp), %rdi
callq 0x7a34
leaq 0x80(%rsp), %rdi
callq 0x7a34
testq %r12, %r12
leaq 0x68(%rsp), %r12
je 0x100d3
movq %r14, %rdi
leaq 0x1988d(%rip), %rsi     # 0x29923
leaq 0x40(%rsp), %rdx
callq 0x9502
leaq 0xb8(%rsp), %rdi
movq %r14, %rsi
callq 0x24caa
movq %r14, %rdi
callq 0x75c8
leaq 0x18(%rsp), %rdi
callq 0x7a34
movq %r12, %rdi
callq 0x7a34
addq $0x10, %r15
jmp 0x10014
movq %r14, %rdi
movq %rbp, %rsi
callq 0x18504
cmpq $0x0, 0x78(%rsp)
jne 0x10105
leaq 0x40(%rsp), %rdi
movq %rbp, %rsi
callq 0x18559
cmpq $0x0, 0x40(%rsp)
je 0x1013b
leaq 0x48(%rsp), %rdi
callq 0x7a34
leaq 0x80(%rsp), %rdi
callq 0x7a34
movq %r14, %rdi
leaq 0x1980e(%rip), %rsi     # 0x2992a
leaq 0x40(%rsp), %rdx
callq 0x9502
leaq 0xb8(%rsp), %rdi
movq %r14, %rsi
callq 0x24caa
jmp 0x100b0
movq %r13, %rdi
movq %rbp, %rsi
callq 0x185ae
movq 0x98(%rsp), %r12
leaq 0xa0(%rsp), %rdi
callq 0x7a34
leaq 0x48(%rsp), %rdi
callq 0x7a34
leaq 0x80(%rsp), %rdi
callq 0x7a34
testq %r12, %r12
leaq 0x68(%rsp), %r12
jne 0x10112
cmpq $0x0, 0x10(%rsp)
je 0x100b8
movq 0xe8(%rsp), %rsi
cmpq 0xf0(%rsp), %rsi
jne 0x101ae
movq 0x100(%rsp), %rax
movq -0x8(%rax), %rsi
movl $0x200, %eax            # imm = 0x200
addq %rax, %rsi
addq $-0x20, %rsi
movq %r14, %rdi
callq 0x73e0
leaq 0xb8(%rsp), %rdi
callq 0x25368
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
andq $0x0, 0x48(%rsp)
movb $0x0, 0x50(%rsp)
movq 0x10(%rsp), %rsi
cmpb $0x1, 0x30(%rsi)
jne 0x1022d
movq 0xe8(%rsp), %rsi
cmpq 0xf0(%rsp), %rsi
jne 0x1020d
movq 0x100(%rsp), %rax
movq -0x8(%rax), %rsi
movl $0x200, %eax            # imm = 0x200
addq %rax, %rsi
addq $-0x20, %rsi
leaq 0x40(%rsp), %rdi
callq 0x71c0
leaq 0xb8(%rsp), %rdi
callq 0x25368
movq 0x10(%rsp), %rsi
leaq 0xa8(%rsp), %rax
movq %rax, 0x98(%rsp)
andq $0x0, 0xa0(%rsp)
movb $0x0, 0xa8(%rsp)
addq $0x10, %rsi
movq %rbx, %rdi
callq 0x73e0
leaq 0x19391(%rip), %rdi     # 0x295f2
leaq 0x20(%rsp), %rsi
callq 0x97dd
movb %al, 0xe(%rsp)
leaq 0x20(%rsp), %rdi
callq 0x75c8
cmpb $0x0, 0xe(%rsp)
je 0x102a5
leaq 0x1969c(%rip), %rdi     # 0x29923
leaq 0x40(%rsp), %rsi
callq 0x97dd
leaq 0x1968b(%rip), %rsi     # 0x29923
testb %al, %al
je 0x103b5
jmp 0x103ee
movq 0x10(%rsp), %rsi
addq $0x10, %rsi
leaq 0x20(%rsp), %rdi
callq 0x73e0
leaq 0x19317(%rip), %rdi     # 0x295d6
leaq 0x20(%rsp), %rsi
callq 0x97dd
testb %al, %al
je 0x102f6
movq 0x10(%rsp), %rax
movb 0x30(%rax), %r12b
leaq 0x20(%rsp), %rdi
callq 0x75c8
leaq 0x19643(%rip), %rsi     # 0x2992a
testb %r12b, %r12b
leaq 0x68(%rsp), %r12
jne 0x10300
jmp 0x103b5
leaq 0x20(%rsp), %rdi
callq 0x75c8
movq 0x10(%rsp), %rsi
addq $0x10, %rsi
movq %rbx, %rdi
callq 0x73e0
leaq 0x192ce(%rip), %rdi     # 0x295e6
leaq 0x20(%rsp), %rsi
callq 0x97dd
testb %al, %al
je 0x10362
movq 0x10(%rsp), %rax
movb 0x30(%rax), %r12b
leaq 0x20(%rsp), %rdi
callq 0x75c8
testb %r12b, %r12b
leaq 0x68(%rsp), %r12
jne 0x1036c
leaq 0x195e0(%rip), %rdi     # 0x2992a
movq %r14, %rsi
callq 0x9976
leaq 0x195ca(%rip), %rsi     # 0x29923
testb %al, %al
je 0x103b5
jmp 0x1047c
leaq 0x20(%rsp), %rdi
callq 0x75c8
movq 0x10(%rsp), %rsi
addq $0x10, %rsi
leaq 0x20(%rsp), %rdi
callq 0x73e0
leaq 0x1926e(%rip), %rdi     # 0x295f4
leaq 0x20(%rsp), %rsi
callq 0x97dd
movb %al, 0xe(%rsp)
leaq 0x20(%rsp), %rdi
callq 0x75c8
cmpb $0x0, 0xe(%rsp)
leaq 0x19579(%rip), %rsi     # 0x29923
leaq 0x19579(%rip), %rax     # 0x2992a
cmovneq %rax, %rsi
movq %r13, %rdi
callq 0x7580
leaq 0xb8(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x2554a
leaq 0x98(%rsp), %rdi
callq 0x75c8
leaq 0x40(%rsp), %rdi
callq 0x75c8
jmp 0x100b0
leaq 0x1953c(%rip), %rsi     # 0x29931
leaq 0x20(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x9502
movq 0x10(%rsp), %rax
movl 0x8(%rax), %esi
leaq 0x20(%rsp), %rdi
callq 0x285f3
leaq 0x20(%rsp), %rdi
callq 0x75c8
leaq 0x98(%rsp), %rdi
callq 0x75c8
leaq 0x40(%rsp), %rdi
callq 0x75c8
leaq 0x78(%rsp), %rdi
callq 0x75c8
leaq 0x18(%rsp), %rdi
callq 0x7a34
movq %r12, %rdi
callq 0x7a34
cmpq 0x70(%rsp), %r15
sete %bl
leaq 0xb8(%rsp), %rdi
callq 0xa0da
movl %ebx, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x194d7(%rip), %rsi     # 0x2995a
leaq 0x20(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x9502
movq 0x10(%rsp), %rax
movl 0x8(%rax), %esi
leaq 0x20(%rsp), %rdi
callq 0x285f3
jmp 0x10416
jmp 0x104ad
jmp 0x104cd
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x75c8
jmp 0x104d0
jmp 0x104cd
jmp 0x104cd
jmp 0x104cd
jmp 0x104cd
movq %rax, %rbx
jmp 0x104dd
jmp 0x104cd
jmp 0x104fc
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x75c8
leaq 0x40(%rsp), %rdi
callq 0x75c8
jmp 0x104f0
jmp 0x104ed
jmp 0x104fc
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x75c8
jmp 0x104ff
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x7a34
leaq 0x68(%rsp), %rdi
callq 0x7a34
leaq 0xb8(%rsp), %rdi
callq 0xa0da
movq %rbx, %rdi
callq 0x7510