// File: /workspace/github_cpp_makefile_star2_O1/yhirose[P]fizzbuzzlang/fzbz.cc
// Function: parse(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::ostream&)
shared_ptr<Ast> parse(const string& source, ostream& out) {
  parser parser(R"(
    # Syntax Rules
    EXPRESSION              ← TERNARY
    TERNARY                 ← CONDITION ('?' EXPRESSION ':' EXPRESSION)?
    CONDITION               ← MULTIPLICATIVE (ConditionOperator MULTIPLICATIVE)?
    MULTIPLICATIVE          ← CALL (MultiplicativeOperator CALL)*
    CALL                    ← PRIMARY (EXPRESSION)?
    PRIMARY                 ← FOR / Identifier / '(' EXPRESSION ')' / String / Number
    FOR                     ← 'for' Identifier 'from' Number 'to' Number EXPRESSION

    # Token Rules
    ConditionOperator       ← '=='
    MultiplicativeOperator  ← '%'
    Identifier              ← !Keyword < [a-zA-Z][a-zA-Z0-9_]* >
    String                  ← "'" < ([^'] .)* > "'"
    Number                  ← < [0-9]+ >

    Keyword                 ← ('for' / 'from' / 'to') ![a-zA-Z]
    %whitespace             ← [ \t\r\n]*
  )");

  parser.enable_ast();

  parser.set_logger([&](size_t ln, size_t col, const auto& msg) {
    out << ln << ":" << col << ": " << msg << endl;
  });

  shared_ptr<Ast> ast;
  if (parser.parse_n(source.data(), source.size(), ast)) {
    return parser.optimize_ast(ast);
  }

  return nullptr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xa0, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x3aa49(%rip), %rdx     # 0x44287
leaq -0xb8(%rbp), %r12
movl $0x372, %esi            # imm = 0x372
movq %r12, %rdi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0xe8ae
movq %r12, %rdi
callq 0xe924
xorps %xmm0, %xmm0
leaq -0x60(%rbp), %rsi
movaps %xmm0, (%rsi)
movaps %xmm0, 0x10(%rsi)
movq %r15, (%rsi)
leaq 0x1163(%rip), %rax      # 0xa9da
movq %rax, 0x18(%rsi)
leaq 0x11f0(%rip), %rax      # 0xaa72
movq %rax, 0x10(%rsi)
leaq -0xb8(%rbp), %rdi
callq 0xe962
movq -0x50(%rbp), %rax
testq %rax, %rax
je 0x98a9
leaq -0x60(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
xorps %xmm0, %xmm0
leaq -0x30(%rbp), %rcx
movaps %xmm0, (%rcx)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
leaq -0xb8(%rbp), %rdi
xorl %r8d, %r8d
callq 0xe9d8
testb %al, %al
je 0x98f3
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, -0x40(%rbp)
movq %rax, -0x38(%rbp)
testq %rax, %rax
je 0x98ff
movq 0x56687(%rip), %rcx     # 0x5ff70
cmpb $0x0, (%rcx)
je 0x98fb
incl 0x8(%rax)
jmp 0x98ff
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
jmp 0x9925
lock
incl 0x8(%rax)
leaq -0xb8(%rbp), %rsi
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
movl $0x1, %ecx
callq 0xeb3a
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x9925
callq 0x13612
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0x9933
callq 0x13612
movq -0x70(%rbp), %rax
testq %rax, %rax
je 0x994a
leaq -0x80(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq -0x98(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9969
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x92b0
movq -0xb0(%rbp), %rdi
testq %rdi, %rdi
je 0x997a
callq 0x13612
movq %rbx, %rax
addq $0xa0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x99a7
callq 0x13612
jmp 0x99a7
jmp 0x99d3
jmp 0x99d3
movq %rax, %rbx
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0x99de
callq 0x13612
jmp 0x99de
movq %rax, %rbx
movq -0x50(%rbp), %rax
testq %rax, %rax
je 0x99de
leaq -0x60(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x99de
movq %rax, %rdi
callq 0xf084
movq %rax, %rbx
leaq -0xb8(%rbp), %rdi
callq 0xec36
movq %rbx, %rdi
callq 0x9420