Just write the following, compile with the right flags under clang, then call alive-tv synth.ll
and see the result.
It should say something like :
ERROR: Value mismatch
Example:
i8 noundef zeroext %#0 = #x3c (60)
0x3c is inc a
#include "cpu.c"
#define inline __attribute__((always_inline))
inline uint8_t gb(uint8_t a, uint8_t inst0) {
struct SM83 cpu;
cpu.mem[cpu.regs.pc] = inst0;
cpu.regs.a = a;
run_single_command(&cpu);
return cpu.regs.a;
}
uint8_t target(uint8_t a) {
return a+1;
}
// query for alive2
bool tgt(uint8_t inst0) {
return target(43) != gb(43, inst0);
}
bool src(uint8_t) { return true; }
note that run_single_command
and SM83
are from an emulator you can find here