Using ChatGPT to clean up bad decompiler output seems to work quite well! Left: original Ghidra decompilation; right: cleaned up version, with an explanation for why it's better.

Dec 16, 2022 · 8:24 PM UTC

Strong showing on renaming variables too -- I wonder how well this compares to work like usenix.org/system/files/sec2…
Ironically, the hardest part might be getting it not to fix security bugs it finds along the way. Here it noticed a potential UAF (intentionally placed!) and added a strdup to fix it.
Overall it did *really* well here. Compared to the original source, the only major issue is that it made up "id" and "flags" which were actually a pointer to the parent FS entry and an enum of the FS entry type. But no way to know that without more context.
Replying to @moyix
How many lines can you paste at one time?
I think based on what other people have seen it's around 4096 tokens' worth of input -- don't know exactly how many LoC that would turn into on average.
Replying to @moyix
Can u helpe to solve this issue
I'm not sure what issue you're talking about based on that screenshot
Replying to @moyix
This has been on my to try list
Replying to @moyix
I use it to decompile my stream of consciousness English into better paragraphs