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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x1,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jg     11cf <main+0xaf>
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <sqrt@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jg     1198 <main+0x78>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
jne    1185 <main+0x65>
movl   $0x0,-0x14(%rbp)
jmp    1198 <main+0x78>
jmp    118a <main+0x6a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114e <main+0x2e>
cmpl   $0x0,-0x14(%rbp)
je     11ba <main+0x9a>
mov    -0x4(%rbp),%esi
lea    0xe54(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113d <main+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x1,%ebx
lea    0xed0(%rip),%r14
jmp    1152 <main+0x32>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x65,%ebx
je     118a <main+0x6a>
mov    %ebx,%edi
call   1040 <sqrt@plt>
cmp    $0x2,%eax
jl     1140 <main+0x20>
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%ebp
mov    %ebx,%eax
xor    %edx,%edx
div    %ebp
test   %edx,%edx
je     114a <main+0x2a>
mov    %ebx,%edi
call   1040 <sqrt@plt>
cmp    %eax,%ebp
jl     1170 <main+0x50>
jmp    1140 <main+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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