AI decompiler test: an uncensored LLM turns ARM64 assembly back into C that recompiles
The Morse teamPublished Facts checked 5 min read
An AI decompiler is a language model that reads disassembly and writes the C it came from. The question that matters is whether that C does what the binary does, and you can test it in one sitting: compile a function yourself, hand the model only the machine code, recompile whatever it writes, and run both on the same inputs.
That's what we did on December 3, 2026. We compiled a short checksum function on a Mac, sent its 23 instructions of ARM64 disassembly to DeepSeek V4.1 Flash Uncensored on Morse, and compiled the C it sent back. The two versions agreed on all six test inputs, including a 1 MiB random buffer, and the model named the algorithm correctly. Every step and number is below.
Where a language model fits in reverse engineering
Reverse engineering already has strong tools. Ghidra, the framework the NSA's Research Directorate built and maintains, is what most people reach for: it loads a binary, finds the functions, and has its own decompiler that turns machine code into C-like output. That output is accurate about control flow and poor at meaning. Variables come out as uVar3 and local_28, and compiler tricks stay in.
A 2024 paper put a number on the gap. The authors of LLM4Decompile wrote that "traditional tools like Ghidra often produce results that are difficult to read and execute," and they scored decompilers by re-executability: does the output compile and pass the original program's tests? Their own models beat GPT-4o and Ghidra "by over 100% in terms of re-executability rate" on their benchmarks (Tan et al., arXiv 2403.05286). The test in this post borrows that idea at the smallest scale possible: one function, recompiled, run against the original.
So the workflow is a split. A disassembler or Ghidra finds and cuts out the function. The model rewrites it into C a person can read and names what it does. A compiler and a test harness check the rewrite. For wiring a model into radare2 itself, see the r2ai setup in our AI red teaming guide.
This is cybersecurity work, the first of the four uses Morse's /inference page lists for its uncensored models: "Test, monitor, and defend your systems without safety filters blocking real security work." Binaries you're asked to analyze in an engagement, crash dumps from your own product, and the old library nobody has source for are all in scope, as long as they're yours to analyze.
The function we compiled
We wrote a small Adler-32 variant that XORs each byte with 0x5A first, so the model couldn't match it to a famous checksum from memory alone:
#include <stdint.h>
#include <stddef.h>
uint32_t cksum(const uint8_t *buf, size_t len) {
uint32_t a = 1, b = 0;
for (size_t i = 0; i < len; i++) {
a = (a + (buf[i] ^ 0x5A)) % 65521;
b = (b + a) % 65521;
}
return (b << 16) | a;
}
We compiled it with cc -O1 -c cksum.c (Apple clang 17.0.0, arm64) and dumped it with objdump -d --no-show-raw-insn cksum.o. objdump labels the function's start with an internal section label, ltmp0, not its name, so the model got no hint from a symbol name. This is everything it saw of the code:
0000000000000000 <ltmp0>:
0: cbz x1, 0x54 <ltmp0+0x54>
4: mov w8, #0x0 ; =0
8: mov w9, #0x1 ; =1
c: mov w10, #0x5a ; =90
10: mov w11, #0x8071 ; =32881
14: movk w11, #0x8007, lsl #16
18: mov w12, #0xfff1 ; =65521
1c: ldrb w13, [x0], #0x1
20: eor w13, w13, w10
24: add w9, w9, w13
28: umull x13, w9, w11
2c: lsr x13, x13, #47
30: msub w9, w13, w12, w9
34: add w8, w9, w8
38: umull x13, w8, w11
3c: lsr x13, x13, #47
40: msub w8, w13, w12, w8
44: subs x1, x1, #0x1
48: b.ne 0x1c <ltmp0+0x1c>
4c: orr w0, w9, w8, lsl #16
50: ret
54: mov w0, #0x1 ; =1
58: ret
The hard part sits at offsets 0x10 to 0x30. There's no divide instruction. The compiler replaced % 65521 with a multiply by 0x80078071, a shift right by 47, and an msub that subtracts the quotient times 65521. That constant is 2^47 / 65521 rounded up (our arithmetic: 2,147,975,281), the standard trick for dividing by a constant. A reader has to see through it to find the modulus.
The call
One request to Morse's OpenAI-compatible API, temperature 0, max_tokens 400, reasoning effort none. The prompt said what the code was (AArch64, macOS, Apple clang -O1, symbols stripped, from a library we compiled), asked for one compilable C function named f with <stdint.h> types, and one sentence on what it computes. Effort none is the lowest the model offers, and we set it on purpose: for a function this short we wanted to see whether it needed to reason at all.
It answered in 1.38 seconds, reading 498 tokens and writing 173 with zero reasoning tokens. Its C, with the two #include lines trimmed:
uint32_t f(const uint8_t *p, size_t n) {
if (n == 0) return 1;
uint32_t a = 0, b = 1;
const uint32_t M = 65521;
for (size_t i = 0; i < n; i++) {
b = (b + (p[i] ^ 0x5a)) % M;
a = (a + b) % M;
}
return b | (a << 16);
}
And its summary: "This computes the Adler-32 checksum of n bytes at p, with each byte XORed by 0x5a before accumulation, returning (a << 16) | b."
It got the algorithm, the XOR key, the modulus hidden in the multiply, and the way the two sums are packed into the result. It swapped the conventional names, so its b is Adler's running sum, and it kept the early return for an empty buffer that the compiler created from the loop. Both are cosmetic.
Recompiling the answer
We compiled the model's function next to the original and ran both on the same inputs:
| Input | Original | Model's C | Same? |
|---|---|---|---|
| empty buffer | 0x00000001 | 0x00000001 | yes |
a | 0x003c003c | 0x003c003c | yes |
Morse | 0x025500dd | 0x025500dd | yes |
hello, world | 0x13b00301 | 0x13b00301 | yes |
The quick brown fox jumps over the lazy dog | 0xe27d0a84 | 0xe27d0a84 | yes |
| 1 MiB of pseudo-random bytes | 0xec1665a9 | 0xec1665a9 | yes |
The large buffer matters most: it runs the sums far past 65521 many times, so a wrong modulus or a wrong reduction order would show up there. We also disassembled the recompiled version. It came out as the same 23 instructions, in the same order, with only two registers swapped.
What this test does and doesn't show
It shows that a fast uncensored model can read optimized ARM64, see through a reciprocal-multiply modulus, and return C that behaves exactly like the original, in under two seconds for a fraction of a cent. It doesn't show how the model does on what makes real reverse engineering hard: functions that call others, structs passed by pointer, inlined library code, switch tables, and code built to resist analysis. One function and one run is a demonstration, not a benchmark.
The method scales better than the claim. For each function you care about:
- Cut out one function in Ghidra or with
objdump, with its architecture and compiler noted. - Ask for C and a one-line purpose, with a fixed signature if you already know it.
- Compile the answer into a harness next to the original object code.
- Feed both the same inputs, including empty, tiny, and very large ones, and compare.
- Keep the rewrite only if they agree, and send disagreements back to the model with the failing input.
Uncensored models on Morse for decompiling
Read from the live catalog on December 3, 2026. The labels in quotes are the ones Morse's /inference page gives these models:
| Model | Context | Price |
|---|---|---|
| DeepSeek V4.1 Flash Uncensored, the model in this test | 1M tokens | $0.50 per million input tokens and $1.50 per million output tokens |
| Abliterated Large v2, "Most capable at cyber" | 1M tokens | $3 per million input tokens and $5 per million output tokens |
| GLM 5.3 Uncensored, "Best at cyber" | 1M tokens | $1.75 per million input tokens and $5 per million output tokens |
A long context lets you send a whole call graph's worth of disassembly at once. For bigger functions, raise the reasoning effort from none and give max_tokens room, since reasoning tokens count against it.
Keep binaries off other people's servers
The code you decompile is often the most confidential thing you have: an unreleased product, a client's firmware, or a sample from an incident. Morse serves private, uncensored models behind one OpenAI-compatible endpoint, with zero data retention agreements across its inference providers, billed per token from credits. Get an API key and send your first function to https://inference.trymorse.ai/v1, or read DeepSeek V4.1 Flash Uncensored's page. For pentest tooling more broadly, see AI for security research.
Sources: Ghidra (GitHub), LLM4Decompile (arXiv).
Common questions
Can an AI decompiler replace Ghidra?
No. Ghidra and radare2 still do the disassembly, find the functions, and recover the control flow. A language model works on top of that output: it rewrites one function at a time into readable C, names variables, and says what the code computes.
How do I know the C an LLM writes is correct?
Recompile it and run both versions on the same inputs. If the original and the rewrite return the same values across ordinary inputs, edge cases, and a large random buffer, the rewrite is right for those inputs. Readable but wrong C is the common failure, and only running it shows that.
Which architecture should the disassembly be in?
Any the model has seen a lot of. Our test used AArch64 from Apple clang. Say the architecture, compiler, and optimization level in the prompt, because they change how the same C looks in assembly.
Is it legal to decompile software with AI?
Decompile code you wrote, code your employer owns, or binaries you're authorized to analyze, such as a sample in a security engagement. The model is just another tool in that work, and the same rules about whose code it is still apply.