#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int getbit(int /*<<< orphan*/);
int getcelltype(int flag) {
  int flags = (~(2730 & flag)) & getbit(0);
  flags = ((flags & 2) >> 1) + ((flags >> 2) & 2) + ((flags >> 3) & 4) +
          ((flags >> 4) & 8) + ((flags >> 5) & 16) + ((flags >> 6) & 32);
  return flags;
}


x86 assembly (clang, -O0):
<getcelltype>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xaaa,%eax
xor    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
xor    %edi,%edi
call   1030 <getbit@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
and    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x2,%eax
sar    $0x1,%eax
mov    -0x8(%rbp),%ecx
sar    $0x2,%ecx
and    $0x2,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%ecx
sar    $0x3,%ecx
and    $0x4,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%ecx
sar    $0x4,%ecx
and    $0x8,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%ecx
sar    $0x5,%ecx
and    $0x10,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%ecx
sar    $0x6,%ecx
and    $0x20,%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getcelltype>:
push   %rbx
mov    %edi,%ebx
not    %ebx
or     $0xfffff555,%ebx
xor    %edi,%edi
call   1030 <getbit@plt>
and    %ebx,%eax
mov    %eax,%ecx
shr    %ecx
and    $0x1,%ecx
mov    %eax,%edx
shr    $0x2,%edx
and    $0x2,%edx
or     %ecx,%edx
mov    %eax,%ecx
shr    $0x3,%ecx
and    $0x4,%ecx
or     %edx,%ecx
mov    %eax,%edx
shr    $0x4,%edx
and    $0x8,%edx
or     %ecx,%edx
mov    %eax,%ecx
shr    $0x5,%ecx
and    $0x10,%ecx
or     %edx,%ecx
shr    $0x6,%eax
and    $0x20,%eax
or     %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @getcelltype(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = and i32 2730, %4
%6 = xor i32 %5, -1
%7 = call i32 @getbit(i32 0)
%8 = and i32 %6, %7
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = and i32 %9, 2
%11 = ashr i32 %10, 1
%12 = load i32, i32* %3
%13 = ashr i32 %12, 2
%14 = and i32 %13, 2
%15 = add nsw i32 %11, %14
%16 = load i32, i32* %3
%17 = ashr i32 %16, 3
%18 = and i32 %17, 4
%19 = add nsw i32 %15, %18
%20 = load i32, i32* %3
%21 = ashr i32 %20, 4
%22 = and i32 %21, 8
%23 = add nsw i32 %19, %22
%24 = load i32, i32* %3
%25 = ashr i32 %24, 5
%26 = and i32 %25, 16
%27 = add nsw i32 %23, %26
%28 = load i32, i32* %3
%29 = ashr i32 %28, 6
%30 = and i32 %29, 32
%31 = add nsw i32 %27, %30
store i32 %31, i32* %3
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
define i32 @getcelltype(i32 %0) {
%2 = and i32 %0, 2730
%3 = xor i32 %2, -1
%4 = tail call i32 @getbit(i32 0)
%5 = and i32 %4, %3
%6 = lshr i32 %5, 1
%7 = and i32 %6, 1
%8 = lshr i32 %5, 2
%9 = and i32 %8, 2
%10 = or i32 %7, %9
%11 = lshr i32 %5, 3
%12 = and i32 %11, 4
%13 = or i32 %10, %12
%14 = lshr i32 %5, 4
%15 = and i32 %14, 8
%16 = or i32 %13, %15
%17 = lshr i32 %5, 5
%18 = and i32 %17, 16
%19 = or i32 %16, %18
%20 = lshr i32 %5, 6
%21 = and i32 %20, 32
%22 = or i32 %19, %21
ret i32 %22
}