#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__ IsPrime(int);
int atoi(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int number = atoi(argv[1]);
  if (number < 2) {
    return -1;
  } else {
    printf("2\n");
    int i;
    for (i = 3; i <= number; i = i + 2) {
      if (IsPrime(i))
        printf("%d\n", i);
    }
  }
  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)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    116c <main+0x3c>
movl   $0xffffffff,-0x4(%rbp)
jmp    11cf <main+0x9f>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x3,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11c3 <main+0x93>
mov    -0x18(%rbp),%edi
call   1040 <IsPrime@plt>
cmp    $0x0,%rax
je     11b0 <main+0x80>
mov    -0x18(%rbp),%esi
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b5 <main+0x85>
mov    -0x18(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x18(%rbp)
jmp    1181 <main+0x51>
jmp    11c8 <main+0x98>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
mov    $0xffffffff,%eax
cmp    $0x2,%ebx
jl     11a3 <main+0x63>
lea    0xea4(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
cmp    $0x2,%ebx
je     11a3 <main+0x63>
mov    $0x3,%ebp
lea    0xe88(%rip),%r14
jmp    1187 <main+0x47>
nopw   0x0(%rax,%rax,1)
add    $0x2,%ebp
cmp    %ebx,%ebp
jg     11a1 <main+0x61>
mov    %ebp,%edi
call   1050 <IsPrime@plt>
test   %rax,%rax
je     1180 <main+0x40>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1180 <main+0x40>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"2\0A\00"
@.str.1 = [4 x i8] c"%d\0A\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 i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @atoi(i8* %10)
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = icmp slt i32 %12, 2
br i1 %13, label %14, label %15
14: ; preds = %2
store i32 -1, i32* %3
br label %34
15: ; preds = %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 3, i32* %7
br label %17
17: ; preds = %29, %15
%18 = load i32, i32* %7
%19 = load i32, i32* %6
%20 = icmp sle i32 %18, %19
br i1 %20, label %21, label %32
21: ; preds = %17
%22 = load i32, i32* %7
%23 = call i64 @IsPrime(i32 %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %21
%26 = load i32, i32* %7
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %25, %21
br label %29
29: ; preds = %28
%30 = load i32, i32* %7
%31 = add nsw i32 %30, 2
store i32 %31, i32* %7
br label %17
32: ; preds = %17
br label %33
33: ; preds = %32
store i32 0, i32* %3
br label %34
34: ; preds = %33, %14
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d\0A\00"
@str = [2 x i8] c"2\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @atoi(i8* %4)
%6 = icmp slt i32 %5, 2
br i1 %6, label %19, label %7
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%9 = icmp eq i32 %5, 2
br i1 %9, label %19, label %10
10: ; preds = %7, %16
%11 = phi i32 [ %17, %16 ], [ 3, %7 ]
%12 = tail call i64 @IsPrime(i32 %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %10
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %16
16: ; preds = %10, %14
%17 = add nuw nsw i32 %11, 2
%18 = icmp sgt i32 %17, %5
br i1 %18, label %19, label %10
19: ; preds = %16, %7, %2
%20 = phi i32 [ -1, %2 ], [ 0, %7 ], [ 0, %16 ]
ret i32 %20
}