一句话:提出 PseudoFix,用大语言模型与检索式上下文学习重构反编译伪代码中的结构畸变,最高降低 34% Halstead 复杂度并提升 BLEU-4 105%。
反编译可将二进制程序转换为清晰的 C 风格伪代码,在安全领域应用广泛。现有研究主要关注恢复函数名、变量名和数据类型等符号信息,却忽视了结构信息。作者观察到,即使符号信息完整保留,伪代码中仍存在严重而复杂的结构畸变,极大损害代码可读性与理解。本文首先系统调研反编译伪代码中的结构畸变,通过定量分析揭示其变化模式,并使用开放编码归纳出包含六个顶层类别的分类体系。基于该体系,作者提出 PseudoFix:结合大语言模型与基于检索的上下文学习,通过语义检索选取最相关的少样本示例以提供结构畸变知识,并借助 LLM 从海量源码库中学到的规范编码模式,高效重构畸变伪代码。综合评估表明 PseudoFix 显著提升伪代码可读性,Halstead 复杂度工作量最多降低 34%,BLEU-4 提升 105%,在临时变量消除与 goto 语句移除任务上明显优于现有最优方法,人工评价在可读性、一致性与合理性方面获得一致正面反馈。
Decompilation can convert binary programs into clear C-style pseudocode, which is of great value in a wide range of security applications. Existing research primarily focuses on recovering symbolic information in pseudocode, such as function names, variable names, and data types, but neglecting structural information. We observe that even when symbolic information is fully preserved, severe and complex structure distortions remain in the pseudocode, greatly impairing code readability and comprehension. In this work, we first systematically investigate structure distortions in decompiled pseudocode, revealing their variation patterns through quantitative analysis. Using open coding, we derive a taxonomy comprising six top-level categories of structure distortions. Building upon this taxonomy, we propose PseudoFix, a novel framework that combines large language models (LLMs) with retrieval-based in-context learning. PseudoFix employs semantic retrieval to select the most relevant few-shot examples that provide structure distortion knowledge, and combines this with the well-structured coding patterns learned by LLMs from vast source code repositories, to efficiently refactor distorted pseudocode. Comprehensive evaluations demonstrate that PseudoFix significantly improves pseudocode readability, achieving up to a 34% reduction in Halstead Complexity Effort and a 105% increase in BLEU-4 score. Notably, it significantly outperforms state-of-the-art approaches in both temporary variable elimination and goto statement removal tasks. Additionally, human evaluations yield consistently positive feedback from users across readability, consistency, and reasonability.
DOI 原文 ·
@inproceedings{paperbot9458,
title = {PseudoFix: Refactoring Distorted Structures in Decompiled C Pseudocode},
author = {Gangyang Li and Xiuwei Shang and Shaoyin Cheng and Junqi Zhang and Li Hu and Xu Zhu and Weiming Zhang and Nenghai Yu},
booktitle = {ASE},
year = {2025},
doi = {10.1109/ase63991.2025.00075}
}