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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jg     1213 <main+0xf3>
movl   $0x1,-0x10(%rbp)
movl   $0x2,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <sqrt@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
jg     11ae <main+0x8e>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x10(%rbp)
xor    %eax,%eax
cmp    %edx,%eax
jne    1194 <main+0x74>
movl   $0x0,-0x8(%rbp)
jmp    11ae <main+0x8e>
movl   $0x1,-0x8(%rbp)
jmp    11a0 <main+0x80>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115c <main+0x3c>
mov    $0x1,%eax
cmp    -0x8(%rbp),%eax
jne    11fe <main+0xde>
mov    -0x4(%rbp),%esi
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
xor    %eax,%eax
cmp    %edx,%eax
jne    11f9 <main+0xd9>
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11fe <main+0xde>
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1144 <main+0x24>
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0x1,%ebx
lea    0xebc(%rip),%r14
xor    %r15d,%r15d
jmp    1158 <main+0x28>
nopl   0x0(%rax)
add    $0x1,%ebx
cmp    $0x65,%ebx
je     11bf <main+0x8f>
mov    %ebx,%edi
call   1050 <sqrt@plt>
cmp    $0x2,%eax
jl     1150 <main+0x20>
mov    %eax,%r12d
mov    $0x1,%ebp
nopl   0x0(%rax)
add    $0x1,%ebp
mov    %ebx,%eax
xor    %edx,%edx
div    %ebp
test   %edx,%edx
je     1150 <main+0x20>
mov    %ebx,%edi
call   1050 <sqrt@plt>
cmp    %eax,%ebp
jl     1170 <main+0x40>
cmp    $0x2,%r12d
jl     1150 <main+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r15d
imul   $0xcccccccd,%r15d,%eax
add    $0x19999998,%eax
ror    %eax
cmp    $0x19999998,%eax
ja     1150 <main+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1150 <main+0x20>
mov    $0xa,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

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