neo-decompiler 0.10.1

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 (base + version).
pub(super) fn var_name(var: &SsaVariable) -> String {
    if var.base == "?" {
        "?".to_string()
    } else {
        format!("{}_{}", var.base, var.version)
    }
}