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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jg     11a3 <main+0x83>
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <sqrt@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cmp    %ecx,%eax
jg     1190 <main+0x70>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
xor    %eax,%eax
cmp    %edx,%eax
jne    117f <main+0x5f>
jmp    1190 <main+0x70>
mov    -0x4(%rbp),%esi
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1195 <main+0x75>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113d <main+0x1d>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
lea    0xec0(%rip),%r14
jmp    1158 <main+0x28>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
cmp    $0x65,%ebx
je     1179 <main+0x49>
mov    %ebx,%edi
call   1050 <sqrt@plt>
cmp    $0x2,%eax
jl     1150 <main+0x20>
mov    %ebx,%eax
and    $0x1,%eax
je     1150 <main+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1150 <main+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
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
store i32 0, i32* %1
store i32 0, i32* %2
store i32 1, i32* %1
br label %3
3: ; preds = %25, %0
%4 = load i32, i32* %1
%5 = icmp sle i32 %4, 100
br i1 %5, label %6, label %28
6: ; preds = %3
store i32 2, i32* %2
br label %7
7: ; preds = %21, %6
%8 = load i32, i32* %2
%9 = load i32, i32* %1
%10 = call i32 @sqrt(i32 %9)
%11 = icmp sle i32 %8, %10
br i1 %11, label %12, label %24
12: ; preds = %7
%13 = load i32, i32* %1
%14 = load i32, i32* %2
%15 = srem i32 %13, %14
%16 = icmp eq i32 0, %15
br i1 %16, label %17, label %18
17: ; preds = %12
br label %24
18: ; preds = %12
%19 = load i32, i32* %1
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %19)
br label %24
21: ; No predecessors!
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
br label %7
24: ; preds = %18, %17, %7
br label %25
25: ; preds = %24
%26 = load i32, i32* %1
%27 = add nsw i32 %26, 1
store i32 %27, i32* %1
br label %3
28: ; preds = %3
%29 = 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, %10
%2 = phi i32 [ 1, %0 ], [ %11, %10 ]
%3 = tail call i32 @sqrt(i32 %2)
%4 = icmp slt i32 %3, 2
%5 = and i32 %2, 1
%6 = icmp eq i32 %5, 0
%7 = or i1 %4, %6
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %10
10: ; preds = %1, %8
%11 = add nuw nsw i32 %2, 1
%12 = icmp eq i32 %11, 101
br i1 %12, label %13, label %1
13: ; preds = %10
%14 = tail call i32 @putchar(i32 10)
ret void
}