TL;DR. Reverse the Verilog flag checker so that it gets transformed into the correct `target` signal value. The encoding for each byte is not exactly one-to-one, so guess a few bytes in the flag after reversing the encodings for the bytes in `target`.