#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*/ input(int);
int /*<<< orphan*/ output(int);
main() {
  int i = -1;
  int prime[1000] = {2, 2, 2};
  int c1, c2, c3;
  for (i = -1; i < 1 || i > 999; 1)
    input(i);
  for (c1 = 2; c1 <= i; c1++) {
    prime[c1] = 0;
  }
  prime[0] = 1;
  prime[1] = 1;
  for (c2 = 2; c2 <= i / 2 + 1; c2++) {
    if (prime[c2] == 0) {
      c1 = c2;
      for (c3 = 2 * c1; c3 <= i + 1; c3 = c3 + c1) {
        prime[c3] = 1;
      }
    }
  }
  for (c1 = 0; c1 < i + 1; c1++) {
    if (prime[c1] == 0)
      output(c1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfd0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
lea    -0xfb0(%rbp),%rdi
xor    %esi,%esi
mov    $0xfa0,%edx
call   1050 <memset@plt>
movl   $0x2,-0xfb0(%rbp)
movl   $0x2,-0xfac(%rbp)
movl   $0x2,-0xfa8(%rbp)
movl   $0xffffffff,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x1,-0x8(%rbp)
mov    %al,-0xfbd(%rbp)
jl     11a3 <main+0x73>
cmpl   $0x3e7,-0x8(%rbp)
setg   %al
mov    %al,-0xfbd(%rbp)
mov    -0xfbd(%rbp),%al
test   $0x1,%al
jne    11b6 <main+0x86>
jmp    11c3 <main+0x93>
mov    -0x8(%rbp),%edi
call   1030 <input@plt>
jmp    1181 <main+0x51>
movl   $0x2,-0xfb4(%rbp)
mov    -0xfb4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1202 <main+0xd2>
movslq -0xfb4(%rbp),%rax
movl   $0x0,-0xfb0(%rbp,%rax,4)
mov    -0xfb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb4(%rbp)
jmp    11cd <main+0x9d>
movl   $0x1,-0xfb0(%rbp)
movl   $0x1,-0xfac(%rbp)
movl   $0x2,-0xfb8(%rbp)
mov    -0xfb8(%rbp),%eax
mov    %eax,-0xfc4(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xfc4(%rbp),%eax
add    $0x1,%ecx
cmp    %ecx,%eax
jg     12d5 <main+0x1a5>
movslq -0xfb8(%rbp),%rax
cmpl   $0x0,-0xfb0(%rbp,%rax,4)
jne    12bc <main+0x18c>
mov    -0xfb8(%rbp),%eax
mov    %eax,-0xfb4(%rbp)
mov    -0xfb4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xfbc(%rbp)
mov    -0xfbc(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jg     12b7 <main+0x187>
movslq -0xfbc(%rbp),%rax
movl   $0x1,-0xfb0(%rbp,%rax,4)
mov    -0xfbc(%rbp),%eax
add    -0xfb4(%rbp),%eax
mov    %eax,-0xfbc(%rbp)
jmp    127a <main+0x14a>
jmp    12bc <main+0x18c>
jmp    12c1 <main+0x191>
mov    -0xfb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb8(%rbp)
jmp    1220 <main+0xf0>
movl   $0x0,-0xfb4(%rbp)
mov    -0xfb4(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    132c <main+0x1fc>
movslq -0xfb4(%rbp),%rax
cmpl   $0x0,-0xfb0(%rbp,%rax,4)
jne    1313 <main+0x1e3>
mov    -0xfb4(%rbp),%edi
call   1040 <output@plt>
jmp    1318 <main+0x1e8>
mov    -0xfb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb4(%rbp)
jmp    12df <main+0x1af>
mov    -0x4(%rbp),%eax
add    $0xfd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xffffffff,%edi
call   1030 <input@plt>
jmp    1120 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [1000 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 -1, i32* %2
%7 = bitcast [1000 x i32]* %3 to i8*
%8 = bitcast i8* %7 to <{ i32, i32, i32, [997 x i32] }>*
%9 = getelementptr inbounds <{ i32, i32, i32, [997 x i32] }>, <{ i32, i32, i32, [997 x i32] }>* %8, i32 0, i32 0
store i32 2, i32* %9
%10 = getelementptr inbounds <{ i32, i32, i32, [997 x i32] }>, <{ i32, i32, i32, [997 x i32] }>* %8, i32 0, i32 1
store i32 2, i32* %10
%11 = getelementptr inbounds <{ i32, i32, i32, [997 x i32] }>, <{ i32, i32, i32, [997 x i32] }>* %8, i32 0, i32 2
store i32 2, i32* %11
store i32 -1, i32* %2
br label %12
12: ; preds = %23, %0
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 1
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = load i32, i32* %2
%17 = icmp sgt i32 %16, 999
br label %18
18: ; preds = %15, %12
%19 = phi i1 [ true, %12 ], [ %17, %15 ]
br i1 %19, label %20, label %24
20: ; preds = %18
%21 = load i32, i32* %2
%22 = call i32 @input(i32 %21)
br label %23
23: ; preds = %20
br label %12
24: ; preds = %18
store i32 2, i32* %4
br label %25
25: ; preds = %33, %24
%26 = load i32, i32* %4
%27 = load i32, i32* %2
%28 = icmp sle i32 %26, %27
br i1 %28, label %29, label %36
29: ; preds = %25
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [1000 x i32], [1000 x i32]* %3, i64 0, i64 %31
store i32 0, i32* %32
br label %33
33: ; preds = %29
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
store i32 %35, i32* %4
br label %25
36: ; preds = %25
%37 = getelementptr inbounds [1000 x i32], [1000 x i32]* %3, i64 0, i64 0
store i32 1, i32* %37
%38 = getelementptr inbounds [1000 x i32], [1000 x i32]* %3, i64 0, i64 1
store i32 1, i32* %38
store i32 2, i32* %5
br label %39
39: ; preds = %70, %36
%40 = load i32, i32* %5
%41 = load i32, i32* %2
%42 = sdiv i32 %41, 2
%43 = add nsw i32 %42, 1
%44 = icmp sle i32 %40, %43
br i1 %44, label %45, label %73
45: ; preds = %39
%46 = load i32, i32* %5
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [1000 x i32], [1000 x i32]* %3, i64 0, i64 %47
%49 = load i32, i32* %48
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %69
51: ; preds = %45
%52 = load i32, i32* %5
store i32 %52, i32* %4
%53 = load i32, i32* %4
%54 = mul nsw i32 2, %53
store i32 %54, i32* %6
br label %55
55: ; preds = %64, %51
%56 = load i32, i32* %6
%57 = load i32, i32* %2
%58 = add nsw i32 %57, 1
%59 = icmp sle i32 %56, %58
br i1 %59, label %60, label %68
60: ; preds = %55
%61 = load i32, i32* %6
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [1000 x i32], [1000 x i32]* %3, i64 0, i64 %62
store i32 1, i32* %63
br label %64
64: ; preds = %60
%65 = load i32, i32* %6
%66 = load i32, i32* %4
%67 = add nsw i32 %65, %66
store i32 %67, i32* %6
br label %55
68: ; preds = %55
br label %69
69: ; preds = %68, %45
br label %70
70: ; preds = %69
%71 = load i32, i32* %5
%72 = add nsw i32 %71, 1
store i32 %72, i32* %5
br label %39
73: ; preds = %39
store i32 0, i32* %4
br label %74
74: ; preds = %89, %73
%75 = load i32, i32* %4
%76 = load i32, i32* %2
%77 = add nsw i32 %76, 1
%78 = icmp slt i32 %75, %77
br i1 %78, label %79, label %92
79: ; preds = %74
%80 = load i32, i32* %4
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [1000 x i32], [1000 x i32]* %3, i64 0, i64 %81
%83 = load i32, i32* %82
%84 = icmp eq i32 %83, 0
br i1 %84, label %85, label %88
85: ; preds = %79
%86 = load i32, i32* %4
%87 = call i32 @output(i32 %86)
br label %88
88: ; preds = %85, %79
br label %89
89: ; preds = %88
%90 = load i32, i32* %4
%91 = add nsw i32 %90, 1
store i32 %91, i32* %4
br label %74
92: ; preds = %74
%93 = load i32, i32* %1
ret i32 %93
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @input(i32 -1)
br label %1
}