#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 */
typedef int /*<<< orphan*/ arr;

/* Variables and functions */
bool isPowerOfTwo0(int n) {
  int arr[] = {1,         2,        4,        8,         16,        32,
               64,        128,      256,      512,       1024,      2048,
               4096,      8192,     16384,    32768,     65536,     131072,
               262144,    524288,   1048576,  2097152,   4194304,   8388608,
               16777216,  33554432, 67108864, 134217728, 268435456, 536870912,
               1073741824};
  for (int i = 0; i < sizeof(arr) / sizeof(int); i++)
    if (n == arr[i])
      return true;
  return false;
}


x86 assembly (clang, -O0):
<isPowerOfTwo0>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x8(%rbp)
lea    -0x90(%rbp),%rdi
lea    0xed4(%rip),%rsi
mov    $0x7c,%edx
call   1030 <memcpy@plt>
movl   $0x0,-0x94(%rbp)
movslq -0x94(%rbp),%rax
cmp    $0x1f,%rax
jae    118d <isPowerOfTwo0+0x7d>
mov    -0x8(%rbp),%eax
movslq -0x94(%rbp),%rcx
cmp    -0x90(%rbp,%rcx,4),%eax
jne    1174 <isPowerOfTwo0+0x64>
movl   $0x1,-0x4(%rbp)
jmp    1194 <isPowerOfTwo0+0x84>
jmp    1179 <isPowerOfTwo0+0x69>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    1140 <isPowerOfTwo0+0x30>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPowerOfTwo0>:
mov    $0x1,%al
cmp    $0x1,%edi
je     1156 <isPowerOfTwo0+0x56>
mov    $0xffffffffffffffff,%rcx
lea    0xeeb(%rip),%rdx
cs nopw 0x0(%rax,%rax,1)
nop
cmp    %edi,0x8(%rdx,%rcx,4)
je     1156 <isPowerOfTwo0+0x56>
cmp    %edi,0xc(%rdx,%rcx,4)
je     1156 <isPowerOfTwo0+0x56>
cmp    $0x1b,%rcx
je     114b <isPowerOfTwo0+0x4b>
cmp    %edi,0x10(%rdx,%rcx,4)
je     114b <isPowerOfTwo0+0x4b>
lea    0x4(%rcx),%rsi
cmp    %edi,0x14(%rdx,%rcx,4)
mov    %rsi,%rcx
jne    1120 <isPowerOfTwo0+0x20>
cmp    $0x1e,%rsi
jmp    1153 <isPowerOfTwo0+0x53>
add    $0x1,%rcx
cmp    $0x1c,%rcx
setb   %al
movzbl %al,%eax
ret

LLVM IR (-O0):
@__const.isPowerOfTwo0.arr = [31 x i32] [i32 1, i32 2, i32 4, i32 8, i32 16, i32 32, i32 64, i32 128, i32 256, i32 512, i32 1024, i32 2048, i32 4096, i32 8192, i32 16384, i32 32768, i32 65536, i32 131072, i32 262144, i32 524288, i32 1048576, i32 2097152, i32 4194304, i32 8388608, i32 16777216, i32 33554432, i32 67108864, i32 134217728, i32 268435456, i32 536870912, i32 1073741824]
define i32 @isPowerOfTwo0(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [31 x i32]
%5 = alloca i32
store i32 %0, i32* %3
%6 = bitcast [31 x i32]* %4 to i8*
store i32 0, i32* %5
br label %7
7: ; preds = %20, %1
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = icmp ult i64 %9, 31
br i1 %10, label %11, label %23
11: ; preds = %7
%12 = load i32, i32* %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [31 x i32], [31 x i32]* %4, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = icmp eq i32 %12, %16
br i1 %17, label %18, label %19
18: ; preds = %11
store i32 1, i32* %2
br label %24
19: ; preds = %11
br label %20
20: ; preds = %19
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
br label %7
23: ; preds = %7
store i32 0, i32* %2
br label %24
24: ; preds = %23, %18
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
@__const.isPowerOfTwo0.arr = [31 x i32] [i32 1, i32 2, i32 4, i32 8, i32 16, i32 32, i32 64, i32 128, i32 256, i32 512, i32 1024, i32 2048, i32 4096, i32 8192, i32 16384, i32 32768, i32 65536, i32 131072, i32 262144, i32 524288, i32 1048576, i32 2097152, i32 4194304, i32 8388608, i32 16777216, i32 33554432, i32 67108864, i32 134217728, i32 268435456, i32 536870912, i32 1073741824]
define i32 @isPowerOfTwo0(i32 %0) {
%2 = icmp eq i32 %0, 1
br i1 %2, label %32, label %3
3: ; preds = %1, %21
%4 = phi i64 [ %22, %21 ], [ 0, %1 ]
%5 = or i64 %4, 1
%6 = getelementptr inbounds [31 x i32], [31 x i32]* @__const.isPowerOfTwo0.arr, i64 0, i64 %5
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, %0
br i1 %8, label %32, label %9
9: ; preds = %3
%10 = or i64 %4, 2
%11 = getelementptr inbounds [31 x i32], [31 x i32]* @__const.isPowerOfTwo0.arr, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, %0
br i1 %13, label %32, label %14
14: ; preds = %9
%15 = or i64 %4, 3
%16 = icmp eq i64 %15, 31
br i1 %16, label %30, label %17
17: ; preds = %14
%18 = getelementptr inbounds [31 x i32], [31 x i32]* @__const.isPowerOfTwo0.arr, i64 0, i64 %15
%19 = load i32, i32* %18
%20 = icmp eq i32 %19, %0
br i1 %20, label %28, label %21
21: ; preds = %17
%22 = add nuw nsw i64 %4, 4
%23 = getelementptr inbounds [31 x i32], [31 x i32]* @__const.isPowerOfTwo0.arr, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = icmp eq i32 %24, %0
br i1 %25, label %26, label %3
26: ; preds = %21
%27 = icmp ult i64 %15, 30
br label %32
28: ; preds = %17
%29 = icmp ult i64 %4, 28
br label %32
30: ; preds = %14
%31 = icmp ult i64 %4, 28
br label %32
32: ; preds = %26, %28, %30, %9, %3, %1
%33 = phi i1 [ true, %1 ], [ %27, %26 ], [ %29, %28 ], [ %31, %30 ], [ true, %9 ], [ true, %3 ]
%34 = zext i1 %33 to i32
ret i32 %34
}