int pixtype(type)
int type;
{
  switch (type) {
  case 8:
    return 6;
  case 16:
    return 1;
  case 32:
    return 2;
  case 0x1000 | 8:
    return 6;
  case 0x1000 | 16:
    return 7;
  case 0x1000 | 32:
    return 8;
  case -32:
    return 4;
  case -64:
    return 5;
  }
  return -1;
}


x86 assembly (clang, -O0):
<pixtype>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0xffffffc0,%eax
je     11ec <pixtype+0xec>
jmp    111b <pixtype+0x1b>
mov    -0xc(%rbp),%eax
sub    $0xffffffe0,%eax
je     11e0 <pixtype+0xe0>
jmp    112c <pixtype+0x2c>
mov    -0xc(%rbp),%eax
sub    $0x8,%eax
je     1198 <pixtype+0x98>
jmp    113d <pixtype+0x3d>
mov    -0xc(%rbp),%eax
sub    $0x10,%eax
je     11a4 <pixtype+0xa4>
jmp    114e <pixtype+0x4e>
mov    -0xc(%rbp),%eax
sub    $0x20,%eax
je     11b0 <pixtype+0xb0>
jmp    115f <pixtype+0x5f>
mov    -0xc(%rbp),%eax
sub    $0x1008,%eax
je     11bc <pixtype+0xbc>
jmp    1172 <pixtype+0x72>
mov    -0xc(%rbp),%eax
sub    $0x1010,%eax
je     11c8 <pixtype+0xc8>
jmp    1185 <pixtype+0x85>
mov    -0xc(%rbp),%eax
sub    $0x1020,%eax
je     11d4 <pixtype+0xd4>
jmp    11f8 <pixtype+0xf8>
movl   $0x6,-0x4(%rbp)
jmp    11ff <pixtype+0xff>
movl   $0x1,-0x4(%rbp)
jmp    11ff <pixtype+0xff>
movl   $0x2,-0x4(%rbp)
jmp    11ff <pixtype+0xff>
movl   $0x6,-0x4(%rbp)
jmp    11ff <pixtype+0xff>
movl   $0x7,-0x4(%rbp)
jmp    11ff <pixtype+0xff>
movl   $0x8,-0x4(%rbp)
jmp    11ff <pixtype+0xff>
movl   $0x4,-0x4(%rbp)
jmp    11ff <pixtype+0xff>
movl   $0x5,-0x4(%rbp)
jmp    11ff <pixtype+0xff>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pixtype>:
mov    $0x6,%eax
cmp    $0x1f,%edi
jg     111f <pixtype+0x1f>
cmp    $0x7,%edi
jg     1135 <pixtype+0x35>
cmp    $0xffffffc0,%edi
je     115b <pixtype+0x5b>
cmp    $0xffffffe0,%edi
jne    116d <pixtype+0x6d>
mov    $0x4,%eax
ret
cmp    $0x100f,%edi
jg     1145 <pixtype+0x45>
cmp    $0x20,%edi
je     1161 <pixtype+0x61>
cmp    $0x1008,%edi
jne    116d <pixtype+0x6d>
ret
cmp    $0x8,%edi
je     1134 <pixtype+0x34>
cmp    $0x10,%edi
jne    116d <pixtype+0x6d>
mov    $0x1,%eax
ret
cmp    $0x1010,%edi
je     1167 <pixtype+0x67>
cmp    $0x1020,%edi
jne    116d <pixtype+0x6d>
mov    $0x8,%eax
ret
mov    $0x5,%eax
ret
mov    $0x2,%eax
ret
mov    $0x7,%eax
ret
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @pixtype(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %13 [
i32 8, label %5
i32 16, label %6
i32 32, label %7
i32 4104, label %8
i32 4112, label %9
i32 4128, label %10
i32 -32, label %11
i32 -64, label %12
]
5: ; preds = %1
store i32 6, i32* %2
br label %14
6: ; preds = %1
store i32 1, i32* %2
br label %14
7: ; preds = %1
store i32 2, i32* %2
br label %14
8: ; preds = %1
store i32 6, i32* %2
br label %14
9: ; preds = %1
store i32 7, i32* %2
br label %14
10: ; preds = %1
store i32 8, i32* %2
br label %14
11: ; preds = %1
store i32 4, i32* %2
br label %14
12: ; preds = %1
store i32 5, i32* %2
br label %14
13: ; preds = %1
store i32 -1, i32* %2
br label %14
14: ; preds = %13, %12, %11, %10, %9, %8, %7, %6, %5
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @pixtype(i32 %0) {
switch i32 %0, label %8 [
i32 8, label %9
i32 16, label %2
i32 32, label %3
i32 4104, label %9
i32 4112, label %4
i32 4128, label %5
i32 -32, label %6
i32 -64, label %7
]
2: ; preds = %1
br label %9
3: ; preds = %1
br label %9
4: ; preds = %1
br label %9
5: ; preds = %1
br label %9
6: ; preds = %1
br label %9
7: ; preds = %1
br label %9
8: ; preds = %1
br label %9
9: ; preds = %1, %1, %8, %7, %6, %5, %4, %3, %2
%10 = phi i32 [ -1, %8 ], [ 5, %7 ], [ 4, %6 ], [ 8, %5 ], [ 7, %4 ], [ 2, %3 ], [ 1, %2 ], [ 6, %1 ], [ 6, %1 ]
ret i32 %10
}