// File: /workspace/github_cpp_makefile_star2_O3/neguse[P]no/lang.cc
// Function: Lang::ValidateNode(std::shared_ptr<Node>, std::vector<SyntaxType, std::allocator<SyntaxType>>)
bool ValidateNode(Node::Ref n, AcceptableSyntax as) {
    // validate current node
    bool valid = false;
    auto syntax = syntax_[n->c];
    for (auto asi : as) {
      if (asi == syntax.st) {
        valid = true;
      }
    }
    if (!valid) {
      printf("failed to validate at %c (%d,%d)\n", n->c, n->pos.line,
             n->pos.col);
      printf("must be either ");
      for (auto asi : as) {
        printf("%d ", asi);
      }
      printf("\n");
      return false;
    }

    // validate child node
    if (n->a) {
      if (!ValidateNode(n->a, syntax.aa)) {
        return false;
      }
    }
    if (n->d) {
      if (!ValidateNode(n->d, syntax.ad)) {
        return false;
      }
    }
    return true;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
movq (%rsi), %rsi
callq 0x46ca
movq %rax, %rbp
movq (%rax), %rax
leaq 0x58(%rsp), %r13
movq %rax, -0x8(%r13)
leaq 0x8(%rbp), %rsi
movq %r13, %rdi
callq 0x464a
leaq 0x70(%rsp), %r14
addq $0x20, %rbp
movq %r14, %rdi
movq %rbp, %rsi
callq 0x464a
movq (%r12), %rax
movq 0x8(%r12), %rcx
cmpq %rcx, %rax
je 0x504f
movl 0x54(%rsp), %esi
xorl %edx, %edx
cmpl %esi, (%rax)
sete %dil
orb %dil, %dl
addq $0x4, %rax
cmpq %rcx, %rax
jne 0x4ff9
testb $0x1, %dl
je 0x504f
movq (%r15), %rax
movq 0x8(%rax), %rcx
testq %rcx, %rcx
je 0x512b
movq %rcx, 0x10(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x50e4
movq 0x5f92(%rip), %rcx      # 0xafd0
cmpb $0x0, (%rcx)
je 0x50e0
incl 0x8(%rax)
jmp 0x50e4
movq (%r15), %rax
movsbl (%rax), %esi
movl 0x28(%rax), %edx
movl 0x2c(%rax), %ecx
leaq 0x30e0(%rip), %rdi      # 0x8142
xorl %eax, %eax
callq 0x2030
leaq 0x30f4(%rip), %rdi      # 0x8164
xorl %eax, %eax
callq 0x2030
movq (%r12), %r14
movq 0x8(%r12), %r15
cmpq %r15, %r14
je 0x50a2
leaq 0x30e8(%rip), %rbx      # 0x8174
movl (%r14), %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2030
addq $0x4, %r14
cmpq %r15, %r14
jne 0x508c
movl $0xa, %edi
callq 0x2130
xorl %ebx, %ebx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x50bd
callq 0x20e0
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x50cc
callq 0x20e0
movl %ebx, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
lock
incl 0x8(%rax)
leaq 0x38(%rsp), %rdi
movq %r13, %rsi
callq 0x464a
leaq 0x10(%rsp), %rsi
leaq 0x38(%rsp), %rdx
movq %rbx, %rdi
callq 0x4f94
movl %eax, %ebp
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x5114
callq 0x20e0
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x5123
callq 0x4f24
testb %bpl, %bpl
je 0x50ac
movq (%r15), %rax
movq 0x18(%rax), %rcx
testq %rcx, %rcx
je 0x51a0
movq %rcx, (%rsp)
movq 0x20(%rax), %rax
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x515b
movq 0x5e83(%rip), %rcx      # 0xafd0
cmpb $0x0, (%rcx)
je 0x5157
incl 0x8(%rax)
jmp 0x515b
lock
incl 0x8(%rax)
leaq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x464a
movq %rsp, %rsi
leaq 0x20(%rsp), %rdx
movq %rbx, %rdi
callq 0x4f94
movl %eax, %ebx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x5189
callq 0x20e0
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x5198
callq 0x4f24
testb %bl, %bl
je 0x50ac
movb $0x1, %bl
jmp 0x50ae
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x51be
callq 0x20e0
jmp 0x51be
movq %rax, %rbx
movq 0x8(%rsp), %rdi
jmp 0x51e1
movq %rax, %rbx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x51dc
callq 0x20e0
jmp 0x51dc
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x51eb
callq 0x4f24
leaq 0x50(%rsp), %rdi
callq 0x4730
jmp 0x5209
movq %rax, %rbx
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x5209
callq 0x20e0
movq %rbx, %rdi
callq 0x21b0
nop