#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 x, y, prime = 0, z;
  for (x = 2; x <= 100; x++) {
    prime = 0;
    for (y = 2; y <= x / 2; y++) {
      if (x % y == 0) {
        prime = 1;
      }
    }
    if (prime == 0) {
      printf("%d \n", x);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x2,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jg     11b9 <main+0xa9>
movl   $0x0,-0x10(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jg     118d <main+0x7d>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    117a <main+0x6a>
movl   $0x1,-0x10(%rbp)
jmp    117f <main+0x6f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1145 <main+0x35>
cmpl   $0x0,-0x10(%rbp)
jne    11a6 <main+0x96>
mov    -0x8(%rbp),%esi
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
jmp    11ab <main+0x9b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0x2,%r15d
lea    0xedb(%rip),%r14
mov    $0x1,%r12d
mov    $0x2,%ebp
jmp    1156 <main+0x46>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    $0x65,%ebp
je     11ef <main+0xdf>
mov    %ebp,%r8d
shr    %r8d
cmp    $0x3,%r8d
cmovb  %r15d,%r8d
cmp    $0x4,%ebp
jb     1140 <main+0x30>
add    $0xffffffff,%r8d
cmp    $0x6,%ebp
jae    1180 <main+0x70>
mov    $0x2,%ecx
xor    %edi,%edi
jmp    11d0 <main+0xc0>
nopl   0x0(%rax,%rax,1)
mov    %r8d,%r9d
and    $0xfffffffe,%r9d
neg    %r9d
mov    $0x2,%esi
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebp,%eax
xor    %edx,%edx
div    %esi
mov    %edx,%ecx
lea    0x1(%rsi),%ebx
mov    %ebp,%eax
xor    %edx,%edx
div    %ebx
test   %ecx,%ecx
cmove  %r12d,%edi
test   %edx,%edx
cmove  %r12d,%edi
mov    %esi,%ecx
add    $0x2,%ecx
lea    (%r9,%rsi,1),%eax
add    $0x2,%eax
mov    %ecx,%esi
cmp    $0x2,%eax
jne    11a0 <main+0x90>
test   $0x1,%r8b
je     11e2 <main+0xd2>
mov    %ebp,%eax
xor    %edx,%edx
div    %ecx
test   %edx,%edx
cmove  %r12d,%edi
test   %edi,%edi
jne    114a <main+0x3a>
jmp    1140 <main+0x30>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%d \0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %40
%2 = phi i32 [ 2, %0 ], [ %41, %40 ]
%3 = lshr i32 %2, 1
%4 = call i32 @llvm.umax.i32(i32 %3, i32 2)
%5 = add nsw i32 %4, -1
%6 = icmp ult i32 %2, 4
br i1 %6, label %38, label %7
7: ; preds = %1
%8 = and i32 %5, 1
%9 = icmp ult i32 %2, 6
br i1 %9, label %26, label %10
10: ; preds = %7
%11 = and i32 %5, -2
br label %12
12: ; preds = %12, %10
%13 = phi i32 [ 0, %10 ], [ %22, %12 ]
%14 = phi i32 [ 2, %10 ], [ %23, %12 ]
%15 = phi i32 [ 0, %10 ], [ %24, %12 ]
%16 = urem i32 %2, %14
%17 = icmp eq i32 %16, 0
%18 = or i32 %14, 1
%19 = urem i32 %2, %18
%20 = icmp eq i32 %19, 0
%21 = select i1 %20, i1 true, i1 %17
%22 = select i1 %21, i32 1, i32 %13
%23 = add nuw nsw i32 %14, 2
%24 = add i32 %15, 2
%25 = icmp eq i32 %24, %11
br i1 %25, label %26, label %12
26: ; preds = %12, %7
%27 = phi i32 [ undef, %7 ], [ %22, %12 ]
%28 = phi i32 [ 0, %7 ], [ %22, %12 ]
%29 = phi i32 [ 2, %7 ], [ %23, %12 ]
%30 = icmp eq i32 %8, 0
br i1 %30, label %35, label %31
31: ; preds = %26
%32 = urem i32 %2, %29
%33 = icmp eq i32 %32, 0
%34 = select i1 %33, i32 1, i32 %28
br label %35
35: ; preds = %26, %31
%36 = phi i32 [ %27, %26 ], [ %34, %31 ]
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %1, %35
%39 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %40
40: ; preds = %35, %38
%41 = add nuw nsw i32 %2, 1
%42 = icmp eq i32 %41, 101
br i1 %42, label %43, label %1
43: ; preds = %40
ret i32 0
}