// SPDX-License-Identifier: MIT
// Copyright (C) 2018-present iced project and contributors

// ⚠️This file was generated by GENERATOR!🦹‍♂️

package com.github.icedland.iced.x86;

import java.util.HashMap;

import com.github.icedland.iced.x86.dec.DecoderOptions;

public final class ToDecoderOptions {
	public static Integer tryGet(String key) {
		return map.get(key);
	}

	public static int get(String key) {
		Integer value = tryGet(key);
		if (value == null)
			throw new UnsupportedOperationException(String.format("Couldn't find enum variant DecoderOptions.%s", key));
		return value.intValue();
	}

	public static String[] names() {
		return map.entrySet().stream().sorted((a, b) -> Integer.compareUnsigned(a.getValue(), b.getValue())).map(a -> a.getKey()).toArray(String[]::new);
	}

	public static Iterable<Integer> values() {
		return map.values();
	}

	public static int size() {
		return map.size();
	}

	public static HashMap<String, Integer> copy() {
		return new HashMap<String, Integer>(map);
	}

	private static final HashMap<String, Integer> map = getMap();

	private static HashMap<String, Integer> getMap() {
		HashMap<String, Integer> map = new HashMap<String, Integer>(26);
		initMap0(map);
		return map;
	}

	private static void initMap0(HashMap<String, Integer> map) {
		map.put("None", DecoderOptions.NONE);
		map.put("NoInvalidCheck", DecoderOptions.NO_INVALID_CHECK);
		map.put("AMD", DecoderOptions.AMD);
		map.put("ForceReservedNop", DecoderOptions.FORCE_RESERVED_NOP);
		map.put("Umov", DecoderOptions.UMOV);
		map.put("Xbts", DecoderOptions.XBTS);
		map.put("Cmpxchg486A", DecoderOptions.CMPXCHG486A);
		map.put("OldFpu", DecoderOptions.OLD_FPU);
		map.put("Pcommit", DecoderOptions.PCOMMIT);
		map.put("Loadall286", DecoderOptions.LOADALL286);
		map.put("Loadall386", DecoderOptions.LOADALL386);
		map.put("Cl1invmb", DecoderOptions.CL1INVMB);
		map.put("MovTr", DecoderOptions.MOV_TR);
		map.put("Jmpe", DecoderOptions.JMPE);
		map.put("NoPause", DecoderOptions.NO_PAUSE);
		map.put("NoWbnoinvd", DecoderOptions.NO_WBNOINVD);
		map.put("Udbg", DecoderOptions.UDBG);
		map.put("NoMPFX_0FBC", DecoderOptions.NO_MPFX_0FBC);
		map.put("NoMPFX_0FBD", DecoderOptions.NO_MPFX_0FBD);
		map.put("NoLahfSahf64", DecoderOptions.NO_LAHF_SAHF_64);
		map.put("MPX", DecoderOptions.MPX);
		map.put("Cyrix", DecoderOptions.CYRIX);
		map.put("Cyrix_SMINT_0F7E", DecoderOptions.CYRIX_SMINT_0F7E);
		map.put("Cyrix_DMI", DecoderOptions.CYRIX_DMI);
		map.put("ALTINST", DecoderOptions.ALTINST);
		map.put("KNC", DecoderOptions.KNC);
	}
}
