#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;
  for (i = 2; i < 30; i++) {
    for (j = 2; j <= (i / j); j++)
      if (!(i % j))
        break;
    if (j > (i / j))
      printf("%d is prime\n", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
cmpl   $0x1e,-0x8(%rbp)
jge    11b5 <main+0xa5>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jg     1179 <main+0x69>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1166 <main+0x56>
jmp    1179 <main+0x69>
jmp    116b <main+0x5b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1137 <main+0x27>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
jle    11a2 <main+0x92>
mov    -0x8(%rbp),%esi
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
jmp    11a7 <main+0x97>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0x2,%ebx
mov    $0xaaaaaaab,%r15d
mov    $0xcccccccd,%r12d
lea    0xed0(%rip),%r14
jmp    1156 <main+0x46>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x1e,%ebx
je     1247 <main+0x137>
cmp    $0x4,%ebx
jb     1140 <main+0x30>
test   $0x1,%bl
je     114a <main+0x3a>
cmp    $0x9,%ebx
jb     1140 <main+0x30>
mov    %ebx,%eax
mov    %rax,%rcx
imul   %r15,%rcx
mov    %rcx,%rdx
shr    $0x21,%rdx
lea    (%rdx,%rdx,2),%edx
mov    $0x2,%esi
sub    %edx,%esi
add    %ebx,%esi
cmp    $0x2,%esi
je     114a <main+0x3a>
cmp    $0x10,%ebx
jb     1140 <main+0x30>
test   $0x3,%bl
je     114a <main+0x3a>
cmp    $0x19,%ebx
jb     1140 <main+0x30>
mov    %rax,%rdx
imul   %r12,%rdx
shr    $0x22,%rdx
lea    (%rdx,%rdx,4),%edx
mov    $0x2,%esi
sub    %edx,%esi
add    %ebx,%esi
cmp    $0x2,%esi
je     114a <main+0x3a>
cmp    $0x24,%ebx
jb     1140 <main+0x30>
shr    $0x22,%rcx
add    %ecx,%ecx
lea    (%rcx,%rcx,2),%ecx
mov    $0x2,%edx
sub    %ecx,%edx
add    %ebx,%edx
cmp    $0x2,%edx
je     114a <main+0x3a>
cmp    $0x31,%ebx
jb     1140 <main+0x30>
imul   $0x24924925,%rax,%rcx
shr    $0x20,%rcx
mov    %ebx,%edx
sub    %ecx,%edx
shr    %edx
add    %ecx,%edx
shr    $0x2,%edx
mov    %edx,%ecx
shl    $0x3,%ecx
neg    %ecx
add    %edx,%ecx
add    $0x2,%ecx
add    %ebx,%ecx
cmp    $0x2,%ecx
je     114a <main+0x3a>
cmp    $0x40,%ebx
jb     1140 <main+0x30>
test   $0x7,%bl
je     114a <main+0x3a>
cmp    $0x51,%ebx
jb     1140 <main+0x30>
imul   $0x38e38e39,%rax,%rax
shr    $0x21,%rax
lea    (%rax,%rax,8),%eax
mov    $0x2,%ecx
sub    %eax,%ecx
add    %ebx,%ecx
cmp    $0x2,%ecx
je     114a <main+0x3a>
jmp    1140 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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