#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 atoi(char *);
scalar_t__ find_in_power_serise(int, int);
scalar_t__ find_in_power_serise_of_2(int);
scalar_t__ find_in_power_serise_of_2_no_loop(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, int, char *, int);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  if (argc != 2) {
    fprintf(stderr, "USAGE:%s <number>\n", argv[0]);
    return -1;
  }
  int num = atoi(argv[1]);
  int power = 2;
  printf("%d is %s Power Serise of %d\n", num,
         find_in_power_serise(num, power) ? "IN" : "NOT IN", power);
  printf("%d is %s Power Serise of %d\n", num,
         find_in_power_serise_of_2(num) ? "IN" : "NOT IN", 2);
  printf("%d is %s Power Serise of %d\n", num,
         find_in_power_serise_of_2_no_loop(num) ? "IN" : "NOT IN", 2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11a8 <main+0x48>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe69(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1278 <main+0x118>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x14(%rbp)
movl   $0x2,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1070 <find_in_power_serise@plt>
mov    -0x24(%rbp),%esi
mov    %rax,%rcx
lea    0xe53(%rip),%rdx
lea    0xe50(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdx
mov    -0x18(%rbp),%ecx
lea    0xe1d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
call   1060 <find_in_power_serise_of_2@plt>
mov    -0x20(%rbp),%esi
mov    %rax,%rcx
lea    0xe1a(%rip),%rdx
lea    0xe17(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdx
lea    0xde7(%rip),%rdi
mov    $0x2,%ecx
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <find_in_power_serise_of_2_no_loop@plt>
mov    -0x1c(%rbp),%esi
mov    %rax,%rcx
lea    0xddf(%rip),%rdx
lea    0xddc(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdx
lea    0xdac(%rip),%rdi
mov    $0x2,%ecx
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    11fa <main+0x9a>
mov    0x8(%rsi),%rdi
call   1080 <atoi@plt>
mov    %eax,%ebx
mov    %eax,%edi
mov    $0x2,%esi
call   1070 <find_in_power_serise@plt>
test   %rax,%rax
lea    0xe9e(%rip),%r12
lea    0xe9b(%rip),%r14
mov    %r14,%rdx
cmove  %r12,%rdx
lea    0xe6c(%rip),%r15
mov    %r15,%rdi
mov    %ebx,%esi
mov    $0x2,%ecx
call   1030 <printf@plt>
mov    %ebx,%edi
call   1060 <find_in_power_serise_of_2@plt>
test   %rax,%rax
mov    %r14,%rdx
cmove  %r12,%rdx
mov    %r15,%rdi
mov    %ebx,%esi
mov    $0x2,%ecx
call   1030 <printf@plt>
mov    %ebx,%edi
call   1050 <find_in_power_serise_of_2_no_loop@plt>
test   %rax,%rax
cmove  %r12,%r14
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14,%rdx
mov    $0x2,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
jmp    1217 <main+0xb7>
mov    0x2ddf(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xdf3(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"USAGE:%s <number>\0A\00"
@.str.1 = [29 x i8] c"%d is %s Power Serise of %d\0A\00"
@.str.2 = [3 x i8] c"IN\00"
@.str.3 = [7 x i8] c"NOT IN\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %14)
store i32 -1, i32* %3
br label %44
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @atoi(i8* %19)
store i32 %20, i32* %6
store i32 2, i32* %7
%21 = load i32, i32* %6
%22 = load i32, i32* %6
%23 = load i32, i32* %7
%24 = call i64 @find_in_power_serise(i32 %22, i32 %23)
%25 = icmp ne i64 %24, 0
%26 = zext i1 %25 to i64
%27 = select i1 %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0)
%28 = load i32, i32* %7
%29 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %21, i8* %27, i32 %28)
%30 = load i32, i32* %6
%31 = load i32, i32* %6
%32 = call i64 @find_in_power_serise_of_2(i32 %31)
%33 = icmp ne i64 %32, 0
%34 = zext i1 %33 to i64
%35 = select i1 %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0)
%36 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %30, i8* %35, i32 2)
%37 = load i32, i32* %6
%38 = load i32, i32* %6
%39 = call i64 @find_in_power_serise_of_2_no_loop(i32 %38)
%40 = icmp ne i64 %39, 0
%41 = zext i1 %40 to i64
%42 = select i1 %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0)
%43 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %37, i8* %42, i32 2)
store i32 0, i32* %3
br label %44
44: ; preds = %16, %10
%45 = load i32, i32* %3
ret i32 %45
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"USAGE:%s <number>\0A\00"
@.str.1 = [29 x i8] c"%d is %s Power Serise of %d\0A\00"
@.str.2 = [3 x i8] c"IN\00"
@.str.3 = [7 x i8] c"NOT IN\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %24
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
%12 = tail call i64 @find_in_power_serise(i32 %11, i32 2)
%13 = icmp eq i64 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %11, i8* %14, i32 2)
%16 = tail call i64 @find_in_power_serise_of_2(i32 %11)
%17 = icmp eq i64 %16, 0
%18 = select i1 %17, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%19 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %11, i8* %18, i32 2)
%20 = tail call i64 @find_in_power_serise_of_2_no_loop(i32 %11)
%21 = icmp eq i64 %20, 0
%22 = select i1 %21, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%23 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %11, i8* %22, i32 2)
br label %24
24: ; preds = %8, %4
%25 = phi i32 [ -1, %4 ], [ 0, %8 ]
ret i32 %25
}