// File: /workspace/github_cpp_makefile_star2_O3/pfnet-research[P]pml/src/parser.cpp
// Function: parser::primary_term(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long&)
term_result_t primary_term(std::string const& input, size_t& pos) {
    auto token = next_token(input, pos);
    if (token.kind == token_t::kind_t::Ident) {
        return var_term(input, pos);
    } else if (token.kind == token_t::kind_t::LParen) {
        EXPECT(lparen_token, LParen);
        auto inner_result = term(input, pos);
        if (inner_result.is_error())
            return inner_result;
        EXPECT(rparen_token, RParen);
        return inner_result;
    } else if (token.kind == token_t::kind_t::Prob) {
        EXPECT(prob_token, Prob);
        EXPECT(lparen_token, LParen);
        auto inner_result = formula(input, pos);
        if (inner_result.is_error())
            return inner_result.convert<ptr<logic::term_t>>();
        EXPECT(rparen_token, RParen);
        return term_result_t::ok(make<logic::prob_term_t>(inner_result.ok()));
    } else if (token.kind == token_t::kind_t::Int) {
        EXPECT(int_token, Int);
        pos = int_token.pos + int_token.lexime.size();
        return term_result_t::ok(make<logic::int_term_t>(std::stoi(int_token.lexime)));
    } else {
        return term_result_t::error(parser::error_t {
            parser::error_t::kind_t::UnexpectedToken, pos,
            "expected was " + token_kind_to_string(token.kind) + ", but coming is " + token.lexime
        });
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq (%rdx), %rdx
leaq 0x1a8(%rsp), %r12
movq %r12, %rdi
callq 0x1ba35
movl (%r12), %esi
cmpl $0x1e, %esi
jg 0x1c9fc
cmpl $0x7, %esi
je 0x1cc4a
cmpl $0xa, %esi
jne 0x1cbd8
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x1c862
jmp 0x1d256
cmpl $0x1f, %esi
je 0x1cd62
cmpl $0x23, %esi
jne 0x1cbd8
movq (%r14), %rdx
leaq 0x50(%rsp), %rdi
movq %r15, %rsi
movl $0x23, %ecx
callq 0x1c56e
cmpb $0x0, 0x80(%rsp)
je 0x1ce83
leaq 0x50(%rsp), %rdi
callq 0x24814
movups (%rax), %xmm0
leaq 0x110(%rsp), %rdi
movaps %xmm0, -0x10(%rdi)
leaq 0x120(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
addq %rsi, %rdx
callq 0xac68
movq 0x118(%rsp), %rdx
addq 0x108(%rsp), %rdx
movq %rdx, (%r14)
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
movl $0x1f, %ecx
callq 0x1c56e
cmpb $0x0, 0x40(%rsp)
je 0x1d03e
leaq 0x10(%rsp), %rdi
callq 0x24814
movups (%rax), %xmm0
leaq 0x180(%rsp), %rdi
movaps %xmm0, -0x10(%rdi)
leaq 0x190(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
addq %rsi, %rdx
callq 0xac68
movq 0x188(%rsp), %rax
addq 0x178(%rsp), %rax
movq %rax, (%r14)
leaq 0x88(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x1eb2f
cmpb $0x0, 0xb8(%rsp)
je 0x1d0a4
movq (%r14), %rdx
leaq 0xc0(%rsp), %rdi
movq %r15, %rsi
movl $0x20, %ecx
callq 0x1c56e
cmpb $0x0, 0xf0(%rsp)
je 0x1d11b
leaq 0xc0(%rsp), %rdi
callq 0x24814
movups (%rax), %xmm0
leaq 0x150(%rsp), %rdi
movaps %xmm0, -0x10(%rdi)
leaq 0x160(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
addq %rsi, %rdx
callq 0xac68
movq 0x158(%rsp), %rax
addq 0x148(%rsp), %rax
movq %rax, (%r14)
leaq 0x88(%rsp), %rdi
callq 0x2486e
leaq 0x138(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x130(%rsp), %rsi
leaq 0xf(%rsp), %rdx
movq %rax, %rcx
callq 0x251ce
movb $0x1, 0x30(%rbx)
movaps 0x130(%rsp), %xmm0
movups %xmm0, (%rbx)
movq 0x150(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d133
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1d133
movl $0x1, 0x50(%rsp)
movq (%r14), %rax
movq %rax, 0x58(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x1b6bc
leaq 0x2b706(%rip), %rcx     # 0x48302
leaq 0xc0(%rsp), %rdi
movl $0xd, %r8d
xorl %esi, %esi
xorl %edx, %edx
callq 0x9330
leaq 0x98(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1ced1
movq %rdx, 0x88(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x98(%rsp)
jmp 0x1ced8
movq (%r14), %rdx
leaq 0x50(%rsp), %rdi
movq %r15, %rsi
movl $0x7, %ecx
callq 0x1c56e
cmpb $0x0, 0x80(%rsp)
je 0x1ce9d
leaq 0x50(%rsp), %rdi
callq 0x24814
movups (%rax), %xmm0
leaq 0x20(%rsp), %rdi
movaps %xmm0, -0x10(%rdi)
leaq 0x30(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
addq %rsi, %rdx
callq 0xac68
movq 0x28(%rsp), %rax
addq 0x18(%rsp), %rax
movq %rax, (%r14)
movq 0x20(%rsp), %r12
callq 0x9050
movq %rax, %r14
movl (%rax), %ebp
movl $0x0, (%rax)
leaq 0x88(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
movl $0xa, %edx
callq 0x93b0
cmpq %r12, (%r13)
je 0x1d28c
movq %rax, %r15
movslq %r15d, %rax
cmpq %r15, %rax
jne 0x1d298
movl (%r14), %eax
cmpl $0x22, %eax
je 0x1d298
testl %eax, %eax
jne 0x1cd02
movl %ebp, (%r14)
movl $0x20, %edi
callq 0x92d0
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0x43bb7(%rip), %rcx     # 0x608d8
movq %rcx, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
leaq 0x43bf6(%rip), %rdx     # 0x60928
movq %rdx, 0x10(%rax)
movl %r15d, 0x18(%rax)
movb $0x1, 0x30(%rbx)
movq %rcx, (%rbx)
movq %rax, 0x8(%rbx)
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1d23b
movq 0x30(%rsp), %rsi
jmp 0x1d233
movq (%r14), %rdx
leaq 0x50(%rsp), %rdi
movq %r15, %rsi
movl $0x1f, %ecx
callq 0x1c56e
cmpb $0x0, 0x80(%rsp)
je 0x1ceb7
leaq 0x50(%rsp), %rdi
callq 0x24814
movups (%rax), %xmm0
leaq 0xd0(%rsp), %rdi
movaps %xmm0, -0x10(%rdi)
leaq 0xe0(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
addq %rsi, %rdx
callq 0xac68
movq 0xd8(%rsp), %rax
addq 0xc8(%rsp), %rax
movq %rax, (%r14)
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x1d79c
movb 0x40(%rsp), %al
testb %al, %al
je 0x1d058
movq (%r14), %rdx
leaq 0x88(%rsp), %rdi
movq %r15, %rsi
movl $0x20, %ecx
callq 0x1c56e
cmpb $0x0, 0xb8(%rsp)
je 0x1d087
leaq 0x88(%rsp), %rdi
callq 0x24814
movups (%rax), %xmm0
leaq 0x110(%rsp), %rdi
movaps %xmm0, -0x10(%rdi)
leaq 0x120(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
addq %rsi, %rdx
callq 0xac68
movq 0x118(%rsp), %rax
addq 0x108(%rsp), %rax
movq %rax, (%r14)
movb 0x40(%rsp), %al
movb %al, 0x30(%rbx)
cmpb $0x1, %al
jne 0x1d0e8
movaps 0x10(%rsp), %xmm0
xorl %eax, %eax
movq %rax, 0x18(%rsp)
movups %xmm0, (%rbx)
movq %rax, 0x10(%rsp)
jmp 0x1d1d6
leaq 0x50(%rsp), %rdi
callq 0x247ba
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2476c
jmp 0x1d23b
leaq 0x50(%rsp), %rdi
callq 0x247ba
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2476c
jmp 0x1d23b
leaq 0x50(%rsp), %rdi
callq 0x247ba
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2476c
jmp 0x1d23b
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
leaq 0x88(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x2b489(%rip), %rsi     # 0x48387
callq 0x9540
leaq 0x20(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1cf2a
movq %rdx, 0x10(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x20(%rsp)
jmp 0x1cf31
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x10(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x1b8(%rsp), %rsi
movq 0x1c0(%rsp), %rdx
callq 0x90d0
leaq 0x70(%rsp), %rcx
movq (%rax), %rdx
movq %rax, %rdi
addq $0x10, %rdi
cmpq %rdi, %rdx
je 0x1cf85
movq %rdx, 0x60(%rsp)
movq (%rdi), %rsi
movq %rsi, 0x70(%rsp)
jmp 0x1cf8e
movups (%rdi), %xmm0
movups %xmm0, (%rcx)
movq %rcx, %rdx
movq 0x8(%rax), %rsi
movq %rdi, (%rax)
movq $0x0, 0x8(%rax)
xorl %edi, %edi
movb %dil, 0x10(%rax)
movb %dil, 0x30(%rbx)
movups 0x50(%rsp), %xmm0
movups %xmm0, (%rbx)
leaq 0x20(%rbx), %rax
movq %rax, 0x10(%rbx)
cmpq %rcx, %rdx
je 0x1cfcb
movq %rdx, 0x10(%rbx)
movq 0x70(%rsp), %rax
movq %rax, 0x20(%rbx)
jmp 0x1cfd1
movups (%rcx), %xmm0
movups %xmm0, (%rax)
movq %rsi, 0x18(%rbx)
movq %rcx, 0x60(%rsp)
movq $0x0, 0x68(%rsp)
movb $0x0, 0x70(%rsp)
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x1cfff
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x92e0
movq 0x88(%rsp), %rdi
cmpq %r14, %rdi
je 0x1d01c
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d256
movq 0xd0(%rsp), %rsi
jmp 0x1d24e
leaq 0x10(%rsp), %rdi
callq 0x247ba
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2476c
jmp 0x1d17e
movb %al, 0x30(%rbx)
leaq 0x30(%rsp), %rax
movaps -0x20(%rax), %xmm0
movups %xmm0, (%rbx)
leaq 0x20(%rbx), %rcx
movq %rcx, 0x10(%rbx)
movq -0x10(%rax), %rdx
cmpq %rax, %rdx
je 0x1d0c1
movq %rdx, 0x10(%rbx)
movq 0x30(%rsp), %rcx
movq %rcx, 0x20(%rbx)
jmp 0x1d0c7
leaq 0x88(%rsp), %rdi
callq 0x247ba
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2476c
jmp 0x1d1f3
leaq 0x88(%rsp), %rdi
callq 0x280fc
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2476c
jmp 0x1d154
movups (%rax), %xmm0
movups %xmm0, (%rcx)
movq 0x28(%rsp), %rcx
movq %rcx, 0x18(%rbx)
movq %rax, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movb $0x0, 0x30(%rsp)
jmp 0x1d214
leaq 0x30(%rsp), %rax
movaps -0x20(%rax), %xmm0
movups %xmm0, (%rbx)
leaq 0x20(%rbx), %rcx
movq %rcx, 0x10(%rbx)
movq -0x10(%rax), %rdx
cmpq %rax, %rdx
je 0x1d1b4
movq %rdx, 0x10(%rbx)
movq 0x30(%rsp), %rcx
movq %rcx, 0x20(%rbx)
jmp 0x1d1ba
leaq 0xc0(%rsp), %rdi
callq 0x247ba
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2476c
leaq 0xe0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d154
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x88(%rsp), %rdi
callq 0x280cc
movq 0x180(%rsp), %rdi
cmpq %r13, %rdi
je 0x1d17e
movq 0x190(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d199
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x92e0
movq 0x110(%rsp), %rdi
cmpq %r12, %rdi
je 0x1d23b
movq 0x120(%rsp), %rsi
jmp 0x1d233
movups (%rax), %xmm0
movups %xmm0, (%rcx)
movq 0x28(%rsp), %rcx
movq %rcx, 0x18(%rbx)
movq %rax, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movb $0x0, 0x30(%rsp)
movq 0x110(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d1f3
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d214
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x10(%rsp), %rdi
callq 0x2809c
movq 0xd0(%rsp), %rdi
cmpq %r12, %rdi
je 0x1d23b
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d256
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x1c8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d277
movq 0x1c8(%rsp), %rsi
incq %rsi
callq 0x92e0
movq %rbx, %rax
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2b157(%rip), %rdi     # 0x483ea
callq 0x9190
leaq 0x2b14b(%rip), %rdi     # 0x483ea
callq 0x93d0
movq %rax, %rbx
movq 0x150(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d2cb
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1d2cb
jmp 0x1d2c8
movq %rax, %rbx
leaq 0xe0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d2f3
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1d2f3
jmp 0x1d2f0
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x280cc
jmp 0x1d305
movq %rax, %rbx
movq 0x180(%rsp), %rdi
cmpq %r13, %rdi
je 0x1d365
movq 0x190(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1d365
jmp 0x1d326
movq %rax, %rbx
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d34f
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1d34f
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2809c
jmp 0x1d385
movq %rax, %rbx
jmp 0x1d3c6
jmp 0x1d362
movq %rax, %rbx
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d3a3
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1d3a3
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
cmpq %r12, %rdi
je 0x1d42f
movq 0xe0(%rsp), %rsi
jmp 0x1d3da
movq %rax, %rbx
movq 0x110(%rsp), %rdi
cmpq %r12, %rdi
je 0x1d42f
movq 0x120(%rsp), %rsi
jmp 0x1d3da
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x1d3c6
movl %ebp, (%r14)
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1d42f
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1d42f
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d403
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1d403
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r14, %rdi
je 0x1d447
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1d447
jmp 0x1d42c
jmp 0x1d42c
jmp 0x1d42c
jmp 0x1d42c
jmp 0x1d42c
movq %rax, %rbx
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d475
movq 0x70(%rsp), %rsi
jmp 0x1d460
movq %rax, %rbx
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d475
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1d475
jmp 0x1d472
jmp 0x1d472
jmp 0x1d472
jmp 0x1d472
movq %rax, %rbx
leaq 0x1c8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d496
movq 0x1c8(%rsp), %rsi
incq %rsi
callq 0x92e0
movq %rbx, %rdi
callq 0x94e0