#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);
void printPrime(int in) {
  bool prime;
  if (in <= 1) {
    return;
  }
  for (int n = 0; n <= in; n++) {
    prime = true;
    for (int i = 2; i < n - 1; i++) {
      if (n % i == 0) {
        prime = false;
        break;
      }
    }
    if (prime) {
      prime = false;
      printf("%d ", n);
    }
  }
}


x86 assembly (clang, -O0):
<printPrime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jg     112a <printPrime+0x1a>
jmp    11be <printPrime+0xae>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     11be <printPrime+0xae>
movl   $0x1,-0x8(%rbp)
movl   $0x2,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    118b <printPrime+0x7b>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    1178 <printPrime+0x68>
movl   $0x0,-0x8(%rbp)
jmp    118b <printPrime+0x7b>
jmp    117d <printPrime+0x6d>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114b <printPrime+0x3b>
cmpl   $0x0,-0x8(%rbp)
je     11ab <printPrime+0x9b>
movl   $0x0,-0x8(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
jmp    11b0 <printPrime+0xa0>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1131 <printPrime+0x21>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printPrime>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jge    1127 <printPrime+0x17>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %edi,%r15d
xor    %ebp,%ebp
lea    0xecd(%rip),%r14
xor    %ebx,%ebx
jmp    1157 <printPrime+0x47>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    0x1(%rbx),%eax
add    $0xffffffff,%ebp
cmp    %r15d,%ebx
mov    %eax,%ebx
je     111c <printPrime+0xc>
cmp    $0x4,%ebx
jb     1140 <printPrime+0x30>
mov    $0x2,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%eax
xor    %edx,%edx
div    %ecx
test   %edx,%edx
je     114a <printPrime+0x3a>
add    $0x1,%ecx
lea    (%rcx,%rbp,1),%eax
cmp    $0xffffffff,%eax
jne    1170 <printPrime+0x60>
jmp    1140 <printPrime+0x30>

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

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