#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);
void main() {
  int i, j;
  for (i = 2; i <= 100; i++) {
    for (j = 2; j <= i - 1; j++) {
      if (i % j == 0) {
        break;
      }
    }
    if (j == i) {
      printf("%d\n", i);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x2,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jg     1197 <main+0x87>
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1169 <main+0x59>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
jne    1156 <main+0x46>
jmp    1169 <main+0x59>
jmp    115b <main+0x4b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1130 <main+0x20>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jne    1184 <main+0x74>
mov    -0x4(%rbp),%esi
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
jmp    1189 <main+0x79>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <main+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x2,%ebx
xor    %r15d,%r15d
lea    0xedc(%rip),%r14
jmp    1146 <main+0x36>
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
add    $0xffffffff,%r15d
cmp    $0x65,%ebx
je     1186 <main+0x76>
mov    $0x2,%ecx
cmp    $0x3,%ebx
jb     1180 <main+0x70>
mov    $0x2,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%eax
xor    %edx,%edx
div    %ecx
test   %edx,%edx
je     1180 <main+0x70>
lea    (%r15,%rcx,1),%eax
add    $0x1,%eax
add    $0x1,%ecx
cmp    $0x2,%eax
jne    1160 <main+0x50>
jmp    1130 <main+0x20>
nopl   0x0(%rax,%rax,1)
cmp    %ebx,%ecx
je     1130 <main+0x20>
jmp    113a <main+0x2a>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
store i32 2, i32* %1
br label %3
3: ; preds = %30, %0
%4 = load i32, i32* %1
%5 = icmp sle i32 %4, 100
br i1 %5, label %6, label %33
6: ; preds = %3
store i32 2, i32* %2
br label %7
7: ; preds = %19, %6
%8 = load i32, i32* %2
%9 = load i32, i32* %1
%10 = sub nsw i32 %9, 1
%11 = icmp sle i32 %8, %10
br i1 %11, label %12, label %22
12: ; preds = %7
%13 = load i32, i32* %1
%14 = load i32, i32* %2
%15 = srem i32 %13, %14
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %12
br label %22
18: ; preds = %12
br label %19
19: ; preds = %18
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %7
22: ; preds = %17, %7
%23 = load i32, i32* %2
%24 = load i32, i32* %1
%25 = icmp eq i32 %23, %24
br i1 %25, label %26, label %29
26: ; preds = %22
%27 = load i32, i32* %1
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %26, %22
br label %30
30: ; preds = %29
%31 = load i32, i32* %1
%32 = add nsw i32 %31, 1
store i32 %32, i32* %1
br label %3
33: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @main() {
br label %1
1: ; preds = %0, %16
%2 = phi i32 [ 2, %0 ], [ %17, %16 ]
%3 = icmp ugt i32 %2, 2
br i1 %3, label %4, label %11
4: ; preds = %1, %8
%5 = phi i32 [ %9, %8 ], [ 2, %1 ]
%6 = urem i32 %2, %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %4
%9 = add nuw nsw i32 %5, 1
%10 = icmp eq i32 %9, %2
br i1 %10, label %14, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 2, %1 ], [ %5, %4 ]
%13 = icmp eq i32 %12, %2
br i1 %13, label %14, label %16
14: ; preds = %8, %11
%15 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %16
16: ; preds = %11, %14
%17 = add nuw nsw i32 %2, 1
%18 = icmp eq i32 %17, 101
br i1 %18, label %19, label %1
19: ; preds = %16
ret void
}