// File: /workspace/github_cpp_makefile_star2_O2/pfnet-research[P]pml/src/parser.cpp
// Function: parser::primary_expr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long&)
expr_result_t primary_expr(std::string const& input, size_t& pos) {
    auto token = next_token(input, pos);
    if (token.kind == token_t::kind_t::Int) {
        pos = token.pos + token.lexime.size();
        return expr_result_t::ok(make<ast::int_expr_t>(std::stoi(token.lexime)));
    } else if (token.kind == token_t::kind_t::True) {
        pos = token.pos + token.lexime.size();
        return expr_result_t::ok(make<ast::bool_expr_t>(true));
    } else if (token.kind == token_t::kind_t::False) {
        pos = token.pos + token.lexime.size();
        return expr_result_t::ok(make<ast::bool_expr_t>(false));
    } else if (token.kind == token_t::kind_t::Rand) {
        EXPECT(rand_token, Rand);
        EXPECT(lparen_token, LParen);
        EXPECT(start_token, Int);
        int start = std::stoi(start_token.lexime);
        EXPECT(comma_token, Comma);
        EXPECT(end_token, Int);
        int end = std::stoi(end_token.lexime);
        EXPECT(rparen_token, RParen);
        return expr_result_t::ok(make<ast::rand_expr_t>(start, end));
    } else if (token.kind == token_t::kind_t::Ident) {
        pos = token.pos + token.lexime.size();
        return expr_result_t::ok(make<ast::var_expr_t>(token.lexime));
    } else if (token.kind == token_t::kind_t::LParen) {
        EXPECT(lparen_token, LParen);
        auto body_result = expr(input, pos);
        if (body_result.is_error())
            return  body_result;
        EXPECT(rparen_token, RParen);
        return body_result;
    } else {
        return expr_result_t::error(error_t {
                error_t::kind_t::UnexpectedToken, pos,
                "expected was number or boolean or paren, but comming is " + token.lexime + "(" + token_kind_to_string(token.kind) + ")"
                });
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2d8, %rsp            # imm = 0x2D8
movq %rdx, %r12
movq %rsi, %rbp
movq %rdi, %rbx
movq (%rdx), %rdx
leaq 0xc0(%rsp), %r14
movq %r14, %rdi
callq 0x1537c
movl (%r14), %ecx
leal -0x6(%rcx), %eax
cmpl $0x4, %eax
ja 0x19698
leaq 0x20105(%rip), %rcx     # 0x3952c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq (%r12), %rdx
leaq 0x50(%rsp), %rdi
pushq $0x6
popq %rcx
movq %rbp, %rsi
callq 0x15bc7
cmpb $0x0, 0x80(%rsp)
je 0x19950
leaq 0x50(%rsp), %rdi
callq 0x1ac66
leaq 0x2a8(%rsp), %rdi
movq %rax, %rsi
callq 0x1acbe
leaq 0x2b8(%rsp), %r14
movq 0x8(%r14), %rdx
addq -0x8(%r14), %rdx
movq %rdx, (%r12)
leaq 0x10(%rsp), %rdi
pushq $0x1f
popq %rcx
movq %rbp, %rsi
callq 0x15bc7
cmpb $0x0, 0x40(%rsp)
je 0x19979
leaq 0x10(%rsp), %rdi
callq 0x1ac66
leaq 0x278(%rsp), %rdi
movq %rax, %rsi
callq 0x1acbe
leaq 0x288(%rsp), %r15
movq 0x8(%r15), %rdx
addq -0x8(%r15), %rdx
movq %rdx, (%r12)
leaq 0x88(%rsp), %rdi
pushq $0x7
popq %rcx
movq %rbp, %rsi
callq 0x15bc7
cmpb $0x0, 0xb8(%rsp)
je 0x199c7
leaq 0x88(%rsp), %rdi
callq 0x1ac66
leaq 0x248(%rsp), %rdi
movq %rax, %rsi
callq 0x1acbe
leaq 0x258(%rsp), %r13
movq 0x8(%r13), %rax
addq -0x8(%r13), %rax
movq %rax, (%r12)
pushq $0xa
popq %rdx
movq %r13, %rdi
xorl %esi, %esi
callq 0x1ad6a
movl %eax, 0xc(%rsp)
movq (%r12), %rdx
leaq 0x128(%rsp), %rdi
pushq $0x12
popq %rcx
movq %rbp, %rsi
callq 0x15bc7
cmpb $0x0, 0x158(%rsp)
je 0x199e4
leaq 0x128(%rsp), %rdi
callq 0x1ac66
leaq 0x1d8(%rsp), %rdi
movq %rax, %rsi
callq 0x1acbe
leaq 0x1e8(%rsp), %rax
movq 0x8(%rax), %rdx
addq -0x8(%rax), %rdx
movq %rdx, (%r12)
leaq 0xf0(%rsp), %rdi
pushq $0x7
popq %rcx
movq %rbp, %rsi
callq 0x15bc7
cmpb $0x0, 0x120(%rsp)
je 0x199fe
leaq 0xf0(%rsp), %rdi
callq 0x1ac66
leaq 0x1a8(%rsp), %rdi
movq %rax, %rsi
callq 0x1acbe
leaq 0x1b8(%rsp), %rdi
movq 0x8(%rdi), %rax
addq -0x8(%rdi), %rax
movq %rax, (%r12)
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x1ad6a
movl %eax, 0x8(%rsp)
movq (%r12), %rdx
leaq 0x170(%rsp), %rdi
pushq $0x20
popq %rcx
movq %rbp, %rsi
callq 0x15bc7
cmpb $0x0, 0x1a0(%rsp)
je 0x19a18
leaq 0x170(%rsp), %rdi
callq 0x1ac66
leaq 0x218(%rsp), %rdi
movq %rax, %rsi
callq 0x1acbe
leaq 0x228(%rsp), %rbp
movq 0x8(%rbp), %rax
addq -0x8(%rbp), %rax
movq %rax, (%r12)
leaq 0x160(%rsp), %rdi
leaq 0xc(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x1d25b
leaq 0x210(%rsp), %rdi
leaq 0x168(%rsp), %r12
andq $0x0, (%rdi)
movb $0x1, 0x30(%rbx)
movaps -0x8(%r12), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0x8(%r12)
movups %xmm0, (%rbx)
andq $0x0, -0x8(%rdi)
callq 0xa248
movq %r12, %rdi
callq 0xa248
movq %rbp, %rdi
callq 0x9130
jmp 0x19a30
cmpl $0x1f, %ecx
jne 0x1977c
movq (%r12), %rdx
leaq 0x50(%rsp), %rdi
pushq $0x1f
popq %rcx
movq %rbp, %rsi
callq 0x15bc7
cmpb $0x0, 0x80(%rsp)
je 0x19936
leaq 0x50(%rsp), %rdi
callq 0x1ac66
leaq 0x128(%rsp), %rdi
movq %rax, %rsi
callq 0x1acbe
leaq 0x138(%rsp), %r14
movq 0x8(%r14), %rax
addq -0x8(%r14), %rax
movq %rax, (%r12)
leaq 0x10(%rsp), %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x18a5b
cmpb $0x0, 0x40(%rsp)
je 0x1996a
movq (%r12), %rdx
leaq 0x88(%rsp), %rdi
pushq $0x20
popq %rcx
movq %rbp, %rsi
callq 0x15bc7
cmpb $0x0, 0xb8(%rsp)
je 0x19993
leaq 0x88(%rsp), %rdi
callq 0x1ac66
leaq 0xf0(%rsp), %rdi
movq %rax, %rsi
callq 0x1acbe
leaq 0x100(%rsp), %r15
movq 0x8(%r15), %rax
addq -0x8(%r15), %rax
movq %rax, (%r12)
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x1b172
movq %r15, %rdi
callq 0x9130
jmp 0x199ab
movl $0x1, 0x50(%rsp)
movq (%r12), %rax
movq %rax, 0x58(%rsp)
leaq 0xd0(%rsp), %rdx
leaq 0x1ff22(%rip), %rsi     # 0x396be
leaq 0x128(%rsp), %rdi
callq 0xebef
leaq 0x1f073(%rip), %rdx     # 0x38823
leaq 0x88(%rsp), %rdi
leaq 0x128(%rsp), %rsi
callq 0xeb69
movl 0xc0(%rsp), %esi
leaq 0xf0(%rsp), %rdi
callq 0x15120
leaq 0x10(%rsp), %rdi
leaq 0x88(%rsp), %rsi
leaq 0xf0(%rsp), %rdx
callq 0xeb88
leaq 0x60(%rsp), %r14
leaq 0x1cb8a(%rip), %rdx     # 0x36389
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0xeb69
leaq 0x50(%rsp), %rsi
movq %rbx, %rdi
callq 0x1b262
movq %r14, %rdi
callq 0x9130
leaq 0x10(%rsp), %rdi
callq 0x9130
leaq 0xf0(%rsp), %rdi
callq 0x9130
leaq 0x88(%rsp), %rdi
callq 0x9130
leaq 0x128(%rsp), %rdi
jmp 0x19aa5
leaq 0xd0(%rsp), %rsi
movq 0x8(%rsi), %rax
addq -0x8(%rsi), %rax
movq %rax, (%r12)
leaq 0x10(%rsp), %rdi
callq 0x1d3d4
jmp 0x198fd
movq 0xd8(%rsp), %rax
addq 0xc8(%rsp), %rax
movq %rax, (%r12)
leaq 0x88(%rsp), %rsi
movb $0x1, (%rsi)
leaq 0x10(%rsp), %rdi
callq 0xbaf2
jmp 0x198fd
movq 0xd8(%rsp), %rax
addq 0xc8(%rsp), %rax
movq %rax, (%r12)
leaq 0x88(%rsp), %rsi
movb $0x0, (%rsi)
leaq 0x10(%rsp), %rdi
callq 0xbaf2
jmp 0x198fd
leaq 0xd0(%rsp), %rdi
movq 0x8(%rdi), %rax
addq -0x8(%rdi), %rax
movq %rax, (%r12)
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x1ad6a
leaq 0x88(%rsp), %rsi
movl %eax, (%rsi)
leaq 0x10(%rsp), %rdi
callq 0xbc7c
leaq 0x58(%rsp), %rdi
leaq 0x18(%rsp), %r14
andq $0x0, (%rdi)
movb $0x1, 0x30(%rbx)
movaps -0x8(%r14), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0x8(%r14)
movups %xmm0, (%rbx)
andq $0x0, -0x8(%rdi)
callq 0xa248
movq %r14, %rdi
callq 0xa248
jmp 0x19aaa
leaq 0x50(%rsp), %rdi
callq 0x1ac0e
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1b144
jmp 0x19aa0
leaq 0x50(%rsp), %rdi
callq 0x1ac0e
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1b144
jmp 0x19aa0
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x1b172
jmp 0x199b8
leaq 0x10(%rsp), %rdi
callq 0x1ac0e
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1b144
jmp 0x19a8e
leaq 0x88(%rsp), %rdi
callq 0x1ac0e
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1b144
leaq 0x98(%rsp), %rdi
callq 0x9130
leaq 0x10(%rsp), %rdi
callq 0x13e4a
jmp 0x19a98
leaq 0x88(%rsp), %rdi
callq 0x1ac0e
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1b144
jmp 0x19a79
leaq 0x128(%rsp), %rdi
callq 0x1ac0e
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1b144
jmp 0x19a64
leaq 0xf0(%rsp), %rdi
callq 0x1ac0e
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1b144
jmp 0x19a4a
leaq 0x170(%rsp), %rdi
callq 0x1ac0e
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1b144
leaq 0x180(%rsp), %rdi
callq 0x9130
leaq 0x1b8(%rsp), %rdi
callq 0x9130
leaq 0x100(%rsp), %rdi
callq 0x9130
leaq 0x1e8(%rsp), %rdi
callq 0x9130
leaq 0x138(%rsp), %rdi
callq 0x9130
movq %r13, %rdi
callq 0x9130
leaq 0x98(%rsp), %rdi
callq 0x9130
movq %r15, %rdi
callq 0x9130
leaq 0x20(%rsp), %rdi
callq 0x9130
movq %r14, %rdi
callq 0x9130
leaq 0x60(%rsp), %rdi
callq 0x9130
leaq 0xd0(%rsp), %rdi
callq 0x9130
movq %rbx, %rax
addq $0x2d8, %rsp            # imm = 0x2D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %rbp, %rdi
callq 0x9130
jmp 0x19ade
jmp 0x19adb
movq %rax, %rbx
leaq 0x180(%rsp), %rdi
callq 0x9130
jmp 0x19af2
jmp 0x19aef
movq %rax, %rbx
leaq 0x1b8(%rsp), %rdi
callq 0x9130
jmp 0x19b06
jmp 0x19b03
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x9130
leaq 0x1e8(%rsp), %rdi
callq 0x9130
jmp 0x19b2c
movq %rax, %rbx
jmp 0x19b13
jmp 0x19b29
movq %rax, %rbx
leaq 0x138(%rsp), %rdi
callq 0x9130
jmp 0x19b40
jmp 0x19b3d
movq %rax, %rbx
movq %r13, %rdi
callq 0x9130
jmp 0x19b5c
movq %rax, %rbx
movq %r15, %rdi
callq 0x9130
jmp 0x19b7d
jmp 0x19b59
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x9130
movq %r15, %rdi
callq 0x9130
jmp 0x19ba2
movq %rax, %rbx
jmp 0x19b69
jmp 0x19b7a
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x9130
jmp 0x19b91
jmp 0x19b8e
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x13e4a
jmp 0x19bb3
jmp 0x19b9f
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x9130
jmp 0x19bb3
jmp 0x19bb0
movq %rax, %rbx
movq %r14, %rdi
callq 0x9130
jmp 0x19c06
movq %rax, %rbx
movq %r14, %rdi
callq 0x9130
jmp 0x19bcd
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x9130
jmp 0x19bdc
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x9130
jmp 0x19bee
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x9130
jmp 0x19c10
jmp 0x19c03
jmp 0x19c03
jmp 0x19c03
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
jmp 0x19c18
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
callq 0x9130
jmp 0x19c2e
jmp 0x19c2b
jmp 0x19c2b
jmp 0x19c2b
jmp 0x19c2b
jmp 0x19c2b
jmp 0x19c2b
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x9130
movq %rbx, %rdi
callq 0x94d0