#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);
int main(void) {
  int i, j, n = 150;
  int P[151];
  for (i = 2; i < n; ++i) {
    P[i] = 0;
  }
  for (i = 2; i < n; ++i) {
    if (P[i] == 0)
      printf("%i ", i);
    for (j = 1; i * j <= n; ++j)
      P[i * j] = 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x270,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x96,-0x10(%rbp)
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1159 <main+0x49>
movslq -0x8(%rbp),%rax
movl   $0x0,-0x270(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1130 <main+0x20>
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11d9 <main+0xc9>
movslq -0x8(%rbp),%rax
cmpl   $0x0,-0x270(%rbp,%rax,4)
jne    118d <main+0x7d>
mov    -0x8(%rbp),%esi
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     11c6 <main+0xb6>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
cltq
movl   $0x1,-0x270(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1194 <main+0x84>
jmp    11cb <main+0xbb>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1160 <main+0x50>
xor    %eax,%eax
add    $0x270,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x260,%rsp
lea    0x8(%rsp),%r14
xor    %ebp,%ebp
mov    $0x250,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    $0x2,%ebx
mov    $0x8,%r12d
lea    0xea9(%rip),%r15
test   %ebp,%ebp
jne    116a <main+0x4a>
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %r14,%rax
mov    %rbx,%rcx
movl   $0x1,(%rax)
add    %rbx,%rcx
add    %r12,%rax
cmp    $0x97,%rcx
jb     1170 <main+0x50>
add    $0x1,%rbx
cmp    $0x96,%rbx
je     11a3 <main+0x83>
mov    (%rsp,%rbx,4),%ebp
add    $0x4,%r14
add    $0x4,%r12
test   %ebp,%ebp
jne    116a <main+0x4a>
jmp    1160 <main+0x40>
xor    %eax,%eax
add    $0x260,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%i \00"
define i32 @main() {
%1 = alloca [151 x i32]
%2 = bitcast [151 x i32]* %1 to i8*
%3 = getelementptr inbounds [151 x i32], [151 x i32]* %1, i64 0, i64 2
%4 = bitcast i32* %3 to i8*
br label %5
5: ; preds = %24, %0
%6 = phi i32 [ 0, %0 ], [ %26, %24 ]
%7 = phi i64 [ 2, %0 ], [ %22, %24 ]
%8 = icmp eq i32 %6, 0
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = trunc i64 %7 to i32
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %5, %9
br label %13
13: ; preds = %12, %13
%14 = phi i64 [ %17, %13 ], [ 1, %12 ]
%15 = phi i64 [ %19, %13 ], [ %7, %12 ]
%16 = getelementptr inbounds [151 x i32], [151 x i32]* %1, i64 0, i64 %15
store i32 1, i32* %16
%17 = add nuw nsw i64 %14, 1
%18 = mul nuw nsw i64 %17, %7
%19 = add nuw nsw i64 %15, %7
%20 = icmp ult i64 %18, 151
br i1 %20, label %13, label %21
21: ; preds = %13
%22 = add nuw nsw i64 %7, 1
%23 = icmp eq i64 %22, 150
br i1 %23, label %27, label %24
24: ; preds = %21
%25 = getelementptr inbounds [151 x i32], [151 x i32]* %1, i64 0, i64 %22
%26 = load i32, i32* %25
br label %5
27: ; preds = %21
ret i32 0
}