Search papers, labs, and topics across Lattice.
PCodeTrans is introduced, a feedback-driven framework that translates decompiled pseudocode into compilable and executable C code by leveraging LLMs. It achieves this by extracting a minimal context for recompilability, hot-swapping the compiled function into the original binary, and using differential tracing for runtime feedback to guide LLM-based repair of semantic discrepancies. Experiments on Coreutils and Binutils demonstrate PCodeTrans achieves near-perfect compilability and behavioral consistency, significantly outperforming existing baselines, even on stripped binaries.
Achieve near-perfect decompilation-to-compilation by hot-swapping LLM-repaired code into the original binary and using runtime feedback to squash semantic hallucinations.
Decompilation is foundational to binary analysis, yet conventional tools prioritize human readability over strict recompilability and verifiable runtime correctness. While recent LLM-based approaches attempt to refine decompiled pseudocode, they typically either optimize solely for readability or rely on static analysis for evaluation. This makes them prone to "semantic hallucinations" that compromise accuracy and fail to resolve actual runtime failures. For critical tasks like software modernization and vulnerability remediation, recovered code must not only compile but replicate the original binary's behavior. We present PCodeTrans, a feedback-driven framework that bridges the gap between decompilation, recompilation, and rigorous function-level dynamic validation. After extracting a minimal yet coherent context to guarantee recompilability, PCodeTrans employs an in situ substitutable engine to hot-swap the compiled function directly into the unmodified binary, natively preserving its authentic execution context and global dependencies. Guided by fine-grained differential tracing, PCodeTrans generates precise runtime feedback to iteratively guide an LLM in repairing semantic discrepancies. Evaluated on Coreutils and Binutils, PCodeTrans achieves unprecedented recovery performance when rectifying raw Hex-Rays outputs, attaining 100% function-level compilability on unstripped binaries alongside 99.55% and 99.89% test-validated behavioral consistency, respectively. In doing so, it resolves 76.56% and 79.74% of logic errors exposed by official test suites. Exhibiting exceptional resilience, PCodeTrans maintains over 96% behavioral consistency even on fully stripped binaries. By significantly outperforming all existing baselines, PCodeTrans paves a practical path to reliably translate decompiled pseudocode into compilable and executable equivalents.