#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 */
scalar_t__ ERANGE;
int EXIT_FAILURE;
int EXIT_SUCCESS;
scalar_t__ errno;
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int ispowerful(unsigned long);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stderr;
long strtol(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ usage(char *);
int main(int argc, char *argv[]) {
  long int number;
  if (argc != 2) {
    usage(argv[0]);
    return EXIT_FAILURE;
  }
  number = strtol(argv[1], NULL, 0);
  if (errno == ERANGE) {
    fputs("The number specified is too large.", stderr);
    return EXIT_FAILURE;
  }
  if (number <= 0) {
    fputs("The number specified should be positive.", stderr);
    return EXIT_FAILURE;
  }
  printf("%d\n", ispowerful((unsigned long int)number));
  return EXIT_SUCCESS;
}


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)
cmpl   $0x2,-0x8(%rbp)
je     118d <main+0x3d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1070 <usage@plt>
mov    0x2e45(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1238 <main+0xe8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
mov    %rax,-0x18(%rbp)
mov    0x2e25(%rip),%rax
mov    (%rax),%rax
mov    0x2e33(%rip),%rcx
cmp    (%rcx),%rax
jne    11e4 <main+0x94>
mov    0x2e13(%rip),%rax
mov    (%rax),%esi
lea    0xe32(%rip),%rdi
call   1050 <fputs@plt>
mov    0x2dee(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1238 <main+0xe8>
cmpq   $0x0,-0x18(%rbp)
jg     1215 <main+0xc5>
mov    0x2de2(%rip),%rax
mov    (%rax),%esi
lea    0xe24(%rip),%rdi
call   1050 <fputs@plt>
mov    0x2dbd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1238 <main+0xe8>
mov    -0x18(%rbp),%rdi
call   1030 <ispowerful@plt>
mov    %eax,%esi
lea    0xe25(%rip),%rdi
call   1040 <printf@plt>
mov    0x2d8d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    118b <main+0x3b>
mov    0x8(%rsi),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
mov    0x2e66(%rip),%rcx
mov    (%rcx),%rcx
mov    0x2e74(%rip),%rdx
cmp    (%rdx),%rcx
jne    1195 <main+0x45>
mov    0x2e58(%rip),%rax
mov    (%rax),%esi
lea    0xe77(%rip),%rdi
jmp    11c9 <main+0x79>
mov    (%rsi),%rdi
call   1070 <usage@plt>
jmp    11ce <main+0x7e>
test   %rax,%rax
jle    11b9 <main+0x69>
mov    %rax,%rdi
call   1030 <ispowerful@plt>
lea    0xea3(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    0x2e09(%rip),%rax
jmp    11d5 <main+0x85>
mov    0x2e18(%rip),%rax
mov    (%rax),%esi
lea    0xe5a(%rip),%rdi
call   1050 <fputs@plt>
mov    0x2df3(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@errno = global i64 0
@ERANGE = global i64 0
@.str = [35 x i8] c"The number specified is too large.\00"
@stderr = global i32 0
@.str.1 = [41 x i8] c"The number specified should be positive.\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %15
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 @usage(i8* %12)
%14 = load i32, i32* @EXIT_FAILURE
store i32 %14, i32* %3
br label %39
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i64 @strtol(i8* %18, i32* null, i32 0)
store i64 %19, i64* %6
%20 = load i64, i64* @errno
%21 = load i64, i64* @ERANGE
%22 = icmp eq i64 %20, %21
br i1 %22, label %23, label %27
23: ; preds = %15
%24 = load i32, i32* @stderr
%25 = call i32 @fputs(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %24)
%26 = load i32, i32* @EXIT_FAILURE
store i32 %26, i32* %3
br label %39
27: ; preds = %15
%28 = load i64, i64* %6
%29 = icmp sle i64 %28, 0
br i1 %29, label %30, label %34
30: ; preds = %27
%31 = load i32, i32* @stderr
%32 = call i32 @fputs(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %31)
%33 = load i32, i32* @EXIT_FAILURE
store i32 %33, i32* %3
br label %39
34: ; preds = %27
%35 = load i64, i64* %6
%36 = call i32 @ispowerful(i64 %35)
%37 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %36)
%38 = load i32, i32* @EXIT_SUCCESS
store i32 %38, i32* %3
br label %39
39: ; preds = %34, %30, %23, %9
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@errno = global i64 0
@ERANGE = global i64 0
@.str = [35 x i8] c"The number specified is too large.\00"
@stderr = global i32 0
@.str.1 = [41 x i8] c"The number specified should be positive.\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @usage(i8* %5)
br label %25
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i64 @strtol(i8* nocapture %9, i32* null, i32 0)
%11 = load i64, i64* @errno
%12 = load i64, i64* @ERANGE
%13 = icmp eq i64 %11, %12
br i1 %13, label %14, label %17
14: ; preds = %7
%15 = load i32, i32* @stderr
%16 = tail call i32 @fputs(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %25
17: ; preds = %7
%18 = icmp slt i64 %10, 1
br i1 %18, label %19, label %22
19: ; preds = %17
%20 = load i32, i32* @stderr
%21 = tail call i32 @fputs(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %20)
br label %25
22: ; preds = %17
%23 = tail call i32 @ispowerful(i64 %10)
%24 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %22, %19, %14, %4
%26 = phi i32* [ @EXIT_FAILURE, %4 ], [ @EXIT_FAILURE, %14 ], [ @EXIT_FAILURE, %19 ], [ @EXIT_SUCCESS, %22 ]
%27 = load i32, i32* %26
ret i32 %27
}