// File: /workspace/github_cpp_makefile_star2_O2/pfnet-research[P]pml/src/logic.cpp
// Function: logic::operator==(logic::term_t const&, logic::term_t const&)
bool operator==(term_t const& lhs, term_t const& rhs) {
    if (lhs.kind() != rhs.kind())
        return false;
    switch (lhs.kind()) {
    case term_kind_t::Var:
        return cast<var_term_t>(lhs).name == cast<var_term_t>(rhs).name;
    case term_kind_t::Int:
        return cast<int_term_t>(lhs).n == cast<int_term_t>(rhs).n;
    case term_kind_t::Add:
        return
            *cast<add_term_t>(lhs).lhs == *cast<add_term_t>(rhs).lhs &&
            *cast<add_term_t>(lhs).rhs == *cast<add_term_t>(rhs).rhs;
    case term_kind_t::Sub:
        return
            *cast<sub_term_t>(lhs).lhs == *cast<sub_term_t>(rhs).lhs &&
            *cast<sub_term_t>(lhs).rhs == *cast<sub_term_t>(rhs).rhs;
    case term_kind_t::Mul:
        return
            *cast<mul_term_t>(lhs).lhs == *cast<mul_term_t>(rhs).lhs &&
            *cast<mul_term_t>(lhs).rhs == *cast<mul_term_t>(rhs).rhs;
    case term_kind_t::Div:
        return
            *cast<div_term_t>(lhs).lhs == *cast<div_term_t>(rhs).lhs &&
            *cast<div_term_t>(lhs).rhs == *cast<div_term_t>(rhs).rhs;
    case term_kind_t::Prob:
        return
            *cast<prob_term_t>(lhs).inner == *cast<prob_term_t>(rhs).inner;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x26f22(%rip), %r12     # 0x3873c
movq (%r14), %rax
movq %r14, %rdi
callq *(%rax)
movl %eax, %ebp
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
cmpl %eax, %ebp
jne 0x11941
movq (%r14), %rax
movq %r14, %rdi
callq *(%rax)
movl %eax, %eax
movslq (%r12,%rax,4), %rax
addq %r12, %rax
jmpq *%rax
movq %r14, %rdi
callq 0xffd5
movq 0x8(%rax), %r15
movq %rbx, %rdi
callq 0xffd5
movq 0x8(%rax), %rsi
movq %r15, %rdi
callq 0x11805
testb %al, %al
je 0x11941
movq %r14, %rdi
callq 0xffd5
movq 0x18(%rax), %r14
movq %rbx, %rdi
callq 0xffd5
jmp 0x11938
movq %r14, %rdi
callq 0x1003b
movq 0x8(%rax), %r15
movq %rbx, %rdi
callq 0x1003b
movq 0x8(%rax), %rsi
movq %r15, %rdi
callq 0x11805
testb %al, %al
je 0x11941
movq %r14, %rdi
callq 0x1003b
movq 0x18(%rax), %r14
movq %rbx, %rdi
callq 0x1003b
jmp 0x11938
movq %r14, %rdi
callq 0x10019
movq 0x8(%rax), %r15
movq %rbx, %rdi
callq 0x10019
movq 0x8(%rax), %rsi
movq %r15, %rdi
callq 0x11805
testb %al, %al
je 0x11941
movq %r14, %rdi
callq 0x10019
movq 0x18(%rax), %r14
movq %rbx, %rdi
callq 0x10019
jmp 0x11938
movq %r14, %rdi
callq 0xfff7
movq 0x8(%rax), %r15
movq %rbx, %rdi
callq 0xfff7
movq 0x8(%rax), %rsi
movq %r15, %rdi
callq 0x11805
testb %al, %al
je 0x11941
movq %r14, %rdi
callq 0xfff7
movq 0x18(%rax), %r14
movq %rbx, %rdi
callq 0xfff7
movq 0x18(%rax), %rbx
jmp 0x1181a
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0xff91
leaq 0x8(%rax), %r14
movq %rbx, %rdi
callq 0xff91
leaq 0x8(%rax), %rsi
movq %r14, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xa5de
movq %r14, %rdi
callq 0xffb3
movl 0x8(%rax), %ebp
movq %rbx, %rdi
callq 0xffb3
cmpl 0x8(%rax), %ebp
sete %al
jmp 0x11943
movq %r14, %rdi
callq 0x10629
movq 0x8(%rax), %r14
movq %rbx, %rdi
callq 0x10629
movq 0x8(%rax), %rsi
movq %r14, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x119b7