#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 */
scalar_t__ isPrime(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i;
  for (i = 1; i < 11; i++) {
    if (isPrime(i))
      printf("%d is Prime\n", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0xb,-0x8(%rbp)
jge    1174 <main+0x54>
mov    -0x8(%rbp),%edi
call   1040 <isPrime@plt>
cmp    $0x0,%rax
je     1161 <main+0x41>
mov    -0x8(%rbp),%esi
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
jmp    1166 <main+0x46>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1040 <isPrime@plt>
test   %rax,%rax
je     1141 <main+0x21>
lea    0xec9(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    $0x2,%edi
call   1040 <isPrime@plt>
test   %rax,%rax
je     1161 <main+0x41>
lea    0xea9(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    $0x3,%edi
call   1040 <isPrime@plt>
test   %rax,%rax
je     1181 <main+0x61>
lea    0xe89(%rip),%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    $0x4,%edi
call   1040 <isPrime@plt>
test   %rax,%rax
je     11a1 <main+0x81>
lea    0xe69(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
mov    $0x5,%edi
call   1040 <isPrime@plt>
test   %rax,%rax
je     11c1 <main+0xa1>
lea    0xe49(%rip),%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
mov    $0x6,%edi
call   1040 <isPrime@plt>
test   %rax,%rax
je     11e1 <main+0xc1>
lea    0xe29(%rip),%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
mov    $0x7,%edi
call   1040 <isPrime@plt>
test   %rax,%rax
je     1201 <main+0xe1>
lea    0xe09(%rip),%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
mov    $0x8,%edi
call   1040 <isPrime@plt>
test   %rax,%rax
je     1221 <main+0x101>
lea    0xde9(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
mov    $0x9,%edi
call   1040 <isPrime@plt>
test   %rax,%rax
je     1241 <main+0x121>
lea    0xdc9(%rip),%rdi
mov    $0x9,%esi
call   1030 <printf@plt>
mov    $0xa,%edi
call   1040 <isPrime@plt>
test   %rax,%rax
je     1261 <main+0x141>
lea    0xda9(%rip),%rdi
mov    $0xa,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"%d is Prime\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
br label %3
3: ; preds = %14, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 11
br i1 %5, label %6, label %17
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i64 @isPrime(i32 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = load i32, i32* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %10, %6
br label %14
14: ; preds = %13
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %3
17: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"%d is Prime\0A\00"
define i32 @main() {
%1 = tail call i64 @isPrime(i32 1)
%2 = icmp eq i64 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 1)
br label %5
5: ; preds = %0, %3
%6 = tail call i64 @isPrime(i32 2)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 2)
br label %10
10: ; preds = %8, %5
%11 = tail call i64 @isPrime(i32 3)
%12 = icmp eq i64 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 3)
br label %15
15: ; preds = %13, %10
%16 = tail call i64 @isPrime(i32 4)
%17 = icmp eq i64 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 4)
br label %20
20: ; preds = %18, %15
%21 = tail call i64 @isPrime(i32 5)
%22 = icmp eq i64 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %20
%24 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 5)
br label %25
25: ; preds = %23, %20
%26 = tail call i64 @isPrime(i32 6)
%27 = icmp eq i64 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %25
%29 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 6)
br label %30
30: ; preds = %28, %25
%31 = tail call i64 @isPrime(i32 7)
%32 = icmp eq i64 %31, 0
br i1 %32, label %35, label %33
33: ; preds = %30
%34 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 7)
br label %35
35: ; preds = %33, %30
%36 = tail call i64 @isPrime(i32 8)
%37 = icmp eq i64 %36, 0
br i1 %37, label %40, label %38
38: ; preds = %35
%39 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 8)
br label %40
40: ; preds = %38, %35
%41 = tail call i64 @isPrime(i32 9)
%42 = icmp eq i64 %41, 0
br i1 %42, label %45, label %43
43: ; preds = %40
%44 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 9)
br label %45
45: ; preds = %43, %40
%46 = tail call i64 @isPrime(i32 10)
%47 = icmp eq i64 %46, 0
br i1 %47, label %50, label %48
48: ; preds = %45
%49 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 10)
br label %50
50: ; preds = %48, %45
ret i32 0
}