Skip to content

RetDec - Retargetable Machine-Code Decompiler Cheatsheet

RetDec - Retargetable Machine-Code Decompiler Cheatsheet

RetDec (Retargetable Decompiler, by Avast) is an open-source machine-code decompiler that converts compiled binaries back into readable high-level code. “Retargetable” is the key property: rather than being built for one architecture, it lifts many instruction sets — x86, ARM, MIPS, PIC32, PowerPC — into LLVM IR, then decompiles that common representation into C or a Python-like pseudocode. It runs standalone and integrates with IDA, Ghidra, and radare2.

Installation

MethodHow
Release buildDownload the prebuilt package from GitHub Releases
From sourceCMake build (see the repo’s build docs)
Dockerdocker run -v "$PWD:/dst" retdec/retdec
Verifyretdec-decompiler --version

Basic Decompilation

CommandDescription
retdec-decompiler binary.exeDecompile to binary.exe.c
retdec-decompiler -o out.c binaryChoose the output path
retdec-decompiler --backend-no-debug binaryCleaner output
retdec-decompiler --cleanup binaryRemove intermediate files
retdec-decompiler --helpFull option list
# Decompile and read the result
retdec-decompiler suspicious.exe
less suspicious.exe.c

Output Formats

FlagProduces
(default)C source
-f pyPython-like pseudocode
--backend-emit-cfgControl-flow graphs
--backend-emit-cgCall graph
--config out.jsonStructured analysis config/results
LLVM IRIntermediate .ll output during decompilation

Supported Architectures

ArchitectureFormats
x86 / x86-64PE, ELF, Mach-O
ARM / ThumbELF, PE, raw
MIPSELF, raw
PIC32ELF, Intel HEX
PowerPCELF

Broad architecture coverage makes RetDec particularly useful for embedded and firmware work, where MIPS and PIC32 binaries are common and mainstream decompilers offer less.

Useful Options

OptionEffect
-a archForce an architecture
-e endianSet endianness (little/big)
-m modeMode: bin, raw, ll
--raw-entry-point ADDREntry point for raw binaries
--raw-section-vma ADDRLoad address for raw code
--select-ranges A-BDecompile only an address range
--select-functions f1,f2Decompile specific functions
# Raw firmware blob: tell RetDec how to load it
retdec-decompiler -m raw -a mips -e big \
  --raw-entry-point 0x80000000 --raw-section-vma 0x80000000 firmware.bin

Analysis Features

FeatureProvides
File format detectionPE/ELF/Mach-O parsing
Compiler/packer detectionToolchain fingerprinting
Signature-based function IDRecognize statically-linked library code
Type reconstructionRecover structures and types
Debug info useDWARF/PDB when available

Library-function identification matters a lot in practice: it lets you skip the thousands of lines of statically-linked libc and focus on the application’s own logic.

Integrations

ToolPlugin
IDA ProRetDec IDA plugin
GhidraRetDec Ghidra plugin
radare2r2retdec
APIDecompile programmatically via the CLI/config

RetDec vs Other Decompilers

AspectRetDecGhidraHex-Rays (IDA)Binary Ninja
CostFree/open-sourceFree/open-sourceCommercialCommercial
ArchitecturesMany (incl. PIC32)ManyMany (per-decompiler licence)Many
InteractiveNo (batch)Yes (GUI)YesYes
Best forBatch/scripted decompilation, embeddedInteractive REHighest-quality outputModern API/UX

Complements Ghidra for interactive work — RetDec shines for automated pipelines and unusual architectures.

Resources