#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 main() {
  int number = 0;
  int temp = 0;
  int counter = 0;
  for (number = 1; number <= 100; number++) {
    for (temp = 2; temp < number; temp++) {
      if (number % temp == 0) {
        break;
      }
      if (temp == number - 1) {
        printf("%d\t  ", number);
        counter++;
        if (counter % 5 == 0) {
          printf("\n");
        }
      }
    }
  }
  printf("\n\nThere are %d prime numbers \n\n", counter);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jg     11e5 <main+0xd5>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d2 <main+0xc2>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    116d <main+0x5d>
jmp    11d2 <main+0xc2>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    11bf <main+0xaf>
mov    -0x8(%rbp),%esi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11ba <main+0xaa>
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bf <main+0xaf>
jmp    11c4 <main+0xb4>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114c <main+0x3c>
jmp    11d7 <main+0xc7>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113b <main+0x2b>
mov    -0x10(%rbp),%esi
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0x1,%r12d
lea    0xecb(%rip),%r14
xor    %ebx,%ebx
xor    %r15d,%r15d
jmp    114d <main+0x2d>
nopl   0x0(%rax)
add    $0x1,%r12d
add    $0xffffffff,%ebx
cmp    $0x65,%r12d
je     11b3 <main+0x93>
cmp    $0x3,%r12d
jb     1140 <main+0x20>
mov    $0x2,%ebp
jmp    1172 <main+0x52>
nopw   0x0(%rax,%rax,1)
lea    (%rbx,%rbp,1),%eax
add    $0x1,%eax
mov    %ebp,%ecx
add    $0x1,%ecx
mov    %ecx,%ebp
cmp    $0x1,%eax
je     1140 <main+0x20>
mov    %r12d,%eax
xor    %edx,%edx
div    %ebp
test   %edx,%edx
je     1140 <main+0x20>
mov    %ebx,%eax
add    %ebp,%eax
jne    1160 <main+0x40>
mov    %r14,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r15d
imul   $0xcccccccd,%r15d,%eax
add    $0x19999999,%eax
cmp    $0x33333332,%eax
ja     1160 <main+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1160 <main+0x40>
lea    0xe4c(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d\09 \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [32 x i8] c"\0A\0AThere are %d prime numbers \0A\0A\00"
define i32 @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 0, i32* %4
store i32 1, i32* %2
br label %5
5: ; preds = %40, %0
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 100
br i1 %7, label %8, label %43
8: ; preds = %5
store i32 2, i32* %3
br label %9
9: ; preds = %36, %8
%10 = load i32, i32* %3
%11 = load i32, i32* %2
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %39
13: ; preds = %9
%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 %39
19: ; preds = %13
%20 = load i32, i32* %3
%21 = load i32, i32* %2
%22 = sub nsw i32 %21, 1
%23 = icmp eq i32 %20, %22
br i1 %23, label %24, label %35
24: ; preds = %19
%25 = load i32, i32* %2
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
%29 = load i32, i32* %4
%30 = srem i32 %29, 5
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %24
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %34
34: ; preds = %32, %24
br label %35
35: ; preds = %34, %19
br label %36
36: ; preds = %35
%37 = load i32, i32* %3
%38 = add nsw i32 %37, 1
store i32 %38, i32* %3
br label %9
39: ; preds = %18, %9
br label %40
40: ; preds = %39
%41 = load i32, i32* %2
%42 = add nsw i32 %41, 1
store i32 %42, i32* %2
br label %5
43: ; preds = %5
%44 = load i32, i32* %4
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %44)
ret i32 0
}

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