binaryninja-api icon indicating copy to clipboard operation
binaryninja-api copied to clipboard

Simplify compound conditionals involving `cmp`

Open galenbwill opened this issue 3 years ago • 0 comments

(Issue for @cookiemon) Version and Platform (required):

  • Binary Ninja Version: 3.1.3618-dev

Bug Description: Transcript from public slack (from @null_ptr)

When I have a function like this in hlil, is there a way to have the conditional simplified by substituting rbx with rbx_1? The conditional comes out of a sub followed by a cmp and it seems binja uses the operand of the sub instead of the result. image For reference the disassembly image

Merging doesn't really solve the issue and just introduces a temporary. image

Expected Behavior:

What I'm looking for is more like how other decompilers decompile it. image

Additional Information:

I can share a test binary I used to check the different compiler outputs in dogbolt that shows the behavior. main.zip The function at 0x140001000 is the one with the condition.

galenbwill avatar Aug 17 '22 22:08 galenbwill