// File: /workspace/github_cpp_makefile_star2_O2/pfnet-research[P]pml/src/parser.cpp
// Function: parser::equive_expr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long&)
expr_result_t equive_expr(std::string const& input, size_t& pos) {
    auto head_result = additive_expr(input, pos);
    if (head_result.is_error())
        return head_result;
    auto acc = head_result.ok();

    while (true) {
        auto op_token = next_token(input, pos);
        if (op_token.kind != token_t::kind_t::DoubleEq &&
            op_token.kind != token_t::kind_t::Neq &&
            op_token.kind != token_t::kind_t::Leq &&
            op_token.kind != token_t::kind_t::Geq)
            break;
        pos = op_token.pos + op_token.lexime.size();

        auto e_result = additive_expr(input, pos);
        if (e_result.is_error())
            return e_result;
        auto e = e_result.ok();

        switch (op_token.kind) {
        case token_t::kind_t::DoubleEq:
            acc = make<ast::eq_expr_t>(acc, e);
            break;
        case token_t::kind_t::Neq:
            acc = make<ast::neq_expr_t>(acc, e);
            break;
        case token_t::kind_t::Leq:
            acc = make<ast::leq_expr_t>(acc, e);
            break;
        case token_t::kind_t::Geq:
            acc = make<ast::geq_expr_t>(acc, e);
            break;
        default:
            throw std::logic_error{"invalid formula op"};
        }
    }
    return acc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
leaq 0x60(%rsp), %r14
movq %r14, %rdi
callq 0x1a2b7
cmpb $0x0, 0x30(%r14)
je 0x1a643
leaq 0x60(%rsp), %rdi
callq 0x1b196
movq %rsp, %rdi
movq %rax, %rsi
callq 0xbde0
leaq 0x20(%rsp), %r15
leaq 0x10(%rsp), %r14
movq (%r12), %rdx
leaq 0x30(%rsp), %rdi
movq %r13, %rsi
callq 0x1537c
movl 0x30(%rsp), %eax
cmpl $0x17, %eax
ja 0x1a65e
movl $0xd80000, %ecx         # imm = 0xD80000
btl %eax, %ecx
jae 0x1a65e
movq 0x48(%rsp), %rax
addq 0x38(%rsp), %rax
movq %rax, (%r12)
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x1a2b7
cmpb $0x0, 0x30(%rbx)
je 0x1a652
movq %rbx, %rdi
callq 0x1b196
movq %r15, %rdi
movq %rax, %rsi
callq 0xbde0
movl 0x30(%rsp), %eax
addl $-0x13, %eax
cmpl $0x4, %eax
ja 0x1a6a7
leaq 0x1efa7(%rip), %rcx     # 0x39540
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r14, %rdi
movq %rsp, %rbp
movq %rbp, %rsi
movq %r15, %rdx
callq 0x1e6cb
movq %rbp, %rdi
movq %r14, %rsi
callq 0x203a6
jmp 0x1a618
movq %r14, %rdi
movq %rsp, %rbp
movq %rbp, %rsi
movq %r15, %rdx
callq 0x1eb37
movq %rbp, %rdi
movq %r14, %rsi
callq 0x20402
jmp 0x1a618
movq %r14, %rdi
movq %rsp, %rbp
movq %rbp, %rsi
movq %r15, %rdx
callq 0x1ed6d
movq %rbp, %rdi
movq %r14, %rsi
callq 0x20430
jmp 0x1a618
movq %r14, %rdi
movq %rsp, %rbp
movq %rbp, %rsi
movq %r15, %rdx
callq 0x1e901
movq %rbp, %rdi
movq %r14, %rsi
callq 0x203d4
leaq 0x18(%rsp), %rdi
callq 0xa248
leaq 0x28(%rsp), %rdi
callq 0xa248
movq %rbx, %rdi
callq 0x13e4a
leaq 0x40(%rsp), %rdi
callq 0x9130
jmp 0x1a51d
leaq 0x60(%rsp), %rsi
movq %rbx, %rdi
callq 0x1b172
jmp 0x1a688
leaq 0x40(%rsp), %rdi
callq 0x9130
jmp 0x1a67e
leaq 0x40(%rsp), %rdi
callq 0x9130
movb $0x1, 0x30(%rbx)
movaps (%rsp), %xmm0
andq $0x0, 0x8(%rsp)
movups %xmm0, (%rbx)
andq $0x0, (%rsp)
leaq 0x8(%rsp), %rdi
callq 0xa248
leaq 0x60(%rsp), %rdi
callq 0x13e4a
movq %rbx, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x9150
movq %rax, %r15
leaq 0x1f03e(%rip), %rsi     # 0x396f7
movq %rax, %rdi
callq 0x93c0
movq 0x41908(%rip), %rsi     # 0x5bfd0
movq 0x418c9(%rip), %rdx     # 0x5bf98
movq %r15, %rdi
callq 0x94b0
jmp 0x1a6d9
movq %rax, %r14
jmp 0x1a72b
jmp 0x1a6f3
movq %rax, %r14
movq %r15, %rdi
callq 0x9210
jmp 0x1a6f6
jmp 0x1a6f3
jmp 0x1a6f3
jmp 0x1a6f3
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0xa248
jmp 0x1a705
movq %rax, %r14
movq %rbx, %rdi
callq 0x13e4a
jmp 0x1a712
movq %rax, %r14
leaq 0x40(%rsp), %rdi
callq 0x9130
jmp 0x1a721
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0xa248
leaq 0x60(%rsp), %rdi
callq 0x13e4a
movq %r14, %rdi
callq 0x94d0