Test guided repair improves accuracy of decompiled C programs

Recompilation Is Not Enough: Test-Guided Decompiled-C Repair

Software EngineeringArtificial Intelligence

Summary

When C programs are decompiled back into code, simply fixing them so they compile again is not enough to guarantee they behave the same as before. The authors show a step-by-step way to fix these programs by using feedback from compilers and running tests to catch any differences in behavior. Their method was tested on 104 common utility programs, where most were successfully repaired to run correctly and pass tests. This approach helps ensure repaired programs not only compile but work as originally intended.

What this means in practice

  • For software maintenance teams: Fix decompiled C programs to behave like original binaries by combining compiler feedback and official test suites in repair workflows.
  • For software security analysts: Improve auditing of decompiled code by verifying repaired binaries pass behavioral tests, reducing risks of semantic bugs after recompilation.

Authors

Yuhan Huang, Puzhuo Liu, Jianlei Chi

Abstract

Decompiled C often becomes recompilable only after repair, but recompilation alone does not establish test-observed behavior. A recompiled command-line binary can still parse options incorrectly, print different bytes, or return a different exit status. We present a few-step workflow for repairing decompiled C using compiler feedback and related official tests. Compiler and linker diagnostics first guide build repair. Once the repaired C recompiles into a binary, smoke checks and related official tests expose behavioral discrepancies for semantic repair. In a preliminary static-enriched evaluation on 104 Coreutils 9.5 binaries with available decompiler exports and deterministic exact-output smoke comparisons, 91 binaries (87.5%) recompile and pass the test gate; 9 do not recompile within the repair budget, and 4 recompile but still fail the test gate. The result suggests that test-gate feedback can make LLM-assisted repair of decompiled C more auditable than compile-only recovery.