Open mytbk opened 5 years ago
The following assembly code can make r2dec generate a if-else-else block:
L0: test esi, esi jne L2 cmp eax, 1 jne short L3 jmp short L4 L3: cmp eax, 2 jne short L2 jmp L6 L2: inc eax L4: xor eax, eax L6: ret
$ nasm -f elf test.asm; r2 -q -c 'aa;pdd' test.o WARNING: Cannot initialize program headers WARNING: Cannot initialize dynamic strings WARNING: Cannot initialize dynamic section Warning: run r2 with -e io.cache=true to fix relocations in disassembly /* r2dec pseudo C output */ #include <stdint.h> int32_t entry0 (void) { /* [01] -r-x section size 22 named .text */ if (esi == 0) { if (eax == 1) { } else { if (eax == 2) { } } else { eax++; } eax = 0; } return eax; }
oh :( i'll try to fix it.
The following assembly code can make r2dec generate a if-else-else block: