#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 /*<<< orphan*/ getch();
int primetester(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  int num, i, j, k, prime;
  j = 2;
  prime = 1;
  scanf("%d", &num);
  int storage[num];
  for (i = 2; i <= num; ++i) {
    primetester(i);
    k = primetester(i);
    storage[i] = k;
  }
  for (i = 2; i <= num; ++i) {
    printf("%d\n", storage[i]);
  }
  getch();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x10(%rbp)
movl   $0x1,-0x18(%rbp)
lea    0xe9c(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11d8 <main+0x98>
mov    -0xc(%rbp),%edi
call   1060 <primetester@plt>
mov    -0xc(%rbp),%edi
call   1060 <primetester@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,-0x14(%rbp)
mov    -0x14(%rbp),%edx
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    119b <main+0x5b>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1210 <main+0xd0>
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe06(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11df <main+0x9f>
mov    $0x0,%al
call   1050 <getch@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xeaa(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1040 <scanf@plt>
mov    %rsp,%r14
mov    -0x24(%rbp),%eax
mov    %rsp,%r15
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
cmpl   $0x2,-0x24(%rbp)
jl     11ea <main+0xaa>
mov    $0x2,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
call   1060 <primetester@plt>
mov    %ebx,%edi
call   1060 <primetester@plt>
mov    %eax,(%r15,%rbx,4)
lea    0x1(%rbx),%rcx
movslq -0x24(%rbp),%rax
cmp    %rax,%rbx
mov    %rcx,%rbx
jl     1190 <main+0x50>
cmp    $0x2,%eax
jl     11ea <main+0xaa>
mov    $0x1,%ebx
lea    0xe40(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x4(%r15,%rbx,4),%esi
mov    %r12,%rdi
call   1030 <printf@plt>
movslq -0x24(%rbp),%rax
add    $0x1,%rbx
cmp    %rax,%rbx
jl     11d0 <main+0x90>
xor    %eax,%eax
call   1050 <getch@plt>
mov    %r14,%rsp
xor    %eax,%eax
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
store i32 0, i32* %1
store i32 2, i32* %4
store i32 1, i32* %6
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %7
%13 = alloca i32, i64 %11
store i64 %11, i64* %8
store i32 2, i32* %3
br label %14
14: ; preds = %27, %0
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = icmp sle i32 %15, %16
br i1 %17, label %18, label %30
18: ; preds = %14
%19 = load i32, i32* %3
%20 = call i32 @primetester(i32 %19)
%21 = load i32, i32* %3
%22 = call i32 @primetester(i32 %21)
store i32 %22, i32* %5
%23 = load i32, i32* %5
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %13, i64 %25
store i32 %23, i32* %26
br label %27
27: ; preds = %18
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %14
30: ; preds = %14
store i32 2, i32* %3
br label %31
31: ; preds = %41, %30
%32 = load i32, i32* %3
%33 = load i32, i32* %2
%34 = icmp sle i32 %32, %33
br i1 %34, label %35, label %44
35: ; preds = %31
%36 = load i32, i32* %3
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i32, i32* %13, i64 %37
%39 = load i32, i32* %38
%40 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %39)
br label %41
41: ; preds = %35
%42 = load i32, i32* %3
%43 = add nsw i32 %42, 1
store i32 %43, i32* %3
br label %31
44: ; preds = %31
%45 = call i32 (...) @getch()
%46 = load i8*, i8** %7
%47 = load i32, i32* %1
ret i32 %47
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = zext i32 %4 to i64
%6 = call i8* @llvm.stacksave()
%7 = alloca i32, i64 %5
%8 = load i32, i32* %1
%9 = icmp slt i32 %8, 2
br i1 %9, label %31, label %12
10: ; preds = %12
%11 = icmp slt i32 %19, 2
br i1 %11, label %31, label %22
12: ; preds = %0, %12
%13 = phi i64 [ %18, %12 ], [ 2, %0 ]
%14 = trunc i64 %13 to i32
%15 = call i32 @primetester(i32 %14)
%16 = call i32 @primetester(i32 %14)
%17 = getelementptr inbounds i32, i32* %7, i64 %13
store i32 %16, i32* %17
%18 = add nuw nsw i64 %13, 1
%19 = load i32, i32* %1
%20 = sext i32 %19 to i64
%21 = icmp slt i64 %13, %20
br i1 %21, label %12, label %10
22: ; preds = %10, %22
%23 = phi i64 [ %27, %22 ], [ 2, %10 ]
%24 = getelementptr inbounds i32, i32* %7, i64 %23
%25 = load i32, i32* %24
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = add nuw nsw i64 %23, 1
%28 = load i32, i32* %1
%29 = sext i32 %28 to i64
%30 = icmp slt i64 %23, %29
br i1 %30, label %22, label %31
31: ; preds = %22, %0, %10
%32 = call i32 (...) @getch()
ret i32 0
}