#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 */
double difftime(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ ft_add_case(int *, int, int);
int ft_find_next_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, 7919);
  ft_add_case(&test[1][0], -236, 2);
  ft_add_case(&test[2][0], 0, 2);
  ft_add_case(&test[3][0], 1, 2);
  ft_add_case(&test[4][0], 2, 2);
  ft_add_case(&test[5][0], 3313, 3313);
  ft_add_case(&test[6][0], 30967, 30971);
  ft_add_case(&test[7][0], 31051, 31051);
  ft_add_case(&test[8][0], 855890, 855901);
  i = 0;
  while (i < 9) {
    nb = test[i][0];
    actual = test[i][1];
    printf("number %i, next prime?\n", nb);
    time(&start_t);
    result = ft_find_next_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,%edx
mov    %edx,%esi
call   1030 <ft_add_case@plt>
lea    -0x60(%rbp),%rdi
add    $0x8,%rdi
mov    $0xffffff14,%esi
mov    $0x2,%edx
call   1030 <ft_add_case@plt>
lea    -0x60(%rbp),%rdi
add    $0x10,%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1030 <ft_add_case@plt>
lea    -0x60(%rbp),%rdi
add    $0x18,%rdi
mov    $0x1,%esi
mov    $0x2,%edx
call   1030 <ft_add_case@plt>
lea    -0x60(%rbp),%rdi
add    $0x20,%rdi
mov    $0x2,%edx
mov    %edx,%esi
call   1030 <ft_add_case@plt>
lea    -0x60(%rbp),%rdi
add    $0x28,%rdi
mov    $0xcf1,%edx
mov    %edx,%esi
call   1030 <ft_add_case@plt>
lea    -0x60(%rbp),%rdi
add    $0x30,%rdi
mov    $0x78f7,%esi
mov    $0x78fb,%edx
call   1030 <ft_add_case@plt>
lea    -0x60(%rbp),%rdi
add    $0x38,%rdi
mov    $0x794b,%edx
mov    %edx,%esi
call   1030 <ft_add_case@plt>
lea    -0x60(%rbp),%rdi
add    $0x40,%rdi
mov    $0xd0f52,%esi
mov    $0xd0f5d,%edx
call   1030 <ft_add_case@plt>
movl   $0x0,-0x64(%rbp)
cmpl   $0x9,-0x64(%rbp)
jge    12ce <main+0x17e>
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    0xdb4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1060 <time@plt>
mov    -0x68(%rbp),%edi
call   1070 <ft_find_next_prime@plt>
mov    %eax,-0x6c(%rbp)
lea    -0xc(%rbp),%rdi
call   1060 <time@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <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    0xd81(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x6c(%rbp),%eax
cmp    -0x70(%rbp),%eax
je     12c0 <main+0x170>
lea    0xd95(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    %eax,-0x4(%rbp)
jmp    12df <main+0x18f>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1222 <main+0xd2>
lea    0xd83(%rip),%rdi
mov    $0x0,%al
call   1040 <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    $0x1eef,%edx
call   1030 <ft_add_case@plt>
lea    0x18(%rsp),%rdi
mov    $0xffffff14,%esi
mov    $0x2,%edx
call   1030 <ft_add_case@plt>
lea    0x20(%rsp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1030 <ft_add_case@plt>
lea    0x28(%rsp),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
call   1030 <ft_add_case@plt>
lea    0x30(%rsp),%rdi
mov    $0x2,%esi
mov    $0x2,%edx
call   1030 <ft_add_case@plt>
lea    0x38(%rsp),%rdi
mov    $0xcf1,%esi
mov    $0xcf1,%edx
call   1030 <ft_add_case@plt>
lea    0x40(%rsp),%rdi
mov    $0x78f7,%esi
mov    $0x78fb,%edx
call   1030 <ft_add_case@plt>
lea    0x48(%rsp),%rdi
mov    $0x794b,%esi
mov    $0x794b,%edx
call   1030 <ft_add_case@plt>
lea    0x50(%rsp),%rdi
mov    $0xd0f52,%esi
mov    $0xd0f5d,%edx
call   1030 <ft_add_case@plt>
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%r13
lea    0xdf8(%rip),%rbx
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x10(%rsp,%r14,8),%ebp
mov    0x14(%rsp,%r14,8),%r15d
lea    0xdbf(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
call   1060 <time@plt>
mov    %ebp,%edi
call   1070 <ft_find_next_prime@plt>
mov    %eax,%ebp
mov    %r13,%rdi
call   1060 <time@plt>
mov    0x8(%rsp),%edi
mov    0xc(%rsp),%esi
call   1050 <difftime@plt>
mov    0x14(%rsp,%r14,8),%edx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x1,%al
call   1040 <printf@plt>
cmp    %r15d,%ebp
jne    1299 <main+0x149>
add    $0x1,%r14
cmp    $0x9,%r14
jne    1230 <main+0xe0>
lea    0xdc1(%rip),%rdi
jmp    12a0 <main+0x150>
lea    0xda6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"number %i, next prime?\0A\00"
@.str.1 = [46 x i8] c" result: %i, actual> %i, execution time = %f\0A\00"
@.str.2 = [18 x i8] c"FAKE AND GAY \E2\9C\97\0A\00"
@.str.3 = [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 7919)
%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 2)
%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 2)
%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 2)
%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 2)
%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 3313)
%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 30971)
%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 31051)
%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 855890, i32 855901)
store i32 0, i32* %6
br label %37
37: ; preds = %73, %0
%38 = load i32, i32* %6
%39 = icmp slt i32 %38, 9
br i1 %39, label %40, label %76
40: ; preds = %37
%41 = load i32, i32* %6
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %5, i64 0, i64 %42
%44 = getelementptr inbounds [2 x i32], [2 x i32]* %43, i64 0, i64 0
%45 = load i32, i32* %44
store i32 %45, i32* %7
%46 = load i32, i32* %6
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %5, i64 0, i64 %47
%49 = getelementptr inbounds [2 x i32], [2 x i32]* %48, i64 0, i64 1
%50 = load i32, i32* %49
store i32 %50, i32* %9
%51 = load i32, i32* %7
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %51)
%53 = call i32 @time(i32* %2)
%54 = load i32, i32* %7
%55 = call i32 @ft_find_next_prime(i32 %54)
store i32 %55, i32* %8
%56 = call i32 @time(i32* %3)
%57 = load i32, i32* %3
%58 = load i32, i32* %2
%59 = call double @difftime(i32 %57, i32 %58)
store double %59, double* %4
%60 = load i32, i32* %8
%61 = load i32, i32* %6
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %5, i64 0, i64 %62
%64 = getelementptr inbounds [2 x i32], [2 x i32]* %63, i64 0, i64 1
%65 = load i32, i32* %64
%66 = load double, double* %4
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i32 %60, i32 %65, double %66)
%68 = load i32, i32* %8
%69 = load i32, i32* %9
%70 = icmp ne i32 %68, %69
br i1 %70, label %71, label %73
71: ; preds = %40
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
store i32 %72, i32* %1
br label %78
73: ; preds = %40
%74 = load i32, i32* %6
%75 = add nsw i32 %74, 1
store i32 %75, i32* %6
br label %37
76: ; preds = %37
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
store i32 %77, i32* %1
br label %78
78: ; preds = %76, %71
%79 = load i32, i32* %1
ret i32 %79
}

LLVM IR (-O2):
@.str = [24 x i8] c"number %i, next prime?\0A\00"
@.str.1 = [46 x i8] c" result: %i, actual> %i, execution time = %f\0A\00"
@.str.2 = [18 x i8] c"FAKE AND GAY \E2\9C\97\0A\00"
@.str.3 = [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 7919)
%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 2)
%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 2)
%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 2)
%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 2)
%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 3313)
%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 30971)
%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 31051)
%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 855890, i32 855901)
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 ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %31)
%35 = call i32 @time(i32* %1)
%36 = call i32 @ft_find_next_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.1, 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.2, i64 0, i64 0), %28 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), %25 ]
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %45)
ret i32 %46
}