#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 power_of_2(int);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int main(int argc, char **argv) {
  ((void)(argc));
  ((void)(argv));
  int n = 0;
  if (argc > 1) {
    sscanf(argv[1], "%i", &n);
  }
  printf("power_of_2(%i) = %i\n", n, power_of_2(n));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    116f <main+0x3f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe9a(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1050 <sscanf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <power_of_2@plt>
mov    -0x18(%rbp),%esi
mov    %eax,%edx
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
xor    %ebx,%ebx
cmp    $0x2,%edi
jl     115d <main+0x2d>
mov    0x8(%rsi),%rdi
lea    0xeb1(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1050 <sscanf@plt>
mov    0xc(%rsp),%ebx
mov    %ebx,%edi
call   1030 <power_of_2@plt>
lea    0xe98(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%i\00"
@.str.1 = [21 x i8] c"power_of_2(%i) = %i\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
store i32 0, i32* %6
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 1
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @sscanf(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
br label %16
16: ; preds = %11, %2
%17 = load i32, i32* %6
%18 = load i32, i32* %6
%19 = call i32 @power_of_2(i32 %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %17, i32 %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
@.str.1 = [21 x i8] c"power_of_2(%i) = %i\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %3
br label %11
11: ; preds = %6, %2
%12 = phi i32 [ %10, %6 ], [ 0, %2 ]
%13 = call i32 @power_of_2(i32 %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 %13)
ret i32 0
}