let x86mnem_string_list = 
  let open X86 in
[ "aaa"          , Aaa        ;
  "aad"          , Aad        ;
  "aam"          , Aam        ;
  "aas"          , Aas        ;
  "adc"          , Adc        ;
  "add"          , Add        ;
  "addpd"        , Addpd      ;
  "addps"        , Addps      ;
  "addsd"        , Addsd      ;
  "addss"        , Addss      ;
  "addsubpd"     , Addsubpd   ;
  "addsubps"     , Addsubps   ;
  "and"          , And        ;
  "andnpd"       , Andnpd     ;
  "andnps"       , Andnps     ;
  "andpd"        , Andpd      ;
  "andps"        , Andps      ;
  "arpl"         , Arpl       ;
  "blendpd"      , Blendpd    ;
  "blendps"      , Blendps    ;
  "blendvpd"     , Blendvpd   ;
  "blendvps"     , Blendvps   ;
  "bound"        , Bound      ;
  "bsf"          , Bsf        ;
  "bsr"          , Bsr        ;
  "bswap"        , Bswap      ;
  "bt"           , Bt         ;
  "btc"          , Btc        ;
  "btr"          , Btr        ;
  "bts"          , Bts        ;
  "call"         , Call       ;
  "callF"        , CallF      ;
  "cbw"          , Cbw        ;
  "cdq"          , Cdq        ;
  "clc"          , Clc        ;
  "cld"          , Cld        ;
  "clflush"      , Clflush    ;
  "cli"          , Cli        ;
  "clts"         , Clts       ;
  "cmc"          , Cmc        ;
  "cmova"        , Cmova      ;
  "cmovae"       , Cmovae     ;
  "cmovb"        , Cmovb      ;
  "cmovbe"       , Cmovbe     ;
  "cmovg"        , Cmovg      ;
  "cmovge"       , Cmovge     ;
  "cmovl"        , Cmovl      ;
  "cmovle"       , Cmovle     ;
  "cmovno"       , Cmovno     ;
  "cmovnp"       , Cmovnp     ;
  "cmovns"       , Cmovns     ;
  "cmovnz"       , Cmovnz     ;
  "cmovo"        , Cmovo      ;
  "cmovp"        , Cmovp      ;
  "cmovs"        , Cmovs      ;
  "cmovz"        , Cmovz      ;
  "cmp"          , Cmp        ;
  "cmppd"        , Cmppd      ;
  "cmpps"        , Cmpps      ;
  "cmpsb"        , Cmpsb      ;
  "cmpsd"        , Cmpsd      ;
  "cmpss"        , Cmpss      ;
  "cmpsw"        , Cmpsw      ;
  "cmpxchg"      , Cmpxchg    ;
  "cmpxchg8b"    , Cmpxchg8b  ;
  "comisd"       , Comisd     ;
  "comiss"       , Comiss     ;
  "cpuid"        , Cpuid      ;
  "crc32"        , Crc32      ;
  "cvtdq2pd"     , Cvtdq2pd   ;
  "cvtdq2ps"     , Cvtdq2ps   ;
  "cvtpd2dq"     , Cvtpd2dq   ;
  "cvtpd2pi"     , Cvtpd2pi   ;
  "cvtpd2ps"     , Cvtpd2ps   ;
  "cvtpi2pd"     , Cvtpi2pd   ;
  "cvtpi2ps"     , Cvtpi2ps   ;
  "cvtps2dq"     , Cvtps2dq   ;
  "cvtps2pd"     , Cvtps2pd   ;
  "cvtps2pi"     , Cvtps2pi   ;
  "cvtsd2si"     , Cvtsd2si   ;
  "cvtsd2ss"     , Cvtsd2ss   ;
  "cvtsi2sd"     , Cvtsi2sd   ;
  "cvtsi2ss"     , Cvtsi2ss   ;
  "cvtss2sd"     , Cvtss2sd   ;
  "cvtss2si"     , Cvtss2si   ;
  "cvttpd2dq"    , Cvttpd2dq  ;
  "cvttpd2pi"    , Cvttpd2pi  ;
  "cvttps2dq"    , Cvttps2dq  ;
  "cvttps2pi"    , Cvttps2pi  ;
  "cvttsd2si"    , Cvttsd2si  ;
  "cvttss2si"    , Cvttss2si  ;
  "cwd"          , Cwd        ;
  "cwde"         , Cwde       ;
  "daa"          , Daa        ;
  "das"          , Das        ;
  "dec"          , Dec        ;
  "div"          , Div        ;
  "divpd"        , Divpd      ;
  "divps"        , Divps      ;
  "divsd"        , Divsd      ;
  "divss"        , Divss      ;
  "dppd"         , Dppd       ;
  "dpps"         , Dpps       ;
  "emms"         , Emms       ;
  "enter"        , Enter      ;
  "extractps"    , Extractps  ;
  "f2xm1"        , F2xm1      ;
  "fabs"         , Fabs       ;
  "fadd"         , Fadd       ;
  "faddp"        , Faddp      ;
  "fbld"         , Fbld       ;
  "fbstp"        , Fbstp      ;
  "fchs"         , Fchs       ;
  "fclex"        , Fclex      ;
  "fcmovb"       , Fcmovb     ;
  "fcmovbe"      , Fcmovbe    ;
  "fcmove"       , Fcmove     ;
  "fcmovnb"      , Fcmovnb    ;
  "fcmovnbe"     , Fcmovnbe   ;
  "fcmovne"      , Fcmovne    ;
  "fcmovnu"      , Fcmovnu    ;
  "fcmovu"       , Fcmovu     ;
  "fcom"         , Fcom       ;
  "fcomi"        , Fcomi      ;
  "fcomip"       , Fcomip     ;
  "fcomp"        , Fcomp      ;
  "fcompp"       , Fcompp     ;
  "fcos"         , Fcos       ;
  "fdecstp"      , Fdecstp    ;
  "fdiv"         , Fdiv       ;
  "fdivp"        , Fdivp      ;
  "fdivr"        , Fdivr      ;
  "fdivrp"       , Fdivrp     ;
  "ffree"        , Ffree      ;
  "fiadd"        , Fiadd      ;
  "ficom"        , Ficom      ;
  "ficomp"       , Ficomp     ;
  "fidiv"        , Fidiv      ;
  "fidivr"       , Fidivr     ;
  "fild"         , Fild       ;
  "fimul"        , Fimul      ;
  "fincstp"      , Fincstp    ;
  "finit"        , Finit      ;
  "fist"         , Fist       ;
  "fistp"        , Fistp      ;
  "fisttp"       , Fisttp     ;
  "fisub"        , Fisub      ;
  "fisubr"       , Fisubr     ;
  "fld"          , Fld        ;
  "fld1"         , Fld1       ;
  "fldcw"        , Fldcw      ;
  "fldenv"       , Fldenv     ;
  "fldl2e"       , Fldl2e     ;
  "fldl2t"       , Fldl2t     ;
  "fldlg2"       , Fldlg2     ;
  "fldln2"       , Fldln2     ;
  "fldpi"        , Fldpi      ;
  "fldz"         , Fldz       ;
  "fmul"         , Fmul       ;
  "fmulp"        , Fmulp      ;
  "fnop"         , Fnop       ;
  "fpatan"       , Fpatan     ;
  "fprem"        , Fprem      ;
  "fprem1"       , Fprem1     ;
  "fptan"        , Fptan      ;
  "frndint"      , Frndint    ;
  "frstor"       , Frstor     ;
  "fsave"        , Fsave      ;
  "fscale"       , Fscale     ;
  "fsin"         , Fsin       ;
  "fsincos"      , Fsincos    ;
  "fsqrt"        , Fsqrt      ;
  "fst"          , Fst        ;
  "fstcw"        , Fstcw      ;
  "fstenv"       , Fstenv     ;
  "fstp"         , Fstp       ;
  "fstsw"        , Fstsw      ;
  "fsub"         , Fsub       ;
  "fsubp"        , Fsubp      ;
  "fsubr"        , Fsubr      ;
  "fsubrp"       , Fsubrp     ;
  "ftst"         , Ftst       ;
  "fucom"        , Fucom      ;
  "fucomi"       , Fucomi     ;
  "fucomip"      , Fucomip    ;
  "fucomp"       , Fucomp     ;
  "fucompp"      , Fucompp    ;
  "fxam"         , Fxam       ;
  "fxch"         , Fxch       ;
  "fxrstor"      , Fxrstor    ;
  "fxsave"       , Fxsave     ;
  "fxtract"      , Fxtract    ;
  "fyl2x"        , Fyl2x      ;
  "fyl2xp1"      , Fyl2xp1    ;
  "getsec"       , Getsec     ;
  "haddpd"       , Haddpd     ;
  "haddps"       , Haddps     ;
  "hlt"          , Hlt        ;
  "hsubpd"       , Hsubpd     ;
  "hsubps"       , Hsubps     ;
  "icebp"        , Icebp      ;
  "idiv"         , Idiv       ;
  "imul"         , Imul       ;
  "in"           , In         ;
  "inc"          , Inc        ;
  "insb"         , Insb       ;
  "insd"         , Insd       ;
  "insertps"     , Insertps   ;
  "insw"         , Insw       ;
  "int"          , Int        ;
  "int3"         , Int3       ;
  "into"         , Into       ;
  "invd"         , Invd       ;
  "invlpg"       , Invlpg     ;
  "iretd"        , Iretd      ;
  "iretw"        , Iretw      ;
  "ja"           , Ja         ;
  "jae"          , Jae        ;
  "jb"           , Jb         ;
  "jbe"          , Jbe        ;
  "jcxz"         , Jcxz       ;
  "jecxz"        , Jecxz      ;
  "jg"           , Jg         ;
  "jge"          , Jge        ;
  "jl"           , Jl         ;
  "jle"          , Jle        ;
  "jmp"          , Jmp        ;
  "jmpF"         , JmpF       ;
  "jno"          , Jno        ;
  "jnp"          , Jnp        ;
  "jns"          , Jns        ;
  "jnz"          , Jnz        ;
  "jo"           , Jo         ;
  "jp"           , Jp         ;
  "js"           , Js         ;
  "jz"           , Jz         ;
  "lahf"         , Lahf       ;
  "lar"          , Lar        ;
  "lddqu"        , Lddqu      ;
  "ldmxcsr"      , Ldmxcsr    ;
  "lds"          , Lds        ;
  "lea"          , Lea        ;
  "leave"        , Leave      ;
  "les"          , Les        ;
  "lfence"       , Lfence     ;
  "lfs"          , Lfs        ;
  "lgdt"         , Lgdt       ;
  "lgs"          , Lgs        ;
  "lidt"         , Lidt       ;
  "lldt"         , Lldt       ;
  "lmsw"         , Lmsw       ;
  "lodsb"        , Lodsb      ;
  "lodsd"        , Lodsd      ;
  "lodsw"        , Lodsw      ;
  "loop"         , Loop       ;
  "loopnz"       , Loopnz     ;
  "loopz"        , Loopz      ;
  "lsl"          , Lsl        ;
  "lss"          , Lss        ;
  "ltr"          , Ltr        ;
  "maskmovdqu"   , Maskmovdqu ;
  "maskmovq"     , Maskmovq   ;
  "maxpd"        , Maxpd      ;
  "maxps"        , Maxps      ;
  "maxsd"        , Maxsd      ;
  "maxss"        , Maxss      ;
  "mfence"       , Mfence     ;
  "minpd"        , Minpd      ;
  "minps"        , Minps      ;
  "minsd"        , Minsd      ;
  "minss"        , Minss      ;
  "monitor"      , Monitor    ;
  "mov"          , Mov        ;
  "movapd"       , Movapd     ;
  "movaps"       , Movaps     ;
  "movd"         , Movd       ;
  "movddup"      , Movddup    ;
  "movdq2q"      , Movdq2q    ;
  "movdqa"       , Movdqa     ;
  "movdqu"       , Movdqu     ;
  "movhlps"      , Movhlps    ;
  "movhpd"       , Movhpd     ;
  "movhps"       , Movhps     ;
  "movlhps"      , Movlhps    ;
  "movlpd"       , Movlpd     ;
  "movlps"       , Movlps     ;
  "movmskpd"     , Movmskpd   ;
  "movmskps"     , Movmskps   ;
  "movntdq"      , Movntdq    ;
  "movntdqa"     , Movntdqa   ;
  "movnti"       , Movnti     ;
  "movntpd"      , Movntpd    ;
  "movntps"      , Movntps    ;
  "movntq"       , Movntq     ;
  "movq"         , Movq       ;
  "movq2dq"      , Movq2dq    ;
  "movsb"        , Movsb      ;
  "movsd"        , Movsd      ;
  "movshdup"     , Movshdup   ;
  "movsldup"     , Movsldup   ;
  "movss"        , Movss      ;
  "movsw"        , Movsw      ;
  "movsx"        , Movsx      ;
  "movupd"       , Movupd     ;
  "movups"       , Movups     ;
  "movzx"        , Movzx      ;
  "mpsadbw"      , Mpsadbw    ;
  "mul"          , Mul        ;
  "mulpd"        , Mulpd      ;
  "mulps"        , Mulps      ;
  "mulsd"        , Mulsd      ;
  "mulss"        , Mulss      ;
  "mwait"        , Mwait      ;
  "neg"          , Neg        ;
  "nop"          , Nop        ;
  "not"          , Not        ;
  "or"           , Or         ;
  "orpd"         , Orpd       ;
  "orps"         , Orps       ;
  "out"          , Out        ;
  "outsb"        , Outsb      ;
  "outsd"        , Outsd      ;
  "outsw"        , Outsw      ;
  "pabsb"        , Pabsb      ;
  "pabsd"        , Pabsd      ;
  "pabsw"        , Pabsw      ;
  "packssdw"     , Packssdw   ;
  "packsswb"     , Packsswb   ;
  "packusdw"     , Packusdw   ;
  "packuswb"     , Packuswb   ;
  "paddb"        , Paddb      ;
  "paddd"        , Paddd      ;
  "paddq"        , Paddq      ;
  "paddsb"       , Paddsb     ;
  "paddsw"       , Paddsw     ;
  "paddusb"      , Paddusb    ;
  "paddusw"      , Paddusw    ;
  "paddw"        , Paddw      ;
  "palignr"      , Palignr    ;
  "pand"         , Pand       ;
  "pandn"        , Pandn      ;
  "pause"        , Pause      ;
  "pavgb"        , Pavgb      ;
  "pavgw"        , Pavgw      ;
  "pblendvb"     , Pblendvb   ;
  "pblendw"      , Pblendw    ;
  "pcmpeqb"      , Pcmpeqb    ;
  "pcmpeqd"      , Pcmpeqd    ;
  "pcmpeqq"      , Pcmpeqq    ;
  "pcmpeqw"      , Pcmpeqw    ;
  "pcmpestri"    , Pcmpestri  ;
  "pcmpestrm"    , Pcmpestrm  ;
  "pcmpgtb"      , Pcmpgtb    ;
  "pcmpgtd"      , Pcmpgtd    ;
  "pcmpgtq"      , Pcmpgtq    ;
  "pcmpgtw"      , Pcmpgtw    ;
  "pcmpistri"    , Pcmpistri  ;
  "pcmpistrm"    , Pcmpistrm  ;
  "pextrb"       , Pextrb     ;
  "pextrd"       , Pextrd     ;
  "pextrw"       , Pextrw     ;
  "phaddd"       , Phaddd     ;
  "phaddsw"      , Phaddsw    ;
  "phaddw"       , Phaddw     ;
  "phminposuw"   , Phminposuw ;
  "phsubd"       , Phsubd     ;
  "phsubsw"      , Phsubsw    ;
  "phsubw"       , Phsubw     ;
  "pinsrb"       , Pinsrb     ;
  "pinsrd"       , Pinsrd     ;
  "pinsrw"       , Pinsrw     ;
  "pmaddubsw"    , Pmaddubsw  ;
  "pmaddwd"      , Pmaddwd    ;
  "pmaxsb"       , Pmaxsb     ;
  "pmaxsd"       , Pmaxsd     ;
  "pmaxsw"       , Pmaxsw     ;
  "pmaxub"       , Pmaxub     ;
  "pmaxud"       , Pmaxud     ;
  "pmaxuw"       , Pmaxuw     ;
  "pminsb"       , Pminsb     ;
  "pminsd"       , Pminsd     ;
  "pminsw"       , Pminsw     ;
  "pminub"       , Pminub     ;
  "pminud"       , Pminud     ;
  "pminuw"       , Pminuw     ;
  "pmovmskb"     , Pmovmskb   ;
  "pmovsxbd"     , Pmovsxbd   ;
  "pmovsxbq"     , Pmovsxbq   ;
  "pmovsxbw"     , Pmovsxbw   ;
  "pmovsxdq"     , Pmovsxdq   ;
  "pmovsxwd"     , Pmovsxwd   ;
  "pmovsxwq"     , Pmovsxwq   ;
  "pmovzxbd"     , Pmovzxbd   ;
  "pmovzxbq"     , Pmovzxbq   ;
  "pmovzxbw"     , Pmovzxbw   ;
  "pmovzxdq"     , Pmovzxdq   ;
  "pmovzxwd"     , Pmovzxwd   ;
  "pmovzxwq"     , Pmovzxwq   ;
  "pmuldq"       , Pmuldq     ;
  "pmulhrsw"     , Pmulhrsw   ;
  "pmulhuw"      , Pmulhuw    ;
  "pmulhw"       , Pmulhw     ;
  "pmulld"       , Pmulld     ;
  "pmullw"       , Pmullw     ;
  "pmuludq"      , Pmuludq    ;
  "pop"          , Pop        ;
  "popad"        , Popad      ;
  "popaw"        , Popaw      ;
  "popcnt"       , Popcnt     ;
  "popfd"        , Popfd      ;
  "popfw"        , Popfw      ;
  "por"          , Por        ;
  "prefetchnta"  , Prefetchnta;
  "prefetcht0"   , Prefetcht0 ;
  "prefetcht1"   , Prefetcht1 ;
  "prefetcht2"   , Prefetcht2 ;
  "psadbw"       , Psadbw     ;
  "pshufb"       , Pshufb     ;
  "pshufd"       , Pshufd     ;
  "pshufhw"      , Pshufhw    ;
  "pshuflw"      , Pshuflw    ;
  "pshufw"       , Pshufw     ;
  "psignb"       , Psignb     ;
  "psignd"       , Psignd     ;
  "psignw"       , Psignw     ;
  "pslld"        , Pslld      ;
  "pslldq"       , Pslldq     ;
  "psllq"        , Psllq      ;
  "psllw"        , Psllw      ;
  "psrad"        , Psrad      ;
  "psraw"        , Psraw      ;
  "psrld"        , Psrld      ;
  "psrldq"       , Psrldq     ;
  "psrlq"        , Psrlq      ;
  "psrlw"        , Psrlw      ;
  "psubb"        , Psubb      ;
  "psubd"        , Psubd      ;
  "psubq"        , Psubq      ;
  "psubsb"       , Psubsb     ;
  "psubsw"       , Psubsw     ;
  "psubusb"      , Psubusb    ;
  "psubusw"      , Psubusw    ;
  "psubw"        , Psubw      ;
  "ptest"        , Ptest      ;
  "punpckhbw"    , Punpckhbw  ;
  "punpckhdq"    , Punpckhdq  ;
  "punpckhqdq"   , Punpckhqdq ;
  "punpckhwd"    , Punpckhwd  ;
  "punpcklbw"    , Punpcklbw  ;
  "punpckldq"    , Punpckldq  ;
  "punpcklqdq"   , Punpcklqdq ;
  "punpcklwd"    , Punpcklwd  ;
  "push"         , Push       ;
  "pushad"       , Pushad     ;
  "pushaw"       , Pushaw     ;
  "pushfd"       , Pushfd     ;
  "pushfw"       , Pushfw     ;
  "pxor"         , Pxor       ;
  "rcl"          , Rcl        ;
  "rcpps"        , Rcpps      ;
  "rcpss"        , Rcpss      ;
  "rcr"          , Rcr        ;
  "rdmsr"        , Rdmsr      ;
  "rdpmc"        , Rdpmc      ;
  "rdtsc"        , Rdtsc      ;
  "ret"          , Ret        ;
  "retf"         , Retf       ;
  "rol"          , Rol        ;
  "ror"          , Ror        ;
  "roundpd"      , Roundpd    ;
  "roundps"      , Roundps    ;
  "roundsd"      , Roundsd    ;
  "roundss"      , Roundss    ;
  "rsm"          , Rsm        ;
  "rsqrtps"      , Rsqrtps    ;
  "rsqrtss"      , Rsqrtss    ;
  "sahf"         , Sahf       ;
  "sal"          , Sal        ;
  "salc"         , Salc       ;
  "sar"          , Sar        ;
  "sbb"          , Sbb        ;
  "scasb"        , Scasb      ;
  "scasd"        , Scasd      ;
  "scasw"        , Scasw      ;
  "seta"         , Seta       ;
  "setae"        , Setae      ;
  "setb"         , Setb       ;
  "setbe"        , Setbe      ;
  "setg"         , Setg       ;
  "setge"        , Setge      ;
  "setl"         , Setl       ;
  "setle"        , Setle      ;
  "setno"        , Setno      ;
  "setnp"        , Setnp      ;
  "setns"        , Setns      ;
  "setnz"        , Setnz      ;
  "seto"         , Seto       ;
  "setp"         , Setp       ;
  "sets"         , Sets       ;
  "setz"         , Setz       ;
  "sfence"       , Sfence     ;
  "sgdt"         , Sgdt       ;
  "shl"          , Shl        ;
  "shld"         , Shld       ;
  "shr"          , Shr        ;
  "shrd"         , Shrd       ;
  "shufpd"       , Shufpd     ;
  "shufps"       , Shufps     ;
  "sidt"         , Sidt       ;
  "sldt"         , Sldt       ;
  "smsw"         , Smsw       ;
  "sqrtpd"       , Sqrtpd     ;
  "sqrtps"       , Sqrtps     ;
  "sqrtsd"       , Sqrtsd     ;
  "sqrtss"       , Sqrtss     ;
  "stc"          , Stc        ;
  "std"          , Std        ;
  "sti"          , Sti        ;
  "stmxcsr"      , Stmxcsr    ;
  "stosb"        , Stosb      ;
  "stosd"        , Stosd      ;
  "stosw"        , Stosw      ;
  "str"          , Str        ;
  "sub"          , Sub        ;
  "subpd"        , Subpd      ;
  "subps"        , Subps      ;
  "subsd"        , Subsd      ;
  "subss"        , Subss      ;
  "syscall"      , Syscall    ;
  "sysenter"     , Sysenter   ;
  "sysexit"      , Sysexit    ;
  "sysret"       , Sysret     ;
  "test"         , Test       ;
  "ucomisd"      , Ucomisd    ;
  "ucomiss"      , Ucomiss    ;
  "ud2"          , Ud2        ;
  "unpckhpd"     , Unpckhpd   ;
  "unpckhps"     , Unpckhps   ;
  "unpcklpd"     , Unpcklpd   ;
  "unpcklps"     , Unpcklps   ;
  "verr"         , Verr       ;
  "verw"         , Verw       ;
  "vmcall"       , Vmcall     ;
  "vmclear"      , Vmclear    ;
  "vmlaunch"     , Vmlaunch   ;
  "vmptrld"      , Vmptrld    ;
  "vmptrst"      , Vmptrst    ;
  "vmread"       , Vmread     ;
  "vmresume"     , Vmresume   ;
  "vmwrite"      , Vmwrite    ;
  "vmxoff"       , Vmxoff     ;
  "vmxon"        , Vmxon      ;
  "wait"         , Wait       ;
  "wbinvd"       , Wbinvd     ;
  "wrmsr"        , Wrmsr      ;
  "xadd"         , Xadd       ;
  "xlat"         , Xlat       ;
  "xchg"         , Xchg       ;
  "xor"          , Xor        ;
  "xorpd"        , Xorpd      ;
  "xorps"        , Xorps      ]
  
let string_to_mnem = Hashtbl.create 1000

let _ = List.iter (fun (s,m) -> Hashtbl.replace string_to_mnem s m) x86mnem_string_list

let x86mnem_of_string_exn = Hashtbl.find string_to_mnem