#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 sqrt(int);
int main() {
  int num;
  int i;
  for (num = 1; num <= 100; num++) {
    for (i = 2; i < num / 2; i++) {
      if (num % i == 0)
        break;
    }
    if (i > sqrt(num))
      printf("%3d", num);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jg     11ca <main+0xaa>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jge    118d <main+0x6d>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    117a <main+0x5a>
jmp    118d <main+0x6d>
jmp    117f <main+0x5f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1147 <main+0x27>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <sqrt@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
jle    11b7 <main+0x97>
mov    -0x8(%rbp),%esi
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
jmp    11bc <main+0x9c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
mov    $0x3,%r15d
lea    0xec7(%rip),%r14
jmp    1148 <main+0x28>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    $0x65,%ebx
je     119a <main+0x7a>
mov    %ebx,%ecx
shr    %ecx
cmp    $0x4,%ecx
cmovb  %r15d,%ecx
mov    $0x2,%ebp
cmp    $0x6,%ebx
jb     1183 <main+0x63>
mov    $0x2,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebx,%eax
xor    %edx,%edx
div    %ebp
test   %edx,%edx
je     1183 <main+0x63>
add    $0x1,%ebp
cmp    %ebp,%ecx
jne    1170 <main+0x50>
mov    %ecx,%ebp
mov    %ebx,%edi
call   1040 <sqrt@plt>
cmp    %eax,%ebp
jle    1140 <main+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
jmp    1140 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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