#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__ is_magical(int);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  int value;
  if (argc < 2) {
    printf("Not enough args!\n");
    return -1;
  }
  value = atoi(argv[1]);
  if (is_magical(value)) {
    printf("Your number is magical!\n");
  } else {
    printf("Not enough magic...\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)
cmpl   $0x2,-0x8(%rbp)
jge    1168 <main+0x38>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ae <main+0x7e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <is_magical@plt>
cmp    $0x0,%rax
je     119b <main+0x6b>
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
jmp    11a7 <main+0x77>
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jge    1144 <main+0x14>
mov    $0xffffffff,%ebx
lea    0xeea(%rip),%rdi
jmp    116b <main+0x3b>
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
call   1040 <is_magical@plt>
test   %rax,%rax
lea    0xea2(%rip),%rax
lea    0xeaf(%rip),%rdi
cmove  %rax,%rdi
xor    %ebx,%ebx
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Not enough args!\0A\00"
@.str.1 = [25 x i8] c"Your number is magical!\0A\00"
@.str.2 = [21 x i8] c"Not enough magic...\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 = icmp slt i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %24
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @atoi(i8* %14)
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = call i64 @is_magical(i32 %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %11
%20 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %23
21: ; preds = %11
%22 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %21, %19
store i32 0, i32* %3
br label %24
24: ; preds = %23, %9
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
@str = [20 x i8] c"Not enough magic...\00"
@str.3 = [24 x i8] c"Your number is magical!\00"
@str.4 = [17 x i8] c"Not enough args!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %11, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = tail call i64 @is_magical(i32 %7)
%9 = icmp eq i64 %8, 0
%10 = select i1 %9, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @str.3, i64 0, i64 0)
br label %11
11: ; preds = %4, %2
%12 = phi i8* [ getelementptr inbounds ([17 x i8], [17 x i8]* @str.4, i64 0, i64 0), %2 ], [ %10, %4 ]
%13 = phi i32 [ -1, %2 ], [ 0, %4 ]
%14 = tail call i32 @puts(i8* dereferenceable(1) %12)
ret i32 %13
}