Machine-learned decompilers and binary-similarity models degrade sharply on optimized code. GPT-4 falls from 72% to 36% on execution reasoning when given LLVM intermediate code instead of the original source, and similarity detectors exceed 40% error when a function's control-flow graph is rearranged without changing what it computes. A control-flow graph is the map of which blocks of instructions can jump to which. The field describes this damage almost entirely by optimization level (-O0 through -O3). That label is coarse. Two functions compiled at -O2 can be restructured very differently, and nobody can say in advance which function a decompiler will get wrong.
We borrow a tool from the physics of disordered networks. In ice and amorphous oxides, a material's properties can change drastically while every atom keeps the same number of neighbors. The change shows up only in the distribution of closed loops, or "rings," in the bond network. We propose to compute the same ring statistics on control-flow graphs. Our claim is that the shift in a function's ring distribution between its unoptimized and optimized builds predicts, function by function, whether a decompiler or similarity model will fail. We claim it does this better than optimization level, function size, or standard complexity counts. If it does, it also tells us which compiler transformations to target when augmenting training data.
Core Claim
Compiler passes behave like the network reconstructions seen in ice. Martoňák et al. (Polyamorphism of Ice at Low Temperatures from Constant-Pressure Simulations) and the follow-up structural study (Evolution of the structure of amorphous ice: From low-density amorphous through high-density amorphous to very high-density amorphous ice) show that compressing amorphous ice converts 6-membered rings into folded 8- and 9-membered rings, with no change in coordination. Donadio et al. (Topological defects and bulk melting of hexagonal ice) show that melting begins with "5+7" defects, in which a 6-ring becomes an adjacent 5-ring and 7-ring while every molecule stays 4-coordinated. These papers motivate the hypothesis. They do not supply evidence about code.
The software analogue works as follows. Loop rotation, unrolling, inlining, and if-conversion largely preserve the local quantities existing tools track, such as per-block in- and out-degree and branch counts. They reshape the medium-range cycle structure. For example, loop rotation turns a loop into a larger ring with an attached guard diamond. Unrolling replicates rings. Inlining welds a callee's rings into the caller.
The specific, testable claim is that a ring-spectrum shift adds predictive information about downstream model failure beyond what size, cyclomatic complexity, degree distribution, and optimization level already provide. The ring-spectrum shift is a distance between the ring-size distributions of the -O0 and -On graphs of the same function. Nothing in the research file applies ring statistics to program graphs. The closest work, Wang et al. (Improving ML-based Binary Function Similarity Detection by Assessing and Deprioritizing Control Flow Graph Features), manipulates whole graphs to show that similarity models over-rely on graph structure. It does not ask which structural changes compilers actually produce, and it does not ask which changes cause failure.
Defining Rings on a Control-Flow Graph
We treat each function's graph two ways. As an undirected graph, the smallest rings capture both loops and branch "diamonds": an if-then-else is a 4-ring. As a directed graph, rings are restricted to genuine cycles, meaning loops. For each node we record the primitive rings through it, using the shortest-path ring definitions standard in network-glass analysis, with sizes from 2 to a cap of about 16 blocks and longer rings binned together.
The function-level descriptor is the normalized ring-size histogram $p(k)$, the fraction of primitive rings of size $k$. A second descriptor counts paired ring-size changes between builds, as the analogue of 5+7 defects. The shift for a function compiled at level $n$ is
$$\Delta_n = W_1\big(p_{O0},\, p_{On}\big),$$
where $W_1$ is the one-dimensional Wasserstein distance between the two ring-size histograms. We chose it because it respects the ordering of ring sizes. Ring enumeration is exponential in the worst case, but the size cap keeps it tractable on typical function-level graphs. We will report the fraction of functions that hit the cap.
Phase-field modeling plays only a minor, constraining role here. The research file suggests modelling optimization passes as a continuous phase-field relaxation. We reject that design for this proposal. Passes are discrete rewrites, and our analysis needs no gradient. The one piece we reuse is the idea of smooth ring counting, from Donadio et al.'s metadynamics variables and Sahbi's double-well relaxation of binary graph connectivity (Phase-field Models for Lightweight Graph Convolutional Networks). We use it only if the third experiment needs ring counts as a differentiable auxiliary training target.
Research Program
The work has three stages, and each stage is gated on the previous one succeeding.
The first stage is measurement. We compile functions from Decompile-Bench (Decompile-Bench: Million-Scale Binary-Source Function Pairs for Real-World Binary Decompilation) and ExeBench with Clang at each level. We also run LLVM's optimizer one pass at a time, which lets us attribute ring shifts to individual passes. The goal is a catalogue of the recurring ring transformations each pass produces, and their frequencies. This answers, for code, the question that ring analysis answered for ice: which reconstructions occur.
The second stage tests prediction. Existing decompilers are run on Decompile-Eval and on held-out Decompile-Bench projects at -O0 through -O3. We also take GPT-family outputs on the 164-problem graph-reconstruction task from Jiang et al. (Can Large Language Models Understand Intermediate Representations in Compilers?). We then ask whether $\Delta_n$ and the defect counts predict per-function failure better than simpler descriptors.
The third stage is an intervention, attempted only if prediction succeeds. We redesign augmentation in the style of Wang et al., which applies semantics-preserving graph edits through their 8CFG tool. Instead of manipulating graphs arbitrarily, we sample edits so that the ring shifts in the training data match those compilers actually produce, weighted toward the transformations that the second stage linked to failure.
The liquid-crystal templating literature informs one variant of the third stage. Sabury et al. (Non-covalent planarizing interactions yield highly ordered and thermotropic liquid crystalline conjugated polymers) show that cooling a polymer through an intermediate, still-mobile ordered phase removes defects that direct quenching locks in. Our variant is a training curriculum that orders pairs by increasing $\Delta_n$ rather than by optimization level. We treat this as an analogy that suggests the experiment, not as evidence that it will work.
Baselines
The naive reference point for prediction is optimization level alone, which is how Decompile-Eval and Decompile-Bench currently stratify results. A logistic regression on level is the floor any descriptor must clear.
The strongest competitor for prediction is a bundle of cheap graph statistics. It contains basic-block count, edge count, cyclomatic complexity, natural-loop count and maximum nesting depth from dominator analysis, the degree histogram, and instruction count. We consider it the strongest because most of the variance in failure plausibly comes from size and loop count, and the bundle captures both without any ring machinery. It will also be given its own -O0-to--On deltas, so the comparison is shift against shift. Both predictors get the same function splits, split by project to prevent leakage, and the same model family: logistic regression and gradient-boosted trees, each with an identical hyperparameter search budget. Ring statistics beat this bundle only if adding them raises held-out AUROC by a margin that survives a paired bootstrap over functions and holds across at least two decompilers.
The decompilers whose failures we predict are the strongest open systems in the file. The headline is the combined self-constructed-context and fine-grained-alignment decompiler of Feng et al. (Self-Constructed Context Decompilation with Fined-grained Alignment Enhancement), which reports 52.41% re-executability on Decompile-Eval. We use it where its weights are released, alongside LLM4Decompile-DCBench, which Decompile-Bench reports at 20.89% re-executability. SK2Decompile (SK2Decompile: LLM-based Two-Phase Binary Decompilation from Skeleton to Skin), which reports 69.00% average re-executability on HumanEval, is included if it is released. Its explicit skeleton-recovery stage makes it the most interesting test of whether ring shift still predicts failure once a model reconstructs structure separately.
For the intervention on BinaryCorp-3M, the strongest baseline is 8CFG augmentation as published. Wang et al. report relative gains of up to 10.1% in MRR, up to 12.7% in Recall@1, and up to 27.2% in F1 over unaugmented training. No absolute post-augmentation MRR is reported on Lacuna. We will therefore rerun 8CFG ourselves on the same similarity models, with the same number of augmented pairs and the same fine-tuning compute.
The key ablation replaces ring-matched sampling with uniform 8CFG sampling at identical volume. This isolates whether matching compiler-realistic ring shifts, rather than augmentation as such, produces any gain. A second ablation orders the curriculum by optimization level instead of by $\Delta_n$.
Why not just…?
Why not just use optimization level as the difficulty label? The level is what everyone already uses, and if it explains failure as well as ring shift, this proposal adds nothing. Within a single level, however, functions vary from almost unchanged to heavily restructured. Jiang et al.'s graph-reconstruction failures span all levels, which suggests that level is a weak per-function signal. The level-only baseline in the second stage settles the question directly.
Why not just use cyclomatic complexity and loop counts, which compilers already compute? This is the real threat. Cyclomatic complexity equals the number of independent cycles, so it already counts how many rings a graph has. What it does not capture is how big the rings are or how they rearrange. The ice papers show precisely that kind of size redistribution at fixed coordination. Whether that redistribution matters for code is an empirical question, and we do not assume the answer. If the cheap-statistics bundle matches ring statistics in held-out AUROC, we will report that ring statistics are redundant for this purpose and stop before the third stage.
Why not just apply 8CFG augmentation, or train a graph neural network end to end and let it learn whatever topology matters? Wang et al. show that models trained this way over-rely on graph shape and still exceed 40% error under semantics-preserving edits. That indicates learned graph features alone do not deliver robustness. Augmentation clearly helps, but uniform augmentation may spend its budget on edits compilers never make. The ring-matched ablation in the third stage tests exactly this. If uniform 8CFG does as well, the intervention claim fails, and the descriptive and predictive results from the first two stages still stand on their own.
Proposed Experiments and Decisive Checks
The first experiment produces per-pass ring-shift profiles over a project-stratified sample of Decompile-Bench functions. It succeeds if a small number of passes account for most of the ring shift, and if the induced transformations recur often enough to be catalogued. Diffuse, pass-independent noise would mean that ring statistics carry no transferable structure.
The second experiment is the decisive check. We fit failure predictors on Decompile-Eval at all four levels, and on held-out Decompile-Bench-Eval and GitHub2025 functions, then compare AUROC for re-executability failure across three predictors: level only, the cheap bundle, and the cheap bundle plus ring descriptors. We separately check that ring shift correlates with the full-accuracy failures in Jiang et al.'s graph-reconstruction task. If ring descriptors add no significant AUROC over the cheap bundle on at least two decompilers, the core claim is falsified.
The third experiment runs only if the second succeeds. It compares on BinaryCorp-3M four conditions: no augmentation, uniform 8CFG, ring-matched 8CFG, and the shift-ordered curriculum. All four use identical pair volume and compute, and we report MRR, Recall@1, and F1 under the 8CFG perturbation protocol. Ring-matched augmentation counts as beating 8CFG only if it improves Recall@1 over our reproduced 8CFG run with non-overlapping bootstrap intervals. The comparison against our reproduced run is the deciding one, because the published 12.7% figure is a relative gain and cannot be used as an absolute target.
References
- Polyamorphism of Ice at Low Temperatures from Constant-Pressure Simulations
- Evolution of the structure of amorphous ice: From low-density amorphous through high-density amorphous to very high-density amorphous ice
- Topological Defects and Bulk Melting of Hexagonal Ice
- Improving ML-based Binary Function Similarity Detection by Assessing and Deprioritizing Control Flow Graph Features
- Phase-field Models for Lightweight Graph Convolutional Networks
- Decompile-Bench: Million-Scale Binary-Source Function Pairs for Real-World Binary Decompilation
- Can Large Language Models Understand Intermediate Representations in Compilers?
- Non-covalent planarizing interactions yield highly ordered and thermotropic liquid crystalline conjugated polymers
- Self-Constructed Context Decompilation with Fined-grained Alignment Enhancement
- SK2Decompile: LLM-based Two-Phase Binary Decompilation from Skeleton to Skin