// File: /workspace/github_cpp_makefile_star2_O1/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 0x1bcc7
movl (%r12), %esi
cmpl $0x1e, %esi
jg 0x1cd09
cmpl $0x7, %esi
je 0x1cf74
cmpl $0xa, %esi
jne 0x1cf02
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x1cb7a
jmp 0x1d54b
cmpl $0x1f, %esi
je 0x1d08c
cmpl $0x23, %esi
jne 0x1cf02
movq (%r14), %rdx
leaq 0x50(%rsp), %rdi
movq %r15, %rsi
movl $0x23, %ecx
callq 0x1c868
cmpb $0x0, 0x80(%rsp)
je 0x1d1ba
leaq 0x50(%rsp), %rdi
callq 0x2494c
movups (%rax), %xmm0
leaq 0x120(%rsp), %rdi
movaps %xmm0, -0x10(%rdi)
leaq 0x130(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
addq %rsi, %rdx
callq 0xad30
movq 0x128(%rsp), %rdx
addq 0x118(%rsp), %rdx
movq %rdx, (%r14)
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
movl $0x1f, %ecx
callq 0x1c868
cmpb $0x0, 0x40(%rsp)
je 0x1d38b
leaq 0x10(%rsp), %rdi
callq 0x2494c
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 0xad30
movq 0x188(%rsp), %rax
addq 0x178(%rsp), %rax
movq %rax, (%r14)
leaq 0x88(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x1ef2d
cmpb $0x0, 0xb8(%rsp)
je 0x1d3f1
movq (%r14), %rdx
leaq 0xc0(%rsp), %rdi
movq %r15, %rsi
movl $0x20, %ecx
callq 0x1c868
cmpb $0x0, 0xf0(%rsp)
je 0x1d45e
leaq 0xc0(%rsp), %rdi
callq 0x2494c
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 0xad30
movq 0x158(%rsp), %rax
addq 0x148(%rsp), %rax
movq %rax, (%r14)
leaq 0x88(%rsp), %rdi
callq 0x249a6
leaq 0x108(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x100(%rsp), %rsi
leaq 0xf(%rsp), %rdx
movq %rax, %rcx
callq 0x252fe
movaps 0x100(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x100(%rsp)
movb $0x1, 0x30(%rbx)
movups %xmm0, (%rbx)
movq 0x108(%rsp), %rdi
testq %rdi, %rdi
je 0x1cedc
callq 0xaa12
movq 0x150(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d476
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1d476
movl $0x1, 0x50(%rsp)
movq (%r14), %rax
movq %rax, 0x58(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x1b93c
leaq 0x2b3dc(%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 0x1d208
movq %rdx, 0x88(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x98(%rsp)
jmp 0x1d20f
movq (%r14), %rdx
leaq 0x50(%rsp), %rdi
movq %r15, %rsi
movl $0x7, %ecx
callq 0x1c868
cmpb $0x0, 0x80(%rsp)
je 0x1d1d4
leaq 0x50(%rsp), %rdi
callq 0x2494c
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 0xad30
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 0x1d581
movq %rax, %r15
movslq %r15d, %rax
cmpq %r15, %rax
jne 0x1d58d
movl (%r14), %eax
cmpl $0x22, %eax
je 0x1d58d
testl %eax, %eax
jne 0x1d02c
movl %ebp, (%r14)
movl $0x20, %edi
callq 0x92d0
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0x44865(%rip), %rcx     # 0x618b0
movq %rcx, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
leaq 0x448a4(%rip), %rdx     # 0x61900
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 0x1d541
movq 0x30(%rsp), %rsi
jmp 0x1d539
movq (%r14), %rdx
leaq 0x50(%rsp), %rdi
movq %r15, %rsi
movl $0x1f, %ecx
callq 0x1c868
cmpb $0x0, 0x80(%rsp)
je 0x1d1ee
leaq 0x50(%rsp), %rdi
callq 0x2494c
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 0xad30
movq 0xd8(%rsp), %rax
addq 0xc8(%rsp), %rax
movq %rax, (%r14)
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x1da9b
movb 0x40(%rsp), %al
testb %al, %al
je 0x1d3a5
movq (%r14), %rdx
leaq 0x88(%rsp), %rdi
movq %r15, %rsi
movl $0x20, %ecx
callq 0x1c868
cmpb $0x0, 0xb8(%rsp)
je 0x1d3d4
leaq 0x88(%rsp), %rdi
callq 0x2494c
movups (%rax), %xmm0
leaq 0x120(%rsp), %rdi
movaps %xmm0, -0x10(%rdi)
leaq 0x130(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
addq %rsi, %rdx
callq 0xad30
movq 0x128(%rsp), %rax
addq 0x118(%rsp), %rax
movq %rax, (%r14)
movb 0x40(%rsp), %al
movb %al, 0x30(%rbx)
cmpb $0x1, %al
jne 0x1d432
movq 0x10(%rsp), %rax
movq %rax, (%rbx)
xorl %eax, %eax
movq %rax, 0x8(%rbx)
movq 0x18(%rsp), %rcx
movq %rax, 0x18(%rsp)
movq %rcx, 0x8(%rbx)
movq %rax, 0x10(%rsp)
jmp 0x1d4f0
leaq 0x50(%rsp), %rdi
callq 0x248f2
movq %rbx, %rdi
movq %rax, %rsi
callq 0x248a4
jmp 0x1d541
leaq 0x50(%rsp), %rdi
callq 0x248f2
movq %rbx, %rdi
movq %rax, %rsi
callq 0x248a4
jmp 0x1d541
leaq 0x50(%rsp), %rdi
callq 0x248f2
movq %rbx, %rdi
movq %rax, %rsi
callq 0x248a4
jmp 0x1d541
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 0x2b152(%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 0x1d261
movq %rdx, 0x10(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x20(%rsp)
jmp 0x1d268
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 %rcx, -0x10(%rcx)
movq (%rax), %rsi
movq %rax, %rdx
addq $0x10, %rdx
cmpq %rdx, %rsi
je 0x1d2c0
movq %rsi, 0x60(%rsp)
movq (%rdx), %rsi
movq %rsi, 0x70(%rsp)
jmp 0x1d2c6
movups (%rdx), %xmm0
movups %xmm0, (%rcx)
movq 0x8(%rax), %rsi
movq %rsi, 0x68(%rsp)
movq %rdx, (%rax)
movq $0x0, 0x8(%rax)
xorl %edx, %edx
movb %dl, 0x10(%rax)
movb %dl, 0x30(%rbx)
movups 0x50(%rsp), %xmm0
movups %xmm0, (%rbx)
leaq 0x20(%rbx), %rax
movq %rax, 0x10(%rbx)
movq 0x60(%rsp), %rdx
cmpq %rcx, %rdx
je 0x1d30b
movq %rdx, 0x10(%rbx)
movq 0x70(%rsp), %rax
movq %rax, 0x20(%rbx)
jmp 0x1d311
movups (%rcx), %xmm0
movups %xmm0, (%rax)
movq 0x68(%rsp), %rax
movq %rax, 0x18(%rbx)
movq %rcx, 0x60(%rsp)
movq $0x0, 0x68(%rsp)
movb $0x0, 0x70(%rsp)
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d344
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x92e0
movq 0x88(%rsp), %rdi
cmpq %r14, %rdi
je 0x1d361
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d54b
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1d54b
leaq 0x10(%rsp), %rdi
callq 0x248f2
movq %rbx, %rdi
movq %rax, %rsi
callq 0x248a4
jmp 0x1d4ad
movb %al, 0x30(%rbx)
leaq 0x30(%rsp), %rax
movups -0x20(%rax), %xmm0
movups %xmm0, (%rbx)
leaq 0x20(%rbx), %rcx
movq %rcx, 0x10(%rbx)
movq -0x10(%rax), %rdx
cmpq %rax, %rdx
je 0x1d40b
movq %rdx, 0x10(%rbx)
movq 0x30(%rsp), %rcx
movq %rcx, 0x20(%rbx)
jmp 0x1d411
leaq 0x88(%rsp), %rdi
callq 0x248f2
movq %rbx, %rdi
movq %rax, %rsi
callq 0x248a4
jmp 0x1d50d
leaq 0x88(%rsp), %rdi
callq 0x28294
movq %rbx, %rdi
movq %rax, %rsi
callq 0x248a4
jmp 0x1d483
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 0x1d51a
leaq 0x30(%rsp), %rax
movups -0x20(%rax), %xmm0
movups %xmm0, (%rbx)
leaq 0x20(%rbx), %rcx
movq %rcx, 0x10(%rbx)
movq -0x10(%rax), %rdx
cmpq %rax, %rdx
je 0x1d4ce
movq %rdx, 0x10(%rbx)
movq 0x30(%rsp), %rcx
movq %rcx, 0x20(%rbx)
jmp 0x1d4d4
leaq 0xc0(%rsp), %rdi
callq 0x248f2
movq %rbx, %rdi
movq %rax, %rsi
callq 0x248a4
leaq 0xc0(%rsp), %rdi
callq 0x28218
leaq 0x88(%rsp), %rdi
callq 0x28264
movq 0x180(%rsp), %rdi
cmpq %r13, %rdi
je 0x1d4ad
movq 0x190(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x10(%rsp), %rdi
callq 0x28218
movq 0x120(%rsp), %rdi
cmpq %r12, %rdi
je 0x1d541
movq 0x130(%rsp), %rsi
jmp 0x1d539
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 0x120(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d50d
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x88(%rsp), %rdi
callq 0x28218
leaq 0x10(%rsp), %rdi
callq 0x28234
movq 0xd0(%rsp), %rdi
cmpq %r12, %rdi
je 0x1d541
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x50(%rsp), %rdi
callq 0x28218
leaq 0x1c8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d56c
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 0x2ae62(%rip), %rdi     # 0x483ea
callq 0x9190
leaq 0x2ae56(%rip), %rdi     # 0x483ea
callq 0x93d0
movq %rax, %rbx
movq 0x150(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d5c0
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1d5c0
jmp 0x1d5bd
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x28218
jmp 0x1d5d4
jmp 0x1d5d1
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x28264
jmp 0x1d5e6
movq %rax, %rbx
movq 0x180(%rsp), %rdi
cmpq %r13, %rdi
je 0x1d632
movq 0x190(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1d632
jmp 0x1d607
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x28218
jmp 0x1d61c
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x28234
jmp 0x1d641
movq %rax, %rbx
jmp 0x1d682
jmp 0x1d62f
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x28218
jmp 0x1d65f
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
cmpq %r12, %rdi
je 0x1d6eb
movq 0xe0(%rsp), %rsi
jmp 0x1d696
movq %rax, %rbx
movq 0x120(%rsp), %rdi
cmpq %r12, %rdi
je 0x1d6eb
movq 0x130(%rsp), %rsi
jmp 0x1d696
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x1d682
movl %ebp, (%r14)
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1d6eb
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1d6eb
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x1d6bf
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1d6bf
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r14, %rdi
je 0x1d6fa
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1d6fa
jmp 0x1d6e8
jmp 0x1d6e8
jmp 0x1d6e8
jmp 0x1d6e8
jmp 0x1d6e8
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x28218
jmp 0x1d728
movq %rax, %rbx
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d728
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1d728
jmp 0x1d725
jmp 0x1d725
jmp 0x1d725
jmp 0x1d725
movq %rax, %rbx
leaq 0x1c8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d749
movq 0x1c8(%rsp), %rsi
incq %rsi
callq 0x92e0
movq %rbx, %rdi
callq 0x94e0