#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 /*<<< orphan*/ time_t;

/* Variables and functions */
int INT_MAX;
double difftime(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ ft_add_case(int *, int, int);
int ft_is_prime(int);
int printf(char *, ...);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  time_t start_t, end_t;
  double diff_t;
  int test[9][2];
  int i, nb, result, actual;
  ft_add_case(&test[0][0], 7919, 1);
  ft_add_case(&test[1][0], -236, 0);
  ft_add_case(&test[2][0], 0, 0);
  ft_add_case(&test[3][0], 1, 0);
  ft_add_case(&test[4][0], 2, 1);
  ft_add_case(&test[5][0], 3313, 1);
  ft_add_case(&test[6][0], 30967, 0);
  ft_add_case(&test[7][0], 31051, 1);
  ft_add_case(&test[8][0], 2000000000, 0);
  i = 0;
  while (i < 9) {
    if (i == 9) {
      printf("\n/!\\WARNING/!\\\n");
      printf("You might fail the following test because of int overflow.\n");
      printf("INT_MAX: %i\n\n", INT_MAX);
    }
    nb = test[i][0];
    actual = test[i][1];
    printf("number %i, prime?\n", nb);
    time(&start_t);
    result = ft_is_prime(nb);
    time(&end_t);
    diff_t = difftime(end_t, start_t);
    printf(" result: %i, actual> %i, execution time = %f\n", result, test[i][1],
           diff_t);
    if (result != actual)
      return printf("FAKE AND GAY ✗\n");
    ++i;
  }
  return printf("GOES ✓\n");
  ;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
mov    $0x1eef,%esi
mov    $0x1,%edx
call   1030 <ft_add_case@plt>
lea    -0x60(%rbp),%rdi
add    $0x8,%rdi
mov    $0xffffff14,%esi
xor    %edx,%edx
call   1030 <ft_add_case@plt>
lea    -0x60(%rbp),%rdi
add    $0x10,%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1030 <ft_add_case@plt>
lea    -0x60(%rbp),%rdi
add    $0x18,%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1030 <ft_add_case@plt>
lea    -0x60(%rbp),%rdi
add    $0x20,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
call   1030 <ft_add_case@plt>
lea    -0x60(%rbp),%rdi
add    $0x28,%rdi
mov    $0xcf1,%esi
mov    $0x1,%edx
call   1030 <ft_add_case@plt>
lea    -0x60(%rbp),%rdi
add    $0x30,%rdi
mov    $0x78f7,%esi
xor    %edx,%edx
call   1030 <ft_add_case@plt>
lea    -0x60(%rbp),%rdi
add    $0x38,%rdi
mov    $0x794b,%esi
mov    $0x1,%edx
call   1030 <ft_add_case@plt>
lea    -0x60(%rbp),%rdi
add    $0x40,%rdi
mov    $0x77359400,%esi
xor    %edx,%edx
call   1030 <ft_add_case@plt>
movl   $0x0,-0x64(%rbp)
cmpl   $0x9,-0x64(%rbp)
jge    1308 <main+0x1b8>
cmpl   $0x9,-0x64(%rbp)
jne    1266 <main+0x116>
lea    0xdc6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdc8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2d92(%rip),%rax
mov    (%rax),%esi
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0x64(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%eax
mov    %eax,-0x68(%rbp)
movslq -0x64(%rbp),%rax
mov    -0x5c(%rbp,%rax,8),%eax
mov    %eax,-0x70(%rbp)
mov    -0x68(%rbp),%esi
lea    0xdd4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1070 <time@plt>
mov    -0x68(%rbp),%edi
call   1040 <ft_is_prime@plt>
mov    %eax,-0x6c(%rbp)
lea    -0xc(%rbp),%rdi
call   1070 <time@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1060 <difftime@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x6c(%rbp),%esi
movslq -0x64(%rbp),%rax
mov    -0x5c(%rbp,%rax,8),%edx
movsd  -0x18(%rbp),%xmm0
lea    0xd9c(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x6c(%rbp),%eax
cmp    -0x70(%rbp),%eax
je     12fa <main+0x1aa>
lea    0xdb0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    %eax,-0x4(%rbp)
jmp    1319 <main+0x1c9>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    121f <main+0xcf>
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
lea    0x10(%rsp),%rdi
mov    $0x1eef,%esi
mov    $0x1,%edx
call   1030 <ft_add_case@plt>
lea    0x18(%rsp),%rdi
mov    $0xffffff14,%esi
xor    %edx,%edx
call   1030 <ft_add_case@plt>
lea    0x20(%rsp),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <ft_add_case@plt>
lea    0x28(%rsp),%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1030 <ft_add_case@plt>
lea    0x30(%rsp),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
call   1030 <ft_add_case@plt>
lea    0x38(%rsp),%rdi
mov    $0xcf1,%esi
mov    $0x1,%edx
call   1030 <ft_add_case@plt>
lea    0x40(%rsp),%rdi
mov    $0x78f7,%esi
xor    %edx,%edx
call   1030 <ft_add_case@plt>
lea    0x48(%rsp),%rdi
mov    $0x794b,%esi
mov    $0x1,%edx
call   1030 <ft_add_case@plt>
lea    0x50(%rsp),%rdi
mov    $0x77359400,%esi
xor    %edx,%edx
call   1030 <ft_add_case@plt>
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%r13
lea    0xe02(%rip),%rbx
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x10(%rsp,%r14,8),%ebp
mov    0x14(%rsp,%r14,8),%r15d
lea    0xdcf(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
call   1070 <time@plt>
mov    %ebp,%edi
call   1040 <ft_is_prime@plt>
mov    %eax,%ebp
mov    %r13,%rdi
call   1070 <time@plt>
mov    0x8(%rsp),%edi
mov    0xc(%rsp),%esi
call   1060 <difftime@plt>
mov    0x14(%rsp,%r14,8),%edx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x1,%al
call   1050 <printf@plt>
cmp    %r15d,%ebp
jne    1289 <main+0x139>
add    $0x1,%r14
cmp    $0x9,%r14
jne    1220 <main+0xd0>
lea    0xdcc(%rip),%rdi
jmp    1290 <main+0x140>
lea    0xdb1(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"\0A/!\\WARNING/!\\\0A\00"
@.str.1 = [60 x i8] c"You might fail the following test because of int overflow.\0A\00"
@.str.2 = [14 x i8] c"INT_MAX: %i\0A\0A\00"
@INT_MAX = global i32 0
@.str.3 = [19 x i8] c"number %i, prime?\0A\00"
@.str.4 = [46 x i8] c" result: %i, actual> %i, execution time = %f\0A\00"
@.str.5 = [18 x i8] c"FAKE AND GAY \E2\9C\97\0A\00"
@.str.6 = [10 x i8] c"GOES \E2\9C\93\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca [9 x [2 x i32]]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %5, i64 0, i64 0
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 0
%12 = call i32 @ft_add_case(i32* %11, i32 7919, i32 1)
%13 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %5, i64 0, i64 1
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 0
%15 = call i32 @ft_add_case(i32* %14, i32 -236, i32 0)
%16 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %5, i64 0, i64 2
%17 = getelementptr inbounds [2 x i32], [2 x i32]* %16, i64 0, i64 0
%18 = call i32 @ft_add_case(i32* %17, i32 0, i32 0)
%19 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %5, i64 0, i64 3
%20 = getelementptr inbounds [2 x i32], [2 x i32]* %19, i64 0, i64 0
%21 = call i32 @ft_add_case(i32* %20, i32 1, i32 0)
%22 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %5, i64 0, i64 4
%23 = getelementptr inbounds [2 x i32], [2 x i32]* %22, i64 0, i64 0
%24 = call i32 @ft_add_case(i32* %23, i32 2, i32 1)
%25 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %5, i64 0, i64 5
%26 = getelementptr inbounds [2 x i32], [2 x i32]* %25, i64 0, i64 0
%27 = call i32 @ft_add_case(i32* %26, i32 3313, i32 1)
%28 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %5, i64 0, i64 6
%29 = getelementptr inbounds [2 x i32], [2 x i32]* %28, i64 0, i64 0
%30 = call i32 @ft_add_case(i32* %29, i32 30967, i32 0)
%31 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %5, i64 0, i64 7
%32 = getelementptr inbounds [2 x i32], [2 x i32]* %31, i64 0, i64 0
%33 = call i32 @ft_add_case(i32* %32, i32 31051, i32 1)
%34 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %5, i64 0, i64 8
%35 = getelementptr inbounds [2 x i32], [2 x i32]* %34, i64 0, i64 0
%36 = call i32 @ft_add_case(i32* %35, i32 2000000000, i32 0)
store i32 0, i32* %6
br label %37
37: ; preds = %81, %0
%38 = load i32, i32* %6
%39 = icmp slt i32 %38, 9
br i1 %39, label %40, label %84
40: ; preds = %37
%41 = load i32, i32* %6
%42 = icmp eq i32 %41, 9
br i1 %42, label %43, label %48
43: ; preds = %40
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0))
%46 = load i32, i32* @INT_MAX
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %46)
br label %48
48: ; preds = %43, %40
%49 = load i32, i32* %6
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %5, i64 0, i64 %50
%52 = getelementptr inbounds [2 x i32], [2 x i32]* %51, i64 0, i64 0
%53 = load i32, i32* %52
store i32 %53, i32* %7
%54 = load i32, i32* %6
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %5, i64 0, i64 %55
%57 = getelementptr inbounds [2 x i32], [2 x i32]* %56, i64 0, i64 1
%58 = load i32, i32* %57
store i32 %58, i32* %9
%59 = load i32, i32* %7
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %59)
%61 = call i32 @time(i32* %2)
%62 = load i32, i32* %7
%63 = call i32 @ft_is_prime(i32 %62)
store i32 %63, i32* %8
%64 = call i32 @time(i32* %3)
%65 = load i32, i32* %3
%66 = load i32, i32* %2
%67 = call double @difftime(i32 %65, i32 %66)
store double %67, double* %4
%68 = load i32, i32* %8
%69 = load i32, i32* %6
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %5, i64 0, i64 %70
%72 = getelementptr inbounds [2 x i32], [2 x i32]* %71, i64 0, i64 1
%73 = load i32, i32* %72
%74 = load double, double* %4
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0), i32 %68, i32 %73, double %74)
%76 = load i32, i32* %8
%77 = load i32, i32* %9
%78 = icmp ne i32 %76, %77
br i1 %78, label %79, label %81
79: ; preds = %48
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
store i32 %80, i32* %1
br label %86
81: ; preds = %48
%82 = load i32, i32* %6
%83 = add nsw i32 %82, 1
store i32 %83, i32* %6
br label %37
84: ; preds = %37
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
store i32 %85, i32* %1
br label %86
86: ; preds = %84, %79
%87 = load i32, i32* %1
ret i32 %87
}

LLVM IR (-O2):
@INT_MAX = global i32 0
@.str.3 = [19 x i8] c"number %i, prime?\0A\00"
@.str.4 = [46 x i8] c" result: %i, actual> %i, execution time = %f\0A\00"
@.str.5 = [18 x i8] c"FAKE AND GAY \E2\9C\97\0A\00"
@.str.6 = [10 x i8] c"GOES \E2\9C\93\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [9 x [2 x i32]]
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast [9 x [2 x i32]]* %3 to i8*
%7 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %3, i64 0, i64 0, i64 0
%8 = call i32 @ft_add_case(i32* %7, i32 7919, i32 1)
%9 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %3, i64 0, i64 1, i64 0
%10 = call i32 @ft_add_case(i32* %9, i32 -236, i32 0)
%11 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %3, i64 0, i64 2, i64 0
%12 = call i32 @ft_add_case(i32* %11, i32 0, i32 0)
%13 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %3, i64 0, i64 3, i64 0
%14 = call i32 @ft_add_case(i32* %13, i32 1, i32 0)
%15 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %3, i64 0, i64 4, i64 0
%16 = call i32 @ft_add_case(i32* %15, i32 2, i32 1)
%17 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %3, i64 0, i64 5, i64 0
%18 = call i32 @ft_add_case(i32* %17, i32 3313, i32 1)
%19 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %3, i64 0, i64 6, i64 0
%20 = call i32 @ft_add_case(i32* %19, i32 30967, i32 0)
%21 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %3, i64 0, i64 7, i64 0
%22 = call i32 @ft_add_case(i32* %21, i32 31051, i32 1)
%23 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %3, i64 0, i64 8, i64 0
%24 = call i32 @ft_add_case(i32* %23, i32 2000000000, i32 0)
br label %28
25: ; preds = %28
%26 = add nuw nsw i64 %29, 1
%27 = icmp eq i64 %26, 9
br i1 %27, label %44, label %28
28: ; preds = %0, %25
%29 = phi i64 [ 0, %0 ], [ %26, %25 ]
%30 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %3, i64 0, i64 %29, i64 0
%31 = load i32, i32* %30
%32 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %3, i64 0, i64 %29, i64 1
%33 = load i32, i32* %32
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %31)
%35 = call i32 @time(i32* %1)
%36 = call i32 @ft_is_prime(i32 %31)
%37 = call i32 @time(i32* %2)
%38 = load i32, i32* %2
%39 = load i32, i32* %1
%40 = call double @difftime(i32 %38, i32 %39)
%41 = load i32, i32* %32
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0), i32 %36, i32 %41, double %40)
%43 = icmp eq i32 %36, %33
br i1 %43, label %25, label %44
44: ; preds = %25, %28
%45 = phi i8* [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), %28 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), %25 ]
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %45)
ret i32 %46
}