// File: /workspace/github_cpp_makefile_star2_O3/pfnet-research[P]pml/src/parser.cpp
// Function: parser::primary_formula(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long&)
formula_result_t primary_formula(std::string const& input, size_t& pos) {
    auto token = next_token(input, pos);
    if (token.kind == token_t::kind_t::True) {
        pos = token.pos + token.lexime.size();
        return formula_result_t::ok(make<logic::top_formula_t>());
    } else if (token.kind == token_t::kind_t::False) {
        pos = token.pos + token.lexime.size();
        return formula_result_t::ok(make<logic::bot_formula_t>());
    } else if (token.kind == token_t::kind_t::LParen) {
        EXPECT(lparen_token, LParen);
        auto inner_result = formula(input, pos);
        if (inner_result.is_error())
            return inner_result;
        EXPECT(rparen_token, RParen);
        return inner_result;
    } else {
        auto cmp_result = comparison_terms_formula(input, pos);
        if (cmp_result.is_ok())
            return cmp_result;
        if (token.kind == token_t::kind_t::Ident) {
            pos = token.pos + token.lexime.size();
            return formula_result_t::ok(make<logic::var_formula_t>(token.lexime));
        } else {
            return formula_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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq (%rdx), %rdx
leaq 0xb0(%rsp), %r12
movq %r12, %rdi
callq 0x1ba35
movl (%r12), %eax
cmpl $0x1f, %eax
je 0x1df47
cmpl $0x9, %eax
je 0x1def0
cmpl $0x8, %eax
jne 0x1e058
movq 0xc8(%rsp), %rax
addq 0xb8(%rsp), %rax
movq %rax, (%r14)
movl $0x18, %edi
callq 0x92d0
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0x42a73(%rip), %rcx     # 0x60950
movq %rcx, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
leaq 0x42ab2(%rip), %rdx     # 0x609a0
jmp 0x1df33
movq 0xc8(%rsp), %rax
addq 0xb8(%rsp), %rax
movq %rax, (%r14)
movl $0x18, %edi
callq 0x92d0
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0x42abe(%rip), %rcx     # 0x609e0
movq %rcx, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
leaq 0x42afd(%rip), %rdx     # 0x60a30
movq %rdx, 0x10(%rax)
movb $0x1, 0x30(%rbx)
movq %rcx, (%rbx)
movq %rax, 0x8(%rbx)
jmp 0x1e41f
movq (%r14), %rdx
leaq 0xe0(%rsp), %rdi
movq %r15, %rsi
movl $0x1f, %ecx
callq 0x1c56e
cmpb $0x0, 0x110(%rsp)
je 0x1e09b
leaq 0xe0(%rsp), %rdi
callq 0x24814
movups (%rax), %xmm0
leaq 0x50(%rsp), %rdi
movaps %xmm0, -0x10(%rdi)
leaq 0x60(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
addq %rsi, %rdx
callq 0xac68
movq 0x58(%rsp), %rax
addq 0x48(%rsp), %rax
movq %rax, (%r14)
movq %rsp, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x1eb2f
movb 0x30(%rsp), %al
testb %al, %al
je 0x1e162
movq (%r14), %rdx
leaq 0x78(%rsp), %rdi
movq %r15, %rsi
movl $0x20, %ecx
callq 0x1c56e
cmpb $0x0, 0xa8(%rsp)
je 0x1e195
leaq 0x78(%rsp), %rdi
callq 0x24814
movups (%rax), %xmm0
leaq 0x130(%rsp), %rdi
movaps %xmm0, -0x10(%rdi)
leaq 0x140(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
addq %rsi, %rdx
callq 0xac68
movq 0x138(%rsp), %rax
addq 0x128(%rsp), %rax
movq %rax, (%r14)
movb 0x30(%rsp), %al
movb %al, 0x30(%rbx)
cmpb $0x1, %al
jne 0x1e353
movaps (%rsp), %xmm0
xorl %eax, %eax
movq %rax, 0x8(%rsp)
movups %xmm0, (%rbx)
movq %rax, (%rsp)
jmp 0x1e3a1
leaq 0xe0(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x1da7e
movb 0x110(%rsp), %al
cmpb $0x1, %al
jne 0x1e0b8
movb %al, 0x30(%rbx)
movaps 0xe0(%rsp), %xmm0
xorl %eax, %eax
movq %rax, 0xe8(%rsp)
movups %xmm0, (%rbx)
movq %rax, 0xe0(%rsp)
jmp 0x1e341
leaq 0xe0(%rsp), %rdi
callq 0x247ba
movq %rbx, %rdi
movq %rax, %rsi
callq 0x249b4
jmp 0x1e3fe
movl 0xb0(%rsp), %esi
cmpl $0xa, %esi
jne 0x1e101
leaq 0xc0(%rsp), %rcx
movq 0x8(%rcx), %rax
addq -0x8(%rcx), %rax
movq %rax, (%r14)
leaq 0x8(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %rsp, %rsi
leaq 0x78(%rsp), %rdx
callq 0x2539c
movb $0x1, 0x30(%rbx)
movaps (%rsp), %xmm0
movups %xmm0, (%rbx)
jmp 0x1e341
movl $0x1, (%rsp)
movq (%r14), %rax
movq %rax, 0x8(%rsp)
leaq 0x120(%rsp), %rdi
callq 0x1b6bc
leaq 0x2a1de(%rip), %rcx     # 0x48302
leaq 0x120(%rsp), %rdi
movl $0xd, %r8d
xorl %esi, %esi
xorl %edx, %edx
callq 0x9330
leaq 0x50(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1e1af
movq %rdx, 0x40(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x50(%rsp)
jmp 0x1e1b6
movb %al, 0x30(%rbx)
leaq 0x20(%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 0x1e20b
movq %rdx, 0x10(%rbx)
movq 0x20(%rsp), %rcx
movq %rcx, 0x20(%rbx)
jmp 0x1e211
leaq 0x78(%rsp), %rdi
callq 0x247ba
movq %rbx, %rdi
movq %rax, %rsi
callq 0x249b4
jmp 0x1e3be
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
leaq 0x40(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x2a1ae(%rip), %rsi     # 0x48387
callq 0x9540
leaq 0x88(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1e232
movq %rdx, 0x78(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x88(%rsp)
jmp 0x1e239
movups (%rax), %xmm0
movups %xmm0, (%rcx)
movq 0x18(%rsp), %rcx
movq %rcx, 0x18(%rbx)
movq %rax, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movb $0x0, 0x20(%rsp)
jmp 0x1e3df
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x78(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0xc0(%rsp), %rsi
movq 0xc8(%rsp), %rdx
callq 0x90d0
leaq 0x20(%rsp), %rcx
movq (%rax), %rdx
movq %rax, %rdi
addq $0x10, %rdi
cmpq %rdi, %rdx
je 0x1e28d
movq %rdx, 0x10(%rsp)
movq (%rdi), %rsi
movq %rsi, 0x20(%rsp)
jmp 0x1e296
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 (%rsp), %xmm0
movups %xmm0, (%rbx)
leaq 0x20(%rbx), %rax
movq %rax, 0x10(%rbx)
cmpq %rcx, %rdx
je 0x1e2d2
movq %rdx, 0x10(%rbx)
movq 0x20(%rsp), %rax
movq %rax, 0x20(%rbx)
jmp 0x1e2d8
movups (%rcx), %xmm0
movups %xmm0, (%rax)
movq %rsi, 0x18(%rbx)
movq %rcx, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movb $0x0, 0x20(%rsp)
movq 0x78(%rsp), %rdi
cmpq %r15, %rdi
je 0x1e309
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x92e0
movq 0x40(%rsp), %rdi
cmpq %r14, %rdi
je 0x1e320
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x130(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1e341
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0xe0(%rsp), %rdi
callq 0x280cc
jmp 0x1e41f
leaq 0x20(%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 0x1e37f
movq %rdx, 0x10(%rbx)
movq 0x20(%rsp), %rcx
movq %rcx, 0x20(%rbx)
jmp 0x1e385
movups (%rax), %xmm0
movups %xmm0, (%rcx)
movq 0x18(%rsp), %rcx
movq %rcx, 0x18(%rbx)
movq %rax, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movb $0x0, 0x20(%rsp)
movq 0x130(%rsp), %rdi
cmpq %r15, %rdi
je 0x1e3be
movq 0x140(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1e3df
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x92e0
movq %rsp, %rdi
callq 0x280cc
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x1e3fe
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x100(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1e41f
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1e440
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x92e0
movq %rbx, %rax
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x1e454
movq %rax, %rbx
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1e49c
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1e49c
movq %rax, %rbx
movq 0x78(%rsp), %rdi
cmpq %r15, %rdi
je 0x1e4a9
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1e4a9
movq %rax, %rbx
movq %rsp, %rdi
callq 0x280cc
jmp 0x1e4ff
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r14, %rdi
je 0x1e4c5
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1e4c5
movq %rax, %rbx
leaq 0x130(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1e4ed
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1e4ed
jmp 0x1e4ea
movq %rax, %rbx
leaq 0xe0(%rsp), %rdi
callq 0x280cc
jmp 0x1e549
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x1e51d
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1e51d
jmp 0x1e51a
movq %rax, %rbx
leaq 0x100(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1e549
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1e549
jmp 0x1e546
jmp 0x1e546
jmp 0x1e546
movq %rax, %rbx
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1e56a
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x92e0
movq %rbx, %rdi
callq 0x94e0