// File: /workspace/github_cpp_makefile_star2_O3/pfnet-research[P]pml/src/mdp_expr.cpp
// Function: mdp::operator==(mdp::expr_t const&, mdp::expr_t const&)
bool operator==(expr_t const& lhs, expr_t const& rhs) {
    if (lhs.kind() != rhs.kind())
        return false;
    if (lhs.kind() == expr_kind_t::Int)
        return cast<int_expr_t>(lhs).n == cast<int_expr_t>(rhs).n;
    if (lhs.kind() == expr_kind_t::Real)
        return cast<real_expr_t>(lhs).d == cast<real_expr_t>(rhs).d;
    if (lhs.kind() == expr_kind_t::Bool)
        return cast<bool_expr_t>(lhs).b == cast<bool_expr_t>(rhs).b;
    if (lhs.kind() == expr_kind_t::Var)
        return cast<var_expr_t>(lhs).name == cast<var_expr_t>(rhs).name;
    if (lhs.kind() == expr_kind_t::Neg)
        return *cast<neg_expr_t>(lhs).inner == *cast<neg_expr_t>(rhs).inner;
    if (lhs.kind() == expr_kind_t::BinOp) {
        auto const& lhs_ = cast<binop_expr_t>(lhs);
        auto const& rhs_ = cast<binop_expr_t>(rhs);
        return
            *lhs_.lhs == *rhs_.lhs && *lhs_.rhs == *rhs_.rhs &&
            lhs_.binop_kind == rhs_.binop_kind;
    }
    if (lhs.kind() == expr_kind_t::If) {
        auto const& lhs_ = cast<if_expr_t>(lhs);
        auto const& rhs_ = cast<if_expr_t>(rhs);
        return
            *lhs_.cond == *rhs_.cond &&
            *lhs_.true_branch == *rhs_.true_branch &&
            *lhs_.false_branch == *rhs_.false_branch;
    }
    if (lhs.kind() == expr_kind_t::Min) {
        auto const& lhs_args = cast<min_expr_t>(lhs).elems;
        auto const& rhs_args = cast<min_expr_t>(rhs).elems;
        if (lhs_args.size() != rhs_args.size())
            return false;
        for (size_t i=0; i<lhs_args.size(); ++i) {
            if (*lhs_args[i] != *rhs_args[i])
                return false;
        }
        return true;
    }
    if (lhs.kind() == expr_kind_t::Max) {
        auto const& lhs_args = cast<max_expr_t>(lhs).elems;
        auto const& rhs_args = cast<max_expr_t>(rhs).elems;
        if (lhs_args.size() != rhs_args.size())
            return false;
        for (size_t i=0; i<lhs_args.size(); ++i) {
            if (*lhs_args[i] != *rhs_args[i])
                return false;
        }
        return true;
    }
    if (lhs.kind() == expr_kind_t::Floor)
        return *cast<floor_expr_t>(lhs).inner == *cast<floor_expr_t>(rhs).inner;
    if (lhs.kind() == expr_kind_t::Ceil)
        return *cast<ceil_expr_t>(lhs).inner == *cast<ceil_expr_t>(rhs).inner;
    if (lhs.kind() == expr_kind_t::Pow) {
        return
            *cast<pow_expr_t>(lhs).x == *cast<pow_expr_t>(rhs).x &&
            *cast<pow_expr_t>(lhs).y == *cast<pow_expr_t>(rhs).y;
    }
    if (lhs.kind() == expr_kind_t::Mod) {
        return
            *cast<mod_expr_t>(lhs).i == *cast<mod_expr_t>(rhs).i &&
            *cast<mod_expr_t>(lhs).n == *cast<mod_expr_t>(rhs).n;
    }
    if (lhs.kind() == expr_kind_t::Log) {
        return
            *cast<log_expr_t>(lhs).x == *cast<log_expr_t>(rhs).x &&
            *cast<log_expr_t>(lhs).b == *cast<log_expr_t>(rhs).b;
    }
    throw std::logic_error{"unreachable"};
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbp
movq %rdi, %r13
movq (%rdi), %rax
callq *(%rax)
movl %eax, %ebx
movq (%rbp), %rax
movq %rbp, %rdi
callq *(%rax)
cmpl %eax, %ebx
jne 0x1b328
leaq 0x45a11(%rip), %rbx     # 0x606f0
leaq 0x45a7a(%rip), %r14     # 0x60760
leaq 0x45aeb(%rip), %r12     # 0x607d8
movq %r12, %r15
movq (%r13), %rax
movq %r13, %rdi
callq *(%rax)
testl %eax, %eax
je 0x1b055
movq (%r13), %rax
movq %r13, %rdi
callq *(%rax)
cmpl $0x1, %eax
je 0x1b0a5
movq (%r13), %rax
movq %r13, %rdi
callq *(%rax)
cmpl $0x2, %eax
je 0x1b102
movq (%r13), %rax
movq %r13, %rdi
callq *(%rax)
cmpl $0x3, %eax
je 0x1b152
movq (%r13), %rax
movq %r13, %rdi
callq *(%rax)
cmpl $0x4, %eax
jne 0x1ad6f
movq %r13, %rdi
movq %rbx, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x9340
testq %rax, %rax
je 0x1b33d
movq %rax, %r13
movq %rbp, %rdi
movq %rbx, %rsi
movq %r14, %rdx
jmp 0x1ae79
movq (%r13), %rax
movq %r13, %rdi
callq *(%rax)
cmpl $0x5, %eax
je 0x1b1bf
movq (%r13), %rax
movq %r13, %rdi
callq *(%rax)
cmpl $0x6, %eax
jne 0x1ae05
movq %r13, %rdi
movq %rbx, %rsi
leaq 0x459f4(%rip), %r12     # 0x60790
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x9340
testq %rax, %rax
je 0x1b33d
movq %rax, %r13
movq %rbp, %rdi
movq %rbx, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x9340
testq %rax, %rax
je 0x1b33d
movq %rax, %rbp
movq 0x8(%r13), %rdi
movq 0x8(%rax), %rsi
callq 0x1acaf
testb %al, %al
je 0x1b328
movq 0x18(%r13), %rdi
movq 0x18(%rbp), %rsi
callq 0x1acaf
testb %al, %al
je 0x1b328
addq $0x28, %r13
addq $0x28, %rbp
jmp 0x1ae94
movq (%r13), %rax
movq %r13, %rdi
callq *(%rax)
cmpl $0x7, %eax
je 0x1b240
movq (%r13), %rax
movq %r13, %rdi
callq *(%rax)
cmpl $0x8, %eax
je 0x1b2ba
movq (%r13), %rax
movq %r13, %rdi
callq *(%rax)
cmpl $0x9, %eax
jne 0x1ae3f
movq %r13, %rdi
movq %rbx, %rsi
jmp 0x1ae5a
movq (%r13), %rax
movq %r13, %rdi
callq *(%rax)
cmpl $0xa, %eax
jne 0x1aec2
movq %r13, %rdi
movq %rbx, %rsi
leaq 0x45996(%rip), %r12     # 0x607f0
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x9340
testq %rax, %rax
je 0x1b33d
movq %rax, %r13
movq %rbp, %rdi
movq %rbx, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x9340
testq %rax, %rax
je 0x1b33d
movq %rax, %rbp
addq $0x8, %r13
addq $0x8, %rbp
movq (%r13), %r13
movq (%rbp), %rbp
movq (%r13), %rax
movq %r13, %rdi
callq *(%rax)
movl %eax, %r12d
movq (%rbp), %rax
movq %rbp, %rdi
callq *(%rax)
cmpl %eax, %r12d
movq %r15, %r12
je 0x1acf0
jmp 0x1b328
movq (%r13), %rax
movq %r13, %rdi
callq *(%rax)
cmpl $0xb, %eax
leaq 0x45933(%rip), %r12     # 0x60808
jne 0x1af34
movq %r13, %rdi
movq %rbx, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x9340
testq %rax, %rax
je 0x1b33d
movq %r12, %rdx
movq %rax, %r12
movq %rbp, %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
callq 0x9340
testq %rax, %rax
je 0x1b33d
movq 0x8(%r12), %rdi
movq 0x8(%rax), %rsi
callq 0x1acaf
testb %al, %al
je 0x1b328
movq %r13, %rdi
movq %rbx, %rsi
leaq 0x458d9(%rip), %r12     # 0x60808
jmp 0x1b016
movq (%r13), %rax
movq %r13, %rdi
callq *(%rax)
cmpl $0xc, %eax
jne 0x1afa4
movq %r13, %rdi
movq %rbx, %rsi
leaq 0x458d1(%rip), %rdx     # 0x60820
xorl %ecx, %ecx
callq 0x9340
testq %rax, %rax
je 0x1b33d
movq %rax, %r12
movq %rbp, %rdi
movq %rbx, %rsi
leaq 0x458b1(%rip), %rdx     # 0x60820
xorl %ecx, %ecx
callq 0x9340
testq %rax, %rax
je 0x1b33d
movq 0x8(%r12), %rdi
movq 0x8(%rax), %rsi
callq 0x1acaf
testb %al, %al
je 0x1b328
movq %r13, %rdi
movq %rbx, %rsi
leaq 0x4587e(%rip), %r12     # 0x60820
jmp 0x1b016
movq (%r13), %rax
movq %r13, %rdi
callq *(%rax)
cmpl $0xd, %eax
jne 0x1b342
movq %r13, %rdi
movq %rbx, %rsi
leaq 0x45875(%rip), %rdx     # 0x60838
xorl %ecx, %ecx
callq 0x9340
testq %rax, %rax
je 0x1b33d
movq %rax, %r12
movq %rbp, %rdi
movq %rbx, %rsi
leaq 0x45855(%rip), %rdx     # 0x60838
xorl %ecx, %ecx
callq 0x9340
testq %rax, %rax
je 0x1b33d
movq 0x8(%r12), %rdi
movq 0x8(%rax), %rsi
callq 0x1acaf
testb %al, %al
je 0x1b328
movq %r13, %rdi
movq %rbx, %rsi
leaq 0x45822(%rip), %r12     # 0x60838
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x9340
testq %rax, %rax
je 0x1b33d
movq %rax, %r13
movq %rbp, %rdi
movq %rbx, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x9340
testq %rax, %rax
je 0x1b33d
movq %rax, %rbp
addq $0x18, %r13
addq $0x18, %rbp
jmp 0x1ae94
leaq 0x45694(%rip), %rsi     # 0x606f0
leaq 0x4569d(%rip), %rdx     # 0x60700
movq %r13, %rdi
xorl %ecx, %ecx
callq 0x9340
testq %rax, %rax
je 0x1b33d
movq %rax, %rbx
leaq 0x45670(%rip), %rsi     # 0x606f0
leaq 0x45679(%rip), %rdx     # 0x60700
movq %rbp, %rdi
xorl %ecx, %ecx
callq 0x9340
testq %rax, %rax
je 0x1b33d
movl 0x8(%rbx), %ecx
cmpl 0x8(%rax), %ecx
jmp 0x1b238
leaq 0x45644(%rip), %rsi     # 0x606f0
leaq 0x45665(%rip), %rdx     # 0x60718
movq %r13, %rdi
xorl %ecx, %ecx
callq 0x9340
testq %rax, %rax
je 0x1b33d
movq %rax, %rbx
leaq 0x45620(%rip), %rsi     # 0x606f0
leaq 0x45641(%rip), %rdx     # 0x60718
movq %rbp, %rdi
xorl %ecx, %ecx
callq 0x9340
testq %rax, %rax
je 0x1b33d
movsd 0x8(%rax), %xmm0
cmpeqsd 0x8(%rbx), %xmm0
movq %xmm0, %rax
andl $0x1, %eax
jmp 0x1b32a
leaq 0x455e7(%rip), %rsi     # 0x606f0
leaq 0x45620(%rip), %rdx     # 0x60730
movq %r13, %rdi
xorl %ecx, %ecx
callq 0x9340
testq %rax, %rax
je 0x1b33d
movq %rax, %rbx
leaq 0x455c3(%rip), %rsi     # 0x606f0
leaq 0x455fc(%rip), %rdx     # 0x60730
movq %rbp, %rdi
xorl %ecx, %ecx
callq 0x9340
testq %rax, %rax
je 0x1b33d
movb 0x8(%rbx), %cl
cmpb 0x8(%rax), %cl
jmp 0x1b238
leaq 0x45597(%rip), %rsi     # 0x606f0
leaq 0x455e8(%rip), %rdx     # 0x60748
movq %r13, %rdi
xorl %ecx, %ecx
callq 0x9340
testq %rax, %rax
je 0x1b33d
movq %rax, %rbx
leaq 0x45573(%rip), %rsi     # 0x606f0
leaq 0x455c4(%rip), %rdx     # 0x60748
movq %rbp, %rdi
xorl %ecx, %ecx
callq 0x9340
testq %rax, %rax
je 0x1b33d
movq 0x10(%rbx), %rdx
cmpq 0x10(%rax), %rdx
jne 0x1b328
testq %rdx, %rdx
je 0x1b339
movq 0x8(%rax), %rsi
movq 0x8(%rbx), %rdi
callq 0x9300
testl %eax, %eax
jmp 0x1b238
leaq 0x4552a(%rip), %rsi     # 0x606f0
leaq 0x455ab(%rip), %rdx     # 0x60778
movq %r13, %rdi
xorl %ecx, %ecx
callq 0x9340
testq %rax, %rax
je 0x1b33d
movq %rax, %rbx
leaq 0x45506(%rip), %rsi     # 0x606f0
leaq 0x45587(%rip), %rdx     # 0x60778
movq %rbp, %rdi
xorl %ecx, %ecx
callq 0x9340
testq %rax, %rax
je 0x1b33d
movq %rax, %r14
movq 0x8(%rbx), %rdi
movq 0x8(%rax), %rsi
callq 0x1acaf
testb %al, %al
je 0x1b328
movq 0x18(%rbx), %rdi
movq 0x18(%r14), %rsi
callq 0x1acaf
testb %al, %al
je 0x1b328
movl 0x28(%rbx), %eax
cmpl 0x28(%r14), %eax
sete %al
jmp 0x1b32a
movq %r13, %rdi
callq 0x1ac6b
movq %rax, %rbx
movq %rbp, %rdi
callq 0x1ac6b
movq %rax, %r14
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rax
movq %rax, %rdx
subq %rcx, %rdx
movq 0x10(%r14), %rsi
subq 0x8(%r14), %rsi
cmpq %rsi, %rdx
jne 0x1b328
cmpq %rcx, %rax
je 0x1b339
xorl %r15d, %r15d
xorl %r12d, %r12d
movq (%rcx,%r15), %rdi
movq 0x8(%r14), %rax
movq (%rax,%r15), %rsi
callq 0x1acaf
testb %al, %al
je 0x1b32a
incq %r12
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rdx
subq %rcx, %rdx
sarq $0x4, %rdx
addq $0x10, %r15
cmpq %rdx, %r12
jb 0x1b284
jmp 0x1b32a
movq %r13, %rdi
callq 0x1ac8d
movq %rax, %rbx
movq %rbp, %rdi
callq 0x1ac8d
movq %rax, %r14
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rax
movq %rax, %rdx
subq %rcx, %rdx
movq 0x10(%r14), %rsi
subq 0x8(%r14), %rsi
cmpq %rsi, %rdx
jne 0x1b328
cmpq %rcx, %rax
je 0x1b339
xorl %r15d, %r15d
xorl %r12d, %r12d
movq (%rcx,%r15), %rdi
movq 0x8(%r14), %rax
movq (%rax,%r15), %rsi
callq 0x1acaf
testb %al, %al
je 0x1b32a
incq %r12
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rdx
subq %rcx, %rdx
sarq $0x4, %rdx
addq $0x10, %r15
cmpq %rdx, %r12
jb 0x1b2f6
jmp 0x1b32a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %al
jmp 0x1b32a
callq 0x9530
movl $0x10, %edi
callq 0x9150
movq %rax, %rbx
leaq 0x2d009(%rip), %rsi     # 0x4835f
movq %rax, %rdi
callq 0x93c0
movq 0x46c6b(%rip), %rsi     # 0x61fd0
movq 0x46c3c(%rip), %rdx     # 0x61fa8
movq %rbx, %rdi
callq 0x94b0
movq %rax, %r14
movq %rbx, %rdi
callq 0x9200
movq %r14, %rdi
callq 0x94e0
nop