int opcode_length(unsigned char op) {
  static int length_lookup[] = {
      1, 2, 0, 0, 0, 2, 2, 0, 1, 2, 1, 0, 0, 3, 3, 0, 2, 2, 0, 0, 0, 2, 2, 0,
      1, 3, 0, 0, 0, 3, 3, 0, 3, 2, 0, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0,
      2, 2, 0, 0, 0, 2, 2, 0, 1, 3, 0, 0, 0, 3, 3, 0, 1, 2, 0, 0, 0, 2, 2, 0,
      1, 2, 1, 0, 3, 3, 3, 0, 2, 2, 0, 0, 0, 2, 2, 0, 1, 3, 0, 0, 0, 3, 3, 0,
      1, 2, 0, 0, 0, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0, 2, 2, 0, 0, 0, 2, 2, 0,
      1, 3, 0, 0, 0, 3, 3, 0, 0, 2, 0, 0, 2, 2, 2, 0, 1, 1, 1, 0, 3, 3, 3, 0,
      2, 2, 0, 0, 2, 2, 2, 0, 1, 3, 1, 0, 0, 3, 0, 0, 2, 2, 2, 0, 2, 2, 2, 0,
      1, 2, 1, 0, 3, 3, 3, 0, 2, 2, 0, 0, 2, 2, 2, 0, 1, 3, 1, 0, 3, 3, 3, 0,
      2, 2, 0, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0, 2, 2, 0, 0, 0, 2, 2, 0,
      1, 3, 0, 0, 0, 3, 3, 0, 2, 2, 0, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0,
      2, 2, 0, 0, 0, 2, 2, 0, 1, 3, 0, 0, 0, 3, 3, 0};
  return length_lookup[op];
}


x86 assembly (clang, -O0):
<opcode_length>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
mov    %eax,%ecx
lea    0x2f19(%rip),%rax
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<opcode_length>:
mov    %edi,%eax
lea    0xef7(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
@opcode_length.length_lookup = internal global [256 x i32] [i32 1, i32 2, i32 0, i32 0, i32 0, i32 2, i32 2, i32 0, i32 1, i32 2, i32 1, i32 0, i32 0, i32 3, i32 3, i32 0, i32 2, i32 2, i32 0, i32 0, i32 0, i32 2, i32 2, i32 0, i32 1, i32 3, i32 0, i32 0, i32 0, i32 3, i32 3, i32 0, i32 3, i32 2, i32 0, i32 0, i32 2, i32 2, i32 2, i32 0, i32 1, i32 2, i32 1, i32 0, i32 3, i32 3, i32 3, i32 0, i32 2, i32 2, i32 0, i32 0, i32 0, i32 2, i32 2, i32 0, i32 1, i32 3, i32 0, i32 0, i32 0, i32 3, i32 3, i32 0, i32 1, i32 2, i32 0, i32 0, i32 0, i32 2, i32 2, i32 0, i32 1, i32 2, i32 1, i32 0, i32 3, i32 3, i32 3, i32 0, i32 2, i32 2, i32 0, i32 0, i32 0, i32 2, i32 2, i32 0, i32 1, i32 3, i32 0, i32 0, i32 0, i32 3, i32 3, i32 0, i32 1, i32 2, i32 0, i32 0, i32 0, i32 2, i32 2, i32 0, i32 1, i32 2, i32 1, i32 0, i32 3, i32 3, i32 3, i32 0, i32 2, i32 2, i32 0, i32 0, i32 0, i32 2, i32 2, i32 0, i32 1, i32 3, i32 0, i32 0, i32 0, i32 3, i32 3, i32 0, i32 0, i32 2, i32 0, i32 0, i32 2, i32 2, i32 2, i32 0, i32 1, i32 1, i32 1, i32 0, i32 3, i32 3, i32 3, i32 0, i32 2, i32 2, i32 0, i32 0, i32 2, i32 2, i32 2, i32 0, i32 1, i32 3, i32 1, i32 0, i32 0, i32 3, i32 0, i32 0, i32 2, i32 2, i32 2, i32 0, i32 2, i32 2, i32 2, i32 0, i32 1, i32 2, i32 1, i32 0, i32 3, i32 3, i32 3, i32 0, i32 2, i32 2, i32 0, i32 0, i32 2, i32 2, i32 2, i32 0, i32 1, i32 3, i32 1, i32 0, i32 3, i32 3, i32 3, i32 0, i32 2, i32 2, i32 0, i32 0, i32 2, i32 2, i32 2, i32 0, i32 1, i32 2, i32 1, i32 0, i32 3, i32 3, i32 3, i32 0, i32 2, i32 2, i32 0, i32 0, i32 0, i32 2, i32 2, i32 0, i32 1, i32 3, i32 0, i32 0, i32 0, i32 3, i32 3, i32 0, i32 2, i32 2, i32 0, i32 0, i32 2, i32 2, i32 2, i32 0, i32 1, i32 2, i32 1, i32 0, i32 3, i32 3, i32 3, i32 0, i32 2, i32 2, i32 0, i32 0, i32 0, i32 2, i32 2, i32 0, i32 1, i32 3, i32 0, i32 0, i32 0, i32 3, i32 3, i32 0]
define i32 @opcode_length(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i64
%5 = getelementptr inbounds [256 x i32], [256 x i32]* @opcode_length.length_lookup, i64 0, i64 %4
%6 = load i32, i32* %5
ret i32 %6
}

LLVM IR (-O2):
@opcode_length.length_lookup = internal unnamed_addr constant [256 x i32] [i32 1, i32 2, i32 0, i32 0, i32 0, i32 2, i32 2, i32 0, i32 1, i32 2, i32 1, i32 0, i32 0, i32 3, i32 3, i32 0, i32 2, i32 2, i32 0, i32 0, i32 0, i32 2, i32 2, i32 0, i32 1, i32 3, i32 0, i32 0, i32 0, i32 3, i32 3, i32 0, i32 3, i32 2, i32 0, i32 0, i32 2, i32 2, i32 2, i32 0, i32 1, i32 2, i32 1, i32 0, i32 3, i32 3, i32 3, i32 0, i32 2, i32 2, i32 0, i32 0, i32 0, i32 2, i32 2, i32 0, i32 1, i32 3, i32 0, i32 0, i32 0, i32 3, i32 3, i32 0, i32 1, i32 2, i32 0, i32 0, i32 0, i32 2, i32 2, i32 0, i32 1, i32 2, i32 1, i32 0, i32 3, i32 3, i32 3, i32 0, i32 2, i32 2, i32 0, i32 0, i32 0, i32 2, i32 2, i32 0, i32 1, i32 3, i32 0, i32 0, i32 0, i32 3, i32 3, i32 0, i32 1, i32 2, i32 0, i32 0, i32 0, i32 2, i32 2, i32 0, i32 1, i32 2, i32 1, i32 0, i32 3, i32 3, i32 3, i32 0, i32 2, i32 2, i32 0, i32 0, i32 0, i32 2, i32 2, i32 0, i32 1, i32 3, i32 0, i32 0, i32 0, i32 3, i32 3, i32 0, i32 0, i32 2, i32 0, i32 0, i32 2, i32 2, i32 2, i32 0, i32 1, i32 1, i32 1, i32 0, i32 3, i32 3, i32 3, i32 0, i32 2, i32 2, i32 0, i32 0, i32 2, i32 2, i32 2, i32 0, i32 1, i32 3, i32 1, i32 0, i32 0, i32 3, i32 0, i32 0, i32 2, i32 2, i32 2, i32 0, i32 2, i32 2, i32 2, i32 0, i32 1, i32 2, i32 1, i32 0, i32 3, i32 3, i32 3, i32 0, i32 2, i32 2, i32 0, i32 0, i32 2, i32 2, i32 2, i32 0, i32 1, i32 3, i32 1, i32 0, i32 3, i32 3, i32 3, i32 0, i32 2, i32 2, i32 0, i32 0, i32 2, i32 2, i32 2, i32 0, i32 1, i32 2, i32 1, i32 0, i32 3, i32 3, i32 3, i32 0, i32 2, i32 2, i32 0, i32 0, i32 0, i32 2, i32 2, i32 0, i32 1, i32 3, i32 0, i32 0, i32 0, i32 3, i32 3, i32 0, i32 2, i32 2, i32 0, i32 0, i32 2, i32 2, i32 2, i32 0, i32 1, i32 2, i32 1, i32 0, i32 3, i32 3, i32 3, i32 0, i32 2, i32 2, i32 0, i32 0, i32 0, i32 2, i32 2, i32 0, i32 1, i32 3, i32 0, i32 0, i32 0, i32 3, i32 3, i32 0]
define i32 @opcode_length(i8 zeroext %0) {
%2 = zext i8 %0 to i64
%3 = getelementptr inbounds [256 x i32], [256 x i32]* @opcode_length.length_lookup, i64 0, i64 %2
%4 = load i32, i32* %3
ret i32 %4
}