
// clang-format off
static x86_insn_spec_t x86_opcode_map_two_byte[256] = {
    /* 0x00 */
    op0f(modrm_group_6, X86_INSN_FLAG_MODRM_REG_GROUP_6),
    op0f(modrm_group_7, X86_INSN_FLAG_MODRM_REG_GROUP_7),
    op2(lar, Gv, Ew),
    op2(lsl, Gv, Ew),
    op0(bad),
    op0(syscall),
    op0(clts),
    op0(sysret),
    op0(invd),
    op0(wbinvd),
    op0(bad),
    op0(ud2),
    op0(bad),
    op0f(modrm_group_p, X86_INSN_FLAG_MODRM_REG_GROUP_p),
    op0(femms),
    op0(escape_3dnow),

    /* 0x10 */
    op2f(movups, X86_INSN_FLAG_SSE_GROUP_10, Gx, Ex),
    op2f(movups, X86_INSN_FLAG_SSE_GROUP_10, Ex, Gx),
    op2f(movlps, X86_INSN_FLAG_SSE_GROUP_10, Ex, Gx),
    op2f(movlps, X86_INSN_FLAG_SSE_GROUP_10, Gx, Ex),
    op2f(unpcklps, X86_INSN_FLAG_SSE_GROUP_10, Gx, Ex),
    op2f(unpckhps, X86_INSN_FLAG_SSE_GROUP_10, Gx, Ex),
    op2f(movhps, X86_INSN_FLAG_SSE_GROUP_10, Ex, Gx),
    op2f(movhps, X86_INSN_FLAG_SSE_GROUP_10, Gx, Ex),
    op0f(modrm_group_16, X86_INSN_FLAG_MODRM_REG_GROUP_16),
    op0(nop),
    op0(nop),
    op0(nop),
    op0(nop),
    op0(nop),
    op0(nop),
    op0(nop),

    /* 0x20 */
    op2(mov, Rv, Cv),
    op2(mov, Rv, Dv),
    op2(mov, Cv, Rv),
    op2(mov, Dv, Rv),
    op0(bad),
    op0(bad),
    op0(bad),
    op0(bad),
    op2f(movaps, X86_INSN_FLAG_SSE_GROUP_28, Gx, Ex),
    op2f(movaps, X86_INSN_FLAG_SSE_GROUP_28, Ex, Gx),
    op2f(cvtpi2ps, X86_INSN_FLAG_SSE_GROUP_28, Gx, Ex),
    op2f(movntps, X86_INSN_FLAG_SSE_GROUP_28, Mx, Gx),
    op2f(cvttps2pi, X86_INSN_FLAG_SSE_GROUP_28, Gx, Ex),
    op2f(cvtps2pi, X86_INSN_FLAG_SSE_GROUP_28, Gx, Ex),
    op2f(ucomiss, X86_INSN_FLAG_SSE_GROUP_28, Gx, Ex),
    op2f(comiss, X86_INSN_FLAG_SSE_GROUP_28, Gx, Ex),

    /* 0x30 */
    op0(wrmsr),
    op0(rdtsc),
    op0(rdmsr),
    op0(rdpmc),
    op0(sysenter),
    op0(sysexit),
    op0(bad),
    op0(bad),
    op0(bad),
    op0(bad),
    op0(bad),
    op0(bad),
    op0(bad),
    op0(bad),
    op0(bad),
    op0(bad),

/* 0x40 */
#define _(x) op2(cmov##x, Gv, Ev),
    foreach_x86_condition
#undef _

    /* 0x50 */
    op2f(movmskps, X86_INSN_FLAG_SSE_GROUP_50, Gd, Rx),
    op2f(sqrtps, X86_INSN_FLAG_SSE_GROUP_50, Gx, Ex),
    op2f(rsqrtps, X86_INSN_FLAG_SSE_GROUP_50, Gx, Ex),
    op2f(rcpps, X86_INSN_FLAG_SSE_GROUP_50, Gx, Ex),
    op2f(andps, X86_INSN_FLAG_SSE_GROUP_50, Gx, Ex),
    op2f(andnps, X86_INSN_FLAG_SSE_GROUP_50, Gx, Ex),
    op2f(orps, X86_INSN_FLAG_SSE_GROUP_50, Gx, Ex),
    op2f(xorps, X86_INSN_FLAG_SSE_GROUP_50, Gx, Ex),
    op2f(addps, X86_INSN_FLAG_SSE_GROUP_58, Gx, Ex),
    op2f(mulps, X86_INSN_FLAG_SSE_GROUP_58, Gx, Ex),
    op2f(cvtps2pd, X86_INSN_FLAG_SSE_GROUP_58, Gx, Ex),
    op2f(cvtdq2ps, X86_INSN_FLAG_SSE_GROUP_58, Gx, Ex),
    op2f(subps, X86_INSN_FLAG_SSE_GROUP_58, Gx, Ex),
    op2f(minps, X86_INSN_FLAG_SSE_GROUP_58, Gx, Ex),
    op2f(divps, X86_INSN_FLAG_SSE_GROUP_58, Gx, Ex),
    op2f(maxps, X86_INSN_FLAG_SSE_GROUP_58, Gx, Ex),

    /* 0x60 */
    op2f(punpcklbw, X86_INSN_FLAG_SSE_GROUP_60, Gm, Em),
    op2f(punpcklwd, X86_INSN_FLAG_SSE_GROUP_60, Gm, Em),
    op2f(punpckldq, X86_INSN_FLAG_SSE_GROUP_60, Gm, Em),
    op2f(packsswb, X86_INSN_FLAG_SSE_GROUP_60, Gm, Em),
    op2f(pcmpgtb, X86_INSN_FLAG_SSE_GROUP_60, Gm, Em),
    op2f(pcmpgtw, X86_INSN_FLAG_SSE_GROUP_60, Gm, Em),
    op2f(pcmpgtd, X86_INSN_FLAG_SSE_GROUP_60, Gm, Em),
    op2f(packuswb, X86_INSN_FLAG_SSE_GROUP_60, Gm, Em),
    op2f(punpckhbw, X86_INSN_FLAG_SSE_GROUP_68, Gm, Em),
    op2f(punpckhwd, X86_INSN_FLAG_SSE_GROUP_68, Gm, Em),
    op2f(punpckhdq, X86_INSN_FLAG_SSE_GROUP_68, Gm, Em),
    op2f(packssdw, X86_INSN_FLAG_SSE_GROUP_68, Gm, Em),
    op0f(bad, X86_INSN_FLAG_SSE_GROUP_68),
    op0f(bad, X86_INSN_FLAG_SSE_GROUP_68),
    op2f(movd, X86_INSN_FLAG_SSE_GROUP_68, Gm, Em),
    op2f(movq, X86_INSN_FLAG_SSE_GROUP_68, Gm, Em),

    /* 0x70 */
    op3f(pshufw, X86_INSN_FLAG_SSE_GROUP_70, Gm, Em, Ib),
    op0f(modrm_group_12, X86_INSN_FLAG_MODRM_REG_GROUP_12),
    op0f(modrm_group_13, X86_INSN_FLAG_MODRM_REG_GROUP_13),
    op0f(modrm_group_14, X86_INSN_FLAG_MODRM_REG_GROUP_14),
    op2f(pcmpeqb, X86_INSN_FLAG_SSE_GROUP_70, Gm, Em),
    op2f(pcmpeqw, X86_INSN_FLAG_SSE_GROUP_70, Gm, Em),
    op2f(pcmpeqd, X86_INSN_FLAG_SSE_GROUP_70, Gm, Em),
    op0f(emms, X86_INSN_FLAG_SSE_GROUP_70),
    op0f(bad, X86_INSN_FLAG_SSE_GROUP_78),
    op0f(bad, X86_INSN_FLAG_SSE_GROUP_78),
    op0f(bad, X86_INSN_FLAG_SSE_GROUP_78),
    op0f(bad, X86_INSN_FLAG_SSE_GROUP_78),
    op0f(bad, X86_INSN_FLAG_SSE_GROUP_78),
    op0f(bad, X86_INSN_FLAG_SSE_GROUP_78),
    op2f(movd, X86_INSN_FLAG_SSE_GROUP_78, Em, Gm),
    op2f(movq, X86_INSN_FLAG_SSE_GROUP_78, Em, Gm),

/* 0x80 */
#define _(x) op1(jmp##x, Jz),
    foreach_x86_condition
#undef _

/* 0x90 */
#define _(x) op1(set##x, Eb),
    foreach_x86_condition
#undef _

    /* 0xa0 */
    op0(push_fs),
    op0(pop_fs),
    op0(cpuid),
    op2(bt, Ev, Gv),
    op3(shld, Ev, Gv, Ib),
    op3(shld, Ev, Gv, CL),
    op0(bad),
    op0(bad),
    op0(push_gs),
    op0(pop_gs),
    op0(rsm),
    op2(bts, Ev, Gv),
    op3(shrd, Ev, Gv, Ib),
    op3(shrd, Ev, Gv, CL),
    op0f(modrm_group_15, X86_INSN_FLAG_MODRM_REG_GROUP_15),
    op2(imul, Gv, Ev),

    /* 0xb0 */
    op2(cmpxchg, Eb, Gb),
    op2(cmpxchg, Ev, Gv),
    op2(lss, Gz, Mp),
    op2(btr, Ev, Gv),
    op2(lfs, Gz, Mp),
    op2(lgs, Gz, Mp),
    op2(movzbl, Gv, Eb),
    op2(movzwl, Gv, Ew),
    op0(bad),
    op0f(modrm_group_10, X86_INSN_FLAG_MODRM_REG_GROUP_10),
    op2f(modrm_group_8, X86_INSN_FLAG_MODRM_REG_GROUP_8, Ev, Ib),
    op2(btc, Ev, Gv),
    op2(bsf, Gv, Ev),
    op2(bsr, Gv, Ev),
    op2(movsx, Gv, Eb),
    op2(movsx, Gv, Ew),

    /* 0xc0 */
    op2(xadd, Eb, Gb),
    op2(xadd, Ev, Gv),
    op3f(cmpps, X86_INSN_FLAG_SSE_GROUP_c0, Gx, Ex, Ib),
    op2(movnti, Mv, Gv),
    op3f(pinsrw, X86_INSN_FLAG_SSE_GROUP_c0, Gm, Ew, Ib),
    op3f(pextrw, X86_INSN_FLAG_SSE_GROUP_c0, Gd, Rm, Ib),
    op3f(shufps, X86_INSN_FLAG_SSE_GROUP_c0, Gx, Ex, Ib),
    op1f(modrm_group_9, X86_INSN_FLAG_MODRM_REG_GROUP_9, Mx),
#define _(r) op1(bswap, r),
    foreach_x86_gp_reg
#undef _

    /* 0xd0 */
    op0f(bad, X86_INSN_FLAG_SSE_GROUP_d0),
    op2f(psrlw, X86_INSN_FLAG_SSE_GROUP_d0, Gm, Em),
    op2f(psrld, X86_INSN_FLAG_SSE_GROUP_d0, Gm, Em),
    op2f(psrlq, X86_INSN_FLAG_SSE_GROUP_d0, Gm, Em),
    op2f(paddq, X86_INSN_FLAG_SSE_GROUP_d0, Gm, Em),
    op2f(pmullw, X86_INSN_FLAG_SSE_GROUP_d0, Gm, Em),
    op0f(bad, X86_INSN_FLAG_SSE_GROUP_d0),
    op2f(pmovmskb, X86_INSN_FLAG_SSE_GROUP_d0, Gd, Rm),
    op2f(psubusb, X86_INSN_FLAG_SSE_GROUP_d8, Gm, Em),
    op2f(psubusw, X86_INSN_FLAG_SSE_GROUP_d8, Gm, Em),
    op2f(pminub, X86_INSN_FLAG_SSE_GROUP_d8, Gm, Em),
    op2f(pand, X86_INSN_FLAG_SSE_GROUP_d8, Gm, Em),
    op2f(paddusb, X86_INSN_FLAG_SSE_GROUP_d8, Gm, Em),
    op2f(paddusw, X86_INSN_FLAG_SSE_GROUP_d8, Gm, Em),
    op2f(pmaxub, X86_INSN_FLAG_SSE_GROUP_d8, Gm, Em),
    op2f(pandn, X86_INSN_FLAG_SSE_GROUP_d8, Gm, Em),

    /* 0xe0 */
    op2f(pavgb, X86_INSN_FLAG_SSE_GROUP_e0, Gm, Em),
    op2f(psraw, X86_INSN_FLAG_SSE_GROUP_e0, Gm, Em),
    op2f(psrad, X86_INSN_FLAG_SSE_GROUP_e0, Gm, Em),
    op2f(pavgw, X86_INSN_FLAG_SSE_GROUP_e0, Gm, Em),
    op2f(pmulhuw, X86_INSN_FLAG_SSE_GROUP_e0, Gm, Em),
    op2f(pmulhw, X86_INSN_FLAG_SSE_GROUP_e0, Gm, Em),
    op2f(bad, X86_INSN_FLAG_SSE_GROUP_e0, Gm, Em),
    op2f(movntq, X86_INSN_FLAG_SSE_GROUP_e0, Mm, Gm),
    op2f(psubsb, X86_INSN_FLAG_SSE_GROUP_e8, Gm, Em),
    op2f(psubsw, X86_INSN_FLAG_SSE_GROUP_e8, Gm, Em),
    op2f(pminsw, X86_INSN_FLAG_SSE_GROUP_e8, Gm, Em),
    op2f(por, X86_INSN_FLAG_SSE_GROUP_e8, Gm, Em),
    op2f(paddsb, X86_INSN_FLAG_SSE_GROUP_e8, Gm, Em),
    op2f(paddsw, X86_INSN_FLAG_SSE_GROUP_e8, Gm, Em),
    op2f(pmaxsw, X86_INSN_FLAG_SSE_GROUP_e8, Gm, Em),
    op2f(pxor, X86_INSN_FLAG_SSE_GROUP_e8, Gm, Em),

    /* 0xf0 */
    op0f(bad, X86_INSN_FLAG_SSE_GROUP_f0),
    op2f(psllw, X86_INSN_FLAG_SSE_GROUP_f0, Gm, Em),
    op2f(pslld, X86_INSN_FLAG_SSE_GROUP_f0, Gm, Em),
    op2f(psllq, X86_INSN_FLAG_SSE_GROUP_f0, Gm, Em),
    op2f(pmuludq, X86_INSN_FLAG_SSE_GROUP_f0, Gm, Em),
    op2f(pmaddwd, X86_INSN_FLAG_SSE_GROUP_f0, Gm, Em),
    op2f(psadbw, X86_INSN_FLAG_SSE_GROUP_f0, Gm, Em),
    op2f(maskmovq, X86_INSN_FLAG_SSE_GROUP_f0, Gm, Em),
    op2f(psubb, X86_INSN_FLAG_SSE_GROUP_f8, Gm, Em),
    op2f(psubw, X86_INSN_FLAG_SSE_GROUP_f8, Gm, Em),
    op2f(psubd, X86_INSN_FLAG_SSE_GROUP_f8, Gm, Em),
    op2f(psubq, X86_INSN_FLAG_SSE_GROUP_f8, Gm, Em),
    op2f(paddb, X86_INSN_FLAG_SSE_GROUP_f8, Gm, Em),
    op2f(paddw, X86_INSN_FLAG_SSE_GROUP_f8, Gm, Em),
    op2f(paddd, X86_INSN_FLAG_SSE_GROUP_f8, Gm, Em),
    op0f(bad, X86_INSN_FLAG_SSE_GROUP_f8),
};

// clang-format on