#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() {
  char a[100];
  int i, j;
  a[0] = a[1] = 0;
  for (i = 2; i < 100; i++)
    a[i] = i;
  for (i = 2; i < 100; i++) {
    if (a[i]) {
      printf("%d\n", i);
      for (j = i * i; j < 100; j += i)
        a[j] = 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x6f(%rbp)
movb   $0x0,-0x70(%rbp)
movl   $0x2,-0x74(%rbp)
cmpl   $0x64,-0x74(%rbp)
jge    1156 <main+0x46>
mov    -0x74(%rbp),%eax
mov    %al,%cl
movslq -0x74(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1131 <main+0x21>
movl   $0x2,-0x74(%rbp)
cmpl   $0x64,-0x74(%rbp)
jge    11c8 <main+0xb8>
movslq -0x74(%rbp),%rax
cmpb   $0x0,-0x70(%rbp,%rax,1)
je     11b5 <main+0xa5>
mov    -0x74(%rbp),%esi
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
mov    -0x74(%rbp),%eax
imul   -0x74(%rbp),%eax
mov    %eax,-0x78(%rbp)
cmpl   $0x64,-0x78(%rbp)
jge    11b0 <main+0xa0>
movslq -0x78(%rbp),%rax
movb   $0x0,-0x70(%rbp,%rax,1)
mov    -0x74(%rbp),%eax
add    -0x78(%rbp),%eax
mov    %eax,-0x78(%rbp)
jmp    118f <main+0x7f>
jmp    11b5 <main+0xa5>
jmp    11ba <main+0xaa>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    115d <main+0x4d>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x68,%rsp
movb   $0x0,0x1(%rsp)
movaps 0xeda(%rip),%xmm0
movups %xmm0,0x2(%rsp)
movaps 0xede(%rip),%xmm0
movups %xmm0,0x12(%rsp)
movaps 0xee2(%rip),%xmm0
movups %xmm0,0x22(%rsp)
movaps 0xee6(%rip),%xmm0
movups %xmm0,0x32(%rsp)
movaps 0xeea(%rip),%xmm0
movups %xmm0,0x42(%rsp)
movaps 0xeee(%rip),%xmm0
movups %xmm0,0x52(%rsp)
movw   $0x6362,0x62(%rsp)
mov    $0x4,%ebp
mov    $0x2,%ebx
mov    $0x5,%r15d
lea    0xedb(%rip),%r14
jmp    11a1 <main+0x91>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
add    %r15d,%ebp
add    $0x2,%r15
cmp    $0x64,%rbx
je     11cf <main+0xbf>
cmpb   $0x0,(%rsp,%rbx,1)
je     1190 <main+0x80>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %rbx,%rax
imul   %rbx,%rax
cmp    $0x63,%rax
ja     1190 <main+0x80>
mov    %ebp,%eax
movb   $0x0,(%rsp,%rax,1)
add    %rbx,%rax
cmp    $0x64,%rax
jb     11c0 <main+0xb0>
jmp    1190 <main+0x80>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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