Lesson 7 of 13 · 24m
Reading Decompiler Output Skeptically
Decompiler output is a fluent first draft, not truth — audit signedness, types, signatures, and invented control flow against the listing, then rebuild structures.
The decompiler is the best thing that ever happened to reverse engineering and the most dangerous tool in the kit. It emits C-shaped text that reads fluently and lies fluently — every type is a guess, every name a placeholder, every signature approximate. The wrong mental model is treating pseudocode as the program. Treat it as a fast first draft you audit against the listing.
What it gets wrong
undefined8 FUN_00001139(long param_1)
{
int local_c;
local_c = 0;
while (*(char *)(param_1 + local_c) != 0) {
*(char *)(param_1 + local_c) = *(char *)(param_1 + local_c) ^ 0x5a;
local_c = local_c + 1;
}
return 0;
}This is a strlen-style walk plus an XOR decode loop — the decompiler just doesn't know param_1 is a char *. Retype it (Ctrl+L → char *) and watch the casts evaporate, the indexing become param_1[local_c], and the function suddenly read like the source. Retyping isn't cosmetic; it's how you inject your understanding back into the tool so it can compound through every caller.
Specific lies to expect
- Wrong signedness.
if (local_c < 0x20)may have been an unsigned compare in source — the listing'sjb/jaeversusjl/jgetells you which. The decompiler guessed. - Everything is an integer. A
doublelocal shows up asundefined8wrapped in bizarre integer ops until you retype it; aboolbecomes anint.undefined8itself means exactly "8 bytes, type unknown" — notlong. - Invented control flow.
gotos vanish intowhileloops it constructed; short-circuit&&/||become nestedifs, or vice versa. The decompiler picks one valid structure among many that produce the same CFG. - Inlining erased the boundaries. A 400-line pseudocode function is often six functions the optimizer merged into one. If a "variable" is written once and read once in a distant block, suspect a swallowed callee.
- Variable splitting. The compiler reuses one register for two source variables; the decompiler dutifully reports
local_candlocal_c_00as if the program had two. They're often the same slot at different lifetimes. - Dead code doesn't exist. Anything
-O2proved unreachable was deleted before the decompiler ever saw it. Pseudocode describes only the behavior that can run — a check that "isn't there" may have been eliminated, not skipped.
When pseudocode and listing disagree
The listing wins — it is the program. If pseudocode shows a comparison you can't square with the cmp/jcc pair, or variables materialize from nowhere (extraout_EAX, in_RDI, CONCAT44), drop to assembly for that block. The usual root cause is a wrong type at a leaf propagating nonsense upward through an expression tree — fix the type at the leaf, not the symptom at the top.
The biggest single lever is the function signature: F (Edit Function Signature) on the function or in the decompiler. A wrong signature — an arg the decompiler invented because it saw a register written, or a return type of undefined8 when the function returns char * — produces bad casts in every caller at once. Fix it once and a dozen call sites clean up simultaneously. This is the same reason the Decompiler Parameter ID analyzer exists in auto-analysis options: better argument recovery upstream means less nonsense downstream.
Rebuild the structures
When [param_1 + 0x18] is written in three functions and read in seven more, +0x18 is a field. Right-click the variable → auto-create structure, fill in fields as you identify them, retype the parameter — and every function taking that type gets clearer simultaneously. Struct recovery is where decompiler work pays compound interest: one correct type explains more code than an hour of instruction-level reading.
Field notes
- Names are claims you're staking.
FUN_...renamed toxor_decodeis a hypothesis; rename freely and rename honestly when it dies. CONCAT44,SUB164,ZEXT,extraout_,in_prefixes are decompiler bookkeeping artifacts, not real variables. Don't decode them — trace where the underlying value comes from.- Higher optimization means worse decompilation.
-O2inlining plus vectorized loops can produce pseudocode uglier than the assembly; sometimes the right call is reading the asm directly. - Hex-Rays has the same class of problems — the tool doesn't matter, the discipline does.
Keep reading
Related articles from the SudoSecurity blog.
A Fake GTA 6 ISO Didn’t Install a Game. It Installed a Wiper.
A fake GTA 6 ISO used a believable installer error to cover remote-access malware, browser-data theft, and destructive file wiping. The “License not found” message wasn’t the crack failing. It was there so the victim would stop looking.
CVE-2025-62718: Critical Axios SSRF Vulnerability Explained
A critical SSRF flaw in Axios was used in a North Korean supply chain attack. Here's what it does and how to patch it today.
Hacktivism, 2021 to Today: From Steel Mills to Power Grids
Part 1 ended on a 70-gigabyte breach in 2021. Since then, hacktivists derailed trains, dumped molten steel on camera, and reached grids in three countries.
What is an Infostealer?
Infostealers are commodity malware that silently harvest credentials, session tokens, and crypto wallets from infected machines. The Lumma Stealer infection that triggered the Vercel breach started with one. Here is how they work and why they are so effective.