#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 */
int EXIT_SUCCESS;
int power_of_two(unsigned char);
int /*<<< orphan*/ printf(char *, unsigned char, int);
int main(void) {
  unsigned char arr[] = {8, 16, 24, 13, 32, 65, 254};
  int i;
  for (i = 0; i < sizeof(arr) / sizeof(arr[0]); i++)
    printf("%3d - is a power of two? %d\n", arr[i], power_of_two(arr[i]));
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xecb(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xec5(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xebd(%rip),%al
mov    %al,-0x5(%rbp)
movl   $0x0,-0x10(%rbp)
movslq -0x10(%rbp),%rax
cmp    $0x7,%rax
jae    119c <main+0x7c>
movslq -0x10(%rbp),%rax
mov    -0xb(%rbp,%rax,1),%al
mov    %al,-0x11(%rbp)
movslq -0x10(%rbp),%rax
movzbl -0xb(%rbp,%rax,1),%edi
call   1040 <power_of_two@plt>
mov    %eax,%edx
mov    -0x11(%rbp),%al
lea    0xe81(%rip),%rdi
movzbl %al,%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1153 <main+0x33>
mov    0x2e3d(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x8,%edi
call   1040 <power_of_two@plt>
lea    0xece(%rip),%rbx
mov    %rbx,%rdi
mov    $0x8,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0x10,%edi
call   1040 <power_of_two@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0x18,%edi
call   1040 <power_of_two@plt>
mov    %rbx,%rdi
mov    $0x18,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xd,%edi
call   1040 <power_of_two@plt>
mov    %rbx,%rdi
mov    $0xd,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0x20,%edi
call   1040 <power_of_two@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0x41,%edi
call   1040 <power_of_two@plt>
mov    %rbx,%rdi
mov    $0x41,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xfe,%edi
call   1040 <power_of_two@plt>
mov    %rbx,%rdi
mov    $0xfe,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    0x2e02(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.arr = [7 x i8] c"\08\10\18\0D A\FE"
@.str = [29 x i8] c"%3d - is a power of two? %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [7 x i8]* %2 to i8*
store i32 0, i32* %3
br label %5
5: ; preds = %20, %0
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = icmp ult i64 %7, 7
br i1 %8, label %9, label %23
9: ; preds = %5
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 %11
%13 = load i8, i8* %12
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = call i32 @power_of_two(i8 zeroext %17)
%19 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8 zeroext %13, i32 %18)
br label %20
20: ; preds = %9
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %5
23: ; preds = %5
%24 = load i32, i32* @EXIT_SUCCESS
ret i32 %24
}

LLVM IR (-O2):
@.str = [29 x i8] c"%3d - is a power of two? %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 @power_of_two(i8 zeroext 8)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8 zeroext 8, i32 %1)
%3 = tail call i32 @power_of_two(i8 zeroext 16)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8 zeroext 16, i32 %3)
%5 = tail call i32 @power_of_two(i8 zeroext 24)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8 zeroext 24, i32 %5)
%7 = tail call i32 @power_of_two(i8 zeroext 13)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8 zeroext 13, i32 %7)
%9 = tail call i32 @power_of_two(i8 zeroext 32)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8 zeroext 32, i32 %9)
%11 = tail call i32 @power_of_two(i8 zeroext 65)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8 zeroext 65, i32 %11)
%13 = tail call i32 @power_of_two(i8 zeroext -2)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8 zeroext -2, i32 %13)
%15 = load i32, i32* @EXIT_SUCCESS
ret i32 %15
}