// Copyright (C) 2019-2026 Provable Inc.
// This file is part of the Leo library.

// The Leo library is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// The Leo library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.

use crate::{ArrayType, IntegerType, Type};

use leo_span::{Span, Symbol, sym};

use snarkvm::{
    prelude::LiteralType,
    synthesizer::program::{CommitVariant, DeserializeVariant, ECDSAVerifyVariant, HashVariant, SerializeVariant},
};

/// An instrinsic operation directly implemented by the compiler.
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Intrinsic {
    // ChaCha random value of type (LiteralType).
    ChaChaRand(LiteralType),
    // Commitment to a value using hash (HashVariant) returning value of type (LiteralType).
    Commit(CommitVariant, LiteralType),
    // ECDSA verify with hash (HashVariant) and the ETH variant (bool).
    ECDSAVerify(ECDSAVerifyVariant),
    // Hash function with variant (HashVariant) returning value of type (LiteralType).
    Hash(HashVariant, Type),

    MappingGet,
    MappingGetOrUse,
    MappingSet,
    MappingRemove,
    MappingContains,

    OptionalUnwrap,
    OptionalUnwrapOr,

    VectorGet,
    VectorSet,
    VectorPush,
    VectorLen,
    VectorClear,
    VectorPop,
    VectorSwapRemove,

    GroupToXCoordinate,
    GroupToYCoordinate,
    GroupGen,

    // Aleo group generator constant.
    AleoGenerator,
    // Aleo precomputed generator powers array ([group; 251]).
    AleoGeneratorPowers,

    // Schnorr signature verification.
    SignatureVerify,

    // Snark proof verification.
    SnarkVerify,
    SnarkVerifyBatch,

    FinalRun,

    ProgramChecksum,
    ProgramEdition,
    ProgramOwner,

    Serialize(SerializeVariant),

    // Note. `Deserialize` cannot be instantiated via `from_symbols` as it requires a type argument.
    Deserialize(DeserializeVariant, Type),

    DynamicCall,
    DynamicContains,
    DynamicGet,
    DynamicGetOrUse,

    SelfAddress,
    SelfCaller,
    SelfChecksum,
    SelfEdition,
    SelfId,
    SelfProgramOwner,
    SelfSigner,
    BlockHeight,
    BlockTimestamp,
    NetworkId,
}

impl Intrinsic {
    /// Returns a `Intrinsic` from a single symbol.
    // TODO: turn into From implementation when old syntax is deprecated
    #[rustfmt::skip]
    pub fn from_symbol(name: Symbol, type_parameters: &[(Type, Span)]) -> Option<Self> {
        Some(match name {
            sym::_self_address => Self::SelfAddress,
            sym::_self_caller => Self::SelfCaller,
            sym::_self_checksum => Self::SelfChecksum,
            sym::_self_edition => Self::SelfEdition,
            sym::_self_id => Self::SelfId,
            sym::_self_program_owner => Self::SelfProgramOwner,
            sym::_self_signer => Self::SelfSigner,
            sym::_block_height => Self::BlockHeight,
            sym::_block_timestamp => Self::BlockTimestamp,
            sym::_network_id => Self::NetworkId,
            sym::_deserialize_from_bits => {
                // The type parameter count is validated in the type checker. Use `Type::Err` as a
                // placeholder when the parameter is absent so that `from_symbol` always returns
                // `Some`, allowing the type checker to emit a targeted diagnostic.
                let ty = type_parameters.first().map_or(Type::Err, |(t, _)| t.clone());
                Self::Deserialize(DeserializeVariant::FromBits, ty)
            }
            sym::_deserialize_from_bits_raw => {
                let ty = type_parameters.first().map_or(Type::Err, |(t, _)| t.clone());
                Self::Deserialize(DeserializeVariant::FromBitsRaw, ty)
            }
            sym::_group_gen => Self::GroupGen,
            sym::_aleo_generator => Self::AleoGenerator,
            sym::_aleo_generator_powers => Self::AleoGeneratorPowers,
            sym::_chacha_rand_address => Self::ChaChaRand(LiteralType::Address),
            sym::_chacha_rand_bool    => Self::ChaChaRand(LiteralType::Boolean),
            sym::_chacha_rand_field   => Self::ChaChaRand(LiteralType::Field),
            sym::_chacha_rand_group   => Self::ChaChaRand(LiteralType::Group),
            sym::_chacha_rand_i8      => Self::ChaChaRand(LiteralType::I8),
            sym::_chacha_rand_i16     => Self::ChaChaRand(LiteralType::I16),
            sym::_chacha_rand_i32     => Self::ChaChaRand(LiteralType::I32),
            sym::_chacha_rand_i64     => Self::ChaChaRand(LiteralType::I64),
            sym::_chacha_rand_i128    => Self::ChaChaRand(LiteralType::I128),
            sym::_chacha_rand_u8      => Self::ChaChaRand(LiteralType::U8),
            sym::_chacha_rand_u16     => Self::ChaChaRand(LiteralType::U16),
            sym::_chacha_rand_u32     => Self::ChaChaRand(LiteralType::U32),
            sym::_chacha_rand_u64     => Self::ChaChaRand(LiteralType::U64),
            sym::_chacha_rand_u128    => Self::ChaChaRand(LiteralType::U128),
            sym::_chacha_rand_scalar  => Self::ChaChaRand(LiteralType::Scalar),
            sym::_bhp256_commit_to_address => Self::Commit(CommitVariant::CommitBHP256, LiteralType::Address),
            sym::_bhp256_commit_to_field   => Self::Commit(CommitVariant::CommitBHP256, LiteralType::Field),
            sym::_bhp256_commit_to_group   => Self::Commit(CommitVariant::CommitBHP256, LiteralType::Group),
            sym::_bhp512_commit_to_address => Self::Commit(CommitVariant::CommitBHP512, LiteralType::Address),
            sym::_bhp512_commit_to_field   => Self::Commit(CommitVariant::CommitBHP512, LiteralType::Field),
            sym::_bhp512_commit_to_group   => Self::Commit(CommitVariant::CommitBHP512, LiteralType::Group),
            sym::_bhp768_commit_to_address => Self::Commit(CommitVariant::CommitBHP768, LiteralType::Address),
            sym::_bhp768_commit_to_field   => Self::Commit(CommitVariant::CommitBHP768, LiteralType::Field),
            sym::_bhp768_commit_to_group   => Self::Commit(CommitVariant::CommitBHP768, LiteralType::Group),
            sym::_bhp1024_commit_to_address => Self::Commit(CommitVariant::CommitBHP1024, LiteralType::Address),
            sym::_bhp1024_commit_to_field   => Self::Commit(CommitVariant::CommitBHP1024, LiteralType::Field),
            sym::_bhp1024_commit_to_group   => Self::Commit(CommitVariant::CommitBHP1024, LiteralType::Group),
            sym::_pedersen64_commit_to_address => Self::Commit(CommitVariant::CommitPED64, LiteralType::Address),
            sym::_pedersen64_commit_to_field   => Self::Commit(CommitVariant::CommitPED64, LiteralType::Field),
            sym::_pedersen64_commit_to_group   => Self::Commit(CommitVariant::CommitPED64, LiteralType::Group),
            sym::_pedersen128_commit_to_address => Self::Commit(CommitVariant::CommitPED128, LiteralType::Address),
            sym::_pedersen128_commit_to_field   => Self::Commit(CommitVariant::CommitPED128, LiteralType::Field),
            sym::_pedersen128_commit_to_group   => Self::Commit(CommitVariant::CommitPED128, LiteralType::Group),
            sym::_bhp256_hash_to_address     => Self::Hash(HashVariant::HashBHP256, Type::Address),
            sym::_bhp256_hash_to_field       => Self::Hash(HashVariant::HashBHP256, Type::Field),
            sym::_bhp256_hash_to_group       => Self::Hash(HashVariant::HashBHP256, Type::Group),
            sym::_bhp256_hash_to_i8          => Self::Hash(HashVariant::HashBHP256, Type::Integer(IntegerType::I8)),
            sym::_bhp256_hash_to_i16         => Self::Hash(HashVariant::HashBHP256, Type::Integer(IntegerType::I16)),
            sym::_bhp256_hash_to_i32         => Self::Hash(HashVariant::HashBHP256, Type::Integer(IntegerType::I32)),
            sym::_bhp256_hash_to_i64         => Self::Hash(HashVariant::HashBHP256, Type::Integer(IntegerType::I64)),
            sym::_bhp256_hash_to_i128        => Self::Hash(HashVariant::HashBHP256, Type::Integer(IntegerType::I128)),
            sym::_bhp256_hash_to_u8          => Self::Hash(HashVariant::HashBHP256, Type::Integer(IntegerType::U8)),
            sym::_bhp256_hash_to_u16         => Self::Hash(HashVariant::HashBHP256, Type::Integer(IntegerType::U16)),
            sym::_bhp256_hash_to_u32         => Self::Hash(HashVariant::HashBHP256, Type::Integer(IntegerType::U32)),
            sym::_bhp256_hash_to_u64         => Self::Hash(HashVariant::HashBHP256, Type::Integer(IntegerType::U64)),
            sym::_bhp256_hash_to_u128        => Self::Hash(HashVariant::HashBHP256, Type::Integer(IntegerType::U128)),
            sym::_bhp256_hash_to_scalar      => Self::Hash(HashVariant::HashBHP256, Type::Scalar),
            sym::_bhp256_hash_to_address_raw => Self::Hash(HashVariant::HashBHP256Raw, Type::Address),
            sym::_bhp256_hash_to_field_raw   => Self::Hash(HashVariant::HashBHP256Raw, Type::Field),
            sym::_bhp256_hash_to_group_raw   => Self::Hash(HashVariant::HashBHP256Raw, Type::Group),
            sym::_bhp256_hash_to_i8_raw      => Self::Hash(HashVariant::HashBHP256Raw, Type::Integer(IntegerType::I8)),
            sym::_bhp256_hash_to_i16_raw     => Self::Hash(HashVariant::HashBHP256Raw, Type::Integer(IntegerType::I16)),
            sym::_bhp256_hash_to_i32_raw     => Self::Hash(HashVariant::HashBHP256Raw, Type::Integer(IntegerType::I32)),
            sym::_bhp256_hash_to_i64_raw     => Self::Hash(HashVariant::HashBHP256Raw, Type::Integer(IntegerType::I64)),
            sym::_bhp256_hash_to_i128_raw    => Self::Hash(HashVariant::HashBHP256Raw, Type::Integer(IntegerType::I128)),
            sym::_bhp256_hash_to_u8_raw      => Self::Hash(HashVariant::HashBHP256Raw, Type::Integer(IntegerType::U8)),
            sym::_bhp256_hash_to_u16_raw     => Self::Hash(HashVariant::HashBHP256Raw, Type::Integer(IntegerType::U16)),
            sym::_bhp256_hash_to_u32_raw     => Self::Hash(HashVariant::HashBHP256Raw, Type::Integer(IntegerType::U32)),
            sym::_bhp256_hash_to_u64_raw     => Self::Hash(HashVariant::HashBHP256Raw, Type::Integer(IntegerType::U64)),
            sym::_bhp256_hash_to_u128_raw    => Self::Hash(HashVariant::HashBHP256Raw, Type::Integer(IntegerType::U128)),
            sym::_bhp256_hash_to_scalar_raw  => Self::Hash(HashVariant::HashBHP256Raw, Type::Scalar),

            sym::_bhp512_hash_to_address     => Self::Hash(HashVariant::HashBHP512, Type::Address),
            sym::_bhp512_hash_to_field       => Self::Hash(HashVariant::HashBHP512, Type::Field),
            sym::_bhp512_hash_to_group       => Self::Hash(HashVariant::HashBHP512, Type::Group),
            sym::_bhp512_hash_to_i8          => Self::Hash(HashVariant::HashBHP512, Type::Integer(IntegerType::I8)),
            sym::_bhp512_hash_to_i16         => Self::Hash(HashVariant::HashBHP512, Type::Integer(IntegerType::I16)),
            sym::_bhp512_hash_to_i32         => Self::Hash(HashVariant::HashBHP512, Type::Integer(IntegerType::I32)),
            sym::_bhp512_hash_to_i64         => Self::Hash(HashVariant::HashBHP512, Type::Integer(IntegerType::I64)),
            sym::_bhp512_hash_to_i128        => Self::Hash(HashVariant::HashBHP512, Type::Integer(IntegerType::I128)),
            sym::_bhp512_hash_to_u8          => Self::Hash(HashVariant::HashBHP512, Type::Integer(IntegerType::U8)),
            sym::_bhp512_hash_to_u16         => Self::Hash(HashVariant::HashBHP512, Type::Integer(IntegerType::U16)),
            sym::_bhp512_hash_to_u32         => Self::Hash(HashVariant::HashBHP512, Type::Integer(IntegerType::U32)),
            sym::_bhp512_hash_to_u64         => Self::Hash(HashVariant::HashBHP512, Type::Integer(IntegerType::U64)),
            sym::_bhp512_hash_to_u128        => Self::Hash(HashVariant::HashBHP512, Type::Integer(IntegerType::U128)),
            sym::_bhp512_hash_to_scalar      => Self::Hash(HashVariant::HashBHP512, Type::Scalar),
            sym::_bhp512_hash_to_address_raw => Self::Hash(HashVariant::HashBHP512Raw, Type::Address),
            sym::_bhp512_hash_to_field_raw   => Self::Hash(HashVariant::HashBHP512Raw, Type::Field),
            sym::_bhp512_hash_to_group_raw   => Self::Hash(HashVariant::HashBHP512Raw, Type::Group),
            sym::_bhp512_hash_to_i8_raw      => Self::Hash(HashVariant::HashBHP512Raw, Type::Integer(IntegerType::I8)),
            sym::_bhp512_hash_to_i16_raw     => Self::Hash(HashVariant::HashBHP512Raw, Type::Integer(IntegerType::I16)),
            sym::_bhp512_hash_to_i32_raw     => Self::Hash(HashVariant::HashBHP512Raw, Type::Integer(IntegerType::I32)),
            sym::_bhp512_hash_to_i64_raw     => Self::Hash(HashVariant::HashBHP512Raw, Type::Integer(IntegerType::I64)),
            sym::_bhp512_hash_to_i128_raw    => Self::Hash(HashVariant::HashBHP512Raw, Type::Integer(IntegerType::I128)),
            sym::_bhp512_hash_to_u8_raw      => Self::Hash(HashVariant::HashBHP512Raw, Type::Integer(IntegerType::U8)),
            sym::_bhp512_hash_to_u16_raw     => Self::Hash(HashVariant::HashBHP512Raw, Type::Integer(IntegerType::U16)),
            sym::_bhp512_hash_to_u32_raw     => Self::Hash(HashVariant::HashBHP512Raw, Type::Integer(IntegerType::U32)),
            sym::_bhp512_hash_to_u64_raw     => Self::Hash(HashVariant::HashBHP512Raw, Type::Integer(IntegerType::U64)),
            sym::_bhp512_hash_to_u128_raw    => Self::Hash(HashVariant::HashBHP512Raw, Type::Integer(IntegerType::U128)),
            sym::_bhp512_hash_to_scalar_raw  => Self::Hash(HashVariant::HashBHP512Raw, Type::Scalar),

            sym::_bhp768_hash_to_address     => Self::Hash(HashVariant::HashBHP768, Type::Address),
            sym::_bhp768_hash_to_field       => Self::Hash(HashVariant::HashBHP768, Type::Field),
            sym::_bhp768_hash_to_group       => Self::Hash(HashVariant::HashBHP768, Type::Group),
            sym::_bhp768_hash_to_i8          => Self::Hash(HashVariant::HashBHP768, Type::Integer(IntegerType::I8)),
            sym::_bhp768_hash_to_i16         => Self::Hash(HashVariant::HashBHP768, Type::Integer(IntegerType::I16)),
            sym::_bhp768_hash_to_i32         => Self::Hash(HashVariant::HashBHP768, Type::Integer(IntegerType::I32)),
            sym::_bhp768_hash_to_i64         => Self::Hash(HashVariant::HashBHP768, Type::Integer(IntegerType::I64)),
            sym::_bhp768_hash_to_i128        => Self::Hash(HashVariant::HashBHP768, Type::Integer(IntegerType::I128)),
            sym::_bhp768_hash_to_u8          => Self::Hash(HashVariant::HashBHP768, Type::Integer(IntegerType::U8)),
            sym::_bhp768_hash_to_u16         => Self::Hash(HashVariant::HashBHP768, Type::Integer(IntegerType::U16)),
            sym::_bhp768_hash_to_u32         => Self::Hash(HashVariant::HashBHP768, Type::Integer(IntegerType::U32)),
            sym::_bhp768_hash_to_u64         => Self::Hash(HashVariant::HashBHP768, Type::Integer(IntegerType::U64)),
            sym::_bhp768_hash_to_u128        => Self::Hash(HashVariant::HashBHP768, Type::Integer(IntegerType::U128)),
            sym::_bhp768_hash_to_scalar      => Self::Hash(HashVariant::HashBHP768, Type::Scalar),
            sym::_bhp768_hash_to_address_raw => Self::Hash(HashVariant::HashBHP768Raw, Type::Address),
            sym::_bhp768_hash_to_field_raw   => Self::Hash(HashVariant::HashBHP768Raw, Type::Field),
            sym::_bhp768_hash_to_group_raw   => Self::Hash(HashVariant::HashBHP768Raw, Type::Group),
            sym::_bhp768_hash_to_i8_raw      => Self::Hash(HashVariant::HashBHP768Raw, Type::Integer(IntegerType::I8)),
            sym::_bhp768_hash_to_i16_raw     => Self::Hash(HashVariant::HashBHP768Raw, Type::Integer(IntegerType::I16)),
            sym::_bhp768_hash_to_i32_raw     => Self::Hash(HashVariant::HashBHP768Raw, Type::Integer(IntegerType::I32)),
            sym::_bhp768_hash_to_i64_raw     => Self::Hash(HashVariant::HashBHP768Raw, Type::Integer(IntegerType::I64)),
            sym::_bhp768_hash_to_i128_raw    => Self::Hash(HashVariant::HashBHP768Raw, Type::Integer(IntegerType::I128)),
            sym::_bhp768_hash_to_u8_raw      => Self::Hash(HashVariant::HashBHP768Raw, Type::Integer(IntegerType::U8)),
            sym::_bhp768_hash_to_u16_raw     => Self::Hash(HashVariant::HashBHP768Raw, Type::Integer(IntegerType::U16)),
            sym::_bhp768_hash_to_u32_raw     => Self::Hash(HashVariant::HashBHP768Raw, Type::Integer(IntegerType::U32)),
            sym::_bhp768_hash_to_u64_raw     => Self::Hash(HashVariant::HashBHP768Raw, Type::Integer(IntegerType::U64)),
            sym::_bhp768_hash_to_u128_raw    => Self::Hash(HashVariant::HashBHP768Raw, Type::Integer(IntegerType::U128)),
            sym::_bhp768_hash_to_scalar_raw  => Self::Hash(HashVariant::HashBHP768Raw, Type::Scalar),

            sym::_bhp1024_hash_to_address     => Self::Hash(HashVariant::HashBHP1024, Type::Address),
            sym::_bhp1024_hash_to_field       => Self::Hash(HashVariant::HashBHP1024, Type::Field),
            sym::_bhp1024_hash_to_group       => Self::Hash(HashVariant::HashBHP1024, Type::Group),
            sym::_bhp1024_hash_to_i8          => Self::Hash(HashVariant::HashBHP1024, Type::Integer(IntegerType::I8)),
            sym::_bhp1024_hash_to_i16         => Self::Hash(HashVariant::HashBHP1024, Type::Integer(IntegerType::I16)),
            sym::_bhp1024_hash_to_i32         => Self::Hash(HashVariant::HashBHP1024, Type::Integer(IntegerType::I32)),
            sym::_bhp1024_hash_to_i64         => Self::Hash(HashVariant::HashBHP1024, Type::Integer(IntegerType::I64)),
            sym::_bhp1024_hash_to_i128        => Self::Hash(HashVariant::HashBHP1024, Type::Integer(IntegerType::I128)),
            sym::_bhp1024_hash_to_u8          => Self::Hash(HashVariant::HashBHP1024, Type::Integer(IntegerType::U8)),
            sym::_bhp1024_hash_to_u16         => Self::Hash(HashVariant::HashBHP1024, Type::Integer(IntegerType::U16)),
            sym::_bhp1024_hash_to_u32         => Self::Hash(HashVariant::HashBHP1024, Type::Integer(IntegerType::U32)),
            sym::_bhp1024_hash_to_u64         => Self::Hash(HashVariant::HashBHP1024, Type::Integer(IntegerType::U64)),
            sym::_bhp1024_hash_to_u128        => Self::Hash(HashVariant::HashBHP1024, Type::Integer(IntegerType::U128)),
            sym::_bhp1024_hash_to_scalar      => Self::Hash(HashVariant::HashBHP1024, Type::Scalar),
            sym::_bhp1024_hash_to_address_raw => Self::Hash(HashVariant::HashBHP1024Raw, Type::Address),
            sym::_bhp1024_hash_to_field_raw   => Self::Hash(HashVariant::HashBHP1024Raw, Type::Field),
            sym::_bhp1024_hash_to_group_raw   => Self::Hash(HashVariant::HashBHP1024Raw, Type::Group),
            sym::_bhp1024_hash_to_i8_raw      => Self::Hash(HashVariant::HashBHP1024Raw, Type::Integer(IntegerType::I8)),
            sym::_bhp1024_hash_to_i16_raw     => Self::Hash(HashVariant::HashBHP1024Raw, Type::Integer(IntegerType::I16)),
            sym::_bhp1024_hash_to_i32_raw     => Self::Hash(HashVariant::HashBHP1024Raw, Type::Integer(IntegerType::I32)),
            sym::_bhp1024_hash_to_i64_raw     => Self::Hash(HashVariant::HashBHP1024Raw, Type::Integer(IntegerType::I64)),
            sym::_bhp1024_hash_to_i128_raw    => Self::Hash(HashVariant::HashBHP1024Raw, Type::Integer(IntegerType::I128)),
            sym::_bhp1024_hash_to_u8_raw      => Self::Hash(HashVariant::HashBHP1024Raw, Type::Integer(IntegerType::U8)),
            sym::_bhp1024_hash_to_u16_raw     => Self::Hash(HashVariant::HashBHP1024Raw, Type::Integer(IntegerType::U16)),
            sym::_bhp1024_hash_to_u32_raw     => Self::Hash(HashVariant::HashBHP1024Raw, Type::Integer(IntegerType::U32)),
            sym::_bhp1024_hash_to_u64_raw     => Self::Hash(HashVariant::HashBHP1024Raw, Type::Integer(IntegerType::U64)),
            sym::_bhp1024_hash_to_u128_raw    => Self::Hash(HashVariant::HashBHP1024Raw, Type::Integer(IntegerType::U128)),
            sym::_bhp1024_hash_to_scalar_raw  => Self::Hash(HashVariant::HashBHP1024Raw, Type::Scalar),

            sym::_keccak256_hash_to_address     => Self::Hash(HashVariant::HashKeccak256, Type::Address),
            sym::_keccak256_hash_to_field       => Self::Hash(HashVariant::HashKeccak256, Type::Field),
            sym::_keccak256_hash_to_group       => Self::Hash(HashVariant::HashKeccak256, Type::Group),
            sym::_keccak256_hash_to_i8          => Self::Hash(HashVariant::HashKeccak256, Type::Integer(IntegerType::I8)),
            sym::_keccak256_hash_to_i16         => Self::Hash(HashVariant::HashKeccak256, Type::Integer(IntegerType::I16)),
            sym::_keccak256_hash_to_i32         => Self::Hash(HashVariant::HashKeccak256, Type::Integer(IntegerType::I32)),
            sym::_keccak256_hash_to_i64         => Self::Hash(HashVariant::HashKeccak256, Type::Integer(IntegerType::I64)),
            sym::_keccak256_hash_to_i128        => Self::Hash(HashVariant::HashKeccak256, Type::Integer(IntegerType::I128)),
            sym::_keccak256_hash_to_u8          => Self::Hash(HashVariant::HashKeccak256, Type::Integer(IntegerType::U8)),
            sym::_keccak256_hash_to_u16         => Self::Hash(HashVariant::HashKeccak256, Type::Integer(IntegerType::U16)),
            sym::_keccak256_hash_to_u32         => Self::Hash(HashVariant::HashKeccak256, Type::Integer(IntegerType::U32)),
            sym::_keccak256_hash_to_u64         => Self::Hash(HashVariant::HashKeccak256, Type::Integer(IntegerType::U64)),
            sym::_keccak256_hash_to_u128        => Self::Hash(HashVariant::HashKeccak256, Type::Integer(IntegerType::U128)),
            sym::_keccak256_hash_to_scalar      => Self::Hash(HashVariant::HashKeccak256, Type::Scalar),
            sym::_keccak256_hash_to_address_raw => Self::Hash(HashVariant::HashKeccak256Raw, Type::Address),
            sym::_keccak256_hash_to_field_raw   => Self::Hash(HashVariant::HashKeccak256Raw, Type::Field),
            sym::_keccak256_hash_to_group_raw   => Self::Hash(HashVariant::HashKeccak256Raw, Type::Group),
            sym::_keccak256_hash_to_i8_raw      => Self::Hash(HashVariant::HashKeccak256Raw, Type::Integer(IntegerType::I8)),
            sym::_keccak256_hash_to_i16_raw     => Self::Hash(HashVariant::HashKeccak256Raw, Type::Integer(IntegerType::I16)),
            sym::_keccak256_hash_to_i32_raw     => Self::Hash(HashVariant::HashKeccak256Raw, Type::Integer(IntegerType::I32)),
            sym::_keccak256_hash_to_i64_raw     => Self::Hash(HashVariant::HashKeccak256Raw, Type::Integer(IntegerType::I64)),
            sym::_keccak256_hash_to_i128_raw    => Self::Hash(HashVariant::HashKeccak256Raw, Type::Integer(IntegerType::I128)),
            sym::_keccak256_hash_to_u8_raw      => Self::Hash(HashVariant::HashKeccak256Raw, Type::Integer(IntegerType::U8)),
            sym::_keccak256_hash_to_u16_raw     => Self::Hash(HashVariant::HashKeccak256Raw, Type::Integer(IntegerType::U16)),
            sym::_keccak256_hash_to_u32_raw     => Self::Hash(HashVariant::HashKeccak256Raw, Type::Integer(IntegerType::U32)),
            sym::_keccak256_hash_to_u64_raw     => Self::Hash(HashVariant::HashKeccak256Raw, Type::Integer(IntegerType::U64)),
            sym::_keccak256_hash_to_u128_raw    => Self::Hash(HashVariant::HashKeccak256Raw, Type::Integer(IntegerType::U128)),
            sym::_keccak256_hash_to_scalar_raw  => Self::Hash(HashVariant::HashKeccak256Raw, Type::Scalar),
            sym::_keccak256_hash_to_bits         => Self::Hash(HashVariant::HashKeccak256Native, Type::Array(ArrayType::bit_array(256))),
            sym::_keccak256_hash_to_bits_raw     => Self::Hash(HashVariant::HashKeccak256NativeRaw, Type::Array(ArrayType::bit_array(256))),

            sym::_keccak384_hash_to_address     => Self::Hash(HashVariant::HashKeccak384, Type::Address),
            sym::_keccak384_hash_to_field       => Self::Hash(HashVariant::HashKeccak384, Type::Field),
            sym::_keccak384_hash_to_group       => Self::Hash(HashVariant::HashKeccak384, Type::Group),
            sym::_keccak384_hash_to_i8          => Self::Hash(HashVariant::HashKeccak384, Type::Integer(IntegerType::I8)),
            sym::_keccak384_hash_to_i16         => Self::Hash(HashVariant::HashKeccak384, Type::Integer(IntegerType::I16)),
            sym::_keccak384_hash_to_i32         => Self::Hash(HashVariant::HashKeccak384, Type::Integer(IntegerType::I32)),
            sym::_keccak384_hash_to_i64         => Self::Hash(HashVariant::HashKeccak384, Type::Integer(IntegerType::I64)),
            sym::_keccak384_hash_to_i128        => Self::Hash(HashVariant::HashKeccak384, Type::Integer(IntegerType::I128)),
            sym::_keccak384_hash_to_u8          => Self::Hash(HashVariant::HashKeccak384, Type::Integer(IntegerType::U8)),
            sym::_keccak384_hash_to_u16         => Self::Hash(HashVariant::HashKeccak384, Type::Integer(IntegerType::U16)),
            sym::_keccak384_hash_to_u32         => Self::Hash(HashVariant::HashKeccak384, Type::Integer(IntegerType::U32)),
            sym::_keccak384_hash_to_u64         => Self::Hash(HashVariant::HashKeccak384, Type::Integer(IntegerType::U64)),
            sym::_keccak384_hash_to_u128        => Self::Hash(HashVariant::HashKeccak384, Type::Integer(IntegerType::U128)),
            sym::_keccak384_hash_to_scalar      => Self::Hash(HashVariant::HashKeccak384, Type::Scalar),
            sym::_keccak384_hash_to_address_raw => Self::Hash(HashVariant::HashKeccak384Raw, Type::Address),
            sym::_keccak384_hash_to_field_raw   => Self::Hash(HashVariant::HashKeccak384Raw, Type::Field),
            sym::_keccak384_hash_to_group_raw   => Self::Hash(HashVariant::HashKeccak384Raw, Type::Group),
            sym::_keccak384_hash_to_i8_raw      => Self::Hash(HashVariant::HashKeccak384Raw, Type::Integer(IntegerType::I8)),
            sym::_keccak384_hash_to_i16_raw     => Self::Hash(HashVariant::HashKeccak384Raw, Type::Integer(IntegerType::I16)),
            sym::_keccak384_hash_to_i32_raw     => Self::Hash(HashVariant::HashKeccak384Raw, Type::Integer(IntegerType::I32)),
            sym::_keccak384_hash_to_i64_raw     => Self::Hash(HashVariant::HashKeccak384Raw, Type::Integer(IntegerType::I64)),
            sym::_keccak384_hash_to_i128_raw    => Self::Hash(HashVariant::HashKeccak384Raw, Type::Integer(IntegerType::I128)),
            sym::_keccak384_hash_to_u8_raw      => Self::Hash(HashVariant::HashKeccak384Raw, Type::Integer(IntegerType::U8)),
            sym::_keccak384_hash_to_u16_raw     => Self::Hash(HashVariant::HashKeccak384Raw, Type::Integer(IntegerType::U16)),
            sym::_keccak384_hash_to_u32_raw     => Self::Hash(HashVariant::HashKeccak384Raw, Type::Integer(IntegerType::U32)),
            sym::_keccak384_hash_to_u64_raw     => Self::Hash(HashVariant::HashKeccak384Raw, Type::Integer(IntegerType::U64)),
            sym::_keccak384_hash_to_u128_raw    => Self::Hash(HashVariant::HashKeccak384Raw, Type::Integer(IntegerType::U128)),
            sym::_keccak384_hash_to_scalar_raw  => Self::Hash(HashVariant::HashKeccak384Raw, Type::Scalar),
            sym::_keccak384_hash_to_bits         => Self::Hash(HashVariant::HashKeccak384Native, Type::Array(ArrayType::bit_array(384))),
            sym::_keccak384_hash_to_bits_raw     => Self::Hash(HashVariant::HashKeccak384NativeRaw, Type::Array(ArrayType::bit_array(384))),

            sym::_keccak512_hash_to_address     => Self::Hash(HashVariant::HashKeccak512, Type::Address),
            sym::_keccak512_hash_to_field       => Self::Hash(HashVariant::HashKeccak512, Type::Field),
            sym::_keccak512_hash_to_group       => Self::Hash(HashVariant::HashKeccak512, Type::Group),
            sym::_keccak512_hash_to_i8          => Self::Hash(HashVariant::HashKeccak512, Type::Integer(IntegerType::I8)),
            sym::_keccak512_hash_to_i16         => Self::Hash(HashVariant::HashKeccak512, Type::Integer(IntegerType::I16)),
            sym::_keccak512_hash_to_i32         => Self::Hash(HashVariant::HashKeccak512, Type::Integer(IntegerType::I32)),
            sym::_keccak512_hash_to_i64         => Self::Hash(HashVariant::HashKeccak512, Type::Integer(IntegerType::I64)),
            sym::_keccak512_hash_to_i128        => Self::Hash(HashVariant::HashKeccak512, Type::Integer(IntegerType::I128)),
            sym::_keccak512_hash_to_u8          => Self::Hash(HashVariant::HashKeccak512, Type::Integer(IntegerType::U8)),
            sym::_keccak512_hash_to_u16         => Self::Hash(HashVariant::HashKeccak512, Type::Integer(IntegerType::U16)),
            sym::_keccak512_hash_to_u32         => Self::Hash(HashVariant::HashKeccak512, Type::Integer(IntegerType::U32)),
            sym::_keccak512_hash_to_u64         => Self::Hash(HashVariant::HashKeccak512, Type::Integer(IntegerType::U64)),
            sym::_keccak512_hash_to_u128        => Self::Hash(HashVariant::HashKeccak512, Type::Integer(IntegerType::U128)),
            sym::_keccak512_hash_to_scalar      => Self::Hash(HashVariant::HashKeccak512, Type::Scalar),
            sym::_keccak512_hash_to_address_raw => Self::Hash(HashVariant::HashKeccak512Raw, Type::Address),
            sym::_keccak512_hash_to_field_raw   => Self::Hash(HashVariant::HashKeccak512Raw, Type::Field),
            sym::_keccak512_hash_to_group_raw   => Self::Hash(HashVariant::HashKeccak512Raw, Type::Group),
            sym::_keccak512_hash_to_i8_raw      => Self::Hash(HashVariant::HashKeccak512Raw, Type::Integer(IntegerType::I8)),
            sym::_keccak512_hash_to_i16_raw     => Self::Hash(HashVariant::HashKeccak512Raw, Type::Integer(IntegerType::I16)),
            sym::_keccak512_hash_to_i32_raw     => Self::Hash(HashVariant::HashKeccak512Raw, Type::Integer(IntegerType::I32)),
            sym::_keccak512_hash_to_i64_raw     => Self::Hash(HashVariant::HashKeccak512Raw, Type::Integer(IntegerType::I64)),
            sym::_keccak512_hash_to_i128_raw    => Self::Hash(HashVariant::HashKeccak512Raw, Type::Integer(IntegerType::I128)),
            sym::_keccak512_hash_to_u8_raw      => Self::Hash(HashVariant::HashKeccak512Raw, Type::Integer(IntegerType::U8)),
            sym::_keccak512_hash_to_u16_raw     => Self::Hash(HashVariant::HashKeccak512Raw, Type::Integer(IntegerType::U16)),
            sym::_keccak512_hash_to_u32_raw     => Self::Hash(HashVariant::HashKeccak512Raw, Type::Integer(IntegerType::U32)),
            sym::_keccak512_hash_to_u64_raw     => Self::Hash(HashVariant::HashKeccak512Raw, Type::Integer(IntegerType::U64)),
            sym::_keccak512_hash_to_u128_raw    => Self::Hash(HashVariant::HashKeccak512Raw, Type::Integer(IntegerType::U128)),
            sym::_keccak512_hash_to_scalar_raw  => Self::Hash(HashVariant::HashKeccak512Raw, Type::Scalar),
            sym::_keccak512_hash_to_bits         => Self::Hash(HashVariant::HashKeccak512Native, Type::Array(ArrayType::bit_array(512))),
            sym::_keccak512_hash_to_bits_raw     => Self::Hash(HashVariant::HashKeccak512NativeRaw, Type::Array(ArrayType::bit_array(512))),

            sym::_pedersen64_hash_to_address     => Self::Hash(HashVariant::HashPED64, Type::Address),
            sym::_pedersen64_hash_to_field       => Self::Hash(HashVariant::HashPED64, Type::Field),
            sym::_pedersen64_hash_to_group       => Self::Hash(HashVariant::HashPED64, Type::Group),
            sym::_pedersen64_hash_to_i8          => Self::Hash(HashVariant::HashPED64, Type::Integer(IntegerType::I8)),
            sym::_pedersen64_hash_to_i16         => Self::Hash(HashVariant::HashPED64, Type::Integer(IntegerType::I16)),
            sym::_pedersen64_hash_to_i32         => Self::Hash(HashVariant::HashPED64, Type::Integer(IntegerType::I32)),
            sym::_pedersen64_hash_to_i64         => Self::Hash(HashVariant::HashPED64, Type::Integer(IntegerType::I64)),
            sym::_pedersen64_hash_to_i128        => Self::Hash(HashVariant::HashPED64, Type::Integer(IntegerType::I128)),
            sym::_pedersen64_hash_to_u8          => Self::Hash(HashVariant::HashPED64, Type::Integer(IntegerType::U8)),
            sym::_pedersen64_hash_to_u16         => Self::Hash(HashVariant::HashPED64, Type::Integer(IntegerType::U16)),
            sym::_pedersen64_hash_to_u32         => Self::Hash(HashVariant::HashPED64, Type::Integer(IntegerType::U32)),
            sym::_pedersen64_hash_to_u64         => Self::Hash(HashVariant::HashPED64, Type::Integer(IntegerType::U64)),
            sym::_pedersen64_hash_to_u128        => Self::Hash(HashVariant::HashPED64, Type::Integer(IntegerType::U128)),
            sym::_pedersen64_hash_to_scalar      => Self::Hash(HashVariant::HashPED64, Type::Scalar),
            sym::_pedersen64_hash_to_address_raw => Self::Hash(HashVariant::HashPED64Raw, Type::Address),
            sym::_pedersen64_hash_to_field_raw   => Self::Hash(HashVariant::HashPED64Raw, Type::Field),
            sym::_pedersen64_hash_to_group_raw   => Self::Hash(HashVariant::HashPED64Raw, Type::Group),
            sym::_pedersen64_hash_to_i8_raw      => Self::Hash(HashVariant::HashPED64Raw, Type::Integer(IntegerType::I8)),
            sym::_pedersen64_hash_to_i16_raw     => Self::Hash(HashVariant::HashPED64Raw, Type::Integer(IntegerType::I16)),
            sym::_pedersen64_hash_to_i32_raw     => Self::Hash(HashVariant::HashPED64Raw, Type::Integer(IntegerType::I32)),
            sym::_pedersen64_hash_to_i64_raw     => Self::Hash(HashVariant::HashPED64Raw, Type::Integer(IntegerType::I64)),
            sym::_pedersen64_hash_to_i128_raw    => Self::Hash(HashVariant::HashPED64Raw, Type::Integer(IntegerType::I128)),
            sym::_pedersen64_hash_to_u8_raw      => Self::Hash(HashVariant::HashPED64Raw, Type::Integer(IntegerType::U8)),
            sym::_pedersen64_hash_to_u16_raw     => Self::Hash(HashVariant::HashPED64Raw, Type::Integer(IntegerType::U16)),
            sym::_pedersen64_hash_to_u32_raw     => Self::Hash(HashVariant::HashPED64Raw, Type::Integer(IntegerType::U32)),
            sym::_pedersen64_hash_to_u64_raw     => Self::Hash(HashVariant::HashPED64Raw, Type::Integer(IntegerType::U64)),
            sym::_pedersen64_hash_to_u128_raw    => Self::Hash(HashVariant::HashPED64Raw, Type::Integer(IntegerType::U128)),
            sym::_pedersen64_hash_to_scalar_raw  => Self::Hash(HashVariant::HashPED64Raw, Type::Scalar),

            sym::_pedersen128_hash_to_address     => Self::Hash(HashVariant::HashPED128, Type::Address),
            sym::_pedersen128_hash_to_field       => Self::Hash(HashVariant::HashPED128, Type::Field),
            sym::_pedersen128_hash_to_group       => Self::Hash(HashVariant::HashPED128, Type::Group),
            sym::_pedersen128_hash_to_i8          => Self::Hash(HashVariant::HashPED128, Type::Integer(IntegerType::I8)),
            sym::_pedersen128_hash_to_i16         => Self::Hash(HashVariant::HashPED128, Type::Integer(IntegerType::I16)),
            sym::_pedersen128_hash_to_i32         => Self::Hash(HashVariant::HashPED128, Type::Integer(IntegerType::I32)),
            sym::_pedersen128_hash_to_i64         => Self::Hash(HashVariant::HashPED128, Type::Integer(IntegerType::I64)),
            sym::_pedersen128_hash_to_i128        => Self::Hash(HashVariant::HashPED128, Type::Integer(IntegerType::I128)),
            sym::_pedersen128_hash_to_u8          => Self::Hash(HashVariant::HashPED128, Type::Integer(IntegerType::U8)),
            sym::_pedersen128_hash_to_u16         => Self::Hash(HashVariant::HashPED128, Type::Integer(IntegerType::U16)),
            sym::_pedersen128_hash_to_u32         => Self::Hash(HashVariant::HashPED128, Type::Integer(IntegerType::U32)),
            sym::_pedersen128_hash_to_u64         => Self::Hash(HashVariant::HashPED128, Type::Integer(IntegerType::U64)),
            sym::_pedersen128_hash_to_u128        => Self::Hash(HashVariant::HashPED128, Type::Integer(IntegerType::U128)),
            sym::_pedersen128_hash_to_scalar      => Self::Hash(HashVariant::HashPED128, Type::Scalar),
            sym::_pedersen128_hash_to_address_raw => Self::Hash(HashVariant::HashPED128Raw, Type::Address),
            sym::_pedersen128_hash_to_field_raw   => Self::Hash(HashVariant::HashPED128Raw, Type::Field),
            sym::_pedersen128_hash_to_group_raw   => Self::Hash(HashVariant::HashPED128Raw, Type::Group),
            sym::_pedersen128_hash_to_i8_raw      => Self::Hash(HashVariant::HashPED128Raw, Type::Integer(IntegerType::I8)),
            sym::_pedersen128_hash_to_i16_raw     => Self::Hash(HashVariant::HashPED128Raw, Type::Integer(IntegerType::I16)),
            sym::_pedersen128_hash_to_i32_raw     => Self::Hash(HashVariant::HashPED128Raw, Type::Integer(IntegerType::I32)),
            sym::_pedersen128_hash_to_i64_raw     => Self::Hash(HashVariant::HashPED128Raw, Type::Integer(IntegerType::I64)),
            sym::_pedersen128_hash_to_i128_raw    => Self::Hash(HashVariant::HashPED128Raw, Type::Integer(IntegerType::I128)),
            sym::_pedersen128_hash_to_u8_raw      => Self::Hash(HashVariant::HashPED128Raw, Type::Integer(IntegerType::U8)),
            sym::_pedersen128_hash_to_u16_raw     => Self::Hash(HashVariant::HashPED128Raw, Type::Integer(IntegerType::U16)),
            sym::_pedersen128_hash_to_u32_raw     => Self::Hash(HashVariant::HashPED128Raw, Type::Integer(IntegerType::U32)),
            sym::_pedersen128_hash_to_u64_raw     => Self::Hash(HashVariant::HashPED128Raw, Type::Integer(IntegerType::U64)),
            sym::_pedersen128_hash_to_u128_raw    => Self::Hash(HashVariant::HashPED128Raw, Type::Integer(IntegerType::U128)),
            sym::_pedersen128_hash_to_scalar_raw  => Self::Hash(HashVariant::HashPED128Raw, Type::Scalar),

            sym::_poseidon2_hash_to_address     => Self::Hash(HashVariant::HashPSD2, Type::Address),
            sym::_poseidon2_hash_to_field       => Self::Hash(HashVariant::HashPSD2, Type::Field),
            sym::_poseidon2_hash_to_group       => Self::Hash(HashVariant::HashPSD2, Type::Group),
            sym::_poseidon2_hash_to_i8          => Self::Hash(HashVariant::HashPSD2, Type::Integer(IntegerType::I8)),
            sym::_poseidon2_hash_to_i16         => Self::Hash(HashVariant::HashPSD2, Type::Integer(IntegerType::I16)),
            sym::_poseidon2_hash_to_i32         => Self::Hash(HashVariant::HashPSD2, Type::Integer(IntegerType::I32)),
            sym::_poseidon2_hash_to_i64         => Self::Hash(HashVariant::HashPSD2, Type::Integer(IntegerType::I64)),
            sym::_poseidon2_hash_to_i128        => Self::Hash(HashVariant::HashPSD2, Type::Integer(IntegerType::I128)),
            sym::_poseidon2_hash_to_u8          => Self::Hash(HashVariant::HashPSD2, Type::Integer(IntegerType::U8)),
            sym::_poseidon2_hash_to_u16         => Self::Hash(HashVariant::HashPSD2, Type::Integer(IntegerType::U16)),
            sym::_poseidon2_hash_to_u32         => Self::Hash(HashVariant::HashPSD2, Type::Integer(IntegerType::U32)),
            sym::_poseidon2_hash_to_u64         => Self::Hash(HashVariant::HashPSD2, Type::Integer(IntegerType::U64)),
            sym::_poseidon2_hash_to_u128        => Self::Hash(HashVariant::HashPSD2, Type::Integer(IntegerType::U128)),
            sym::_poseidon2_hash_to_scalar      => Self::Hash(HashVariant::HashPSD2, Type::Scalar),
            sym::_poseidon2_hash_to_address_raw => Self::Hash(HashVariant::HashPSD2Raw, Type::Address),
            sym::_poseidon2_hash_to_field_raw   => Self::Hash(HashVariant::HashPSD2Raw, Type::Field),
            sym::_poseidon2_hash_to_group_raw   => Self::Hash(HashVariant::HashPSD2Raw, Type::Group),
            sym::_poseidon2_hash_to_i8_raw      => Self::Hash(HashVariant::HashPSD2Raw, Type::Integer(IntegerType::I8)),
            sym::_poseidon2_hash_to_i16_raw     => Self::Hash(HashVariant::HashPSD2Raw, Type::Integer(IntegerType::I16)),
            sym::_poseidon2_hash_to_i32_raw     => Self::Hash(HashVariant::HashPSD2Raw, Type::Integer(IntegerType::I32)),
            sym::_poseidon2_hash_to_i64_raw     => Self::Hash(HashVariant::HashPSD2Raw, Type::Integer(IntegerType::I64)),
            sym::_poseidon2_hash_to_i128_raw    => Self::Hash(HashVariant::HashPSD2Raw, Type::Integer(IntegerType::I128)),
            sym::_poseidon2_hash_to_u8_raw      => Self::Hash(HashVariant::HashPSD2Raw, Type::Integer(IntegerType::U8)),
            sym::_poseidon2_hash_to_u16_raw     => Self::Hash(HashVariant::HashPSD2Raw, Type::Integer(IntegerType::U16)),
            sym::_poseidon2_hash_to_u32_raw     => Self::Hash(HashVariant::HashPSD2Raw, Type::Integer(IntegerType::U32)),
            sym::_poseidon2_hash_to_u64_raw     => Self::Hash(HashVariant::HashPSD2Raw, Type::Integer(IntegerType::U64)),
            sym::_poseidon2_hash_to_u128_raw    => Self::Hash(HashVariant::HashPSD2Raw, Type::Integer(IntegerType::U128)),
            sym::_poseidon2_hash_to_scalar_raw  => Self::Hash(HashVariant::HashPSD2Raw, Type::Scalar),

            sym::_poseidon4_hash_to_address     => Self::Hash(HashVariant::HashPSD4, Type::Address),
            sym::_poseidon4_hash_to_field       => Self::Hash(HashVariant::HashPSD4, Type::Field),
            sym::_poseidon4_hash_to_group       => Self::Hash(HashVariant::HashPSD4, Type::Group),
            sym::_poseidon4_hash_to_i8          => Self::Hash(HashVariant::HashPSD4, Type::Integer(IntegerType::I8)),
            sym::_poseidon4_hash_to_i16         => Self::Hash(HashVariant::HashPSD4, Type::Integer(IntegerType::I16)),
            sym::_poseidon4_hash_to_i32         => Self::Hash(HashVariant::HashPSD4, Type::Integer(IntegerType::I32)),
            sym::_poseidon4_hash_to_i64         => Self::Hash(HashVariant::HashPSD4, Type::Integer(IntegerType::I64)),
            sym::_poseidon4_hash_to_i128        => Self::Hash(HashVariant::HashPSD4, Type::Integer(IntegerType::I128)),
            sym::_poseidon4_hash_to_u8          => Self::Hash(HashVariant::HashPSD4, Type::Integer(IntegerType::U8)),
            sym::_poseidon4_hash_to_u16         => Self::Hash(HashVariant::HashPSD4, Type::Integer(IntegerType::U16)),
            sym::_poseidon4_hash_to_u32         => Self::Hash(HashVariant::HashPSD4, Type::Integer(IntegerType::U32)),
            sym::_poseidon4_hash_to_u64         => Self::Hash(HashVariant::HashPSD4, Type::Integer(IntegerType::U64)),
            sym::_poseidon4_hash_to_u128        => Self::Hash(HashVariant::HashPSD4, Type::Integer(IntegerType::U128)),
            sym::_poseidon4_hash_to_scalar      => Self::Hash(HashVariant::HashPSD4, Type::Scalar),
            sym::_poseidon4_hash_to_address_raw => Self::Hash(HashVariant::HashPSD4Raw, Type::Address),
            sym::_poseidon4_hash_to_field_raw   => Self::Hash(HashVariant::HashPSD4Raw, Type::Field),
            sym::_poseidon4_hash_to_group_raw   => Self::Hash(HashVariant::HashPSD4Raw, Type::Group),
            sym::_poseidon4_hash_to_i8_raw      => Self::Hash(HashVariant::HashPSD4Raw, Type::Integer(IntegerType::I8)),
            sym::_poseidon4_hash_to_i16_raw     => Self::Hash(HashVariant::HashPSD4Raw, Type::Integer(IntegerType::I16)),
            sym::_poseidon4_hash_to_i32_raw     => Self::Hash(HashVariant::HashPSD4Raw, Type::Integer(IntegerType::I32)),
            sym::_poseidon4_hash_to_i64_raw     => Self::Hash(HashVariant::HashPSD4Raw, Type::Integer(IntegerType::I64)),
            sym::_poseidon4_hash_to_i128_raw    => Self::Hash(HashVariant::HashPSD4Raw, Type::Integer(IntegerType::I128)),
            sym::_poseidon4_hash_to_u8_raw      => Self::Hash(HashVariant::HashPSD4Raw, Type::Integer(IntegerType::U8)),
            sym::_poseidon4_hash_to_u16_raw     => Self::Hash(HashVariant::HashPSD4Raw, Type::Integer(IntegerType::U16)),
            sym::_poseidon4_hash_to_u32_raw     => Self::Hash(HashVariant::HashPSD4Raw, Type::Integer(IntegerType::U32)),
            sym::_poseidon4_hash_to_u64_raw     => Self::Hash(HashVariant::HashPSD4Raw, Type::Integer(IntegerType::U64)),
            sym::_poseidon4_hash_to_u128_raw    => Self::Hash(HashVariant::HashPSD4Raw, Type::Integer(IntegerType::U128)),
            sym::_poseidon4_hash_to_scalar_raw  => Self::Hash(HashVariant::HashPSD4Raw, Type::Scalar),

            sym::_poseidon8_hash_to_address     => Self::Hash(HashVariant::HashPSD8, Type::Address),
            sym::_poseidon8_hash_to_field       => Self::Hash(HashVariant::HashPSD8, Type::Field),
            sym::_poseidon8_hash_to_group       => Self::Hash(HashVariant::HashPSD8, Type::Group),
            sym::_poseidon8_hash_to_i8          => Self::Hash(HashVariant::HashPSD8, Type::Integer(IntegerType::I8)),
            sym::_poseidon8_hash_to_i16         => Self::Hash(HashVariant::HashPSD8, Type::Integer(IntegerType::I16)),
            sym::_poseidon8_hash_to_i32         => Self::Hash(HashVariant::HashPSD8, Type::Integer(IntegerType::I32)),
            sym::_poseidon8_hash_to_i64         => Self::Hash(HashVariant::HashPSD8, Type::Integer(IntegerType::I64)),
            sym::_poseidon8_hash_to_i128        => Self::Hash(HashVariant::HashPSD8, Type::Integer(IntegerType::I128)),
            sym::_poseidon8_hash_to_u8          => Self::Hash(HashVariant::HashPSD8, Type::Integer(IntegerType::U8)),
            sym::_poseidon8_hash_to_u16         => Self::Hash(HashVariant::HashPSD8, Type::Integer(IntegerType::U16)),
            sym::_poseidon8_hash_to_u32         => Self::Hash(HashVariant::HashPSD8, Type::Integer(IntegerType::U32)),
            sym::_poseidon8_hash_to_u64         => Self::Hash(HashVariant::HashPSD8, Type::Integer(IntegerType::U64)),
            sym::_poseidon8_hash_to_u128        => Self::Hash(HashVariant::HashPSD8, Type::Integer(IntegerType::U128)),
            sym::_poseidon8_hash_to_scalar      => Self::Hash(HashVariant::HashPSD8, Type::Scalar),
            sym::_poseidon8_hash_to_address_raw => Self::Hash(HashVariant::HashPSD8Raw, Type::Address),
            sym::_poseidon8_hash_to_field_raw   => Self::Hash(HashVariant::HashPSD8Raw, Type::Field),
            sym::_poseidon8_hash_to_group_raw   => Self::Hash(HashVariant::HashPSD8Raw, Type::Group),
            sym::_poseidon8_hash_to_i8_raw      => Self::Hash(HashVariant::HashPSD8Raw, Type::Integer(IntegerType::I8)),
            sym::_poseidon8_hash_to_i16_raw     => Self::Hash(HashVariant::HashPSD8Raw, Type::Integer(IntegerType::I16)),
            sym::_poseidon8_hash_to_i32_raw     => Self::Hash(HashVariant::HashPSD8Raw, Type::Integer(IntegerType::I32)),
            sym::_poseidon8_hash_to_i64_raw     => Self::Hash(HashVariant::HashPSD8Raw, Type::Integer(IntegerType::I64)),
            sym::_poseidon8_hash_to_i128_raw    => Self::Hash(HashVariant::HashPSD8Raw, Type::Integer(IntegerType::I128)),
            sym::_poseidon8_hash_to_u8_raw      => Self::Hash(HashVariant::HashPSD8Raw, Type::Integer(IntegerType::U8)),
            sym::_poseidon8_hash_to_u16_raw     => Self::Hash(HashVariant::HashPSD8Raw, Type::Integer(IntegerType::U16)),
            sym::_poseidon8_hash_to_u32_raw     => Self::Hash(HashVariant::HashPSD8Raw, Type::Integer(IntegerType::U32)),
            sym::_poseidon8_hash_to_u64_raw     => Self::Hash(HashVariant::HashPSD8Raw, Type::Integer(IntegerType::U64)),
            sym::_poseidon8_hash_to_u128_raw    => Self::Hash(HashVariant::HashPSD8Raw, Type::Integer(IntegerType::U128)),
            sym::_poseidon8_hash_to_scalar_raw  => Self::Hash(HashVariant::HashPSD8Raw, Type::Scalar),

            sym::_sha3_256_hash_to_address     => Self::Hash(HashVariant::HashSha3_256, Type::Address),
            sym::_sha3_256_hash_to_field       => Self::Hash(HashVariant::HashSha3_256, Type::Field),
            sym::_sha3_256_hash_to_group       => Self::Hash(HashVariant::HashSha3_256, Type::Group),
            sym::_sha3_256_hash_to_i8          => Self::Hash(HashVariant::HashSha3_256, Type::Integer(IntegerType::I8)),
            sym::_sha3_256_hash_to_i16         => Self::Hash(HashVariant::HashSha3_256, Type::Integer(IntegerType::I16)),
            sym::_sha3_256_hash_to_i32         => Self::Hash(HashVariant::HashSha3_256, Type::Integer(IntegerType::I32)),
            sym::_sha3_256_hash_to_i64         => Self::Hash(HashVariant::HashSha3_256, Type::Integer(IntegerType::I64)),
            sym::_sha3_256_hash_to_i128        => Self::Hash(HashVariant::HashSha3_256, Type::Integer(IntegerType::I128)),
            sym::_sha3_256_hash_to_u8          => Self::Hash(HashVariant::HashSha3_256, Type::Integer(IntegerType::U8)),
            sym::_sha3_256_hash_to_u16         => Self::Hash(HashVariant::HashSha3_256, Type::Integer(IntegerType::U16)),
            sym::_sha3_256_hash_to_u32         => Self::Hash(HashVariant::HashSha3_256, Type::Integer(IntegerType::U32)),
            sym::_sha3_256_hash_to_u64         => Self::Hash(HashVariant::HashSha3_256, Type::Integer(IntegerType::U64)),
            sym::_sha3_256_hash_to_u128        => Self::Hash(HashVariant::HashSha3_256, Type::Integer(IntegerType::U128)),
            sym::_sha3_256_hash_to_scalar      => Self::Hash(HashVariant::HashSha3_256, Type::Scalar),
            sym::_sha3_256_hash_to_address_raw => Self::Hash(HashVariant::HashSha3_256Raw, Type::Address),
            sym::_sha3_256_hash_to_field_raw   => Self::Hash(HashVariant::HashSha3_256Raw, Type::Field),
            sym::_sha3_256_hash_to_group_raw   => Self::Hash(HashVariant::HashSha3_256Raw, Type::Group),
            sym::_sha3_256_hash_to_i8_raw      => Self::Hash(HashVariant::HashSha3_256Raw, Type::Integer(IntegerType::I8)),
            sym::_sha3_256_hash_to_i16_raw     => Self::Hash(HashVariant::HashSha3_256Raw, Type::Integer(IntegerType::I16)),
            sym::_sha3_256_hash_to_i32_raw     => Self::Hash(HashVariant::HashSha3_256Raw, Type::Integer(IntegerType::I32)),
            sym::_sha3_256_hash_to_i64_raw     => Self::Hash(HashVariant::HashSha3_256Raw, Type::Integer(IntegerType::I64)),
            sym::_sha3_256_hash_to_i128_raw    => Self::Hash(HashVariant::HashSha3_256Raw, Type::Integer(IntegerType::I128)),
            sym::_sha3_256_hash_to_u8_raw      => Self::Hash(HashVariant::HashSha3_256Raw, Type::Integer(IntegerType::U8)),
            sym::_sha3_256_hash_to_u16_raw     => Self::Hash(HashVariant::HashSha3_256Raw, Type::Integer(IntegerType::U16)),
            sym::_sha3_256_hash_to_u32_raw     => Self::Hash(HashVariant::HashSha3_256Raw, Type::Integer(IntegerType::U32)),
            sym::_sha3_256_hash_to_u64_raw     => Self::Hash(HashVariant::HashSha3_256Raw, Type::Integer(IntegerType::U64)),
            sym::_sha3_256_hash_to_u128_raw    => Self::Hash(HashVariant::HashSha3_256Raw, Type::Integer(IntegerType::U128)),
            sym::_sha3_256_hash_to_scalar_raw  => Self::Hash(HashVariant::HashSha3_256Raw, Type::Scalar),
            sym::_sha3_256_hash_to_bits         => Self::Hash(HashVariant::HashSha3_256Native, Type::Array(ArrayType::bit_array(256))),
            sym::_sha3_256_hash_to_bits_raw     => Self::Hash(HashVariant::HashSha3_256NativeRaw, Type::Array(ArrayType::bit_array(256))),

            sym::_sha3_384_hash_to_address     => Self::Hash(HashVariant::HashSha3_384, Type::Address),
            sym::_sha3_384_hash_to_field       => Self::Hash(HashVariant::HashSha3_384, Type::Field),
            sym::_sha3_384_hash_to_group       => Self::Hash(HashVariant::HashSha3_384, Type::Group),
            sym::_sha3_384_hash_to_i8          => Self::Hash(HashVariant::HashSha3_384, Type::Integer(IntegerType::I8)),
            sym::_sha3_384_hash_to_i16         => Self::Hash(HashVariant::HashSha3_384, Type::Integer(IntegerType::I16)),
            sym::_sha3_384_hash_to_i32         => Self::Hash(HashVariant::HashSha3_384, Type::Integer(IntegerType::I32)),
            sym::_sha3_384_hash_to_i64         => Self::Hash(HashVariant::HashSha3_384, Type::Integer(IntegerType::I64)),
            sym::_sha3_384_hash_to_i128        => Self::Hash(HashVariant::HashSha3_384, Type::Integer(IntegerType::I128)),
            sym::_sha3_384_hash_to_u8          => Self::Hash(HashVariant::HashSha3_384, Type::Integer(IntegerType::U8)),
            sym::_sha3_384_hash_to_u16         => Self::Hash(HashVariant::HashSha3_384, Type::Integer(IntegerType::U16)),
            sym::_sha3_384_hash_to_u32         => Self::Hash(HashVariant::HashSha3_384, Type::Integer(IntegerType::U32)),
            sym::_sha3_384_hash_to_u64         => Self::Hash(HashVariant::HashSha3_384, Type::Integer(IntegerType::U64)),
            sym::_sha3_384_hash_to_u128        => Self::Hash(HashVariant::HashSha3_384, Type::Integer(IntegerType::U128)),
            sym::_sha3_384_hash_to_scalar      => Self::Hash(HashVariant::HashSha3_384, Type::Scalar),
            sym::_sha3_384_hash_to_address_raw => Self::Hash(HashVariant::HashSha3_384Raw, Type::Address),
            sym::_sha3_384_hash_to_field_raw   => Self::Hash(HashVariant::HashSha3_384Raw, Type::Field),
            sym::_sha3_384_hash_to_group_raw   => Self::Hash(HashVariant::HashSha3_384Raw, Type::Group),
            sym::_sha3_384_hash_to_i8_raw      => Self::Hash(HashVariant::HashSha3_384Raw, Type::Integer(IntegerType::I8)),
            sym::_sha3_384_hash_to_i16_raw     => Self::Hash(HashVariant::HashSha3_384Raw, Type::Integer(IntegerType::I16)),
            sym::_sha3_384_hash_to_i32_raw     => Self::Hash(HashVariant::HashSha3_384Raw, Type::Integer(IntegerType::I32)),
            sym::_sha3_384_hash_to_i64_raw     => Self::Hash(HashVariant::HashSha3_384Raw, Type::Integer(IntegerType::I64)),
            sym::_sha3_384_hash_to_i128_raw    => Self::Hash(HashVariant::HashSha3_384Raw, Type::Integer(IntegerType::I128)),
            sym::_sha3_384_hash_to_u8_raw      => Self::Hash(HashVariant::HashSha3_384Raw, Type::Integer(IntegerType::U8)),
            sym::_sha3_384_hash_to_u16_raw     => Self::Hash(HashVariant::HashSha3_384Raw, Type::Integer(IntegerType::U16)),
            sym::_sha3_384_hash_to_u32_raw     => Self::Hash(HashVariant::HashSha3_384Raw, Type::Integer(IntegerType::U32)),
            sym::_sha3_384_hash_to_u64_raw     => Self::Hash(HashVariant::HashSha3_384Raw, Type::Integer(IntegerType::U64)),
            sym::_sha3_384_hash_to_u128_raw    => Self::Hash(HashVariant::HashSha3_384Raw, Type::Integer(IntegerType::U128)),
            sym::_sha3_384_hash_to_scalar_raw  => Self::Hash(HashVariant::HashSha3_384Raw, Type::Scalar),
            sym::_sha3_384_hash_to_bits         => Self::Hash(HashVariant::HashSha3_384Native, Type::Array(ArrayType::bit_array(384))),
            sym::_sha3_384_hash_to_bits_raw     => Self::Hash(HashVariant::HashSha3_384NativeRaw, Type::Array(ArrayType::bit_array(384))),

            sym::_sha3_512_hash_to_address     => Self::Hash(HashVariant::HashSha3_512, Type::Address),
            sym::_sha3_512_hash_to_field       => Self::Hash(HashVariant::HashSha3_512, Type::Field),
            sym::_sha3_512_hash_to_group       => Self::Hash(HashVariant::HashSha3_512, Type::Group),
            sym::_sha3_512_hash_to_i8          => Self::Hash(HashVariant::HashSha3_512, Type::Integer(IntegerType::I8)),
            sym::_sha3_512_hash_to_i16         => Self::Hash(HashVariant::HashSha3_512, Type::Integer(IntegerType::I16)),
            sym::_sha3_512_hash_to_i32         => Self::Hash(HashVariant::HashSha3_512, Type::Integer(IntegerType::I32)),
            sym::_sha3_512_hash_to_i64         => Self::Hash(HashVariant::HashSha3_512, Type::Integer(IntegerType::I64)),
            sym::_sha3_512_hash_to_i128        => Self::Hash(HashVariant::HashSha3_512, Type::Integer(IntegerType::I128)),
            sym::_sha3_512_hash_to_u8          => Self::Hash(HashVariant::HashSha3_512, Type::Integer(IntegerType::U8)),
            sym::_sha3_512_hash_to_u16         => Self::Hash(HashVariant::HashSha3_512, Type::Integer(IntegerType::U16)),
            sym::_sha3_512_hash_to_u32         => Self::Hash(HashVariant::HashSha3_512, Type::Integer(IntegerType::U32)),
            sym::_sha3_512_hash_to_u64         => Self::Hash(HashVariant::HashSha3_512, Type::Integer(IntegerType::U64)),
            sym::_sha3_512_hash_to_u128        => Self::Hash(HashVariant::HashSha3_512, Type::Integer(IntegerType::U128)),
            sym::_sha3_512_hash_to_scalar      => Self::Hash(HashVariant::HashSha3_512, Type::Scalar),
            sym::_sha3_512_hash_to_address_raw => Self::Hash(HashVariant::HashSha3_512Raw, Type::Address),
            sym::_sha3_512_hash_to_field_raw   => Self::Hash(HashVariant::HashSha3_512Raw, Type::Field),
            sym::_sha3_512_hash_to_group_raw   => Self::Hash(HashVariant::HashSha3_512Raw, Type::Group),
            sym::_sha3_512_hash_to_i8_raw      => Self::Hash(HashVariant::HashSha3_512Raw, Type::Integer(IntegerType::I8)),
            sym::_sha3_512_hash_to_i16_raw     => Self::Hash(HashVariant::HashSha3_512Raw, Type::Integer(IntegerType::I16)),
            sym::_sha3_512_hash_to_i32_raw     => Self::Hash(HashVariant::HashSha3_512Raw, Type::Integer(IntegerType::I32)),
            sym::_sha3_512_hash_to_i64_raw     => Self::Hash(HashVariant::HashSha3_512Raw, Type::Integer(IntegerType::I64)),
            sym::_sha3_512_hash_to_i128_raw    => Self::Hash(HashVariant::HashSha3_512Raw, Type::Integer(IntegerType::I128)),
            sym::_sha3_512_hash_to_u8_raw      => Self::Hash(HashVariant::HashSha3_512Raw, Type::Integer(IntegerType::U8)),
            sym::_sha3_512_hash_to_u16_raw     => Self::Hash(HashVariant::HashSha3_512Raw, Type::Integer(IntegerType::U16)),
            sym::_sha3_512_hash_to_u32_raw     => Self::Hash(HashVariant::HashSha3_512Raw, Type::Integer(IntegerType::U32)),
            sym::_sha3_512_hash_to_u64_raw     => Self::Hash(HashVariant::HashSha3_512Raw, Type::Integer(IntegerType::U64)),
            sym::_sha3_512_hash_to_u128_raw    => Self::Hash(HashVariant::HashSha3_512Raw, Type::Integer(IntegerType::U128)),
            sym::_sha3_512_hash_to_scalar_raw  => Self::Hash(HashVariant::HashSha3_512Raw, Type::Scalar),
            sym::_sha3_512_hash_to_bits         => Self::Hash(HashVariant::HashSha3_512Native, Type::Array(ArrayType::bit_array(512))),
            sym::_sha3_512_hash_to_bits_raw     => Self::Hash(HashVariant::HashSha3_512NativeRaw, Type::Array(ArrayType::bit_array(512))),

            sym::_ecdsa_verify_digest          => Self::ECDSAVerify(ECDSAVerifyVariant::Digest),
            sym::_ecdsa_verify_digest_eth      => Self::ECDSAVerify(ECDSAVerifyVariant::DigestEth),
            sym::_ecdsa_verify_keccak256       => Self::ECDSAVerify(ECDSAVerifyVariant::HashKeccak256),
            sym::_ecdsa_verify_keccak256_raw   => Self::ECDSAVerify(ECDSAVerifyVariant::HashKeccak256Raw),
            sym::_ecdsa_verify_keccak256_eth   => Self::ECDSAVerify(ECDSAVerifyVariant::HashKeccak256Eth),
            sym::_ecdsa_verify_keccak384       => Self::ECDSAVerify(ECDSAVerifyVariant::HashKeccak384),
            sym::_ecdsa_verify_keccak384_raw   => Self::ECDSAVerify(ECDSAVerifyVariant::HashKeccak384Raw),
            sym::_ecdsa_verify_keccak384_eth   => Self::ECDSAVerify(ECDSAVerifyVariant::HashKeccak384Eth),
            sym::_ecdsa_verify_keccak512       => Self::ECDSAVerify(ECDSAVerifyVariant::HashKeccak512),
            sym::_ecdsa_verify_keccak512_raw   => Self::ECDSAVerify(ECDSAVerifyVariant::HashKeccak512Raw),
            sym::_ecdsa_verify_keccak512_eth   => Self::ECDSAVerify(ECDSAVerifyVariant::HashKeccak512Eth),
            sym::_ecdsa_verify_sha3_256        => Self::ECDSAVerify(ECDSAVerifyVariant::HashSha3_256),
            sym::_ecdsa_verify_sha3_256_raw    => Self::ECDSAVerify(ECDSAVerifyVariant::HashSha3_256Raw),
            sym::_ecdsa_verify_sha3_256_eth    => Self::ECDSAVerify(ECDSAVerifyVariant::HashSha3_256Eth),
            sym::_ecdsa_verify_sha3_384        => Self::ECDSAVerify(ECDSAVerifyVariant::HashSha3_384),
            sym::_ecdsa_verify_sha3_384_raw    => Self::ECDSAVerify(ECDSAVerifyVariant::HashSha3_384Raw),
            sym::_ecdsa_verify_sha3_384_eth    => Self::ECDSAVerify(ECDSAVerifyVariant::HashSha3_384Eth),
            sym::_ecdsa_verify_sha3_512        => Self::ECDSAVerify(ECDSAVerifyVariant::HashSha3_512),
            sym::_ecdsa_verify_sha3_512_raw    => Self::ECDSAVerify(ECDSAVerifyVariant::HashSha3_512Raw),
            sym::_ecdsa_verify_sha3_512_eth    => Self::ECDSAVerify(ECDSAVerifyVariant::HashSha3_512Eth),

            sym::_mapping_get => Self::MappingGet,
            sym::_mapping_set => Self::MappingSet,
            sym::_mapping_get_or_use => Self::MappingGetOrUse,
            sym::_mapping_remove => Self::MappingRemove,
            sym::_mapping_contains => Self::MappingContains,

            sym::_optional_unwrap => Self::OptionalUnwrap,
            sym::_optional_unwrap_or => Self::OptionalUnwrapOr,

            sym::_vector_get => Self::VectorGet,
            sym::_vector_set => Self::VectorSet,
            sym::_vector_push => Self::VectorPush,
            sym::_vector_len => Self::VectorLen,
            sym::_vector_clear => Self::VectorClear,
            sym::_vector_pop => Self::VectorPop,
            sym::_vector_swap_remove => Self::VectorSwapRemove,

            sym::_group_to_x_coordinate => Self::GroupToXCoordinate,
            sym::_group_to_y_coordinate => Self::GroupToYCoordinate,

            sym::_program_checksum => Self::ProgramChecksum,
            sym::_program_edition => Self::ProgramEdition,
            sym::_program_owner => Self::ProgramOwner,

            sym::_signature_verify => Self::SignatureVerify,
            sym::_snark_verify => Self::SnarkVerify,
            sym::_snark_verify_batch => Self::SnarkVerifyBatch,
            sym::_final_run => Self::FinalRun,

            sym::_serialize_to_bits => Self::Serialize(SerializeVariant::ToBits),
            sym::_serialize_to_bits_raw => Self::Serialize(SerializeVariant::ToBitsRaw),

            sym::_dynamic_call => Self::DynamicCall,
            sym::_dynamic_contains => Self::DynamicContains,
            sym::_dynamic_get => Self::DynamicGet,
            sym::_dynamic_get_or_use => Self::DynamicGetOrUse,

            _ => return None,
        })
    }

    /// Returns a `Intrinsic` from the given module and method symbols.
    #[rustfmt::skip]
    pub fn convert_path_symbols(module: Symbol, function: Symbol) -> Option<Symbol> {
        Some(match (module, function) {
            (sym::Deserialize, sym::from_bits) => sym::_deserialize_from_bits,
            (sym::Deserialize, sym::from_bits_raw) => sym::_deserialize_from_bits_raw,

            (sym::ChaCha, sym::rand_address) => sym::_chacha_rand_address,
            (sym::ChaCha, sym::rand_bool)    => sym::_chacha_rand_bool,
            (sym::ChaCha, sym::rand_field)   => sym::_chacha_rand_field,
            (sym::ChaCha, sym::rand_group)   => sym::_chacha_rand_group,
            (sym::ChaCha, sym::rand_i8)      => sym::_chacha_rand_i8,
            (sym::ChaCha, sym::rand_i16)     => sym::_chacha_rand_i16,
            (sym::ChaCha, sym::rand_i32)     => sym::_chacha_rand_i32,
            (sym::ChaCha, sym::rand_i64)     => sym::_chacha_rand_i64,
            (sym::ChaCha, sym::rand_i128)    => sym::_chacha_rand_i128,
            (sym::ChaCha, sym::rand_u8)      => sym::_chacha_rand_u8,
            (sym::ChaCha, sym::rand_u16)     => sym::_chacha_rand_u16,
            (sym::ChaCha, sym::rand_u32)     => sym::_chacha_rand_u32,
            (sym::ChaCha, sym::rand_u64)     => sym::_chacha_rand_u64,
            (sym::ChaCha, sym::rand_u128)    => sym::_chacha_rand_u128,
            (sym::ChaCha, sym::rand_scalar)  => sym::_chacha_rand_scalar,

            (sym::BHP256, sym::commit_to_address)   => sym::_bhp256_commit_to_address,
            (sym::BHP256, sym::commit_to_field)     => sym::_bhp256_commit_to_field,
            (sym::BHP256, sym::commit_to_group)     => sym::_bhp256_commit_to_group,
            (sym::BHP512, sym::commit_to_address)   => sym::_bhp512_commit_to_address,
            (sym::BHP512, sym::commit_to_field)     => sym::_bhp512_commit_to_field,
            (sym::BHP512, sym::commit_to_group)     => sym::_bhp512_commit_to_group,
            (sym::BHP768, sym::commit_to_address)   => sym::_bhp768_commit_to_address,
            (sym::BHP768, sym::commit_to_field)     => sym::_bhp768_commit_to_field,
            (sym::BHP768, sym::commit_to_group)     => sym::_bhp768_commit_to_group,
            (sym::BHP1024, sym::commit_to_address)   => sym::_bhp1024_commit_to_address,
            (sym::BHP1024, sym::commit_to_field)     => sym::_bhp1024_commit_to_field,
            (sym::BHP1024, sym::commit_to_group)     => sym::_bhp1024_commit_to_group,
            (sym::Pedersen64, sym::commit_to_address)   => sym::_pedersen64_commit_to_address,
            (sym::Pedersen64, sym::commit_to_field)     => sym::_pedersen64_commit_to_field,
            (sym::Pedersen64, sym::commit_to_group)     => sym::_pedersen64_commit_to_group,
            (sym::Pedersen128, sym::commit_to_address)   => sym::_pedersen128_commit_to_address,
            (sym::Pedersen128, sym::commit_to_field)     => sym::_pedersen128_commit_to_field,
            (sym::Pedersen128, sym::commit_to_group)     => sym::_pedersen128_commit_to_group,

            (sym::BHP256, sym::hash_to_address)     => sym::_bhp256_hash_to_address,
            (sym::BHP256, sym::hash_to_field)       => sym::_bhp256_hash_to_field,
            (sym::BHP256, sym::hash_to_group)       => sym::_bhp256_hash_to_group,
            (sym::BHP256, sym::hash_to_i8)          => sym::_bhp256_hash_to_i8,
            (sym::BHP256, sym::hash_to_i16)         => sym::_bhp256_hash_to_i16,
            (sym::BHP256, sym::hash_to_i32)         => sym::_bhp256_hash_to_i32,
            (sym::BHP256, sym::hash_to_i64)         => sym::_bhp256_hash_to_i64,
            (sym::BHP256, sym::hash_to_i128)        => sym::_bhp256_hash_to_i128,
            (sym::BHP256, sym::hash_to_u8)          => sym::_bhp256_hash_to_u8,
            (sym::BHP256, sym::hash_to_u16)         => sym::_bhp256_hash_to_u16,
            (sym::BHP256, sym::hash_to_u32)         => sym::_bhp256_hash_to_u32,
            (sym::BHP256, sym::hash_to_u64)         => sym::_bhp256_hash_to_u64,
            (sym::BHP256, sym::hash_to_u128)        => sym::_bhp256_hash_to_u128,
            (sym::BHP256, sym::hash_to_scalar)      => sym::_bhp256_hash_to_scalar,
            (sym::BHP256, sym::hash_to_address_raw) => sym::_bhp256_hash_to_address_raw,
            (sym::BHP256, sym::hash_to_field_raw)   => sym::_bhp256_hash_to_field_raw,
            (sym::BHP256, sym::hash_to_group_raw)   => sym::_bhp256_hash_to_group_raw,
            (sym::BHP256, sym::hash_to_i8_raw)      => sym::_bhp256_hash_to_i8_raw,
            (sym::BHP256, sym::hash_to_i16_raw)     => sym::_bhp256_hash_to_i16_raw,
            (sym::BHP256, sym::hash_to_i32_raw)     => sym::_bhp256_hash_to_i32_raw,
            (sym::BHP256, sym::hash_to_i64_raw)     => sym::_bhp256_hash_to_i64_raw,
            (sym::BHP256, sym::hash_to_i128_raw)    => sym::_bhp256_hash_to_i128_raw,
            (sym::BHP256, sym::hash_to_u8_raw)      => sym::_bhp256_hash_to_u8_raw,
            (sym::BHP256, sym::hash_to_u16_raw)     => sym::_bhp256_hash_to_u16_raw,
            (sym::BHP256, sym::hash_to_u32_raw)     => sym::_bhp256_hash_to_u32_raw,
            (sym::BHP256, sym::hash_to_u64_raw)     => sym::_bhp256_hash_to_u64_raw,
            (sym::BHP256, sym::hash_to_u128_raw)    => sym::_bhp256_hash_to_u128_raw,
            (sym::BHP256, sym::hash_to_scalar_raw)  => sym::_bhp256_hash_to_scalar_raw,

            (sym::BHP512, sym::hash_to_address)     => sym::_bhp512_hash_to_address,
            (sym::BHP512, sym::hash_to_field)       => sym::_bhp512_hash_to_field,
            (sym::BHP512, sym::hash_to_group)       => sym::_bhp512_hash_to_group,
            (sym::BHP512, sym::hash_to_i8)          => sym::_bhp512_hash_to_i8,
            (sym::BHP512, sym::hash_to_i16)         => sym::_bhp512_hash_to_i16,
            (sym::BHP512, sym::hash_to_i32)         => sym::_bhp512_hash_to_i32,
            (sym::BHP512, sym::hash_to_i64)         => sym::_bhp512_hash_to_i64,
            (sym::BHP512, sym::hash_to_i128)        => sym::_bhp512_hash_to_i128,
            (sym::BHP512, sym::hash_to_u8)          => sym::_bhp512_hash_to_u8,
            (sym::BHP512, sym::hash_to_u16)         => sym::_bhp512_hash_to_u16,
            (sym::BHP512, sym::hash_to_u32)         => sym::_bhp512_hash_to_u32,
            (sym::BHP512, sym::hash_to_u64)         => sym::_bhp512_hash_to_u64,
            (sym::BHP512, sym::hash_to_u128)        => sym::_bhp512_hash_to_u128,
            (sym::BHP512, sym::hash_to_scalar)      => sym::_bhp512_hash_to_scalar,
            (sym::BHP512, sym::hash_to_address_raw) => sym::_bhp512_hash_to_address_raw,
            (sym::BHP512, sym::hash_to_field_raw)   => sym::_bhp512_hash_to_field_raw,
            (sym::BHP512, sym::hash_to_group_raw)   => sym::_bhp512_hash_to_group_raw,
            (sym::BHP512, sym::hash_to_i8_raw)      => sym::_bhp512_hash_to_i8_raw,
            (sym::BHP512, sym::hash_to_i16_raw)     => sym::_bhp512_hash_to_i16_raw,
            (sym::BHP512, sym::hash_to_i32_raw)     => sym::_bhp512_hash_to_i32_raw,
            (sym::BHP512, sym::hash_to_i64_raw)     => sym::_bhp512_hash_to_i64_raw,
            (sym::BHP512, sym::hash_to_i128_raw)    => sym::_bhp512_hash_to_i128_raw,
            (sym::BHP512, sym::hash_to_u8_raw)      => sym::_bhp512_hash_to_u8_raw,
            (sym::BHP512, sym::hash_to_u16_raw)     => sym::_bhp512_hash_to_u16_raw,
            (sym::BHP512, sym::hash_to_u32_raw)     => sym::_bhp512_hash_to_u32_raw,
            (sym::BHP512, sym::hash_to_u64_raw)     => sym::_bhp512_hash_to_u64_raw,
            (sym::BHP512, sym::hash_to_u128_raw)    => sym::_bhp512_hash_to_u128_raw,
            (sym::BHP512, sym::hash_to_scalar_raw)  => sym::_bhp512_hash_to_scalar_raw,

            (sym::BHP768, sym::hash_to_address)     => sym::_bhp768_hash_to_address,
            (sym::BHP768, sym::hash_to_field)       => sym::_bhp768_hash_to_field,
            (sym::BHP768, sym::hash_to_group)       => sym::_bhp768_hash_to_group,
            (sym::BHP768, sym::hash_to_i8)          => sym::_bhp768_hash_to_i8,
            (sym::BHP768, sym::hash_to_i16)         => sym::_bhp768_hash_to_i16,
            (sym::BHP768, sym::hash_to_i32)         => sym::_bhp768_hash_to_i32,
            (sym::BHP768, sym::hash_to_i64)         => sym::_bhp768_hash_to_i64,
            (sym::BHP768, sym::hash_to_i128)        => sym::_bhp768_hash_to_i128,
            (sym::BHP768, sym::hash_to_u8)          => sym::_bhp768_hash_to_u8,
            (sym::BHP768, sym::hash_to_u16)         => sym::_bhp768_hash_to_u16,
            (sym::BHP768, sym::hash_to_u32)         => sym::_bhp768_hash_to_u32,
            (sym::BHP768, sym::hash_to_u64)         => sym::_bhp768_hash_to_u64,
            (sym::BHP768, sym::hash_to_u128)        => sym::_bhp768_hash_to_u128,
            (sym::BHP768, sym::hash_to_scalar)      => sym::_bhp768_hash_to_scalar,
            (sym::BHP768, sym::hash_to_address_raw) => sym::_bhp768_hash_to_address_raw,
            (sym::BHP768, sym::hash_to_field_raw)   => sym::_bhp768_hash_to_field_raw,
            (sym::BHP768, sym::hash_to_group_raw)   => sym::_bhp768_hash_to_group_raw,
            (sym::BHP768, sym::hash_to_i8_raw)      => sym::_bhp768_hash_to_i8_raw,
            (sym::BHP768, sym::hash_to_i16_raw)     => sym::_bhp768_hash_to_i16_raw,
            (sym::BHP768, sym::hash_to_i32_raw)     => sym::_bhp768_hash_to_i32_raw,
            (sym::BHP768, sym::hash_to_i64_raw)     => sym::_bhp768_hash_to_i64_raw,
            (sym::BHP768, sym::hash_to_i128_raw)    => sym::_bhp768_hash_to_i128_raw,
            (sym::BHP768, sym::hash_to_u8_raw)      => sym::_bhp768_hash_to_u8_raw,
            (sym::BHP768, sym::hash_to_u16_raw)     => sym::_bhp768_hash_to_u16_raw,
            (sym::BHP768, sym::hash_to_u32_raw)     => sym::_bhp768_hash_to_u32_raw,
            (sym::BHP768, sym::hash_to_u64_raw)     => sym::_bhp768_hash_to_u64_raw,
            (sym::BHP768, sym::hash_to_u128_raw)    => sym::_bhp768_hash_to_u128_raw,
            (sym::BHP768, sym::hash_to_scalar_raw)  => sym::_bhp768_hash_to_scalar_raw,

            (sym::BHP1024, sym::hash_to_address)     => sym::_bhp1024_hash_to_address,
            (sym::BHP1024, sym::hash_to_field)       => sym::_bhp1024_hash_to_field,
            (sym::BHP1024, sym::hash_to_group)       => sym::_bhp1024_hash_to_group,
            (sym::BHP1024, sym::hash_to_i8)          => sym::_bhp1024_hash_to_i8,
            (sym::BHP1024, sym::hash_to_i16)         => sym::_bhp1024_hash_to_i16,
            (sym::BHP1024, sym::hash_to_i32)         => sym::_bhp1024_hash_to_i32,
            (sym::BHP1024, sym::hash_to_i64)         => sym::_bhp1024_hash_to_i64,
            (sym::BHP1024, sym::hash_to_i128)        => sym::_bhp1024_hash_to_i128,
            (sym::BHP1024, sym::hash_to_u8)          => sym::_bhp1024_hash_to_u8,
            (sym::BHP1024, sym::hash_to_u16)         => sym::_bhp1024_hash_to_u16,
            (sym::BHP1024, sym::hash_to_u32)         => sym::_bhp1024_hash_to_u32,
            (sym::BHP1024, sym::hash_to_u64)         => sym::_bhp1024_hash_to_u64,
            (sym::BHP1024, sym::hash_to_u128)        => sym::_bhp1024_hash_to_u128,
            (sym::BHP1024, sym::hash_to_scalar)      => sym::_bhp1024_hash_to_scalar,
            (sym::BHP1024, sym::hash_to_address_raw) => sym::_bhp1024_hash_to_address_raw,
            (sym::BHP1024, sym::hash_to_field_raw)   => sym::_bhp1024_hash_to_field_raw,
            (sym::BHP1024, sym::hash_to_group_raw)   => sym::_bhp1024_hash_to_group_raw,
            (sym::BHP1024, sym::hash_to_i8_raw)      => sym::_bhp1024_hash_to_i8_raw,
            (sym::BHP1024, sym::hash_to_i16_raw)     => sym::_bhp1024_hash_to_i16_raw,
            (sym::BHP1024, sym::hash_to_i32_raw)     => sym::_bhp1024_hash_to_i32_raw,
            (sym::BHP1024, sym::hash_to_i64_raw)     => sym::_bhp1024_hash_to_i64_raw,
            (sym::BHP1024, sym::hash_to_i128_raw)    => sym::_bhp1024_hash_to_i128_raw,
            (sym::BHP1024, sym::hash_to_u8_raw)      => sym::_bhp1024_hash_to_u8_raw,
            (sym::BHP1024, sym::hash_to_u16_raw)     => sym::_bhp1024_hash_to_u16_raw,
            (sym::BHP1024, sym::hash_to_u32_raw)     => sym::_bhp1024_hash_to_u32_raw,
            (sym::BHP1024, sym::hash_to_u64_raw)     => sym::_bhp1024_hash_to_u64_raw,
            (sym::BHP1024, sym::hash_to_u128_raw)    => sym::_bhp1024_hash_to_u128_raw,
            (sym::BHP1024, sym::hash_to_scalar_raw)  => sym::_bhp1024_hash_to_scalar_raw,

            (sym::Keccak256, sym::hash_to_address)     => sym::_keccak256_hash_to_address,
            (sym::Keccak256, sym::hash_to_field)       => sym::_keccak256_hash_to_field,
            (sym::Keccak256, sym::hash_to_group)       => sym::_keccak256_hash_to_group,
            (sym::Keccak256, sym::hash_to_i8)          => sym::_keccak256_hash_to_i8,
            (sym::Keccak256, sym::hash_to_i16)         => sym::_keccak256_hash_to_i16,
            (sym::Keccak256, sym::hash_to_i32)         => sym::_keccak256_hash_to_i32,
            (sym::Keccak256, sym::hash_to_i64)         => sym::_keccak256_hash_to_i64,
            (sym::Keccak256, sym::hash_to_i128)        => sym::_keccak256_hash_to_i128,
            (sym::Keccak256, sym::hash_to_u8)          => sym::_keccak256_hash_to_u8,
            (sym::Keccak256, sym::hash_to_u16)         => sym::_keccak256_hash_to_u16,
            (sym::Keccak256, sym::hash_to_u32)         => sym::_keccak256_hash_to_u32,
            (sym::Keccak256, sym::hash_to_u64)         => sym::_keccak256_hash_to_u64,
            (sym::Keccak256, sym::hash_to_u128)        => sym::_keccak256_hash_to_u128,
            (sym::Keccak256, sym::hash_to_scalar)      => sym::_keccak256_hash_to_scalar,
            (sym::Keccak256, sym::hash_to_address_raw) => sym::_keccak256_hash_to_address_raw,
            (sym::Keccak256, sym::hash_to_field_raw)   => sym::_keccak256_hash_to_field_raw,
            (sym::Keccak256, sym::hash_to_group_raw)   => sym::_keccak256_hash_to_group_raw,
            (sym::Keccak256, sym::hash_to_i8_raw)      => sym::_keccak256_hash_to_i8_raw,
            (sym::Keccak256, sym::hash_to_i16_raw)     => sym::_keccak256_hash_to_i16_raw,
            (sym::Keccak256, sym::hash_to_i32_raw)     => sym::_keccak256_hash_to_i32_raw,
            (sym::Keccak256, sym::hash_to_i64_raw)     => sym::_keccak256_hash_to_i64_raw,
            (sym::Keccak256, sym::hash_to_i128_raw)    => sym::_keccak256_hash_to_i128_raw,
            (sym::Keccak256, sym::hash_to_u8_raw)      => sym::_keccak256_hash_to_u8_raw,
            (sym::Keccak256, sym::hash_to_u16_raw)     => sym::_keccak256_hash_to_u16_raw,
            (sym::Keccak256, sym::hash_to_u32_raw)     => sym::_keccak256_hash_to_u32_raw,
            (sym::Keccak256, sym::hash_to_u64_raw)     => sym::_keccak256_hash_to_u64_raw,
            (sym::Keccak256, sym::hash_to_u128_raw)    => sym::_keccak256_hash_to_u128_raw,
            (sym::Keccak256, sym::hash_to_scalar_raw)  => sym::_keccak256_hash_to_scalar_raw,
            (sym::Keccak256, sym::hash_to_bits)         => sym::_keccak256_hash_to_bits,
            (sym::Keccak256, sym::hash_to_bits_raw)     => sym::_keccak256_hash_to_bits_raw,

            (sym::Keccak384, sym::hash_to_address)     => sym::_keccak384_hash_to_address,
            (sym::Keccak384, sym::hash_to_field)       => sym::_keccak384_hash_to_field,
            (sym::Keccak384, sym::hash_to_group)       => sym::_keccak384_hash_to_group,
            (sym::Keccak384, sym::hash_to_i8)          => sym::_keccak384_hash_to_i8,
            (sym::Keccak384, sym::hash_to_i16)         => sym::_keccak384_hash_to_i16,
            (sym::Keccak384, sym::hash_to_i32)         => sym::_keccak384_hash_to_i32,
            (sym::Keccak384, sym::hash_to_i64)         => sym::_keccak384_hash_to_i64,
            (sym::Keccak384, sym::hash_to_i128)        => sym::_keccak384_hash_to_i128,
            (sym::Keccak384, sym::hash_to_u8)          => sym::_keccak384_hash_to_u8,
            (sym::Keccak384, sym::hash_to_u16)         => sym::_keccak384_hash_to_u16,
            (sym::Keccak384, sym::hash_to_u32)         => sym::_keccak384_hash_to_u32,
            (sym::Keccak384, sym::hash_to_u64)         => sym::_keccak384_hash_to_u64,
            (sym::Keccak384, sym::hash_to_u128)        => sym::_keccak384_hash_to_u128,
            (sym::Keccak384, sym::hash_to_scalar)      => sym::_keccak384_hash_to_scalar,
            (sym::Keccak384, sym::hash_to_address_raw) => sym::_keccak384_hash_to_address_raw,
            (sym::Keccak384, sym::hash_to_field_raw)   => sym::_keccak384_hash_to_field_raw,
            (sym::Keccak384, sym::hash_to_group_raw)   => sym::_keccak384_hash_to_group_raw,
            (sym::Keccak384, sym::hash_to_i8_raw)      => sym::_keccak384_hash_to_i8_raw,
            (sym::Keccak384, sym::hash_to_i16_raw)     => sym::_keccak384_hash_to_i16_raw,
            (sym::Keccak384, sym::hash_to_i32_raw)     => sym::_keccak384_hash_to_i32_raw,
            (sym::Keccak384, sym::hash_to_i64_raw)     => sym::_keccak384_hash_to_i64_raw,
            (sym::Keccak384, sym::hash_to_i128_raw)    => sym::_keccak384_hash_to_i128_raw,
            (sym::Keccak384, sym::hash_to_u8_raw)      => sym::_keccak384_hash_to_u8_raw,
            (sym::Keccak384, sym::hash_to_u16_raw)     => sym::_keccak384_hash_to_u16_raw,
            (sym::Keccak384, sym::hash_to_u32_raw)     => sym::_keccak384_hash_to_u32_raw,
            (sym::Keccak384, sym::hash_to_u64_raw)     => sym::_keccak384_hash_to_u64_raw,
            (sym::Keccak384, sym::hash_to_u128_raw)    => sym::_keccak384_hash_to_u128_raw,
            (sym::Keccak384, sym::hash_to_scalar_raw)  => sym::_keccak384_hash_to_scalar_raw,
            (sym::Keccak384, sym::hash_to_bits)         => sym::_keccak384_hash_to_bits,
            (sym::Keccak384, sym::hash_to_bits_raw)     => sym::_keccak384_hash_to_bits_raw,

            (sym::Keccak512, sym::hash_to_address)     => sym::_keccak512_hash_to_address,
            (sym::Keccak512, sym::hash_to_field)       => sym::_keccak512_hash_to_field,
            (sym::Keccak512, sym::hash_to_group)       => sym::_keccak512_hash_to_group,
            (sym::Keccak512, sym::hash_to_i8)          => sym::_keccak512_hash_to_i8,
            (sym::Keccak512, sym::hash_to_i16)         => sym::_keccak512_hash_to_i16,
            (sym::Keccak512, sym::hash_to_i32)         => sym::_keccak512_hash_to_i32,
            (sym::Keccak512, sym::hash_to_i64)         => sym::_keccak512_hash_to_i64,
            (sym::Keccak512, sym::hash_to_i128)        => sym::_keccak512_hash_to_i128,
            (sym::Keccak512, sym::hash_to_u8)          => sym::_keccak512_hash_to_u8,
            (sym::Keccak512, sym::hash_to_u16)         => sym::_keccak512_hash_to_u16,
            (sym::Keccak512, sym::hash_to_u32)         => sym::_keccak512_hash_to_u32,
            (sym::Keccak512, sym::hash_to_u64)         => sym::_keccak512_hash_to_u64,
            (sym::Keccak512, sym::hash_to_u128)        => sym::_keccak512_hash_to_u128,
            (sym::Keccak512, sym::hash_to_scalar)      => sym::_keccak512_hash_to_scalar,
            (sym::Keccak512, sym::hash_to_address_raw) => sym::_keccak512_hash_to_address_raw,
            (sym::Keccak512, sym::hash_to_field_raw)   => sym::_keccak512_hash_to_field_raw,
            (sym::Keccak512, sym::hash_to_group_raw)   => sym::_keccak512_hash_to_group_raw,
            (sym::Keccak512, sym::hash_to_i8_raw)      => sym::_keccak512_hash_to_i8_raw,
            (sym::Keccak512, sym::hash_to_i16_raw)     => sym::_keccak512_hash_to_i16_raw,
            (sym::Keccak512, sym::hash_to_i32_raw)     => sym::_keccak512_hash_to_i32_raw,
            (sym::Keccak512, sym::hash_to_i64_raw)     => sym::_keccak512_hash_to_i64_raw,
            (sym::Keccak512, sym::hash_to_i128_raw)    => sym::_keccak512_hash_to_i128_raw,
            (sym::Keccak512, sym::hash_to_u8_raw)      => sym::_keccak512_hash_to_u8_raw,
            (sym::Keccak512, sym::hash_to_u16_raw)     => sym::_keccak512_hash_to_u16_raw,
            (sym::Keccak512, sym::hash_to_u32_raw)     => sym::_keccak512_hash_to_u32_raw,
            (sym::Keccak512, sym::hash_to_u64_raw)     => sym::_keccak512_hash_to_u64_raw,
            (sym::Keccak512, sym::hash_to_u128_raw)    => sym::_keccak512_hash_to_u128_raw,
            (sym::Keccak512, sym::hash_to_scalar_raw)  => sym::_keccak512_hash_to_scalar_raw,
            (sym::Keccak512, sym::hash_to_bits)         => sym::_keccak512_hash_to_bits,
            (sym::Keccak512, sym::hash_to_bits_raw)     => sym::_keccak512_hash_to_bits_raw,

            (sym::Pedersen64, sym::hash_to_address)     => sym::_pedersen64_hash_to_address,
            (sym::Pedersen64, sym::hash_to_field)       => sym::_pedersen64_hash_to_field,
            (sym::Pedersen64, sym::hash_to_group)       => sym::_pedersen64_hash_to_group,
            (sym::Pedersen64, sym::hash_to_i8)          => sym::_pedersen64_hash_to_i8,
            (sym::Pedersen64, sym::hash_to_i16)         => sym::_pedersen64_hash_to_i16,
            (sym::Pedersen64, sym::hash_to_i32)         => sym::_pedersen64_hash_to_i32,
            (sym::Pedersen64, sym::hash_to_i64)         => sym::_pedersen64_hash_to_i64,
            (sym::Pedersen64, sym::hash_to_i128)        => sym::_pedersen64_hash_to_i128,
            (sym::Pedersen64, sym::hash_to_u8)          => sym::_pedersen64_hash_to_u8,
            (sym::Pedersen64, sym::hash_to_u16)         => sym::_pedersen64_hash_to_u16,
            (sym::Pedersen64, sym::hash_to_u32)         => sym::_pedersen64_hash_to_u32,
            (sym::Pedersen64, sym::hash_to_u64)         => sym::_pedersen64_hash_to_u64,
            (sym::Pedersen64, sym::hash_to_u128)        => sym::_pedersen64_hash_to_u128,
            (sym::Pedersen64, sym::hash_to_scalar)      => sym::_pedersen64_hash_to_scalar,
            (sym::Pedersen64, sym::hash_to_address_raw) => sym::_pedersen64_hash_to_address_raw,
            (sym::Pedersen64, sym::hash_to_field_raw)   => sym::_pedersen64_hash_to_field_raw,
            (sym::Pedersen64, sym::hash_to_group_raw)   => sym::_pedersen64_hash_to_group_raw,
            (sym::Pedersen64, sym::hash_to_i8_raw)      => sym::_pedersen64_hash_to_i8_raw,
            (sym::Pedersen64, sym::hash_to_i16_raw)     => sym::_pedersen64_hash_to_i16_raw,
            (sym::Pedersen64, sym::hash_to_i32_raw)     => sym::_pedersen64_hash_to_i32_raw,
            (sym::Pedersen64, sym::hash_to_i64_raw)     => sym::_pedersen64_hash_to_i64_raw,
            (sym::Pedersen64, sym::hash_to_i128_raw)    => sym::_pedersen64_hash_to_i128_raw,
            (sym::Pedersen64, sym::hash_to_u8_raw)      => sym::_pedersen64_hash_to_u8_raw,
            (sym::Pedersen64, sym::hash_to_u16_raw)     => sym::_pedersen64_hash_to_u16_raw,
            (sym::Pedersen64, sym::hash_to_u32_raw)     => sym::_pedersen64_hash_to_u32_raw,
            (sym::Pedersen64, sym::hash_to_u64_raw)     => sym::_pedersen64_hash_to_u64_raw,
            (sym::Pedersen64, sym::hash_to_u128_raw)    => sym::_pedersen64_hash_to_u128_raw,
            (sym::Pedersen64, sym::hash_to_scalar_raw)  => sym::_pedersen64_hash_to_scalar_raw,

            (sym::Pedersen128, sym::hash_to_address)     => sym::_pedersen128_hash_to_address,
            (sym::Pedersen128, sym::hash_to_field)       => sym::_pedersen128_hash_to_field,
            (sym::Pedersen128, sym::hash_to_group)       => sym::_pedersen128_hash_to_group,
            (sym::Pedersen128, sym::hash_to_i8)          => sym::_pedersen128_hash_to_i8,
            (sym::Pedersen128, sym::hash_to_i16)         => sym::_pedersen128_hash_to_i16,
            (sym::Pedersen128, sym::hash_to_i32)         => sym::_pedersen128_hash_to_i32,
            (sym::Pedersen128, sym::hash_to_i64)         => sym::_pedersen128_hash_to_i64,
            (sym::Pedersen128, sym::hash_to_i128)        => sym::_pedersen128_hash_to_i128,
            (sym::Pedersen128, sym::hash_to_u8)          => sym::_pedersen128_hash_to_u8,
            (sym::Pedersen128, sym::hash_to_u16)         => sym::_pedersen128_hash_to_u16,
            (sym::Pedersen128, sym::hash_to_u32)         => sym::_pedersen128_hash_to_u32,
            (sym::Pedersen128, sym::hash_to_u64)         => sym::_pedersen128_hash_to_u64,
            (sym::Pedersen128, sym::hash_to_u128)        => sym::_pedersen128_hash_to_u128,
            (sym::Pedersen128, sym::hash_to_scalar)      => sym::_pedersen128_hash_to_scalar,
            (sym::Pedersen128, sym::hash_to_address_raw) => sym::_pedersen128_hash_to_address_raw,
            (sym::Pedersen128, sym::hash_to_field_raw)   => sym::_pedersen128_hash_to_field_raw,
            (sym::Pedersen128, sym::hash_to_group_raw)   => sym::_pedersen128_hash_to_group_raw,
            (sym::Pedersen128, sym::hash_to_i8_raw)      => sym::_pedersen128_hash_to_i8_raw,
            (sym::Pedersen128, sym::hash_to_i16_raw)     => sym::_pedersen128_hash_to_i16_raw,
            (sym::Pedersen128, sym::hash_to_i32_raw)     => sym::_pedersen128_hash_to_i32_raw,
            (sym::Pedersen128, sym::hash_to_i64_raw)     => sym::_pedersen128_hash_to_i64_raw,
            (sym::Pedersen128, sym::hash_to_i128_raw)    => sym::_pedersen128_hash_to_i128_raw,
            (sym::Pedersen128, sym::hash_to_u8_raw)      => sym::_pedersen128_hash_to_u8_raw,
            (sym::Pedersen128, sym::hash_to_u16_raw)     => sym::_pedersen128_hash_to_u16_raw,
            (sym::Pedersen128, sym::hash_to_u32_raw)     => sym::_pedersen128_hash_to_u32_raw,
            (sym::Pedersen128, sym::hash_to_u64_raw)     => sym::_pedersen128_hash_to_u64_raw,
            (sym::Pedersen128, sym::hash_to_u128_raw)    => sym::_pedersen128_hash_to_u128_raw,
            (sym::Pedersen128, sym::hash_to_scalar_raw)  => sym::_pedersen128_hash_to_scalar_raw,

            (sym::Poseidon2, sym::hash_to_address)     => sym::_poseidon2_hash_to_address,
            (sym::Poseidon2, sym::hash_to_field)       => sym::_poseidon2_hash_to_field,
            (sym::Poseidon2, sym::hash_to_group)       => sym::_poseidon2_hash_to_group,
            (sym::Poseidon2, sym::hash_to_i8)          => sym::_poseidon2_hash_to_i8,
            (sym::Poseidon2, sym::hash_to_i16)         => sym::_poseidon2_hash_to_i16,
            (sym::Poseidon2, sym::hash_to_i32)         => sym::_poseidon2_hash_to_i32,
            (sym::Poseidon2, sym::hash_to_i64)         => sym::_poseidon2_hash_to_i64,
            (sym::Poseidon2, sym::hash_to_i128)        => sym::_poseidon2_hash_to_i128,
            (sym::Poseidon2, sym::hash_to_u8)          => sym::_poseidon2_hash_to_u8,
            (sym::Poseidon2, sym::hash_to_u16)         => sym::_poseidon2_hash_to_u16,
            (sym::Poseidon2, sym::hash_to_u32)         => sym::_poseidon2_hash_to_u32,
            (sym::Poseidon2, sym::hash_to_u64)         => sym::_poseidon2_hash_to_u64,
            (sym::Poseidon2, sym::hash_to_u128)        => sym::_poseidon2_hash_to_u128,
            (sym::Poseidon2, sym::hash_to_scalar)      => sym::_poseidon2_hash_to_scalar,
            (sym::Poseidon2, sym::hash_to_address_raw) => sym::_poseidon2_hash_to_address_raw,
            (sym::Poseidon2, sym::hash_to_field_raw)   => sym::_poseidon2_hash_to_field_raw,
            (sym::Poseidon2, sym::hash_to_group_raw)   => sym::_poseidon2_hash_to_group_raw,
            (sym::Poseidon2, sym::hash_to_i8_raw)      => sym::_poseidon2_hash_to_i8_raw,
            (sym::Poseidon2, sym::hash_to_i16_raw)     => sym::_poseidon2_hash_to_i16_raw,
            (sym::Poseidon2, sym::hash_to_i32_raw)     => sym::_poseidon2_hash_to_i32_raw,
            (sym::Poseidon2, sym::hash_to_i64_raw)     => sym::_poseidon2_hash_to_i64_raw,
            (sym::Poseidon2, sym::hash_to_i128_raw)    => sym::_poseidon2_hash_to_i128_raw,
            (sym::Poseidon2, sym::hash_to_u8_raw)      => sym::_poseidon2_hash_to_u8_raw,
            (sym::Poseidon2, sym::hash_to_u16_raw)     => sym::_poseidon2_hash_to_u16_raw,
            (sym::Poseidon2, sym::hash_to_u32_raw)     => sym::_poseidon2_hash_to_u32_raw,
            (sym::Poseidon2, sym::hash_to_u64_raw)     => sym::_poseidon2_hash_to_u64_raw,
            (sym::Poseidon2, sym::hash_to_u128_raw)    => sym::_poseidon2_hash_to_u128_raw,
            (sym::Poseidon2, sym::hash_to_scalar_raw)  => sym::_poseidon2_hash_to_scalar_raw,

            (sym::Poseidon4, sym::hash_to_address)     => sym::_poseidon4_hash_to_address,
            (sym::Poseidon4, sym::hash_to_field)       => sym::_poseidon4_hash_to_field,
            (sym::Poseidon4, sym::hash_to_group)       => sym::_poseidon4_hash_to_group,
            (sym::Poseidon4, sym::hash_to_i8)          => sym::_poseidon4_hash_to_i8,
            (sym::Poseidon4, sym::hash_to_i16)         => sym::_poseidon4_hash_to_i16,
            (sym::Poseidon4, sym::hash_to_i32)         => sym::_poseidon4_hash_to_i32,
            (sym::Poseidon4, sym::hash_to_i64)         => sym::_poseidon4_hash_to_i64,
            (sym::Poseidon4, sym::hash_to_i128)        => sym::_poseidon4_hash_to_i128,
            (sym::Poseidon4, sym::hash_to_u8)          => sym::_poseidon4_hash_to_u8,
            (sym::Poseidon4, sym::hash_to_u16)         => sym::_poseidon4_hash_to_u16,
            (sym::Poseidon4, sym::hash_to_u32)         => sym::_poseidon4_hash_to_u32,
            (sym::Poseidon4, sym::hash_to_u64)         => sym::_poseidon4_hash_to_u64,
            (sym::Poseidon4, sym::hash_to_u128)        => sym::_poseidon4_hash_to_u128,
            (sym::Poseidon4, sym::hash_to_scalar)      => sym::_poseidon4_hash_to_scalar,
            (sym::Poseidon4, sym::hash_to_address_raw) => sym::_poseidon4_hash_to_address_raw,
            (sym::Poseidon4, sym::hash_to_field_raw)   => sym::_poseidon4_hash_to_field_raw,
            (sym::Poseidon4, sym::hash_to_group_raw)   => sym::_poseidon4_hash_to_group_raw,
            (sym::Poseidon4, sym::hash_to_i8_raw)      => sym::_poseidon4_hash_to_i8_raw,
            (sym::Poseidon4, sym::hash_to_i16_raw)     => sym::_poseidon4_hash_to_i16_raw,
            (sym::Poseidon4, sym::hash_to_i32_raw)     => sym::_poseidon4_hash_to_i32_raw,
            (sym::Poseidon4, sym::hash_to_i64_raw)     => sym::_poseidon4_hash_to_i64_raw,
            (sym::Poseidon4, sym::hash_to_i128_raw)    => sym::_poseidon4_hash_to_i128_raw,
            (sym::Poseidon4, sym::hash_to_u8_raw)      => sym::_poseidon4_hash_to_u8_raw,
            (sym::Poseidon4, sym::hash_to_u16_raw)     => sym::_poseidon4_hash_to_u16_raw,
            (sym::Poseidon4, sym::hash_to_u32_raw)     => sym::_poseidon4_hash_to_u32_raw,
            (sym::Poseidon4, sym::hash_to_u64_raw)     => sym::_poseidon4_hash_to_u64_raw,
            (sym::Poseidon4, sym::hash_to_u128_raw)    => sym::_poseidon4_hash_to_u128_raw,
            (sym::Poseidon4, sym::hash_to_scalar_raw)  => sym::_poseidon4_hash_to_scalar_raw,

            (sym::Poseidon8, sym::hash_to_address)     => sym::_poseidon8_hash_to_address,
            (sym::Poseidon8, sym::hash_to_field)       => sym::_poseidon8_hash_to_field,
            (sym::Poseidon8, sym::hash_to_group)       => sym::_poseidon8_hash_to_group,
            (sym::Poseidon8, sym::hash_to_i8)          => sym::_poseidon8_hash_to_i8,
            (sym::Poseidon8, sym::hash_to_i16)         => sym::_poseidon8_hash_to_i16,
            (sym::Poseidon8, sym::hash_to_i32)         => sym::_poseidon8_hash_to_i32,
            (sym::Poseidon8, sym::hash_to_i64)         => sym::_poseidon8_hash_to_i64,
            (sym::Poseidon8, sym::hash_to_i128)        => sym::_poseidon8_hash_to_i128,
            (sym::Poseidon8, sym::hash_to_u8)          => sym::_poseidon8_hash_to_u8,
            (sym::Poseidon8, sym::hash_to_u16)         => sym::_poseidon8_hash_to_u16,
            (sym::Poseidon8, sym::hash_to_u32)         => sym::_poseidon8_hash_to_u32,
            (sym::Poseidon8, sym::hash_to_u64)         => sym::_poseidon8_hash_to_u64,
            (sym::Poseidon8, sym::hash_to_u128)        => sym::_poseidon8_hash_to_u128,
            (sym::Poseidon8, sym::hash_to_scalar)      => sym::_poseidon8_hash_to_scalar,
            (sym::Poseidon8, sym::hash_to_address_raw) => sym::_poseidon8_hash_to_address_raw,
            (sym::Poseidon8, sym::hash_to_field_raw)   => sym::_poseidon8_hash_to_field_raw,
            (sym::Poseidon8, sym::hash_to_group_raw)   => sym::_poseidon8_hash_to_group_raw,
            (sym::Poseidon8, sym::hash_to_i8_raw)      => sym::_poseidon8_hash_to_i8_raw,
            (sym::Poseidon8, sym::hash_to_i16_raw)     => sym::_poseidon8_hash_to_i16_raw,
            (sym::Poseidon8, sym::hash_to_i32_raw)     => sym::_poseidon8_hash_to_i32_raw,
            (sym::Poseidon8, sym::hash_to_i64_raw)     => sym::_poseidon8_hash_to_i64_raw,
            (sym::Poseidon8, sym::hash_to_i128_raw)    => sym::_poseidon8_hash_to_i128_raw,
            (sym::Poseidon8, sym::hash_to_u8_raw)      => sym::_poseidon8_hash_to_u8_raw,
            (sym::Poseidon8, sym::hash_to_u16_raw)     => sym::_poseidon8_hash_to_u16_raw,
            (sym::Poseidon8, sym::hash_to_u32_raw)     => sym::_poseidon8_hash_to_u32_raw,
            (sym::Poseidon8, sym::hash_to_u64_raw)     => sym::_poseidon8_hash_to_u64_raw,
            (sym::Poseidon8, sym::hash_to_u128_raw)    => sym::_poseidon8_hash_to_u128_raw,
            (sym::Poseidon8, sym::hash_to_scalar_raw)  => sym::_poseidon8_hash_to_scalar_raw,

            (sym::SHA3_256, sym::hash_to_address)     => sym::_sha3_256_hash_to_address,
            (sym::SHA3_256, sym::hash_to_field)       => sym::_sha3_256_hash_to_field,
            (sym::SHA3_256, sym::hash_to_group)       => sym::_sha3_256_hash_to_group,
            (sym::SHA3_256, sym::hash_to_i8)          => sym::_sha3_256_hash_to_i8,
            (sym::SHA3_256, sym::hash_to_i16)         => sym::_sha3_256_hash_to_i16,
            (sym::SHA3_256, sym::hash_to_i32)         => sym::_sha3_256_hash_to_i32,
            (sym::SHA3_256, sym::hash_to_i64)         => sym::_sha3_256_hash_to_i64,
            (sym::SHA3_256, sym::hash_to_i128)        => sym::_sha3_256_hash_to_i128,
            (sym::SHA3_256, sym::hash_to_u8)          => sym::_sha3_256_hash_to_u8,
            (sym::SHA3_256, sym::hash_to_u16)         => sym::_sha3_256_hash_to_u16,
            (sym::SHA3_256, sym::hash_to_u32)         => sym::_sha3_256_hash_to_u32,
            (sym::SHA3_256, sym::hash_to_u64)         => sym::_sha3_256_hash_to_u64,
            (sym::SHA3_256, sym::hash_to_u128)        => sym::_sha3_256_hash_to_u128,
            (sym::SHA3_256, sym::hash_to_scalar)      => sym::_sha3_256_hash_to_scalar,
            (sym::SHA3_256, sym::hash_to_address_raw) => sym::_sha3_256_hash_to_address_raw,
            (sym::SHA3_256, sym::hash_to_field_raw)   => sym::_sha3_256_hash_to_field_raw,
            (sym::SHA3_256, sym::hash_to_group_raw)   => sym::_sha3_256_hash_to_group_raw,
            (sym::SHA3_256, sym::hash_to_i8_raw)      => sym::_sha3_256_hash_to_i8_raw,
            (sym::SHA3_256, sym::hash_to_i16_raw)     => sym::_sha3_256_hash_to_i16_raw,
            (sym::SHA3_256, sym::hash_to_i32_raw)     => sym::_sha3_256_hash_to_i32_raw,
            (sym::SHA3_256, sym::hash_to_i64_raw)     => sym::_sha3_256_hash_to_i64_raw,
            (sym::SHA3_256, sym::hash_to_i128_raw)    => sym::_sha3_256_hash_to_i128_raw,
            (sym::SHA3_256, sym::hash_to_u8_raw)      => sym::_sha3_256_hash_to_u8_raw,
            (sym::SHA3_256, sym::hash_to_u16_raw)     => sym::_sha3_256_hash_to_u16_raw,
            (sym::SHA3_256, sym::hash_to_u32_raw)     => sym::_sha3_256_hash_to_u32_raw,
            (sym::SHA3_256, sym::hash_to_u64_raw)     => sym::_sha3_256_hash_to_u64_raw,
            (sym::SHA3_256, sym::hash_to_u128_raw)    => sym::_sha3_256_hash_to_u128_raw,
            (sym::SHA3_256, sym::hash_to_scalar_raw)  => sym::_sha3_256_hash_to_scalar_raw,
            (sym::SHA3_256, sym::hash_to_bits)         => sym::_sha3_256_hash_to_bits,
            (sym::SHA3_256, sym::hash_to_bits_raw)     => sym::_sha3_256_hash_to_bits_raw,

            (sym::SHA3_384, sym::hash_to_address)     => sym::_sha3_384_hash_to_address,
            (sym::SHA3_384, sym::hash_to_field)       => sym::_sha3_384_hash_to_field,
            (sym::SHA3_384, sym::hash_to_group)       => sym::_sha3_384_hash_to_group,
            (sym::SHA3_384, sym::hash_to_i8)          => sym::_sha3_384_hash_to_i8,
            (sym::SHA3_384, sym::hash_to_i16)         => sym::_sha3_384_hash_to_i16,
            (sym::SHA3_384, sym::hash_to_i32)         => sym::_sha3_384_hash_to_i32,
            (sym::SHA3_384, sym::hash_to_i64)         => sym::_sha3_384_hash_to_i64,
            (sym::SHA3_384, sym::hash_to_i128)        => sym::_sha3_384_hash_to_i128,
            (sym::SHA3_384, sym::hash_to_u8)          => sym::_sha3_384_hash_to_u8,
            (sym::SHA3_384, sym::hash_to_u16)         => sym::_sha3_384_hash_to_u16,
            (sym::SHA3_384, sym::hash_to_u32)         => sym::_sha3_384_hash_to_u32,
            (sym::SHA3_384, sym::hash_to_u64)         => sym::_sha3_384_hash_to_u64,
            (sym::SHA3_384, sym::hash_to_u128)        => sym::_sha3_384_hash_to_u128,
            (sym::SHA3_384, sym::hash_to_scalar)      => sym::_sha3_384_hash_to_scalar,
            (sym::SHA3_384, sym::hash_to_address_raw) => sym::_sha3_384_hash_to_address_raw,
            (sym::SHA3_384, sym::hash_to_field_raw)   => sym::_sha3_384_hash_to_field_raw,
            (sym::SHA3_384, sym::hash_to_group_raw)   => sym::_sha3_384_hash_to_group_raw,
            (sym::SHA3_384, sym::hash_to_i8_raw)      => sym::_sha3_384_hash_to_i8_raw,
            (sym::SHA3_384, sym::hash_to_i16_raw)     => sym::_sha3_384_hash_to_i16_raw,
            (sym::SHA3_384, sym::hash_to_i32_raw)     => sym::_sha3_384_hash_to_i32_raw,
            (sym::SHA3_384, sym::hash_to_i64_raw)     => sym::_sha3_384_hash_to_i64_raw,
            (sym::SHA3_384, sym::hash_to_i128_raw)    => sym::_sha3_384_hash_to_i128_raw,
            (sym::SHA3_384, sym::hash_to_u8_raw)      => sym::_sha3_384_hash_to_u8_raw,
            (sym::SHA3_384, sym::hash_to_u16_raw)     => sym::_sha3_384_hash_to_u16_raw,
            (sym::SHA3_384, sym::hash_to_u32_raw)     => sym::_sha3_384_hash_to_u32_raw,
            (sym::SHA3_384, sym::hash_to_u64_raw)     => sym::_sha3_384_hash_to_u64_raw,
            (sym::SHA3_384, sym::hash_to_u128_raw)    => sym::_sha3_384_hash_to_u128_raw,
            (sym::SHA3_384, sym::hash_to_scalar_raw)  => sym::_sha3_384_hash_to_scalar_raw,
            (sym::SHA3_384, sym::hash_to_bits)         => sym::_sha3_384_hash_to_bits,
            (sym::SHA3_384, sym::hash_to_bits_raw)     => sym::_sha3_384_hash_to_bits_raw,

            (sym::SHA3_512, sym::hash_to_address)     => sym::_sha3_512_hash_to_address,
            (sym::SHA3_512, sym::hash_to_field)       => sym::_sha3_512_hash_to_field,
            (sym::SHA3_512, sym::hash_to_group)       => sym::_sha3_512_hash_to_group,
            (sym::SHA3_512, sym::hash_to_i8)          => sym::_sha3_512_hash_to_i8,
            (sym::SHA3_512, sym::hash_to_i16)         => sym::_sha3_512_hash_to_i16,
            (sym::SHA3_512, sym::hash_to_i32)         => sym::_sha3_512_hash_to_i32,
            (sym::SHA3_512, sym::hash_to_i64)         => sym::_sha3_512_hash_to_i64,
            (sym::SHA3_512, sym::hash_to_i128)        => sym::_sha3_512_hash_to_i128,
            (sym::SHA3_512, sym::hash_to_u8)          => sym::_sha3_512_hash_to_u8,
            (sym::SHA3_512, sym::hash_to_u16)         => sym::_sha3_512_hash_to_u16,
            (sym::SHA3_512, sym::hash_to_u32)         => sym::_sha3_512_hash_to_u32,
            (sym::SHA3_512, sym::hash_to_u64)         => sym::_sha3_512_hash_to_u64,
            (sym::SHA3_512, sym::hash_to_u128)        => sym::_sha3_512_hash_to_u128,
            (sym::SHA3_512, sym::hash_to_scalar)      => sym::_sha3_512_hash_to_scalar,
            (sym::SHA3_512, sym::hash_to_address_raw) => sym::_sha3_512_hash_to_address_raw,
            (sym::SHA3_512, sym::hash_to_field_raw)   => sym::_sha3_512_hash_to_field_raw,
            (sym::SHA3_512, sym::hash_to_group_raw)   => sym::_sha3_512_hash_to_group_raw,
            (sym::SHA3_512, sym::hash_to_i8_raw)      => sym::_sha3_512_hash_to_i8_raw,
            (sym::SHA3_512, sym::hash_to_i16_raw)     => sym::_sha3_512_hash_to_i16_raw,
            (sym::SHA3_512, sym::hash_to_i32_raw)     => sym::_sha3_512_hash_to_i32_raw,
            (sym::SHA3_512, sym::hash_to_i64_raw)     => sym::_sha3_512_hash_to_i64_raw,
            (sym::SHA3_512, sym::hash_to_i128_raw)    => sym::_sha3_512_hash_to_i128_raw,
            (sym::SHA3_512, sym::hash_to_u8_raw)      => sym::_sha3_512_hash_to_u8_raw,
            (sym::SHA3_512, sym::hash_to_u16_raw)     => sym::_sha3_512_hash_to_u16_raw,
            (sym::SHA3_512, sym::hash_to_u32_raw)     => sym::_sha3_512_hash_to_u32_raw,
            (sym::SHA3_512, sym::hash_to_u64_raw)     => sym::_sha3_512_hash_to_u64_raw,
            (sym::SHA3_512, sym::hash_to_u128_raw)    => sym::_sha3_512_hash_to_u128_raw,
            (sym::SHA3_512, sym::hash_to_scalar_raw)  => sym::_sha3_512_hash_to_scalar_raw,
            (sym::SHA3_512, sym::hash_to_bits)         => sym::_sha3_512_hash_to_bits,
            (sym::SHA3_512, sym::hash_to_bits_raw)     => sym::_sha3_512_hash_to_bits_raw,

            (sym::ECDSA, sym::verify_digest)          => sym::_ecdsa_verify_digest,
            (sym::ECDSA, sym::verify_digest_eth)      => sym::_ecdsa_verify_digest_eth,
            (sym::ECDSA, sym::verify_keccak256)       => sym::_ecdsa_verify_keccak256,
            (sym::ECDSA, sym::verify_keccak256_raw)   => sym::_ecdsa_verify_keccak256_raw,
            (sym::ECDSA, sym::verify_keccak256_eth)   => sym::_ecdsa_verify_keccak256_eth,
            (sym::ECDSA, sym::verify_keccak384)       => sym::_ecdsa_verify_keccak384,
            (sym::ECDSA, sym::verify_keccak384_raw)   => sym::_ecdsa_verify_keccak384_raw,
            (sym::ECDSA, sym::verify_keccak384_eth)   => sym::_ecdsa_verify_keccak384_eth,
            (sym::ECDSA, sym::verify_keccak512)       => sym::_ecdsa_verify_keccak512,
            (sym::ECDSA, sym::verify_keccak512_raw)   => sym::_ecdsa_verify_keccak512_raw,
            (sym::ECDSA, sym::verify_keccak512_eth)   => sym::_ecdsa_verify_keccak512_eth,
            (sym::ECDSA, sym::verify_sha3_256)        => sym::_ecdsa_verify_sha3_256,
            (sym::ECDSA, sym::verify_sha3_256_raw)    => sym::_ecdsa_verify_sha3_256_raw,
            (sym::ECDSA, sym::verify_sha3_256_eth)    => sym::_ecdsa_verify_sha3_256_eth,
            (sym::ECDSA, sym::verify_sha3_384)        => sym::_ecdsa_verify_sha3_384,
            (sym::ECDSA, sym::verify_sha3_384_raw)    => sym::_ecdsa_verify_sha3_384_raw,
            (sym::ECDSA, sym::verify_sha3_384_eth)    => sym::_ecdsa_verify_sha3_384_eth,
            (sym::ECDSA, sym::verify_sha3_512)        => sym::_ecdsa_verify_sha3_512,
            (sym::ECDSA, sym::verify_sha3_512_raw)    => sym::_ecdsa_verify_sha3_512_raw,
            (sym::ECDSA, sym::verify_sha3_512_eth)    => sym::_ecdsa_verify_sha3_512_eth,

            (sym::Snark, sym::verify) => sym::_snark_verify,
            (sym::Snark, sym::verify_batch) => sym::_snark_verify_batch,

            (sym::Mapping, sym::get_or_use) => sym::_mapping_get_or_use,
            (sym::Mapping, sym::remove) => sym::_mapping_remove,
            (sym::Mapping, sym::contains) => sym::_mapping_contains,
            (sym::Mapping, sym::get) => sym::_mapping_get,
            (sym::Mapping, sym::set) => sym::_mapping_set,

            (sym::Optional, sym::unwrap) => sym::_optional_unwrap,
            (sym::Optional, sym::unwrap_or) => sym::_optional_unwrap_or,

            (sym::Vector, sym::push) => sym::_vector_push,
            (sym::Vector, sym::len) => sym::_vector_len,
            (sym::Vector, sym::clear) => sym::_vector_clear,
            (sym::Vector, sym::pop) => sym::_vector_pop,
            (sym::Vector, sym::swap_remove) => sym::_vector_swap_remove,
            (sym::Vector, sym::get) => sym::_mapping_get,
            (sym::Vector, sym::set) => sym::_mapping_set,

            (sym::group, sym::to_x_coordinate) => sym::_group_to_x_coordinate,
            (sym::group, sym::to_y_coordinate) => sym::_group_to_y_coordinate,

            (sym::ProgramCore, sym::checksum) => sym::_program_checksum,
            (sym::ProgramCore, sym::edition) => sym::_program_edition,
            (sym::ProgramCore, sym::program_owner) => sym::_program_owner,

            (sym::signature, sym::verify) => sym::_signature_verify,
            (sym::Final, sym::run) => sym::_final_run,

            (sym::Serialize, sym::to_bits) => sym::_serialize_to_bits,
            (sym::Serialize, sym::to_bits_raw) => sym::_serialize_to_bits_raw,

            (sym::Aleo, sym::generator) => sym::_aleo_generator,
            (sym::Aleo, sym::generator_powers) => sym::_aleo_generator_powers,

            _ => return None,
        })
    }

    /// Returns the number of arguments required by the instruction.
    pub fn num_args(&self) -> usize {
        match self {
            Self::ChaChaRand(_) => 0,
            Self::GroupGen => 0,
            Self::AleoGenerator => 0,
            Self::AleoGeneratorPowers => 0,
            Self::SelfAddress => 0,
            Self::SelfCaller => 0,
            Self::SelfChecksum => 0,
            Self::SelfEdition => 0,
            Self::SelfId => 0,
            Self::SelfProgramOwner => 0,
            Self::SelfSigner => 0,
            Self::BlockHeight => 0,
            Self::BlockTimestamp => 0,
            Self::NetworkId => 0,

            Self::Commit(_, _) => 2,
            Self::Hash(_, _) => 1,
            Self::ECDSAVerify(_) => 3,

            Self::MappingGet => 2,
            Self::MappingSet => 3,
            Self::MappingGetOrUse => 3,
            Self::MappingRemove => 2,
            Self::MappingContains => 2,

            Self::OptionalUnwrap => 1,
            Self::OptionalUnwrapOr => 2,

            Self::VectorGet => 2,
            Self::VectorSet => 3,
            Self::VectorPush => 2,
            Self::VectorLen => 1,
            Self::VectorClear => 1,
            Self::VectorPop => 1,
            Self::VectorSwapRemove => 2,

            Self::GroupToXCoordinate => 1,
            Self::GroupToYCoordinate => 1,

            Self::SignatureVerify => 3,
            Self::SnarkVerify | Self::SnarkVerifyBatch => 4,
            Self::FinalRun => 1,

            Self::ProgramChecksum => 1,
            Self::ProgramEdition => 1,
            Self::ProgramOwner => 1,

            Self::Serialize(_) => 1,
            Self::Deserialize(_, _) => 1,

            // Variable arity (min 3); full validation in check_dynamic_call_intrinsic().
            Self::DynamicCall => 3,
            Self::DynamicContains => 4,
            Self::DynamicGet => 4,
            Self::DynamicGetOrUse => 5,
        }
    }

    /// Returns whether or not this function is finalize command.
    pub fn is_finalize_command(&self) -> bool {
        match self {
            Intrinsic::FinalRun
            | Intrinsic::ChaChaRand(_)
            | Intrinsic::ECDSAVerify(_)
            | Intrinsic::MappingGet
            | Intrinsic::MappingSet
            | Intrinsic::MappingGetOrUse
            | Intrinsic::VectorGet
            | Intrinsic::VectorSet
            | Intrinsic::MappingRemove
            | Intrinsic::MappingContains
            | Intrinsic::ProgramChecksum
            | Intrinsic::ProgramEdition
            | Intrinsic::ProgramOwner
            | Intrinsic::VectorPush
            | Intrinsic::VectorLen
            | Intrinsic::VectorClear
            | Intrinsic::VectorPop
            | Intrinsic::VectorSwapRemove
            | Intrinsic::SnarkVerify
            | Intrinsic::SnarkVerifyBatch
            | Intrinsic::DynamicContains
            | Intrinsic::DynamicGet
            | Intrinsic::DynamicGetOrUse => true,
            // DynamicCall is transition-only, not finalize. Validated separately.
            Intrinsic::DynamicCall
            | Intrinsic::Commit(_, _)
            | Intrinsic::Hash(_, _)
            | Intrinsic::OptionalUnwrap
            | Intrinsic::OptionalUnwrapOr
            | Intrinsic::GroupToXCoordinate
            | Intrinsic::GroupToYCoordinate
            | Intrinsic::GroupGen
            | Intrinsic::AleoGenerator
            | Intrinsic::AleoGeneratorPowers
            | Intrinsic::SelfAddress
            | Intrinsic::SelfCaller
            | Intrinsic::SelfChecksum
            | Intrinsic::SelfEdition
            | Intrinsic::SelfId
            | Intrinsic::SelfProgramOwner
            | Intrinsic::SelfSigner
            | Intrinsic::BlockHeight
            | Intrinsic::BlockTimestamp
            | Intrinsic::NetworkId
            | Intrinsic::SignatureVerify
            | Intrinsic::Serialize(_)
            | Intrinsic::Deserialize(_, _) => false,
        }
    }

    /// Returns whether or not this function has side effects
    pub fn is_pure(&self) -> bool {
        match self {
            Intrinsic::FinalRun
            | Intrinsic::VectorSet
            | Intrinsic::VectorPush
            | Intrinsic::VectorClear
            | Intrinsic::VectorPop
            // Pedersen64 and Pedersen128 operations can fail for large inputs.
            | Intrinsic::Hash(
                HashVariant::HashPED64
                | HashVariant::HashPED64Raw
                | HashVariant::HashPED128
                | HashVariant::HashPED128Raw,
                _,
            )
            // Mapping operations have side effects
            | Intrinsic::MappingRemove
            | Intrinsic::MappingGet
            | Intrinsic::MappingSet
            | Intrinsic::MappingGetOrUse
            | Intrinsic::MappingContains
            | Intrinsic::VectorSwapRemove
            | Intrinsic::DynamicCall
            | Intrinsic::DynamicContains
            | Intrinsic::DynamicGet
            | Intrinsic::DynamicGetOrUse
            // These intrinsics can halt.
            | Intrinsic::Commit(_, _)
            | Intrinsic::ECDSAVerify(_)
            | Intrinsic::SnarkVerify
            | Intrinsic::SnarkVerifyBatch
            // Deserialization can halt on invalid encodings.
            | Intrinsic::Deserialize(_, _) => false,

            Intrinsic::ChaChaRand(_)
            | Intrinsic::ProgramChecksum
            | Intrinsic::ProgramEdition
            | Intrinsic::ProgramOwner
            | Intrinsic::VectorLen
            | Intrinsic::VectorGet
            | Intrinsic::Hash(_, _)
            | Intrinsic::OptionalUnwrap
            | Intrinsic::OptionalUnwrapOr
            | Intrinsic::GroupToXCoordinate
            | Intrinsic::GroupToYCoordinate
            | Intrinsic::GroupGen
            | Intrinsic::AleoGenerator
            | Intrinsic::AleoGeneratorPowers
            | Intrinsic::SelfAddress
            | Intrinsic::SelfCaller
            | Intrinsic::SelfChecksum
            | Intrinsic::SelfEdition
            | Intrinsic::SelfId
            | Intrinsic::SelfProgramOwner
            | Intrinsic::SelfSigner
            | Intrinsic::BlockHeight
            | Intrinsic::BlockTimestamp
            | Intrinsic::NetworkId
            | Intrinsic::SignatureVerify
            | Intrinsic::Serialize(_) => true,
        }
    }

    /// Returns whether or not this function can be evaluated at compile time.
    pub fn can_const_evaluate(&self) -> bool {
        self.is_pure()
            || matches!(self, Intrinsic::Commit(_, _) | Intrinsic::ECDSAVerify(_) | Intrinsic::Deserialize(_, _))
    }
}
