// File: /workspace/github_cpp_makefile_star2_O1/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 0x4b06
movq %rax, %rbp
movq (%rax), %rax
leaq 0x58(%rsp), %r13
movq %rax, -0x8(%r13)
leaq 0x8(%rbp), %rsi
movq %r13, %rdi
callq 0x4a86
leaq 0x70(%rsp), %r14
addq $0x20, %rbp
movq %r14, %rdi
movq %rbp, %rsi
callq 0x4a86
movq (%r12), %rax
movq 0x8(%r12), %rcx
cmpq %rcx, %rax
je 0x54db
movl 0x54(%rsp), %esi
xorl %edx, %edx
movl $0x1, %edi
cmpl %esi, (%rax)
movzbl %dl, %edx
cmovel %edi, %edx
addq $0x4, %rax
cmpq %rcx, %rax
jne 0x5486
testb $0x1, %dl
je 0x54db
movq (%r15), %rax
movq 0x8(%rax), %rcx
testq %rcx, %rcx
je 0x55b4
movq %rcx, 0x10(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x5570
movq 0x5b06(%rip), %rcx      # 0xafd0
cmpb $0x0, (%rcx)
je 0x556c
incl 0x8(%rax)
jmp 0x5570
movq (%r15), %rax
movsbl (%rax), %esi
movl 0x28(%rax), %edx
movl 0x2c(%rax), %ecx
leaq 0x2c54(%rip), %rdi      # 0x8142
xorl %eax, %eax
callq 0x2030
leaq 0x2c68(%rip), %rdi      # 0x8164
xorl %eax, %eax
callq 0x2030
movq (%r12), %r14
movq 0x8(%r12), %r15
cmpq %r15, %r14
je 0x552e
leaq 0x2c5c(%rip), %rbx      # 0x8174
movl (%r14), %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2030
addq $0x4, %r14
cmpq %r15, %r14
jne 0x5518
movl $0xa, %edi
callq 0x2130
xorl %ebx, %ebx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x5549
callq 0x20e0
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x5558
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 0x4a86
leaq 0x10(%rsp), %rsi
leaq 0x38(%rsp), %rdx
movq %rbx, %rdi
callq 0x541c
movl %eax, %ebp
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x55a0
callq 0x20e0
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x55af
callq 0x53ac
testb %bpl, %bpl
je 0x5538
movq (%r15), %rax
movq 0x18(%rax), %rcx
testq %rcx, %rcx
je 0x562c
movq %rcx, (%rsp)
movq 0x20(%rax), %rax
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x55e7
movq 0x59f7(%rip), %rcx      # 0xafd0
cmpb $0x0, (%rcx)
je 0x55e3
incl 0x8(%rax)
jmp 0x55e7
lock
incl 0x8(%rax)
leaq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x4a86
movq %rsp, %rsi
leaq 0x20(%rsp), %rdx
movq %rbx, %rdi
callq 0x541c
movl %eax, %ebx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x5615
callq 0x20e0
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x5624
callq 0x53ac
testb %bl, %bl
je 0x5538
movb $0x1, %bl
jmp 0x553a
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x564a
callq 0x20e0
jmp 0x564a
movq %rax, %rbx
movq 0x8(%rsp), %rdi
jmp 0x566d
movq %rax, %rbx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x5668
callq 0x20e0
jmp 0x5668
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x5677
callq 0x53ac
leaq 0x50(%rsp), %rdi
callq 0x4b6a
jmp 0x5695
movq %rax, %rbx
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x5695
callq 0x20e0
movq %rbx, %rdi
callq 0x21b0
nop