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

/* Variables and functions */
scalar_t__ is_nth_bit_set(unsigned int, int);
int find_in_power_serise_of_2(unsigned int number) {
  int count = 0;
  for (int i = 0; i < (sizeof(number) * 8); i++) {
    if (is_nth_bit_set(number, i)) {
      count++;
    }
  }
  if (count == 1) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<find_in_power_serise_of_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movslq -0x10(%rbp),%rax
cmp    $0x20,%rax
jae    1168 <find_in_power_serise_of_2+0x58>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <is_nth_bit_set@plt>
cmp    $0x0,%rax
je     1155 <find_in_power_serise_of_2+0x45>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115a <find_in_power_serise_of_2+0x4a>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1129 <find_in_power_serise_of_2+0x19>
cmpl   $0x1,-0xc(%rbp)
jne    117e <find_in_power_serise_of_2+0x6e>
movl   $0x1,-0x4(%rbp)
jmp    1185 <find_in_power_serise_of_2+0x75>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_in_power_serise_of_2>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
xor    %ebp,%ebp
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    %r14d,%edi
mov    %ebp,%esi
call   1030 <is_nth_bit_set@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebx
add    $0x1,%ebp
cmp    $0x20,%ebp
jne    1120 <find_in_power_serise_of_2+0x10>
xor    %eax,%eax
cmp    $0x1,%ebx
sete   %al
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @find_in_power_serise_of_2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %19, %1
%7 = load i32, i32* %5
%8 = sext i32 %7 to i64
%9 = icmp ult i64 %8, 32
br i1 %9, label %10, label %22
10: ; preds = %6
%11 = load i32, i32* %3
%12 = load i32, i32* %5
%13 = call i64 @is_nth_bit_set(i32 %11, i32 %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %10
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
store i32 %17, i32* %4
br label %18
18: ; preds = %15, %10
br label %19
19: ; preds = %18
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %6
22: ; preds = %6
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %26
25: ; preds = %22
store i32 1, i32* %2
br label %27
26: ; preds = %22
store i32 0, i32* %2
br label %27
27: ; preds = %26, %25
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
define i32 @find_in_power_serise_of_2(i32 %0) {
br label %5
2: ; preds = %5
%3 = icmp eq i32 %11, 1
%4 = zext i1 %3 to i32
ret i32 %4
5: ; preds = %1, %5
%6 = phi i32 [ 0, %1 ], [ %12, %5 ]
%7 = phi i32 [ 0, %1 ], [ %11, %5 ]
%8 = tail call i64 @is_nth_bit_set(i32 %0, i32 %6)
%9 = icmp ne i64 %8, 0
%10 = zext i1 %9 to i32
%11 = add nuw nsw i32 %7, %10
%12 = add nuw nsw i32 %6, 1
%13 = icmp eq i32 %12, 32
br i1 %13, label %2, label %5
}