#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 */
typedef int clock_t;

/* Variables and functions */
int CLOCKS_PER_SEC;
int EXIT_SUCCESS;
int clock();
int isPrimeIt(int, int, int);
int /*<<< orphan*/ isPrimeItIO();
int /*<<< orphan*/ printf(char *, int, ...);
int main(int argc, char *argv[]) {
  printf("R1 = %d \n", isPrimeIt(11, 2, (11 / 7)));
  printf("R2 = %d \n", isPrimeIt(11, (11 / 7), (11 / 6)));
  printf("R3 = %d \n", isPrimeIt(11, (11 / 6), (11 / 5)));
  printf("11/6 = %d und 11/5 = %d \n", (11 / 6), (11 / 5));
  printf("R4 = %d \n", isPrimeIt(11, (11 / 5), (11 / 4)));
  printf("R5 inc => 11/4 = %d und 11/3 = %d \n", (11 / 4), (11 / 3));
  printf("R5 = %d \n", isPrimeIt(11, (11 / 4), (11 / 3)));
  printf("R6 = %d \n", isPrimeIt(11, (11 / 3), (11 / 2)));
  clock_t start = clock(), diff;
  isPrimeItIO();
  diff = clock() - start;
  int msec = diff * 1000 / CLOCKS_PER_SEC;
  printf("Function took %ds and %d milliseconds to complete.", msec / 1000,
         msec % 1000);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xb,%edi
mov    $0x2,%esi
mov    $0x1,%edx
call   1030 <isPrimeIt@plt>
mov    %eax,%esi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xb,%edi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <isPrimeIt@plt>
mov    %eax,%esi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xb,%edi
mov    $0x1,%esi
mov    $0x2,%edx
call   1030 <isPrimeIt@plt>
mov    %eax,%esi
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe58(%rip),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xb,%edi
mov    $0x2,%edx
mov    %edx,%esi
call   1030 <isPrimeIt@plt>
mov    %eax,%esi
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe43(%rip),%rdi
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xb,%edi
mov    $0x2,%esi
mov    $0x3,%edx
call   1030 <isPrimeIt@plt>
mov    %eax,%esi
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xb,%edi
mov    $0x3,%esi
mov    $0x5,%edx
call   1030 <isPrimeIt@plt>
mov    %eax,%esi
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1060 <isPrimeItIO@plt>
mov    $0x0,%al
call   1040 <clock@plt>
sub    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
imul   $0x3e8,-0x18(%rbp),%eax
mov    0x2d64(%rip),%rcx
cltd
idivl  (%rcx)
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x1c(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
lea    0xdd1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2d21(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xb,%edi
mov    $0x2,%esi
mov    $0x1,%edx
call   1030 <isPrimeIt@plt>
lea    0xea4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xb,%edi
mov    $0x1,%esi
mov    $0x1,%edx
call   1030 <isPrimeIt@plt>
lea    0xe8a(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xb,%edi
mov    $0x1,%esi
mov    $0x2,%edx
call   1030 <isPrimeIt@plt>
lea    0xe70(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe6a(%rip),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xb,%edi
mov    $0x2,%esi
mov    $0x2,%edx
call   1030 <isPrimeIt@plt>
lea    0xe58(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe52(%rip),%rdi
mov    $0x2,%esi
mov    $0x3,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xb,%edi
mov    $0x2,%esi
mov    $0x3,%edx
call   1030 <isPrimeIt@plt>
lea    0xe4a(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xb,%edi
mov    $0x3,%esi
mov    $0x5,%edx
call   1030 <isPrimeIt@plt>
lea    0xe30(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <clock@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <isPrimeItIO@plt>
xor    %eax,%eax
call   1040 <clock@plt>
sub    %ebx,%eax
imul   $0x3e8,%eax,%eax
mov    0x2d79(%rip),%rcx
cltd
idivl  (%rcx)
movslq %eax,%rdx
imul   $0x10624dd3,%rdx,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x26,%rsi
add    %eax,%esi
imul   $0x3e8,%esi,%eax
sub    %eax,%edx
lea    0xde2(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2d32(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"R1 = %d \0A\00"
@.str.1 = [10 x i8] c"R2 = %d \0A\00"
@.str.2 = [10 x i8] c"R3 = %d \0A\00"
@.str.3 = [26 x i8] c"11/6 = %d und 11/5 = %d \0A\00"
@.str.4 = [10 x i8] c"R4 = %d \0A\00"
@.str.5 = [36 x i8] c"R5 inc => 11/4 = %d und 11/3 = %d \0A\00"
@.str.6 = [10 x i8] c"R5 = %d \0A\00"
@.str.7 = [10 x i8] c"R6 = %d \0A\00"
@CLOCKS_PER_SEC = global i32 0
@.str.8 = [51 x i8] c"Function took %ds and %d milliseconds to complete.\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 @isPrimeIt(i32 11, i32 2, i32 1)
%10 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = call i32 @isPrimeIt(i32 11, i32 1, i32 1)
%12 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = call i32 @isPrimeIt(i32 11, i32 1, i32 2)
%14 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 2)
%16 = call i32 @isPrimeIt(i32 11, i32 2, i32 2)
%17 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %16)
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 2, i32 3)
%19 = call i32 @isPrimeIt(i32 11, i32 2, i32 3)
%20 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %19)
%21 = call i32 @isPrimeIt(i32 11, i32 3, i32 5)
%22 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 %21)
%23 = call i32 (...) @clock()
store i32 %23, i32* %6
%24 = call i32 (...) @isPrimeItIO()
%25 = call i32 (...) @clock()
%26 = load i32, i32* %6
%27 = sub nsw i32 %25, %26
store i32 %27, i32* %7
%28 = load i32, i32* %7
%29 = mul nsw i32 %28, 1000
%30 = load i32, i32* @CLOCKS_PER_SEC
%31 = sdiv i32 %29, %30
store i32 %31, i32* %8
%32 = load i32, i32* %8
%33 = sdiv i32 %32, 1000
%34 = load i32, i32* %8
%35 = srem i32 %34, 1000
%36 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.8, i64 0, i64 0), i32 %33, i32 %35)
%37 = load i32, i32* @EXIT_SUCCESS
ret i32 %37
}

LLVM IR (-O2):
@.str = [10 x i8] c"R1 = %d \0A\00"
@.str.1 = [10 x i8] c"R2 = %d \0A\00"
@.str.2 = [10 x i8] c"R3 = %d \0A\00"
@.str.3 = [26 x i8] c"11/6 = %d und 11/5 = %d \0A\00"
@.str.4 = [10 x i8] c"R4 = %d \0A\00"
@.str.5 = [36 x i8] c"R5 inc => 11/4 = %d und 11/3 = %d \0A\00"
@.str.6 = [10 x i8] c"R5 = %d \0A\00"
@.str.7 = [10 x i8] c"R6 = %d \0A\00"
@CLOCKS_PER_SEC = global i32 0
@.str.8 = [51 x i8] c"Function took %ds and %d milliseconds to complete.\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @isPrimeIt(i32 11, i32 2, i32 1)
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @isPrimeIt(i32 11, i32 1, i32 1)
%6 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = tail call i32 @isPrimeIt(i32 11, i32 1, i32 2)
%8 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 2)
%10 = tail call i32 @isPrimeIt(i32 11, i32 2, i32 2)
%11 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %10)
%12 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 2, i32 3)
%13 = tail call i32 @isPrimeIt(i32 11, i32 2, i32 3)
%14 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %13)
%15 = tail call i32 @isPrimeIt(i32 11, i32 3, i32 5)
%16 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 %15)
%17 = tail call i32 (...) @clock()
%18 = tail call i32 (...) @isPrimeItIO()
%19 = tail call i32 (...) @clock()
%20 = sub nsw i32 %19, %17
%21 = mul nsw i32 %20, 1000
%22 = load i32, i32* @CLOCKS_PER_SEC
%23 = sdiv i32 %21, %22
%24 = sdiv i32 %23, 1000
%25 = srem i32 %23, 1000
%26 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.8, i64 0, i64 0), i32 %24, i32 %25)
%27 = load i32, i32* @EXIT_SUCCESS
ret i32 %27
}