// File: /workspace/github_cpp_makefile_star2_O2/pfnet-research[P]pml/src/typechecker.cpp
// Function: check_by_PRISM(mdp::mdp_t const&, pctl::pctl_t const&)
bool check_by_PRISM(mdp::mdp_t const& mdp, pctl::pctl_t const& pctl) {
    std::ofstream mdp_output{"./output.mdp"};
    if (mdp_output.fail())
        throw std::runtime_error{"can not open file: ./output.mdp"};
    mdp_output << mdp << std::endl;

    std::ofstream pctl_output{"./output.pctl"};
    if (pctl_output.fail())
        throw std::runtime_error{"can not open file: ./output.pctl"};
    pctl.output(pctl_output);

    if (std::system("prism ./output.mdp ./output.pctl > prism_output") != 0)
        throw std::runtime_error{"can not execute prism"};

    std::ifstream prism{"prism_output"};

    std::string line;
    while (std::getline(prism, line)) {
        if (line.find("Result: true") != std::string::npos)
            return true;
    }
    return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x628, %rsp            # imm = 0x628
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x8f09(%rip), %rsi      # 0x3e50f
leaq 0x220(%rsp), %r15
pushq $0x10
popq %rdx
movq %r15, %rdi
callq 0x9320
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x240(%rsp,%rax)
jne 0x3573b
leaq 0x220(%rsp), %rdi
movq %r14, %rsi
callq 0x9b88
movq %rax, %rdi
callq 0x9140
leaq 0x8ee2(%rip), %rsi      # 0x3e52f
leaq 0x20(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x9320
movq 0x20(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x40(%rsp,%rax)
jne 0x3576b
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0xac2c
leaq 0x8ebb(%rip), %rdi      # 0x3e53d
callq 0x9260
testl %eax, %eax
jne 0x35787
leaq 0x8eca(%rip), %rsi      # 0x3e560
leaq 0x420(%rsp), %rdi
pushq $0x8
popq %rdx
callq 0x94f0
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x420(%rsp), %rbx
movq %rsp, %r14
leaq 0x8eba(%rip), %r15      # 0x3e583
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9070
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x20(%rax,%rcx), %ebp
testb $0x5, %bpl
jne 0x356f8
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x9550
cmpq $-0x1, %rax
je 0x356c9
testb $0x5, %bpl
sete %bl
movq %rsp, %rdi
callq 0x9130
leaq 0x420(%rsp), %rdi
callq 0x90a0
leaq 0x20(%rsp), %rdi
callq 0x9400
leaq 0x220(%rsp), %rdi
callq 0x9400
movl %ebx, %eax
addq $0x628, %rsp            # imm = 0x628
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x9150
movq %rax, %r14
leaq 0x8daf(%rip), %rsi      # 0x3e4fc
movq %rax, %rdi
callq 0x90f0
movq 0x26894(%rip), %rsi     # 0x5bff0
movq 0x2682d(%rip), %rdx     # 0x5bf90
movq %r14, %rdi
callq 0x94b0
pushq $0x10
popq %rdi
callq 0x9150
movq %rax, %r14
leaq 0x8d9f(%rip), %rsi      # 0x3e51c
movq %rax, %rdi
callq 0x90f0
jmp 0x357a1
pushq $0x10
popq %rdi
callq 0x9150
movq %rax, %r14
leaq 0x8dd4(%rip), %rsi      # 0x3e56d
movq %rax, %rdi
callq 0x90f0
movq 0x26848(%rip), %rsi     # 0x5bff0
movq 0x267e1(%rip), %rdx     # 0x5bf90
movq %r14, %rdi
callq 0x94b0
jmp 0x357b9
movq %rax, %rbx
movq %r14, %rdi
callq 0x9210
jmp 0x357f9
movq %rax, %rbx
movq %r14, %rdi
callq 0x9210
jmp 0x35803
jmp 0x357dc
jmp 0x357d7
movq %rax, %rbx
jmp 0x35803
movq %rax, %rbx
jmp 0x357f9
movq %rax, %rbx
movq %rsp, %rdi
callq 0x9130
leaq 0x420(%rsp), %rdi
callq 0x90a0
leaq 0x20(%rsp), %rdi
callq 0x9400
leaq 0x220(%rsp), %rdi
callq 0x9400
movq %rbx, %rdi
callq 0x94d0