#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 uint32_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
scalar_t__ is_power_of_two(int);
scalar_t__ is_power_of_two_naive(int);
int /*<<< orphan*/ printf(char *, int);
void verify() {
  uint32_t x = 0;
  while (1) {
    if ((x & 0xfffff) == 0) {
      printf("%x\n", x);
    }
    assert(is_power_of_two(x) == is_power_of_two_naive(x));
    x += 1;
    if (x == 0)
      break;
  }
}


x86 assembly (clang, -O0):
<verify>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xfffff,%eax
cmp    $0x0,%eax
jne    116f <verify+0x2f>
mov    -0x4(%rbp),%esi
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1050 <is_power_of_two@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <is_power_of_two_naive@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    11b2 <verify+0x72>
jmp    11b7 <verify+0x77>
jmp    114f <verify+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verify>:
push   %r15
push   %r14
push   %rbx
xor    %ebx,%ebx
lea    0xeb2(%rip),%r14
jmp    1172 <verify+0x32>
mov    %ebx,%edi
call   1050 <is_power_of_two@plt>
mov    %rax,%r15
mov    %ebx,%edi
call   1060 <is_power_of_two_naive@plt>
xor    %edi,%edi
cmp    %rax,%r15
sete   %dil
call   1040 <assert@plt>
add    $0x1,%ebx
test   $0xfffff,%ebx
jne    1150 <verify+0x10>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
jmp    1150 <verify+0x10>

LLVM IR (-O0):
@.str = [4 x i8] c"%x\0A\00"
define void @verify() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %0, %22
%3 = load i32, i32* %1
%4 = and i32 %3, 1048575
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = load i32, i32* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %6, %2
%10 = load i32, i32* %1
%11 = call i64 @is_power_of_two(i32 %10)
%12 = load i32, i32* %1
%13 = call i64 @is_power_of_two_naive(i32 %12)
%14 = icmp eq i64 %11, %13
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = load i32, i32* %1
%18 = add nsw i32 %17, 1
store i32 %18, i32* %1
%19 = load i32, i32* %1
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %9
br label %23
22: ; preds = %9
br label %2
23: ; preds = %21
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%x\0A\00"
define void @verify() {
br label %1
1: ; preds = %7, %0
%2 = phi i32 [ 0, %0 ], [ %13, %7 ]
%3 = and i32 %2, 1048575
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %7
7: ; preds = %5, %1
%8 = tail call i64 @is_power_of_two(i32 %2)
%9 = tail call i64 @is_power_of_two_naive(i32 %2)
%10 = icmp eq i64 %8, %9
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = add nuw nsw i32 %2, 1
br label %1
}