int NumBytesPerPoint(int type) {
  int numBytesPerPoint;
  switch (type & ~(1 | 0x40)) {
  case 8:
    numBytesPerPoint = 1;
    break;
  case 0x10:
    numBytesPerPoint = 2;
    break;
  case 0x20:
    numBytesPerPoint = 4;
    break;
  case 2:
    numBytesPerPoint = 4;
    break;
  case 4:
    numBytesPerPoint = 8;
    break;
  default:
    return 0;
    break;
  }
  if (type & 1)
    numBytesPerPoint *= 2;
  return numBytesPerPoint;
}


x86 assembly (clang, -O0):
<NumBytesPerPoint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xffffffbe,%eax
add    $0xfffffffe,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x1e,%eax
ja     116f <NumBytesPerPoint+0x6f>
mov    -0x18(%rbp),%rax
lea    0xed6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0xc(%rbp)
jmp    117b <NumBytesPerPoint+0x7b>
movl   $0x2,-0xc(%rbp)
jmp    117b <NumBytesPerPoint+0x7b>
movl   $0x4,-0xc(%rbp)
jmp    117b <NumBytesPerPoint+0x7b>
movl   $0x4,-0xc(%rbp)
jmp    117b <NumBytesPerPoint+0x7b>
movl   $0x8,-0xc(%rbp)
jmp    117b <NumBytesPerPoint+0x7b>
movl   $0x0,-0x4(%rbp)
jmp    1199 <NumBytesPerPoint+0x99>
mov    -0x8(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1193 <NumBytesPerPoint+0x93>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<NumBytesPerPoint>:
mov    %edi,%ecx
and    $0xffffffbe,%ecx
xor    %eax,%eax
add    $0xfffffffe,%ecx
cmp    $0x1e,%ecx
ja     1141 <NumBytesPerPoint+0x41>
mov    $0x1,%edx
lea    0xee5(%rip),%rsi
movslq (%rsi,%rcx,4),%rcx
add    %rsi,%rcx
jmp    *%rcx
mov    $0x4,%edx
jmp    1137 <NumBytesPerPoint+0x37>
mov    $0x8,%edx
jmp    1137 <NumBytesPerPoint+0x37>
mov    $0x2,%edx
and    $0x1,%dil
mov    %edi,%ecx
shl    %cl,%edx
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @NumBytesPerPoint(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = and i32 %5, -66
switch i32 %6, label %12 [
i32 8, label %7
i32 16, label %8
i32 32, label %9
i32 2, label %10
i32 4, label %11
]
7: ; preds = %1
store i32 1, i32* %4
br label %13
8: ; preds = %1
store i32 2, i32* %4
br label %13
9: ; preds = %1
store i32 4, i32* %4
br label %13
10: ; preds = %1
store i32 4, i32* %4
br label %13
11: ; preds = %1
store i32 8, i32* %4
br label %13
12: ; preds = %1
store i32 0, i32* %2
br label %22
13: ; preds = %11, %10, %9, %8, %7
%14 = load i32, i32* %3
%15 = and i32 %14, 1
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = load i32, i32* %4
%19 = mul nsw i32 %18, 2
store i32 %19, i32* %4
br label %20
20: ; preds = %17, %13
%21 = load i32, i32* %4
store i32 %21, i32* %2
br label %22
22: ; preds = %20, %12
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @NumBytesPerPoint(i32 %0) {
%2 = and i32 %0, -66
switch i32 %2, label %11 [
i32 8, label %7
i32 16, label %3
i32 32, label %4
i32 2, label %5
i32 4, label %6
]
3: ; preds = %1
br label %7
4: ; preds = %1
br label %7
5: ; preds = %1
br label %7
6: ; preds = %1
br label %7
7: ; preds = %1, %6, %5, %4, %3
%8 = phi i32 [ 8, %6 ], [ 4, %5 ], [ 4, %4 ], [ 2, %3 ], [ 1, %1 ]
%9 = and i32 %0, 1
%10 = shl nuw nsw i32 %8, %9
br label %11
11: ; preds = %1, %7
%12 = phi i32 [ %10, %7 ], [ 0, %1 ]
ret i32 %12
}