// File: /workspace/github_cpp_makefile_star2_O1/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 $0x148, %rsp            # imm = 0x148
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq (%rdx), %rdx
leaq 0x78(%rsp), %r12
movq %r12, %rdi
callq 0x1bcc7
movl (%r12), %eax
cmpl $0x1f, %eax
je 0x1e28f
cmpl $0x9, %eax
je 0x1e238
cmpl $0x8, %eax
jne 0x1e3b3
movq 0x90(%rsp), %rax
addq 0x80(%rsp), %rax
movq %rax, (%r14)
movl $0x18, %edi
callq 0x92d0
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0x43703(%rip), %rcx     # 0x61928
movq %rcx, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
leaq 0x43742(%rip), %rdx     # 0x61978
jmp 0x1e27b
movq 0x90(%rsp), %rax
addq 0x80(%rsp), %rax
movq %rax, (%r14)
movl $0x18, %edi
callq 0x92d0
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0x4374e(%rip), %rcx     # 0x619b8
movq %rcx, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
leaq 0x4378d(%rip), %rdx     # 0x61a08
movq %rdx, 0x10(%rax)
movb $0x1, 0x30(%rbx)
movq %rcx, (%rbx)
movq %rax, 0x8(%rbx)
jmp 0x1e799
movq (%r14), %rdx
leaq 0x110(%rsp), %rdi
movq %r15, %rsi
movl $0x1f, %ecx
callq 0x1c868
cmpb $0x0, 0x140(%rsp)
je 0x1e406
leaq 0x110(%rsp), %rdi
callq 0x2494c
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 0xad30
movq 0x58(%rsp), %rax
addq 0x48(%rsp), %rax
movq %rax, (%r14)
movq %rsp, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x1ef2d
movb 0x30(%rsp), %al
testb %al, %al
je 0x1e4e7
movq (%r14), %rdx
leaq 0xa8(%rsp), %rdi
movq %r15, %rsi
movl $0x20, %ecx
callq 0x1c868
cmpb $0x0, 0xd8(%rsp)
je 0x1e51d
leaq 0xa8(%rsp), %rdi
callq 0x2494c
movups (%rax), %xmm0
leaq 0xf0(%rsp), %rdi
movaps %xmm0, -0x10(%rdi)
leaq 0x100(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
addq %rsi, %rdx
callq 0xad30
movq 0xf8(%rsp), %rax
addq 0xe8(%rsp), %rax
movq %rax, (%r14)
movb 0x30(%rsp), %al
movb %al, 0x30(%rbx)
cmpb $0x1, %al
jne 0x1e6f5
movq (%rsp), %rax
movq %rax, (%rbx)
xorl %eax, %eax
movq %rax, 0x8(%rbx)
movq 0x8(%rsp), %rcx
movq %rax, 0x8(%rsp)
movq %rcx, 0x8(%rbx)
movq %rax, (%rsp)
jmp 0x1e743
leaq 0x110(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x1ddc9
movb 0x140(%rsp), %al
cmpb $0x1, %al
jne 0x1e423
movb %al, 0x30(%rbx)
movq 0x110(%rsp), %rax
movq %rax, (%rbx)
xorl %eax, %eax
movq %rax, 0x8(%rbx)
movq 0x118(%rsp), %rcx
movq %rax, 0x118(%rsp)
movq %rcx, 0x8(%rbx)
movq %rax, 0x110(%rsp)
jmp 0x1e6e3
leaq 0x110(%rsp), %rdi
callq 0x248f2
movq %rbx, %rdi
movq %rax, %rsi
callq 0x24aec
jmp 0x1e78c
movl 0x78(%rsp), %esi
cmpl $0xa, %esi
jne 0x1e486
leaq 0x88(%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 0xa8(%rsp), %rdx
callq 0x254de
movaps (%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, (%rsp)
movb $0x1, 0x30(%rbx)
movups %xmm0, (%rbx)
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1e6e3
callq 0xaa12
jmp 0x1e6e3
movl $0x1, (%rsp)
movq (%r14), %rax
movq %rax, 0x8(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x1b93c
leaq 0x29e59(%rip), %rcx     # 0x48302
leaq 0xe0(%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 0x1e53a
movq %rdx, 0x40(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x50(%rsp)
jmp 0x1e541
movb %al, 0x30(%rbx)
leaq 0x20(%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 0x1e599
movq %rdx, 0x10(%rbx)
movq 0x20(%rsp), %rcx
movq %rcx, 0x20(%rbx)
jmp 0x1e59f
leaq 0xa8(%rsp), %rdi
callq 0x248f2
movq %rbx, %rdi
movq %rax, %rsi
callq 0x24aec
jmp 0x1e760
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 0x29e23(%rip), %rsi     # 0x48387
callq 0x9540
leaq 0xb8(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1e5c0
movq %rdx, 0xa8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xb8(%rsp)
jmp 0x1e5c7
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 0x1e76d
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0xa8(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x88(%rsp), %rsi
movq 0x90(%rsp), %rdx
callq 0x90d0
leaq 0x20(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq (%rax), %rsi
movq %rax, %rdx
addq $0x10, %rdx
cmpq %rdx, %rsi
je 0x1e622
movq %rsi, 0x10(%rsp)
movq (%rdx), %rsi
movq %rsi, 0x20(%rsp)
jmp 0x1e628
movups (%rdx), %xmm0
movups %xmm0, (%rcx)
movq 0x8(%rax), %rsi
movq %rsi, 0x18(%rsp)
movq %rdx, (%rax)
movq $0x0, 0x8(%rax)
xorl %edx, %edx
movb %dl, 0x10(%rax)
movb %dl, 0x30(%rbx)
movups (%rsp), %xmm0
movups %xmm0, (%rbx)
leaq 0x20(%rbx), %rax
movq %rax, 0x10(%rbx)
movq 0x10(%rsp), %rdx
cmpq %rcx, %rdx
je 0x1e66c
movq %rdx, 0x10(%rbx)
movq 0x20(%rsp), %rax
movq %rax, 0x20(%rbx)
jmp 0x1e672
movups (%rcx), %xmm0
movups %xmm0, (%rax)
movq 0x18(%rsp), %rax
movq %rax, 0x18(%rbx)
movq %rcx, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movb $0x0, 0x20(%rsp)
movq 0xa8(%rsp), %rdi
cmpq %r15, %rdi
je 0x1e6ab
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x92e0
movq 0x40(%rsp), %rdi
cmpq %r14, %rdi
je 0x1e6c2
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0xf0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1e6e3
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x110(%rsp), %rdi
callq 0x28264
jmp 0x1e799
leaq 0x20(%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 0x1e721
movq %rdx, 0x10(%rbx)
movq 0x20(%rsp), %rcx
movq %rcx, 0x20(%rbx)
jmp 0x1e727
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 0xf0(%rsp), %rdi
cmpq %r15, %rdi
je 0x1e760
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0xa8(%rsp), %rdi
callq 0x28218
movq %rsp, %rdi
callq 0x28264
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x1e78c
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x110(%rsp), %rdi
callq 0x28218
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1e7ba
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x92e0
movq %rbx, %rax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x1e7ce
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x28218
jmp 0x1e805
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r15, %rdi
je 0x1e812
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1e812
movq %rax, %rbx
movq %rsp, %rdi
callq 0x28264
jmp 0x1e868
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r14, %rdi
je 0x1e82e
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1e82e
movq %rax, %rbx
leaq 0xf0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1e856
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1e856
jmp 0x1e853
movq %rax, %rbx
leaq 0x110(%rsp), %rdi
callq 0x28264
jmp 0x1e89e
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x1e886
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1e886
jmp 0x1e883
movq %rax, %rbx
leaq 0x110(%rsp), %rdi
callq 0x28218
jmp 0x1e89e
jmp 0x1e89b
jmp 0x1e89b
jmp 0x1e89b
movq %rax, %rbx
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1e8bf
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x92e0
movq %rbx, %rdi
callq 0x94e0