// File: yhirose[P]fizzbuzzlang/./peglib.h
// Function: void peg::add_ast_action<peg::AstBase<peg::EmptyType>>(peg::Definition&)::'lambda'(peg::SemanticValues const&)::operator()(peg::SemanticValues const&) const
void add_ast_action(Definition &rule) {
  rule.action = [&](const SemanticValues &vs) {
    auto line = vs.line_info();

    if (rule.is_token()) {
      return std::make_shared<T>(
          vs.path, line.first, line.second, rule.name.data(), vs.token(),
          std::distance(vs.ss, vs.sv().data()), vs.sv().length(),
          vs.choice_count(), vs.choice());
    }

    auto ast =
        std::make_shared<T>(vs.path, line.first, line.second, rule.name.data(),
                            vs.transform<std::shared_ptr<T>>(),
                            std::distance(vs.ss, vs.sv().data()),
                            vs.sv().length(), vs.choice_count(), vs.choice());

    for (auto node : ast->nodes) {
      node->parent = ast;
    }
    return ast;
  };
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rdi, -0x148(%rbp)
movq %rdi, %rax
movq %rax, -0x140(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0x20(%rbp), %rdi
callq 0x67ed0
movq %rax, %rcx
movq -0x138(%rbp), %rax
movq %rcx, -0x30(%rbp)
movq %rdx, -0x28(%rbp)
movq (%rax), %rdi
callq 0x198a0
testb $0x1, %al
jne 0x99ef0
jmp 0x9a00c
movq -0x138(%rbp), %rax
movq -0x20(%rbp), %rcx
addq $0x18, %rcx
movq %rcx, -0x160(%rbp)
leaq -0x30(%rbp), %rcx
movq %rcx, -0x158(%rbp)
leaq -0x30(%rbp), %rcx
addq $0x8, %rcx
movq %rcx, -0x150(%rbp)
movq (%rax), %rdi
callq 0xa220
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x69d30
movq %rax, -0x48(%rbp)
movq %rdx, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x168(%rbp)
movq -0x20(%rbp), %rdi
callq 0x4f260
movq %rax, -0x60(%rbp)
movq %rdx, -0x58(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x1fc60
movq -0x168(%rbp), %rdi
movq %rax, %rsi
callq 0x18ff0
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rdi
callq 0x4f260
movq %rax, -0x78(%rbp)
movq %rdx, -0x70(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x60be0
movq %rax, -0x68(%rbp)
movq -0x20(%rbp), %rdi
callq 0x9a3c0
movq %rax, -0x80(%rbp)
movq -0x20(%rbp), %rdi
callq 0x4ebb0
movq -0x148(%rbp), %rdi
movq -0x160(%rbp), %rsi
movq -0x158(%rbp), %rdx
movq -0x150(%rbp), %rcx
movq %rax, -0x88(%rbp)
leaq -0x38(%rbp), %r8
leaq -0x48(%rbp), %r9
leaq -0x50(%rbp), %rbx
leaq -0x68(%rbp), %r11
leaq -0x80(%rbp), %r10
leaq -0x88(%rbp), %rax
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
callq 0x9a2e0
jmp 0x9a269
movq -0x138(%rbp), %rax
movq -0x20(%rbp), %rcx
addq $0x18, %rcx
movq %rcx, -0x190(%rbp)
leaq -0x30(%rbp), %rcx
movq %rcx, -0x188(%rbp)
leaq -0x28(%rbp), %rcx
movq %rcx, -0x180(%rbp)
movq (%rax), %rdi
callq 0xa220
movq %rax, -0xa0(%rbp)
movq -0x20(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
leaq -0xb8(%rbp), %rdi
movq $-0x1, %rcx
callq 0x9a4c0
movq -0x20(%rbp), %rdi
movq 0x20(%rdi), %rax
movq %rax, -0x178(%rbp)
callq 0x4f260
movq %rax, -0xd0(%rbp)
movq %rdx, -0xc8(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x1fc60
movq -0x178(%rbp), %rdi
movq %rax, %rsi
callq 0x18ff0
movq %rax, -0x170(%rbp)
jmp 0x9a0a8
movq -0x170(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x20(%rbp), %rdi
callq 0x4f260
movq %rax, -0xf8(%rbp)
movq %rdx, -0xf0(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x60be0
movq %rax, -0xe8(%rbp)
movq -0x20(%rbp), %rdi
callq 0x9a3c0
movq %rax, -0x198(%rbp)
jmp 0x9a0f2
movq -0x198(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x20(%rbp), %rdi
callq 0x4ebb0
movq -0x190(%rbp), %rsi
movq -0x188(%rbp), %rdx
movq -0x180(%rbp), %rcx
movq %rax, -0x108(%rbp)
movq %rsp, %rax
leaq -0x108(%rbp), %rdi
movq %rdi, 0x18(%rax)
leaq -0x100(%rbp), %rdi
movq %rdi, 0x10(%rax)
leaq -0xe8(%rbp), %rdi
movq %rdi, 0x8(%rax)
leaq -0xc0(%rbp), %rdi
movq %rdi, (%rax)
leaq -0x98(%rbp), %rdi
leaq -0xa0(%rbp), %r8
leaq -0xb8(%rbp), %r9
callq 0x9a3e0
jmp 0x9a16f
leaq -0xb8(%rbp), %rdi
callq 0x9a5c0
leaq -0x98(%rbp), %rdi
callq 0x13720
addq $0xc0, %rax
movq %rax, -0x110(%rbp)
movq -0x110(%rbp), %rdi
callq 0x9a620
movq %rax, -0x118(%rbp)
movq -0x110(%rbp), %rdi
callq 0x9a650
movq %rax, -0x120(%rbp)
leaq -0x118(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x9a680
testb $0x1, %al
jne 0x9a1d3
jmp 0x9a24a
leaq -0x118(%rbp), %rdi
callq 0x9a6c0
movq %rax, %rsi
leaq -0x130(%rbp), %rdi
callq 0x13010
leaq -0x130(%rbp), %rdi
callq 0x13720
movq %rax, %rdi
addq $0xd8, %rdi
leaq -0x98(%rbp), %rsi
callq 0x9a6e0
leaq -0x130(%rbp), %rdi
callq 0x13040
leaq -0x118(%rbp), %rdi
callq 0x9a710
jmp 0x9a1ba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x9a5c0
jmp 0x9a27a
movq -0x148(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x9a730
leaq -0x98(%rbp), %rdi
callq 0x13040
movq -0x140(%rbp), %rax
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %rbp
retq
movq -0xd8(%rbp), %rdi
callq 0xa650
nopw %cs:(%rax,%rax)