#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 ceilPower2(int);
char *test_ceilPower2() {
  do {
    if (!(ceilPower2(16) == 16))
      return "error, ceilPower2(16) != 16";
  } while (0);
  do {
    if (!(ceilPower2(15) == 16))
      return "error, ceilPower2(15) != 16";
  } while (0);
  do {
    if (!(ceilPower2(17) == 32))
      return "error, ceilPower2(17) != 32";
  } while (0);
  do {
    if (!(ceilPower2(1) == 1))
      return "error, ceilPower2(1) != 1";
  } while (0);
  do {
    if (!(ceilPower2(1073741824) == 1073741824))
      return "error, ceilPower2(2^30) != 2^30";
  } while (0);
  do {
    if (!(ceilPower2(1073741823) == 1073741824))
      return "error, ceilPower2(2^30-1) != 2^30";
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<test_ceilPower2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x10,%edi
call   1030 <ceilPower2@plt>
cmp    $0x10,%eax
je     113b <test_ceilPower2+0x2b>
lea    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122d <test_ceilPower2+0x11d>
jmp    1140 <test_ceilPower2+0x30>
jmp    1145 <test_ceilPower2+0x35>
mov    $0xf,%edi
call   1030 <ceilPower2@plt>
cmp    $0x10,%eax
je     1168 <test_ceilPower2+0x58>
lea    0xebd(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122d <test_ceilPower2+0x11d>
jmp    116d <test_ceilPower2+0x5d>
jmp    1172 <test_ceilPower2+0x62>
mov    $0x11,%edi
call   1030 <ceilPower2@plt>
cmp    $0x20,%eax
je     1195 <test_ceilPower2+0x85>
lea    0xeac(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122d <test_ceilPower2+0x11d>
jmp    119a <test_ceilPower2+0x8a>
jmp    119f <test_ceilPower2+0x8f>
mov    $0x1,%edi
call   1030 <ceilPower2@plt>
cmp    $0x1,%eax
je     11c2 <test_ceilPower2+0xb2>
lea    0xe9b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122d <test_ceilPower2+0x11d>
jmp    11c7 <test_ceilPower2+0xb7>
jmp    11cc <test_ceilPower2+0xbc>
mov    $0x40000000,%edi
call   1030 <ceilPower2@plt>
cmp    $0x40000000,%eax
je     11f1 <test_ceilPower2+0xe1>
lea    0xe86(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122d <test_ceilPower2+0x11d>
jmp    11f6 <test_ceilPower2+0xe6>
jmp    11fb <test_ceilPower2+0xeb>
mov    $0x3fffffff,%edi
call   1030 <ceilPower2@plt>
cmp    $0x40000000,%eax
je     1220 <test_ceilPower2+0x110>
lea    0xe77(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    122d <test_ceilPower2+0x11d>
jmp    1225 <test_ceilPower2+0x115>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_ceilPower2>:
push   %rax
mov    $0x10,%edi
call   1030 <ceilPower2@plt>
cmp    $0x10,%eax
jne    117f <test_ceilPower2+0x6f>
mov    $0xf,%edi
call   1030 <ceilPower2@plt>
cmp    $0x10,%eax
jne    1188 <test_ceilPower2+0x78>
mov    $0x11,%edi
call   1030 <ceilPower2@plt>
cmp    $0x20,%eax
jne    1191 <test_ceilPower2+0x81>
mov    $0x1,%edi
call   1030 <ceilPower2@plt>
cmp    $0x1,%eax
jne    119a <test_ceilPower2+0x8a>
mov    $0x40000000,%edi
call   1030 <ceilPower2@plt>
cmp    $0x40000000,%eax
jne    11a3 <test_ceilPower2+0x93>
mov    $0x3fffffff,%edi
call   1030 <ceilPower2@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x40000000,%ecx
lea    0xf15(%rip),%rcx
cmovne %rcx,%rax
pop    %rcx
ret
lea    0xe7a(%rip),%rax
pop    %rcx
ret
lea    0xe8d(%rip),%rax
pop    %rcx
ret
lea    0xea0(%rip),%rax
pop    %rcx
ret
lea    0xeb3(%rip),%rax
pop    %rcx
ret
lea    0xec4(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"error, ceilPower2(16) != 16\00"
@.str.1 = [28 x i8] c"error, ceilPower2(15) != 16\00"
@.str.2 = [28 x i8] c"error, ceilPower2(17) != 32\00"
@.str.3 = [26 x i8] c"error, ceilPower2(1) != 1\00"
@.str.4 = [32 x i8] c"error, ceilPower2(2^30) != 2^30\00"
@.str.5 = [34 x i8] c"error, ceilPower2(2^30-1) != 2^30\00"
define i8* @test_ceilPower2() {
%1 = alloca i8*
br label %2
2: ; preds = %0
%3 = call i32 @ceilPower2(i32 16)
%4 = icmp eq i32 %3, 16
br i1 %4, label %6, label %5
5: ; preds = %2
store i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8** %1
br label %38
6: ; preds = %2
br label %7
7: ; preds = %6
br label %8
8: ; preds = %7
%9 = call i32 @ceilPower2(i32 15)
%10 = icmp eq i32 %9, 16
br i1 %10, label %12, label %11
11: ; preds = %8
store i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %38
12: ; preds = %8
br label %13
13: ; preds = %12
br label %14
14: ; preds = %13
%15 = call i32 @ceilPower2(i32 17)
%16 = icmp eq i32 %15, 32
br i1 %16, label %18, label %17
17: ; preds = %14
store i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8** %1
br label %38
18: ; preds = %14
br label %19
19: ; preds = %18
br label %20
20: ; preds = %19
%21 = call i32 @ceilPower2(i32 1)
%22 = icmp eq i32 %21, 1
br i1 %22, label %24, label %23
23: ; preds = %20
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8** %1
br label %38
24: ; preds = %20
br label %25
25: ; preds = %24
br label %26
26: ; preds = %25
%27 = call i32 @ceilPower2(i32 1073741824)
%28 = icmp eq i32 %27, 1073741824
br i1 %28, label %30, label %29
29: ; preds = %26
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8** %1
br label %38
30: ; preds = %26
br label %31
31: ; preds = %30
br label %32
32: ; preds = %31
%33 = call i32 @ceilPower2(i32 1073741823)
%34 = icmp eq i32 %33, 1073741824
br i1 %34, label %36, label %35
35: ; preds = %32
store i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i8** %1
br label %38
36: ; preds = %32
br label %37
37: ; preds = %36
store i8* null, i8** %1
br label %38
38: ; preds = %37, %35, %29, %23, %17, %11, %5
%39 = load i8*, i8** %1
ret i8* %39
}

LLVM IR (-O2):
@.str = [28 x i8] c"error, ceilPower2(16) != 16\00"
@.str.1 = [28 x i8] c"error, ceilPower2(15) != 16\00"
@.str.2 = [28 x i8] c"error, ceilPower2(17) != 32\00"
@.str.3 = [26 x i8] c"error, ceilPower2(1) != 1\00"
@.str.4 = [32 x i8] c"error, ceilPower2(2^30) != 2^30\00"
@.str.5 = [34 x i8] c"error, ceilPower2(2^30-1) != 2^30\00"
define i8* @test_ceilPower2() {
%1 = tail call i32 @ceilPower2(i32 16)
%2 = icmp eq i32 %1, 16
br i1 %2, label %3, label %19
3: ; preds = %0
%4 = tail call i32 @ceilPower2(i32 15)
%5 = icmp eq i32 %4, 16
br i1 %5, label %6, label %19
6: ; preds = %3
%7 = tail call i32 @ceilPower2(i32 17)
%8 = icmp eq i32 %7, 32
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = tail call i32 @ceilPower2(i32 1)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %19
12: ; preds = %9
%13 = tail call i32 @ceilPower2(i32 1073741824)
%14 = icmp eq i32 %13, 1073741824
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = tail call i32 @ceilPower2(i32 1073741823)
%17 = icmp eq i32 %16, 1073741824
%18 = select i1 %17, i8* null, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0)
br label %19
19: ; preds = %15, %12, %9, %6, %3, %0
%20 = phi i8* [ getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), %0 ], [ getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), %6 ], [ getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), %9 ], [ getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), %12 ], [ %18, %15 ]
ret i8* %20
}