// Dispatcher for instruction execution
use crate::emu::Emu;
use iced_x86::{Instruction, Mnemonic};

pub mod instructions;
pub mod logic;

pub fn emulate_instruction(
    emu: &mut Emu,
    ins: &Instruction,
    instruction_sz: usize,
    rep_step: bool,
) -> bool {
    match ins.mnemonic() {
        Mnemonic::Jmp => instructions::jmp::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Call => instructions::call::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Push => instructions::push::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Pop => instructions::pop::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Pushad => instructions::pushad::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Popad => instructions::popad::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Popcnt => instructions::popcnt::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Lzcnt => instructions::lzcnt::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Pdep => instructions::pdep::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cdqe => instructions::cdqe::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cdq => instructions::cdq::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cqo => instructions::cqo::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Ret => instructions::ret::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Xchg => instructions::xchg::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Aad => instructions::aad::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Les => instructions::les::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Mov => instructions::mov::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Movnti => instructions::movnti::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Xor => instructions::xor::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Add => instructions::add::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Adc => instructions::adc::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Sbb => instructions::sbb::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Sub => instructions::sub::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Inc => instructions::inc::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Dec => instructions::dec::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Neg => instructions::neg::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Not => instructions::not::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::And => instructions::and::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Or => instructions::or::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Sal => instructions::sal::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Sar => instructions::sar::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Shl => instructions::shl::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Shr => instructions::shr::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Ror => instructions::ror::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Rcr => instructions::rcr::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Rol => instructions::rol::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Rcl => instructions::rcl::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Mul => instructions::mul::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Div => instructions::div::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Idiv => instructions::idiv::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Imul => instructions::imul::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Bt => instructions::bt::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Btc => instructions::btc::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Bts => instructions::bts::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Btr => instructions::btr::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Bsf => instructions::bsf::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Bsr => instructions::bsr::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Bswap => instructions::bswap::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Xadd => instructions::xadd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Ucomiss => instructions::ucomiss::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Ucomisd => instructions::ucomisd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Movss => instructions::movss::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Movsxd => instructions::movsxd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Movsx => instructions::movsx::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Movzx => instructions::movzx::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Movsb => instructions::movsb::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Movsw => instructions::movsw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Movsq => instructions::movsq::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Movsd => instructions::movsd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cmova => instructions::cmova::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cmovae => instructions::cmovae::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cmovb => instructions::cmovb::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cmovbe => instructions::cmovbe::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cmove => instructions::cmove::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cmovg => instructions::cmovg::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cmovge => instructions::cmovge::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cmovl => instructions::cmovl::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cmovle => instructions::cmovle::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cmovno => instructions::cmovno::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cmovne => instructions::cmovne::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cmovp => instructions::cmovp::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cmovnp => instructions::cmovnp::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cmovs => instructions::cmovs::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cmovns => instructions::cmovns::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cmovo => instructions::cmovo::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Seta => instructions::seta::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Setae => instructions::setae::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Setb => instructions::setb::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Setbe => instructions::setbe::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Sete => instructions::sete::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Setg => instructions::setg::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Setge => instructions::setge::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Setl => instructions::setl::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Setle => instructions::setle::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Setne => instructions::setne::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Setno => instructions::setno::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Setnp => instructions::setnp::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Setns => instructions::setns::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Seto => instructions::seto::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Setp => instructions::setp::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Sets => instructions::sets::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Stosb => instructions::stosb::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Stosw => instructions::stosw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Stosd => instructions::stosd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Stosq => instructions::stosq::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Scasb => instructions::scasb::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Scasw => instructions::scasw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Scasd => instructions::scasd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Scasq => instructions::scasq::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Test => instructions::test::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cmpxchg => instructions::cmpxchg::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cmpxchg8b => instructions::cmpxchg8b::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cmpxchg16b => {
            instructions::cmpxchg16b::execute(emu, ins, instruction_sz, rep_step)
        }
        Mnemonic::Cmp => instructions::cmp::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cmpsq => instructions::cmpsq::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cmpsd => instructions::cmpsd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cmpsw => instructions::cmpsw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cmpsb => instructions::cmpsb::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Jo => instructions::jo::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Jno => instructions::jno::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Js => instructions::js::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Jns => instructions::jns::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Je => instructions::je::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Jne => instructions::jne::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Jb => instructions::jb::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Jae => instructions::jae::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Jbe => instructions::jbe::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Ja => instructions::ja::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Jl => instructions::jl::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Jge => instructions::jge::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Jle => instructions::jle::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Jg => instructions::jg::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Jp => instructions::jp::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Jnp => instructions::jnp::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Jcxz => instructions::jcxz::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Jecxz => instructions::jecxz::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Jrcxz => instructions::jrcxz::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Int3 => instructions::int3::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Nop => instructions::nop::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fnop => instructions::fnop::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Mfence => instructions::mfence::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Lfence => instructions::lfence::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Sfence => instructions::sfence::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cpuid => instructions::cpuid::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Clc => instructions::clc::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Rdtsc => instructions::rdtsc::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Rdtscp => instructions::rdtscp::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Loop => instructions::r#loop::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Loope => instructions::loope::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Loopne => instructions::loopne::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Lea => instructions::lea::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Leave => instructions::leave::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Int => instructions::int::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Syscall => instructions::syscall::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Std => instructions::std::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Stc => instructions::stc::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cmc => instructions::cmc::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cld => instructions::cld::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Lodsq => instructions::lodsq::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Lodsd => instructions::lodsd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Lodsw => instructions::lodsw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Lodsb => instructions::lodsb::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cbw => instructions::cbw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cwde => instructions::cwde::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cwd => instructions::cwd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fninit => instructions::fninit::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Finit => instructions::finit::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Ffree => instructions::ffree::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fbld => instructions::fbld::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fldcw => instructions::fldcw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fnstenv => instructions::fnstenv::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fld => instructions::fld::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fldz => instructions::fldz::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fld1 => instructions::fld1::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fldpi => instructions::fldpi::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fldl2t => instructions::fldl2t::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fldlg2 => instructions::fldlg2::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fldln2 => instructions::fldln2::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fldl2e => instructions::fldl2e::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fst => instructions::fst::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fsubrp => instructions::fsubrp::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fstp => instructions::fstp::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fincstp => instructions::fincstp::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fild => instructions::fild::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fist => instructions::fist::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fxtract => instructions::fxtract::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fxsave => instructions::fxsave::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fxrstor => instructions::fxrstor::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fistp => instructions::fistp::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fcmove => instructions::fcmove::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fcmovb => instructions::fcmovb::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fcmovbe => instructions::fcmovbe::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fcmovu => instructions::fcmovu::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fcmovnb => instructions::fcmovnb::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fcmovne => instructions::fcmovne::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fcmovnbe => instructions::fcmovnbe::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fcmovnu => instructions::fcmovnu::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fxch => instructions::fxch::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fsqrt => instructions::fsqrt::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fchs => instructions::fchs::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fptan => instructions::fptan::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fmulp => instructions::fmulp::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fdivp => instructions::fdivp::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fsubp => instructions::fsubp::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fsubr => instructions::fsubr::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fsub => instructions::fsub::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fadd => instructions::fadd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fucom => instructions::fucom::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::F2xm1 => instructions::f2xm1::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fyl2x => instructions::fyl2x::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fyl2xp1 => instructions::fyl2xp1::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Faddp => instructions::faddp::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fnclex => instructions::fnclex::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fcom => instructions::fcom::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fmul => instructions::fmul::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fabs => instructions::fabs::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fsin => instructions::fsin::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fcos => instructions::fcos::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fdiv => instructions::fdiv::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fdivr => instructions::fdivr::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fdivrp => instructions::fdivrp::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fpatan => instructions::fpatan::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fprem => instructions::fprem::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fprem1 => instructions::fprem1::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Popf => instructions::popf::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Popfd => instructions::popfd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Popfq => instructions::popfq::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Daa => instructions::daa::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Shld => instructions::shld::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Shrd => instructions::shrd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Sysenter => instructions::sysenter::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Pcmpeqd => instructions::pcmpeqd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Psubusb => instructions::psubusb::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Punpckhbw => instructions::punpckhbw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Pand => instructions::pand::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Por => instructions::por::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Pxor => instructions::pxor::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Punpcklbw => instructions::punpcklbw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Punpcklwd => instructions::punpcklwd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Xorps => instructions::xorps::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Xorpd => instructions::xorpd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Psubb => instructions::psubb::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Psubw => instructions::psubw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Psubd => instructions::psubd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Psubq => instructions::psubq::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Movhpd => instructions::movhpd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Movlpd => instructions::movlpd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Movlps => instructions::movlps::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cvtsi2sd => instructions::cvtsi2sd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Cvtsi2ss => instructions::cvtsi2ss::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Movhps => instructions::movhps::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Punpcklqdq => {
            instructions::punpcklqdq::execute(emu, ins, instruction_sz, rep_step)
        }
        Mnemonic::Movq => instructions::movq::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Punpckhdq => instructions::punpckhdq::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Punpckldq => instructions::punpckldq::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Movd => instructions::movd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Movdqa => instructions::movdqa::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Andpd => instructions::andpd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Orpd => instructions::orpd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Addps => instructions::addps::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Addpd => instructions::addpd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Addsd => instructions::addsd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Addss => instructions::addss::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Subps => instructions::subps::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Subpd => instructions::subpd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Subsd => instructions::subsd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Subss => instructions::subss::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Mulpd => instructions::mulpd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Mulps => instructions::mulps::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Mulsd => instructions::mulsd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Mulss => instructions::mulss::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Packsswb => instructions::packsswb::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Packssdw => instructions::packssdw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Psrldq => instructions::psrldq::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Pslld => instructions::pslld::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Pslldq => instructions::pslldq::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Psllq => instructions::psllq::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Psllw => instructions::psllw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Paddsw => instructions::paddsw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Paddsb => instructions::paddsb::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Psrad => instructions::psrad::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Paddusb => instructions::paddusb::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Paddb => instructions::paddb::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Paddusw => instructions::paddusw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Paddw => instructions::paddw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Pshufd => instructions::pshufd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Movups => instructions::movups::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Movdqu => instructions::movdqu::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Vzeroupper => {
            instructions::vzeroupper::execute(emu, ins, instruction_sz, rep_step)
        }
        Mnemonic::Vmovdqu => instructions::vmovdqu::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Vmovdqa => instructions::vmovdqa::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Movaps => instructions::movaps::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Movapd => instructions::movapd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Vmovd => instructions::vmovd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Vmovq => instructions::vmovq::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Vpbroadcastb => {
            instructions::vpbroadcastb::execute(emu, ins, instruction_sz, rep_step)
        }
        Mnemonic::Vpor => instructions::vpor::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Vpxor => instructions::vpxor::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Pcmpeqb => instructions::pcmpeqb::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Psubsb => instructions::psubsb::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fcomp => instructions::fcomp::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Psrlq => instructions::psrlq::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Psubsw => instructions::psubsw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fsincos => instructions::fsincos::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Packuswb => instructions::packuswb::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Pandn => instructions::pandn::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Psrld => instructions::psrld::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Punpckhwd => instructions::punpckhwd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Psraw => instructions::psraw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Frndint => instructions::frndint::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Psrlw => instructions::psrlw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Paddd => instructions::paddd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fscale => instructions::fscale::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Vpcmpeqb => instructions::vpcmpeqb::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Pmullw => instructions::pmullw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Pmulhw => instructions::pmulhw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Pmovmskb => instructions::pmovmskb::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Vpmovmskb => instructions::vpmovmskb::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Vpminub => instructions::vpminub::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fdecstp => instructions::fdecstp::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Ftst => instructions::ftst::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Emms => instructions::emms::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fxam => instructions::fxam::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Pcmpgtw => instructions::pcmpgtw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Pcmpgtb => instructions::pcmpgtb::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Pcmpeqw => instructions::pcmpeqw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Pcmpgtd => instructions::pcmpgtd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Pmaddwd => instructions::pmaddwd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Tzcnt => instructions::tzcnt::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Xgetbv => instructions::xgetbv::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Arpl => instructions::arpl::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Pushf => instructions::pushf::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Pushfd => instructions::pushfd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Pushfq => instructions::pushfq::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Bound => instructions::bound::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Lahf => instructions::lahf::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Salc => instructions::salc::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Movlhps => instructions::movlhps::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Pshuflw => instructions::pshuflw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Pshufhw => instructions::pshufhw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Stmxcsr => instructions::stmxcsr::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Ldmxcsr => instructions::ldmxcsr::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Fnstcw => instructions::fnstcw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Prefetchnta => {
            instructions::prefetchnta::execute(emu, ins, instruction_sz, rep_step)
        }
        Mnemonic::Prefetchw => instructions::prefetchw::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Pause => instructions::pause::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Wait => instructions::wait::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Mwait => instructions::mwait::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Endbr64 => instructions::endbr64::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Endbr32 => instructions::endbr32::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Enqcmd => instructions::enqcmd::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Enqcmds => instructions::enqcmds::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Enter => instructions::enter::execute(emu, ins, instruction_sz, rep_step),
        Mnemonic::Rdmsr => instructions::rdmsr::execute(emu, ins, instruction_sz, rep_step),
        _ => {
            log::info!(
                "{} Unimplemented instruction: {:?}",
                emu.pos,
                ins.mnemonic()
            );
            false
        }
    }
}
