simonlindholm / decomp-permuter

Randomly permute C files to better match a target binary
MIT License
128 stars 46 forks source link

Alternative Comparison Support #147

Open NWPlayer123 opened 2 years ago

NWPlayer123 commented 2 years ago

As seen in https://decomp.me/scratch/zQg5e on line 59, !(==0) or !! produces different codegen than != 0

simonlindholm commented 2 years ago

We have perm_condition: """Change if(x) into if(x != 0), or vice versa. Also handles for/while/do-while.""" Would be nice to extend that!

simonlindholm commented 2 years ago

... although, a separate pass may be better since we could then have it work with comparisons being assigned to variables instead of just being if'd. Leaving perm_condition for just x <-> x != 0 which is only valid if the variable is immediately used as a comparison