// File: yhirose[P]fizzbuzzlang/./peglib.h
// Function: peg::Holder::parse_core(char const*, unsigned long, peg::SemanticValues&, peg::Context&, std::any&) const
inline size_t Holder::parse_core(const char *s, size_t n, SemanticValues &vs,
                                 Context &c, std::any &dt) const {
  if (!ope_) {
    throw std::logic_error("Uninitialized definition ope was used...");
  }

  // Macro reference
  if (outer_->is_macro) {
    c.rule_stack.push_back(outer_);
    auto len = ope_->parse(s, n, vs, c, dt);
    c.rule_stack.pop_back();
    return len;
  }

  size_t len;
  std::any val;

  c.packrat(s, outer_->id, len, val, [&](std::any &a_val) {
    if (outer_->enter) { outer_->enter(c, s, n, dt); }
    auto &chvs = c.push_semantic_values_scope();
    auto se = scope_exit([&]() {
      c.pop_semantic_values_scope();
      if (outer_->leave) { outer_->leave(c, s, n, len, a_val, dt); }
    });

    c.rule_stack.push_back(outer_);
    len = ope_->parse(s, n, chvs, c, dt);
    c.rule_stack.pop_back();

    // Invoke action
    if (success(len)) {
      chvs.sv_ = std::string_view(s, len);
      chvs.name_ = outer_->name;

      auto ope_ptr = ope_.get();
      {
        auto tok_ptr = dynamic_cast<const peg::TokenBoundary *>(ope_ptr);
        if (tok_ptr) { ope_ptr = tok_ptr->ope_.get(); }
      }
      if (!dynamic_cast<const peg::PrioritizedChoice *>(ope_ptr) &&
          !dynamic_cast<const peg::Dictionary *>(ope_ptr)) {
        chvs.choice_count_ = 0;
        chvs.choice_ = 0;
      }

      std::string msg;
      if (outer_->predicate && !outer_->predicate(chvs, dt, msg)) {
        if (c.log && !msg.empty() && c.error_info.message_pos < s) {
          c.error_info.message_pos = s;
          c.error_info.message = msg;
          c.error_info.label = outer_->name;
        }
        len = static_cast<size_t>(-1);
      }

      if (success(len)) {
        if (!c.recovered) { a_val = reduce(chvs, dt); }
      } else {
        if (c.log && !msg.empty() && c.error_info.message_pos < s) {
          c.error_info.message_pos = s;
          c.error_info.message = msg;
          c.error_info.label = outer_->name;
        }
      }
    } else {
      if (c.log && !outer_->error_message.empty() &&
          c.error_info.message_pos < s) {
        c.error_info.message_pos = s;
        c.error_info.message = outer_->error_message;
        c.error_info.label = outer_->name;
      }
    }
  });

  if (success(len)) {
    if (!outer_->ignoreSemanticValue) {
      vs.emplace_back(std::move(val));
      vs.tags.emplace_back(str2tag(outer_->name));
    }
  }

  return len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
addq $0x8, %rdi
callq 0xd270
testb $0x1, %al
jne 0xeb47
movl $0x10, %edi
callq 0xa1d0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xc0(%rbp)
leaq 0x92ccf(%rip), %rsi     # 0xa17d8
callq 0xa540
jmp 0xeb10
movq -0xc0(%rbp), %rdi
movq 0xe649a(%rip), %rsi     # 0xf4fb8
movq 0xe6453(%rip), %rdx     # 0xf4f78
callq 0xa620
movq -0xc0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
callq 0xa300
jmp 0xed36
movq -0xb8(%rbp), %rax
movq 0x18(%rax), %rax
testb $0x1, 0xe9(%rax)
je 0xebc3
movq -0xb8(%rbp), %rsi
movq -0x30(%rbp), %rdi
addq $0xb8, %rdi
addq $0x18, %rsi
callq 0xed40
movq -0xb8(%rbp), %rdi
addq $0x8, %rdi
callq 0xded0
movq %rax, %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %r8
movq -0x38(%rbp), %r9
callq 0xdaf0
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rdi
addq $0xb8, %rdi
callq 0xedb0
movq -0x50(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xed29
leaq -0x68(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0xda70
movq -0xb8(%rbp), %rax
movq -0xc8(%rbp), %r8
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq 0x18(%rax), %rcx
movq 0x58(%rcx), %rdx
movq %rax, -0x98(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0x18(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0x20(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x78(%rbp)
leaq -0x58(%rbp), %rcx
movq %rcx, -0x70(%rbp)
movups -0x98(%rbp), %xmm0
movups -0x88(%rbp), %xmm1
movups -0x78(%rbp), %xmm2
movq %rsp, %rax
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0xede0
jmp 0xec4d
movq -0x58(%rbp), %rdi
callq 0xe9a0
movb %al, -0xc9(%rbp)
jmp 0xec5e
movb -0xc9(%rbp), %al
testb $0x1, %al
jne 0xec6d
jmp 0xed18
movq -0xb8(%rbp), %rax
movq 0x18(%rax), %rax
testb $0x1, 0xc0(%rax)
jne 0xed16
movq -0x28(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0xf0c0
jmp 0xec94
movq -0xb8(%rbp), %rax
movq -0x28(%rbp), %rcx
addq $0x28, %rcx
movq %rcx, -0xd8(%rbp)
movq 0x18(%rax), %rdi
callq 0xa420
movq %rax, -0xb0(%rbp)
movq %rdx, -0xa8(%rbp)
movq -0xb0(%rbp), %rdi
movq -0xa8(%rbp), %rsi
callq 0xf1c0
movl %eax, -0xd0(%rbp)
jmp 0xecdc
movq -0xd8(%rbp), %rdi
movl -0xd0(%rbp), %eax
movl %eax, -0x9c(%rbp)
leaq -0x9c(%rbp), %rsi
callq 0xf140
jmp 0xecfd
jmp 0xed16
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x68(%rbp), %rdi
callq 0xd9f0
jmp 0xed36
jmp 0xed18
movq -0x58(%rbp), %rax
movq %rax, -0x8(%rbp)
leaq -0x68(%rbp), %rdi
callq 0xd9f0
movq -0x8(%rbp), %rax
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0xa650
nop