// File: pfnet-research[P]pml/src/logic.cpp
// Function: logic::operator==(logic::formula_t const&, logic::formula_t const&)
bool operator==(formula_t const& lhs, formula_t const& rhs) {
    if (lhs.kind() != rhs.kind())
        return false;
    switch (lhs.kind()) {
    case formula_kind_t::Var:
        return cast<var_formula_t>(lhs).name == cast<var_formula_t>(rhs).name;
    case formula_kind_t::Bot:
    case formula_kind_t::Top:
        return true;
    case formula_kind_t::Neg:
        return *cast<neg_formula_t>(lhs).inner == *cast<neg_formula_t>(rhs).inner;
    case formula_kind_t::And:
        return *cast<and_formula_t>(lhs).lhs == *cast<and_formula_t>(rhs).lhs &&
            *cast<and_formula_t>(lhs).rhs == *cast<and_formula_t>(rhs).rhs;
    case formula_kind_t::Or:
        return *cast<or_formula_t>(lhs).lhs == *cast<or_formula_t>(rhs).lhs &&
            *cast<or_formula_t>(lhs).rhs == *cast<or_formula_t>(rhs).rhs;
    case formula_kind_t::Impl:
        return *cast<impl_formula_t>(lhs).lhs == *cast<impl_formula_t>(rhs).lhs &&
            *cast<impl_formula_t>(lhs).rhs == *cast<impl_formula_t>(rhs).rhs;
    case formula_kind_t::Eq:
        return *cast<eq_formula_t>(lhs).lhs == *cast<eq_formula_t>(rhs).lhs &&
            *cast<eq_formula_t>(lhs).rhs == *cast<eq_formula_t>(rhs).rhs;
    case formula_kind_t::Lt:
        return *cast<less_formula_t>(lhs).lhs == *cast<less_formula_t>(rhs).lhs &&
            *cast<less_formula_t>(lhs).rhs == *cast<less_formula_t>(rhs).rhs;
    case formula_kind_t::Leq:
        return *cast<leq_formula_t>(lhs).lhs == *cast<leq_formula_t>(rhs).lhs &&
            *cast<leq_formula_t>(lhs).rhs == *cast<leq_formula_t>(rhs).rhs;
    case formula_kind_t::Geq:
        return *cast<geq_formula_t>(lhs).lhs == *cast<geq_formula_t>(rhs).lhs &&
            *cast<geq_formula_t>(lhs).rhs == *cast<geq_formula_t>(rhs).rhs;
    case formula_kind_t::Gt:
        return *cast<greater_formula_t>(lhs).lhs == *cast<greater_formula_t>(rhs).lhs &&
            *cast<greater_formula_t>(lhs).rhs == *cast<greater_formula_t>(rhs).rhs;
    }
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
callq *(%rax)
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
callq *(%rax)
movl %eax, %ecx
movl -0x1c(%rbp), %eax
cmpl %ecx, %eax
je 0x246fa
movb $0x0, -0x1(%rbp)
jmp 0x24ca4
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
movq (%rax), %rax
callq *%rax
movl %eax, %ecx
movq %rcx, -0x28(%rbp)
subl $0xb, %eax
ja 0x24ca0
movq -0x28(%rbp), %rax
leaq 0x77478(%rip), %rcx     # 0x9bb98
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rdi
callq 0x22260
addq $0x8, %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
callq 0x22260
movq -0x30(%rbp), %rdi
movq %rax, %rsi
addq $0x8, %rsi
callq 0xf040
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x24ca4
movb $0x1, -0x1(%rbp)
jmp 0x24ca4
movq -0x10(%rbp), %rdi
callq 0x222a0
movq %rax, %rdi
addq $0x8, %rdi
callq 0x115e0
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
callq 0x222a0
movq %rax, %rdi
addq $0x8, %rdi
callq 0x115e0
movq -0x38(%rbp), %rdi
movq %rax, %rsi
callq 0x246c0
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x24ca4
movq -0x10(%rbp), %rdi
callq 0x222e0
movq %rax, %rdi
addq $0x8, %rdi
callq 0x115e0
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rdi
callq 0x222e0
movq %rax, %rdi
addq $0x8, %rdi
callq 0x115e0
movq -0x48(%rbp), %rdi
movq %rax, %rsi
callq 0x246c0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x39(%rbp)
jne 0x247f2
jmp 0x2482f
movq -0x10(%rbp), %rdi
callq 0x222e0
movq %rax, %rdi
addq $0x18, %rdi
callq 0x115e0
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rdi
callq 0x222e0
movq %rax, %rdi
addq $0x18, %rdi
callq 0x115e0
movq -0x50(%rbp), %rdi
movq %rax, %rsi
callq 0x246c0
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x24ca4
movq -0x10(%rbp), %rdi
callq 0x22320
movq %rax, %rdi
addq $0x8, %rdi
callq 0x115e0
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rdi
callq 0x22320
movq %rax, %rdi
addq $0x8, %rdi
callq 0x115e0
movq -0x60(%rbp), %rdi
movq %rax, %rsi
callq 0x246c0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x51(%rbp)
jne 0x24884
jmp 0x248c1
movq -0x10(%rbp), %rdi
callq 0x22320
movq %rax, %rdi
addq $0x18, %rdi
callq 0x115e0
movq %rax, -0x68(%rbp)
movq -0x18(%rbp), %rdi
callq 0x22320
movq %rax, %rdi
addq $0x18, %rdi
callq 0x115e0
movq -0x68(%rbp), %rdi
movq %rax, %rsi
callq 0x246c0
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x24ca4
movq -0x10(%rbp), %rdi
callq 0x22360
movq %rax, %rdi
addq $0x8, %rdi
callq 0x115e0
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rdi
callq 0x22360
movq %rax, %rdi
addq $0x8, %rdi
callq 0x115e0
movq -0x78(%rbp), %rdi
movq %rax, %rsi
callq 0x246c0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x69(%rbp)
jne 0x24916
jmp 0x24953
movq -0x10(%rbp), %rdi
callq 0x22360
movq %rax, %rdi
addq $0x18, %rdi
callq 0x115e0
movq %rax, -0x80(%rbp)
movq -0x18(%rbp), %rdi
callq 0x22360
movq %rax, %rdi
addq $0x18, %rdi
callq 0x115e0
movq -0x80(%rbp), %rdi
movq %rax, %rsi
callq 0x246c0
movb %al, -0x69(%rbp)
movb -0x69(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x24ca4
movq -0x10(%rbp), %rdi
callq 0x223a0
movq %rax, %rdi
addq $0x8, %rdi
callq 0x24f80
movq %rax, -0x90(%rbp)
movq -0x18(%rbp), %rdi
callq 0x223a0
movq %rax, %rdi
addq $0x8, %rdi
callq 0x24f80
movq -0x90(%rbp), %rdi
movq %rax, %rsi
callq 0x24340
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x81(%rbp)
jne 0x249b1
jmp 0x249f7
movq -0x10(%rbp), %rdi
callq 0x223a0
movq %rax, %rdi
addq $0x18, %rdi
callq 0x24f80
movq %rax, -0x98(%rbp)
movq -0x18(%rbp), %rdi
callq 0x223a0
movq %rax, %rdi
addq $0x18, %rdi
callq 0x24f80
movq -0x98(%rbp), %rdi
movq %rax, %rsi
callq 0x24340
movb %al, -0x81(%rbp)
movb -0x81(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x24ca4
movq -0x10(%rbp), %rdi
callq 0x223e0
movq %rax, %rdi
addq $0x8, %rdi
callq 0x24f80
movq %rax, -0xa8(%rbp)
movq -0x18(%rbp), %rdi
callq 0x223e0
movq %rax, %rdi
addq $0x8, %rdi
callq 0x24f80
movq -0xa8(%rbp), %rdi
movq %rax, %rsi
callq 0x24340
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x99(%rbp)
jne 0x24a58
jmp 0x24a9e
movq -0x10(%rbp), %rdi
callq 0x223e0
movq %rax, %rdi
addq $0x18, %rdi
callq 0x24f80
movq %rax, -0xb0(%rbp)
movq -0x18(%rbp), %rdi
callq 0x223e0
movq %rax, %rdi
addq $0x18, %rdi
callq 0x24f80
movq -0xb0(%rbp), %rdi
movq %rax, %rsi
callq 0x24340
movb %al, -0x99(%rbp)
movb -0x99(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x24ca4
movq -0x10(%rbp), %rdi
callq 0x22420
movq %rax, %rdi
addq $0x8, %rdi
callq 0x24f80
movq %rax, -0xc0(%rbp)
movq -0x18(%rbp), %rdi
callq 0x22420
movq %rax, %rdi
addq $0x8, %rdi
callq 0x24f80
movq -0xc0(%rbp), %rdi
movq %rax, %rsi
callq 0x24340
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0xb1(%rbp)
jne 0x24aff
jmp 0x24b45
movq -0x10(%rbp), %rdi
callq 0x22420
movq %rax, %rdi
addq $0x18, %rdi
callq 0x24f80
movq %rax, -0xc8(%rbp)
movq -0x18(%rbp), %rdi
callq 0x22420
movq %rax, %rdi
addq $0x18, %rdi
callq 0x24f80
movq -0xc8(%rbp), %rdi
movq %rax, %rsi
callq 0x24340
movb %al, -0xb1(%rbp)
movb -0xb1(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x24ca4
movq -0x10(%rbp), %rdi
callq 0x22460
movq %rax, %rdi
addq $0x8, %rdi
callq 0x24f80
movq %rax, -0xd8(%rbp)
movq -0x18(%rbp), %rdi
callq 0x22460
movq %rax, %rdi
addq $0x8, %rdi
callq 0x24f80
movq -0xd8(%rbp), %rdi
movq %rax, %rsi
callq 0x24340
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0xc9(%rbp)
jne 0x24ba6
jmp 0x24bec
movq -0x10(%rbp), %rdi
callq 0x22460
movq %rax, %rdi
addq $0x18, %rdi
callq 0x24f80
movq %rax, -0xe0(%rbp)
movq -0x18(%rbp), %rdi
callq 0x22460
movq %rax, %rdi
addq $0x18, %rdi
callq 0x24f80
movq -0xe0(%rbp), %rdi
movq %rax, %rsi
callq 0x24340
movb %al, -0xc9(%rbp)
movb -0xc9(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x24ca4
movq -0x10(%rbp), %rdi
callq 0x224a0
movq %rax, %rdi
addq $0x8, %rdi
callq 0x24f80
movq %rax, -0xf0(%rbp)
movq -0x18(%rbp), %rdi
callq 0x224a0
movq %rax, %rdi
addq $0x8, %rdi
callq 0x24f80
movq -0xf0(%rbp), %rdi
movq %rax, %rsi
callq 0x24340
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0xe1(%rbp)
jne 0x24c4d
jmp 0x24c93
movq -0x10(%rbp), %rdi
callq 0x224a0
movq %rax, %rdi
addq $0x18, %rdi
callq 0x24f80
movq %rax, -0xf8(%rbp)
movq -0x18(%rbp), %rdi
callq 0x224a0
movq %rax, %rdi
addq $0x18, %rdi
callq 0x24f80
movq -0xf8(%rbp), %rdi
movq %rax, %rsi
callq 0x24340
movb %al, -0xe1(%rbp)
movb -0xe1(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x24ca4
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopw %cs:(%rax,%rax)