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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x270,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x96,-0x26c(%rbp)
movl   $0x2,-0x264(%rbp)
mov    -0x264(%rbp),%eax
cmp    -0x26c(%rbp),%eax
jg     116e <main+0x5e>
movslq -0x264(%rbp),%rax
movl   $0x0,-0x260(%rbp,%rax,4)
mov    -0x264(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x264(%rbp)
jmp    1136 <main+0x26>
movl   $0x2,-0x264(%rbp)
mov    -0x264(%rbp),%eax
cmp    -0x26c(%rbp),%eax
jg     1216 <main+0x106>
movslq -0x264(%rbp),%rax
cmpl   $0x0,-0x260(%rbp,%rax,4)
jne    11b1 <main+0xa1>
mov    -0x264(%rbp),%esi
lea    0xe54(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x268(%rbp)
mov    -0x264(%rbp),%eax
imul   -0x268(%rbp),%eax
cmp    -0x26c(%rbp),%eax
jg     1202 <main+0xf2>
mov    -0x264(%rbp),%eax
imul   -0x268(%rbp),%eax
cltq
movl   $0x1,-0x260(%rbp,%rax,4)
mov    -0x268(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x268(%rbp)
jmp    11bb <main+0xab>
mov    -0x264(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x264(%rbp)
jmp    1178 <main+0x68>
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    $0x254,%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    $0x97,%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 = [5 x i8] c"%i \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [151 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 150, i32* %5
store i32 2, i32* %3
br label %6
6: ; preds = %14, %0
%7 = load i32, i32* %3
%8 = load i32, i32* %5
%9 = icmp sle i32 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [151 x i32], [151 x i32]* %2, i64 0, i64 %12
store i32 0, i32* %13
br label %14
14: ; preds = %10
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %6
17: ; preds = %6
store i32 2, i32* %3
br label %18
18: ; preds = %46, %17
%19 = load i32, i32* %3
%20 = load i32, i32* %5
%21 = icmp sle i32 %19, %20
br i1 %21, label %22, label %49
22: ; preds = %18
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [151 x i32], [151 x i32]* %2, 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* %3
%30 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %28, %22
store i32 1, i32* %4
br label %32
32: ; preds = %38, %31
%33 = load i32, i32* %3
%34 = load i32, i32* %4
%35 = mul nsw i32 %33, %34
%36 = load i32, i32* %5
%37 = icmp sle i32 %35, %36
br i1 %37, label %38, label %46
38: ; preds = %32
%39 = load i32, i32* %3
%40 = load i32, i32* %4
%41 = mul nsw i32 %39, %40
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [151 x i32], [151 x i32]* %2, i64 0, i64 %42
store i32 1, i32* %43
%44 = load i32, i32* %4
%45 = add nsw i32 %44, 1
store i32 %45, i32* %4
br label %32
46: ; preds = %32
%47 = load i32, i32* %3
%48 = add nsw i32 %47, 1
store i32 %48, i32* %3
br label %18
49: ; preds = %18
ret i32 0
}

LLVM IR (-O2):
@.str = [5 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 ([5 x i8], [5 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, 151
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
}