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 super::state::EntryStack;

pub(super) fn apply_pick(state: &mut EntryStack) -> Option<()> {
    let depth = state.top_literal()?;
    let needed = depth.saturating_add(1);
    state.pop_count(1);
    state.ensure_available(needed);
    let picked = state.value_from_top(depth);
    state.push(picked);
    Some(())
}

pub(super) fn apply_roll(state: &mut EntryStack) -> Option<()> {
    let depth = state.top_literal()?;
    let needed = depth.saturating_add(1);
    state.pop_count(1);
    state.ensure_available(needed);
    if let Some(value) = state.remove_from_top(depth) {
        state.push(value);
    } else {
        state.mark_top_unknown();
    }
    Some(())
}

pub(super) fn apply_xdrop(state: &mut EntryStack) -> Option<()> {
    let depth = state.top_literal()?;
    let needed = depth.saturating_add(1);
    state.pop_count(1);
    state.ensure_available(needed);
    state.remove_from_top(depth);
    Some(())
}

pub(super) fn apply_reversen(state: &mut EntryStack) -> Option<()> {
    let count = state.top_literal()?;
    state.pop_count(1);
    state.ensure_available(count);
    state.reverse_top(count);
    Some(())
}