#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__ fermatTest(int, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int i;
  for (i = 15; i > 1; i--) {
    if (fermatTest(i, 100))
      printf("%d is prime\n", i);
    else
      printf("%d is composite\n", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xf,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    118d <main+0x6d>
mov    -0x8(%rbp),%edi
mov    $0x64,%esi
call   1040 <fermatTest@plt>
cmp    $0x0,%rax
je     116b <main+0x4b>
mov    -0x8(%rbp),%esi
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
jmp    117a <main+0x5a>
mov    -0x8(%rbp),%esi
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
jmp    117f <main+0x5f>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0xf,%edi
mov    $0x64,%esi
call   1040 <fermatTest@plt>
test   %rax,%rax
lea    0xed0(%rip),%r14
lea    0xebc(%rip),%rbx
mov    %rbx,%rdi
cmove  %r14,%rdi
mov    $0xf,%esi
call   1030 <printf@plt>
mov    $0xe,%edi
mov    $0x64,%esi
call   1040 <fermatTest@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmove  %r14,%rdi
mov    $0xe,%esi
call   1030 <printf@plt>
mov    $0xd,%edi
mov    $0x64,%esi
call   1040 <fermatTest@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmove  %r14,%rdi
mov    $0xd,%esi
call   1030 <printf@plt>
mov    $0xc,%edi
mov    $0x64,%esi
call   1040 <fermatTest@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmove  %r14,%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
mov    $0xb,%edi
mov    $0x64,%esi
call   1040 <fermatTest@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmove  %r14,%rdi
mov    $0xb,%esi
call   1030 <printf@plt>
mov    $0xa,%edi
mov    $0x64,%esi
call   1040 <fermatTest@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmove  %r14,%rdi
mov    $0xa,%esi
call   1030 <printf@plt>
mov    $0x9,%edi
mov    $0x64,%esi
call   1040 <fermatTest@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmove  %r14,%rdi
mov    $0x9,%esi
call   1030 <printf@plt>
mov    $0x8,%edi
mov    $0x64,%esi
call   1040 <fermatTest@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmove  %r14,%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
mov    $0x7,%edi
mov    $0x64,%esi
call   1040 <fermatTest@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmove  %r14,%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
mov    $0x6,%edi
mov    $0x64,%esi
call   1040 <fermatTest@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmove  %r14,%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
mov    $0x5,%edi
mov    $0x64,%esi
call   1040 <fermatTest@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmove  %r14,%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
mov    $0x4,%edi
mov    $0x64,%esi
call   1040 <fermatTest@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmove  %r14,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
mov    $0x3,%edi
mov    $0x64,%esi
call   1040 <fermatTest@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmove  %r14,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    $0x2,%edi
mov    $0x64,%esi
call   1040 <fermatTest@plt>
test   %rax,%rax
cmove  %r14,%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [13 x i8] c"%d is prime\0A\00"
@.str.1 = [17 x i8] c"%d is composite\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 15, i32* %2
br label %3
3: ; preds = %17, %0
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 1
br i1 %5, label %6, label %20
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i64 @fermatTest(i32 %7, i32 100)
%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 %16
13: ; preds = %6
%14 = load i32, i32* %2
%15 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %13, %10
br label %17
17: ; preds = %16
%18 = load i32, i32* %2
%19 = add nsw i32 %18, -1
store i32 %19, i32* %2
br label %3
20: ; preds = %3
ret i32 0
}

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