#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*/ x;

/* Variables and functions */
scalar_t__ is_power_of_two(unsigned int);
int next_power_of_two1(unsigned int);
int next_power_of_two2(unsigned int);
int next_power_of_two3(unsigned int);
int next_power_of_two4(unsigned int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  unsigned int x[] = {1, 17, 32, 43, 121};
  int i;
  printf("sizeof int: %ld\n", sizeof(unsigned int));
  for (i = 0; i < sizeof(x) / sizeof(x[0]); i++) {
    printf(is_power_of_two(x[i]) ? "true\n" : "false\n");
    printf("%d -> %d\n", x[i], next_power_of_two1(x[i]));
    printf("%d -> %d\n", x[i], next_power_of_two2(x[i]));
    printf("%d -> %d\n", x[i], next_power_of_two3(x[i]));
    printf("%d -> %d\n", x[i], next_power_of_two4(x[i]));
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xe83(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe80(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xe7e(%rip),%eax
mov    %eax,-0x20(%rbp)
lea    0xe78(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x34(%rbp)
movslq -0x34(%rbp),%rax
cmp    $0x5,%rax
jae    12a4 <main+0x144>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
call   1080 <is_power_of_two@plt>
mov    %rax,%rcx
lea    0xe57(%rip),%rdi
lea    0xe4a(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x44(%rbp)
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
call   1060 <next_power_of_two1@plt>
mov    -0x44(%rbp),%esi
mov    %eax,%edx
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x40(%rbp)
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
call   1030 <next_power_of_two2@plt>
mov    -0x40(%rbp),%esi
mov    %eax,%edx
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x3c(%rbp)
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
call   1070 <next_power_of_two3@plt>
mov    -0x3c(%rbp),%esi
mov    %eax,%edx
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x38(%rbp)
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
call   1040 <next_power_of_two4@plt>
mov    -0x38(%rbp),%esi
mov    %eax,%edx
lea    0xda3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11af <main+0x4f>
lea    0xd8f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xe84(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   1090 <is_power_of_two@plt>
test   %rax,%rax
lea    0xe7b(%rip),%r15
lea    0xe6e(%rip),%r14
mov    %r14,%rdi
cmove  %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   1070 <next_power_of_two1@plt>
lea    0xe5c(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   1030 <next_power_of_two2@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   1080 <next_power_of_two3@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   1050 <next_power_of_two4@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x11,%edi
call   1090 <is_power_of_two@plt>
test   %rax,%rax
mov    %r14,%rdi
cmove  %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x11,%edi
call   1070 <next_power_of_two1@plt>
mov    %rbx,%rdi
mov    $0x11,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x11,%edi
call   1030 <next_power_of_two2@plt>
mov    %rbx,%rdi
mov    $0x11,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x11,%edi
call   1080 <next_power_of_two3@plt>
mov    %rbx,%rdi
mov    $0x11,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x11,%edi
call   1050 <next_power_of_two4@plt>
mov    %rbx,%rdi
mov    $0x11,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x20,%edi
call   1090 <is_power_of_two@plt>
test   %rax,%rax
mov    %r14,%rdi
cmove  %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x20,%edi
call   1070 <next_power_of_two1@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x20,%edi
call   1030 <next_power_of_two2@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x20,%edi
call   1080 <next_power_of_two3@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x20,%edi
call   1050 <next_power_of_two4@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x2b,%edi
call   1090 <is_power_of_two@plt>
test   %rax,%rax
mov    %r14,%rdi
cmove  %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x2b,%edi
call   1070 <next_power_of_two1@plt>
mov    %rbx,%rdi
mov    $0x2b,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x2b,%edi
call   1030 <next_power_of_two2@plt>
mov    %rbx,%rdi
mov    $0x2b,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x2b,%edi
call   1080 <next_power_of_two3@plt>
mov    %rbx,%rdi
mov    $0x2b,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x2b,%edi
call   1050 <next_power_of_two4@plt>
mov    %rbx,%rdi
mov    $0x2b,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x79,%edi
call   1090 <is_power_of_two@plt>
test   %rax,%rax
cmove  %r15,%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x79,%edi
call   1070 <next_power_of_two1@plt>
mov    %rbx,%rdi
mov    $0x79,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x79,%edi
call   1030 <next_power_of_two2@plt>
mov    %rbx,%rdi
mov    $0x79,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x79,%edi
call   1080 <next_power_of_two3@plt>
mov    %rbx,%rdi
mov    $0x79,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x79,%edi
call   1050 <next_power_of_two4@plt>
mov    %rbx,%rdi
mov    $0x79,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.x = [5 x i32] [i32 1, i32 17, i32 32, i32 43, i32 121]
@.str = [17 x i8] c"sizeof int: %ld\0A\00"
@.str.1 = [6 x i8] c"true\0A\00"
@.str.2 = [7 x i8] c"false\0A\00"
@.str.3 = [10 x i8] c"%d -> %d\0A\00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [5 x i32]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [5 x i32]* %6 to i8*
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 4)
store i32 0, i32* %7
br label %10
10: ; preds = %64, %2
%11 = load i32, i32* %7
%12 = sext i32 %11 to i64
%13 = icmp ult i64 %12, 5
br i1 %13, label %14, label %67
14: ; preds = %10
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = call i64 @is_power_of_two(i32 %18)
%20 = icmp ne i64 %19, 0
%21 = zext i1 %20 to i64
%22 = select i1 %20, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0)
%23 = call i32 (i8*, ...) @printf(i8* %22)
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %25
%27 = load i32, i32* %26
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %29
%31 = load i32, i32* %30
%32 = call i32 @next_power_of_two1(i32 %31)
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %27, i32 %32)
%34 = load i32, i32* %7
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %35
%37 = load i32, i32* %36
%38 = load i32, i32* %7
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %39
%41 = load i32, i32* %40
%42 = call i32 @next_power_of_two2(i32 %41)
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %37, i32 %42)
%44 = load i32, i32* %7
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = load i32, i32* %7
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %49
%51 = load i32, i32* %50
%52 = call i32 @next_power_of_two3(i32 %51)
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %47, i32 %52)
%54 = load i32, i32* %7
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %55
%57 = load i32, i32* %56
%58 = load i32, i32* %7
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %59
%61 = load i32, i32* %60
%62 = call i32 @next_power_of_two4(i32 %61)
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %57, i32 %62)
br label %64
64: ; preds = %14
%65 = load i32, i32* %7
%66 = add nsw i32 %65, 1
store i32 %66, i32* %7
br label %10
67: ; preds = %10
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"sizeof int: %ld\0A\00"
@.str.1 = [6 x i8] c"true\0A\00"
@.str.2 = [7 x i8] c"false\0A\00"
@.str.3 = [10 x i8] c"%d -> %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 4)
%4 = tail call i64 @is_power_of_two(i32 1)
%5 = icmp eq i64 %4, 0
%6 = select i1 %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %6)
%8 = tail call i32 @next_power_of_two1(i32 1)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 %8)
%10 = tail call i32 @next_power_of_two2(i32 1)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 %10)
%12 = tail call i32 @next_power_of_two3(i32 1)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 %12)
%14 = tail call i32 @next_power_of_two4(i32 1)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 %14)
%16 = tail call i64 @is_power_of_two(i32 17)
%17 = icmp eq i64 %16, 0
%18 = select i1 %17, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %18)
%20 = tail call i32 @next_power_of_two1(i32 17)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 17, i32 %20)
%22 = tail call i32 @next_power_of_two2(i32 17)
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 17, i32 %22)
%24 = tail call i32 @next_power_of_two3(i32 17)
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 17, i32 %24)
%26 = tail call i32 @next_power_of_two4(i32 17)
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 17, i32 %26)
%28 = tail call i64 @is_power_of_two(i32 32)
%29 = icmp eq i64 %28, 0
%30 = select i1 %29, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0)
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %30)
%32 = tail call i32 @next_power_of_two1(i32 32)
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 32, i32 %32)
%34 = tail call i32 @next_power_of_two2(i32 32)
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 32, i32 %34)
%36 = tail call i32 @next_power_of_two3(i32 32)
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 32, i32 %36)
%38 = tail call i32 @next_power_of_two4(i32 32)
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 32, i32 %38)
%40 = tail call i64 @is_power_of_two(i32 43)
%41 = icmp eq i64 %40, 0
%42 = select i1 %41, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0)
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %42)
%44 = tail call i32 @next_power_of_two1(i32 43)
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 43, i32 %44)
%46 = tail call i32 @next_power_of_two2(i32 43)
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 43, i32 %46)
%48 = tail call i32 @next_power_of_two3(i32 43)
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 43, i32 %48)
%50 = tail call i32 @next_power_of_two4(i32 43)
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 43, i32 %50)
%52 = tail call i64 @is_power_of_two(i32 121)
%53 = icmp eq i64 %52, 0
%54 = select i1 %53, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0)
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %54)
%56 = tail call i32 @next_power_of_two1(i32 121)
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 121, i32 %56)
%58 = tail call i32 @next_power_of_two2(i32 121)
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 121, i32 %58)
%60 = tail call i32 @next_power_of_two3(i32 121)
%61 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 121, i32 %60)
%62 = tail call i32 @next_power_of_two4(i32 121)
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 121, i32 %62)
%64 = tail call i32 @putchar(i32 10)
ret i32 0
}