benchmark/: three-way RE-tool comparison + first real C-lift
Three small functions extracted from the v1.19 conservative blob with
ground-truth C and per-tool (Ghidra / retdec / decomp.me) docs:
01_memset — byte memset, 28 B
02_memcpy32 — word-aligned memcpy, 36 B
03_magic_memset — magic check + tail-call to memset, 40 B
04_train_phy_block — first real poll-site function (104 B, 26 insts),
contains poll sites 12-15
Results in RESULTS.md:
- Ghidra: A on all four. Auto-decompile is close to final.
- retdec: A on #3, F on #1 and #2 (no register-arg inference on raw),
C on #4 (mistakes & 0xF0000000 for < 0x10000000).
GRIND_LOG.md (in 04_train_phy_block/) records the matching-decomp
iteration: 116-byte candidate.c at -Os vs vendor 104 bytes = 89.7%
size match on first real iteration. Remaining gap is GCC's choice of
`cmp w, w_const; b.ls` over vendor's `tst w, #imm; b.eq` for the
mask tests.
gdb_debug/ holds a native-aarch64 GDB single-stepper for the three
benchmark functions — boltzmann smoke test passed (memset:
buf[10] 0x00→0xab).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// This file was generated by the Retargetable Decompiler
|
||||
// Website: https://retdec.com
|
||||
//
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// ------------------- Function Prototypes --------------------
|
||||
|
||||
int64_t entry_point(void);
|
||||
|
||||
// ------------------------ Functions -------------------------
|
||||
|
||||
// Address range: 0x1200 - 0x1224
|
||||
int64_t entry_point(void) {
|
||||
// 0x1200
|
||||
int64_t result; // 0x1200
|
||||
int64_t v1 = result & 0xfffffffc; // 0x1200
|
||||
if (v1 == 0) {
|
||||
// 0x1210
|
||||
return result;
|
||||
}
|
||||
int64_t v2 = 0;
|
||||
int64_t v3 = v2 + 4; // 0x121c
|
||||
while (v3 != v1) {
|
||||
// 0x1214
|
||||
v2 = v3;
|
||||
v3 = v2 + 4;
|
||||
}
|
||||
// 0x1210
|
||||
return result;
|
||||
}
|
||||
|
||||
// --------------------- Meta-Information ---------------------
|
||||
|
||||
// Detected compiler/packer: starforce (3.x)
|
||||
// Detected functions: 1
|
||||
|
||||
Reference in New Issue
Block a user