neo-decompiler 0.11.0

Neo N3 NEF decompiler: parse, disassemble, lift bytecode to high-level pseudocode and C# skeletons, with a CLI, JSON reports, and optional WebAssembly bindings.
Documentation
use crate::decompiler::cfg::ssa::{SsaExpr, SsaVariable};

pub(super) fn is_literal(e: &SsaExpr) -> bool {
    matches!(e, SsaExpr::Literal(_))
}

/// Strip an SSA variable's version suffix (`loc0_3` -> `loc0`).
pub(super) fn strip_version(name: &str) -> String {
    match name.rsplit_once('_') {
        Some((base, digits))
            if !digits.is_empty() && digits.chars().all(|c| c.is_ascii_digit()) =>
        {
            base.to_string()
        }
        _ => name.to_string(),
    }
}

/// Display name for an SSA variable.  Uses the base name only (no version
/// suffix) so the output reads as plain high-level source rather than
/// internal SSA notation.  Version suffixes (`loc0_0`, `loc0_3`) are
/// noise for a human reader — after SSA optimisation (copy prop,
/// trivial-φ elimination) each logical variable has one dominant
/// definition and the base name is unambiguous.
pub(super) fn var_name(var: &SsaVariable) -> String {
    if var.base == "?" {
        "?".to_string()
    } else {
        var.base.clone()
    }
}