#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*/ printf(char *, ...);
int main() {
  int arr[1000] = {0}, p, i, j, count;
  for (i = 2; i * i < 1000; i++)
    if (!arr[i])
      for (j = i * 2; j < 1000; j += i)
        arr[j] = 1;
  printf("The prime numbers between 1 and 999 are:\n");
  for (i = 2, count = 0; i < 1000; i++)
    if (!arr[i]) {
      printf("%d", i);
      count++;
      if (count % 5)
        printf("\t");
      else
        printf("\n");
    }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfc0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xfb0(%rbp),%rdi
xor    %esi,%esi
mov    $0xfa0,%edx
call   1040 <memset@plt>
movl   $0x2,-0xfb8(%rbp)
mov    -0xfb8(%rbp),%eax
imul   -0xfb8(%rbp),%eax
cmp    $0x3e8,%eax
jge    11e2 <main+0xc2>
movslq -0xfb8(%rbp),%rax
cmpl   $0x0,-0xfb0(%rbp,%rax,4)
jne    11c9 <main+0xa9>
mov    -0xfb8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xfbc(%rbp)
cmpl   $0x3e8,-0xfbc(%rbp)
jge    11c4 <main+0xa4>
movslq -0xfbc(%rbp),%rax
movl   $0x1,-0xfb0(%rbp,%rax,4)
mov    -0xfb8(%rbp),%eax
add    -0xfbc(%rbp),%eax
mov    %eax,-0xfbc(%rbp)
jmp    118b <main+0x6b>
jmp    11c9 <main+0xa9>
jmp    11ce <main+0xae>
mov    -0xfb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb8(%rbp)
jmp    114f <main+0x2f>
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x2,-0xfb8(%rbp)
movl   $0x0,-0xfc0(%rbp)
cmpl   $0x3e8,-0xfb8(%rbp)
jge    12a2 <main+0x182>
movslq -0xfb8(%rbp),%rax
cmpl   $0x0,-0xfb0(%rbp,%rax,4)
jne    1289 <main+0x169>
mov    -0xfb8(%rbp),%esi
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xfc0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfc0(%rbp)
mov    -0xfc0(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1276 <main+0x156>
lea    0xdc3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1284 <main+0x164>
lea    0xdab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1289 <main+0x169>
jmp    128e <main+0x16e>
mov    -0xfb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb8(%rbp)
jmp    1204 <main+0xe4>
xor    %eax,%eax
add    $0xfc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0xfa0,%rsp
mov    %rsp,%rdi
mov    $0xfa0,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    0x10(%rsp),%r8
lea    0x18(%rsp),%r9
mov    $0x4,%eax
mov    $0x2,%ebp
mov    $0x8,%edi
mov    $0xc,%ebx
jmp    119e <main+0x5e>
nopw   0x0(%rax,%rax,1)
add    $0x2,%rbp
add    $0x4,%rax
add    $0x10,%r8
add    $0x8,%rdi
add    $0x10,%r9
add    $0x8,%rbx
cmp    $0x20,%rbp
je     11f7 <main+0xb7>
cmpl   $0x0,(%rsp,%rbp,4)
jne    11c5 <main+0x85>
mov    %r8,%rdx
mov    %rax,%rcx
nopw   0x0(%rax,%rax,1)
movl   $0x1,(%rdx)
add    %rbp,%rcx
add    %rdi,%rdx
cmp    $0x3e8,%rcx
jb     11b0 <main+0x70>
mov    %rbp,%rsi
or     $0x1,%rsi
cmpl   $0x0,(%rsp,%rsi,4)
jne    1180 <main+0x40>
mov    %rax,%rdx
or     $0x2,%rdx
mov    %r9,%rcx
nopl   0x0(%rax)
movl   $0x1,(%rcx)
add    %rsi,%rdx
add    %rbx,%rcx
cmp    $0x3e8,%rdx
jb     11e0 <main+0xa0>
jmp    1180 <main+0x40>
lea    0xe05(%rip),%rdi
call   1040 <puts@plt>
mov    $0x2,%ebx
lea    0xdf1(%rip),%r14
xor    %ebp,%ebp
jmp    122d <main+0xed>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbx
cmp    $0x3e8,%rbx
je     1261 <main+0x121>
cmpl   $0x0,(%rsp,%rbx,4)
jne    1220 <main+0xe0>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebp
imul   $0xcccccccd,%ebp,%eax
add    $0x19999999,%eax
cmp    $0x33333333,%eax
mov    $0x9,%edi
adc    $0x0,%edi
call   1030 <putchar@plt>
jmp    1220 <main+0xe0>
xor    %eax,%eax
add    $0xfa0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"The prime numbers between 1 and 999 are:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"\09\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [1000 x i32]* %2 to i8*
store i32 2, i32* %4
br label %8
8: ; preds = %35, %0
%9 = load i32, i32* %4
%10 = load i32, i32* %4
%11 = mul nsw i32 %9, %10
%12 = icmp slt i32 %11, 1000
br i1 %12, label %13, label %38
13: ; preds = %8
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 %15
%17 = load i32, i32* %16
%18 = icmp ne i32 %17, 0
br i1 %18, label %34, label %19
19: ; preds = %13
%20 = load i32, i32* %4
%21 = mul nsw i32 %20, 2
store i32 %21, i32* %5
br label %22
22: ; preds = %29, %19
%23 = load i32, i32* %5
%24 = icmp slt i32 %23, 1000
br i1 %24, label %25, label %33
25: ; preds = %22
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 %27
store i32 1, i32* %28
br label %29
29: ; preds = %25
%30 = load i32, i32* %4
%31 = load i32, i32* %5
%32 = add nsw i32 %31, %30
store i32 %32, i32* %5
br label %22
33: ; preds = %22
br label %34
34: ; preds = %33, %13
br label %35
35: ; preds = %34
%36 = load i32, i32* %4
%37 = add nsw i32 %36, 1
store i32 %37, i32* %4
br label %8
38: ; preds = %8
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
store i32 2, i32* %4
store i32 0, i32* %6
br label %40
40: ; preds = %63, %38
%41 = load i32, i32* %4
%42 = icmp slt i32 %41, 1000
br i1 %42, label %43, label %66
43: ; preds = %40
%44 = load i32, i32* %4
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = icmp ne i32 %47, 0
br i1 %48, label %62, label %49
49: ; preds = %43
%50 = load i32, i32* %4
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %50)
%52 = load i32, i32* %6
%53 = add nsw i32 %52, 1
store i32 %53, i32* %6
%54 = load i32, i32* %6
%55 = srem i32 %54, 5
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %49
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %61
59: ; preds = %49
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %61
61: ; preds = %59, %57
br label %62
62: ; preds = %61, %43
br label %63
63: ; preds = %62
%64 = load i32, i32* %4
%65 = add nsw i32 %64, 1
store i32 %65, i32* %4
br label %40
66: ; preds = %40
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [41 x i8] c"The prime numbers between 1 and 999 are:\00"
define i32 @main() {
%1 = alloca [1000 x i32]
%2 = bitcast [1000 x i32]* %1 to i8*
br label %3
3: ; preds = %26, %0
%4 = phi i64 [ 2, %0 ], [ %27, %26 ]
%5 = phi i64 [ 4, %0 ], [ %28, %26 ]
%6 = getelementptr inbounds [1000 x i32], [1000 x i32]* %1, i64 0, i64 %4
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %3, %9
%10 = phi i64 [ %12, %9 ], [ %5, %3 ]
%11 = getelementptr inbounds [1000 x i32], [1000 x i32]* %1, i64 0, i64 %10
store i32 1, i32* %11
%12 = add nuw nsw i64 %10, %4
%13 = icmp ult i64 %12, 1000
br i1 %13, label %9, label %14
14: ; preds = %9, %3
%15 = or i64 %4, 1
%16 = getelementptr inbounds [1000 x i32], [1000 x i32]* %1, i64 0, i64 %15
%17 = load i32, i32* %16
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %26
19: ; preds = %14
%20 = or i64 %5, 2
br label %21
21: ; preds = %21, %19
%22 = phi i64 [ %24, %21 ], [ %20, %19 ]
%23 = getelementptr inbounds [1000 x i32], [1000 x i32]* %1, i64 0, i64 %22
store i32 1, i32* %23
%24 = add nuw nsw i64 %22, %15
%25 = icmp ult i64 %24, 1000
br i1 %25, label %21, label %26
26: ; preds = %21, %14
%27 = add nuw nsw i64 %4, 2
%28 = add nuw nsw i64 %5, 4
%29 = icmp eq i64 %27, 32
br i1 %29, label %30, label %3
30: ; preds = %26
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
br label %32
32: ; preds = %30, %46
%33 = phi i64 [ 2, %30 ], [ %48, %46 ]
%34 = phi i32 [ 0, %30 ], [ %47, %46 ]
%35 = getelementptr inbounds [1000 x i32], [1000 x i32]* %1, i64 0, i64 %33
%36 = load i32, i32* %35
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %46
38: ; preds = %32
%39 = trunc i64 %33 to i32
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %39)
%41 = add nsw i32 %34, 1
%42 = srem i32 %41, 5
%43 = icmp eq i32 %42, 0
%44 = select i1 %43, i32 10, i32 9
%45 = tail call i32 @putchar(i32 %44)
br label %46
46: ; preds = %38, %32
%47 = phi i32 [ %34, %32 ], [ %41, %38 ]
%48 = add nuw nsw i64 %33, 1
%49 = icmp eq i64 %48, 1000
br i1 %49, label %50, label %32
50: ; preds = %46
ret i32 0
}