#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_test_case(int *, int, int);
int /*<<< orphan*/ ft_get_values(int *, int *, int *);
int ft_recursive_factorial(int);
int printf(char *, ...);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  time_t start_t, end_t;
  double diff_t;
  int data[4][2];
  int nb;
  int result;
  int actual;
  int i;
  ft_add_test_case(&data[0][0], 5, 120);
  ft_add_test_case(&data[1][0], 0, 1);
  ft_add_test_case(&data[2][0], -42, 0);
  ft_add_test_case(&data[3][0], 12, 479001600);
  i = 0;
  while (i < 4) {
    ft_get_values(&data[i][0], &nb, &actual);
    time(&start_t);
    result = ft_recursive_factorial(nb);
    time(&end_t);
    diff_t = difftime(end_t, start_t);
    printf("nb: %i, result: %i, actual: %i, execution time = %f\n", nb, result,
           actual, diff_t);
    if (result != actual)
      return printf("\e[0;31mFAKE AND GAY ✗\e[0m\n");
    if (diff_t >= 2.0)
      return printf("\e[0;33mYOU ARE TOO SLOW! ✗\e[0m\n");
    ++i;
  }
  return printf("\e[0;32mGOES ✓\e[0m\n");
  ;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
mov    $0x5,%esi
mov    $0x78,%edx
call   1070 <ft_add_test_case@plt>
lea    -0x40(%rbp),%rdi
add    $0x8,%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1070 <ft_add_test_case@plt>
lea    -0x40(%rbp),%rdi
add    $0x10,%rdi
mov    $0xffffffd6,%esi
xor    %edx,%edx
call   1070 <ft_add_test_case@plt>
lea    -0x40(%rbp),%rdi
add    $0x18,%rdi
mov    $0xc,%esi
mov    $0x1c8cfc00,%edx
call   1070 <ft_add_test_case@plt>
movl   $0x0,-0x50(%rbp)
cmpl   $0x4,-0x50(%rbp)
jge    1294 <main+0x134>
movslq -0x50(%rbp),%rax
lea    -0x40(%rbp),%rdi
shl    $0x3,%rax
add    %rax,%rdi
lea    -0x44(%rbp),%rsi
lea    -0x4c(%rbp),%rdx
call   1080 <ft_get_values@plt>
lea    -0x8(%rbp),%rdi
call   1060 <time@plt>
mov    -0x44(%rbp),%edi
call   1030 <ft_recursive_factorial@plt>
mov    %eax,-0x48(%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    -0x44(%rbp),%esi
mov    -0x48(%rbp),%edx
mov    -0x4c(%rbp),%ecx
movsd  -0x18(%rbp),%xmm0
lea    0xdd8(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x48(%rbp),%eax
cmp    -0x4c(%rbp),%eax
je     1259 <main+0xf9>
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    %eax,-0x4(%rbp)
jmp    12a5 <main+0x145>
movsd  -0x18(%rbp),%xmm0
movsd  0xd9a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1286 <main+0x126>
lea    0xde3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    %eax,-0x4(%rbp)
jmp    12a5 <main+0x145>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    11c8 <main+0x68>
lea    0xde1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x40,%rsp
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x78,%edx
call   1070 <ft_add_test_case@plt>
lea    0x28(%rsp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1070 <ft_add_test_case@plt>
lea    0x30(%rsp),%r15
mov    %r15,%rdi
mov    $0xffffffd6,%esi
xor    %edx,%edx
call   1070 <ft_add_test_case@plt>
lea    0x38(%rsp),%r14
mov    %r14,%rdi
mov    $0xc,%esi
mov    $0x1c8cfc00,%edx
call   1070 <ft_add_test_case@plt>
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
call   1080 <ft_get_values@plt>
lea    0x14(%rsp),%rdi
call   1060 <time@plt>
mov    0xc(%rsp),%edi
call   1030 <ft_recursive_factorial@plt>
mov    %eax,%ebp
lea    0x10(%rsp),%rdi
call   1060 <time@plt>
mov    0x10(%rsp),%edi
mov    0x14(%rsp),%esi
call   1050 <difftime@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%ecx
lea    0xdf9(%rip),%rdi
mov    %ebp,%edx
movsd  %xmm0,0x18(%rsp)
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe18(%rip),%rbx
cmp    0x8(%rsp),%ebp
jne    13b5 <main+0x255>
movsd  0x18(%rsp),%xmm0
ucomisd 0xdc3(%rip),%xmm0
jae    13ae <main+0x24e>
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %r12,%rdi
call   1080 <ft_get_values@plt>
lea    0x14(%rsp),%rdi
call   1060 <time@plt>
mov    0xc(%rsp),%edi
call   1030 <ft_recursive_factorial@plt>
mov    %eax,%ebp
lea    0x10(%rsp),%rdi
call   1060 <time@plt>
mov    0x10(%rsp),%edi
mov    0x14(%rsp),%esi
call   1050 <difftime@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%ecx
lea    0xd78(%rip),%rdi
mov    %ebp,%edx
movsd  %xmm0,0x18(%rsp)
mov    $0x1,%al
call   1040 <printf@plt>
cmp    0x8(%rsp),%ebp
jne    13b5 <main+0x255>
movsd  0x18(%rsp),%xmm0
ucomisd 0xd49(%rip),%xmm0
jae    13ae <main+0x24e>
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %r15,%rdi
call   1080 <ft_get_values@plt>
lea    0x14(%rsp),%rdi
call   1060 <time@plt>
mov    0xc(%rsp),%edi
call   1030 <ft_recursive_factorial@plt>
mov    %eax,%ebp
lea    0x10(%rsp),%rdi
call   1060 <time@plt>
mov    0x10(%rsp),%edi
mov    0x14(%rsp),%esi
call   1050 <difftime@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%ecx
lea    0xcfe(%rip),%rdi
mov    %ebp,%edx
movsd  %xmm0,0x18(%rsp)
mov    $0x1,%al
call   1040 <printf@plt>
cmp    0x8(%rsp),%ebp
jne    13b5 <main+0x255>
movsd  0x18(%rsp),%xmm0
ucomisd 0xccf(%rip),%xmm0
jae    13ae <main+0x24e>
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %r14,%rdi
call   1080 <ft_get_values@plt>
lea    0x14(%rsp),%rdi
call   1060 <time@plt>
mov    0xc(%rsp),%edi
call   1030 <ft_recursive_factorial@plt>
mov    %eax,%ebp
lea    0x10(%rsp),%rdi
call   1060 <time@plt>
mov    0x10(%rsp),%edi
mov    0x14(%rsp),%esi
call   1050 <difftime@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%ecx
lea    0xc88(%rip),%rdi
mov    %ebp,%edx
movsd  %xmm0,0x18(%rsp)
mov    $0x1,%al
call   1040 <printf@plt>
cmp    0x8(%rsp),%ebp
jne    13b5 <main+0x255>
movsd  0x18(%rsp),%xmm0
ucomisd 0xc5d(%rip),%xmm0
jae    13ae <main+0x24e>
lea    0xcd0(%rip),%rbx
jmp    13b5 <main+0x255>
lea    0xca5(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [53 x i8] c"nb: %i, result: %i, actual: %i, execution time = %f\0A\00"
@.str.1 = [29 x i8] c"\1B[0;31mFAKE AND GAY \E2\9C\97\1B[0m\0A\00"
@.str.2 = [34 x i8] c"\1B[0;33mYOU ARE TOO SLOW! \E2\9C\97\1B[0m\0A\00"
@.str.3 = [21 x i8] c"\1B[0;32mGOES \E2\9C\93\1B[0m\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca [4 x [2 x i32]]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = getelementptr inbounds [4 x [2 x i32]], [4 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_test_case(i32* %11, i32 5, i32 120)
%13 = getelementptr inbounds [4 x [2 x i32]], [4 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_test_case(i32* %14, i32 0, i32 1)
%16 = getelementptr inbounds [4 x [2 x i32]], [4 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_test_case(i32* %17, i32 -42, i32 0)
%19 = getelementptr inbounds [4 x [2 x i32]], [4 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_test_case(i32* %20, i32 12, i32 479001600)
store i32 0, i32* %9
br label %22
22: ; preds = %53, %0
%23 = load i32, i32* %9
%24 = icmp slt i32 %23, 4
br i1 %24, label %25, label %56
25: ; preds = %22
%26 = load i32, i32* %9
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [4 x [2 x i32]], [4 x [2 x i32]]* %5, i64 0, i64 %27
%29 = getelementptr inbounds [2 x i32], [2 x i32]* %28, i64 0, i64 0
%30 = call i32 @ft_get_values(i32* %29, i32* %6, i32* %8)
%31 = call i32 @time(i32* %2)
%32 = load i32, i32* %6
%33 = call i32 @ft_recursive_factorial(i32 %32)
store i32 %33, i32* %7
%34 = call i32 @time(i32* %3)
%35 = load i32, i32* %3
%36 = load i32, i32* %2
%37 = call double @difftime(i32 %35, i32 %36)
store double %37, double* %4
%38 = load i32, i32* %6
%39 = load i32, i32* %7
%40 = load i32, i32* %8
%41 = load double, double* %4
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %38, i32 %39, i32 %40, double %41)
%43 = load i32, i32* %7
%44 = load i32, i32* %8
%45 = icmp ne i32 %43, %44
br i1 %45, label %46, label %48
46: ; preds = %25
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
store i32 %47, i32* %1
br label %58
48: ; preds = %25
%49 = load double, double* %4
%50 = fcmp oge double %49, 2.000000e+00
br i1 %50, label %51, label %53
51: ; preds = %48
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
store i32 %52, i32* %1
br label %58
53: ; preds = %48
%54 = load i32, i32* %9
%55 = add nsw i32 %54, 1
store i32 %55, i32* %9
br label %22
56: ; preds = %22
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
store i32 %57, i32* %1
br label %58
58: ; preds = %56, %51, %46
%59 = load i32, i32* %1
ret i32 %59
}

LLVM IR (-O2):
@.str = [53 x i8] c"nb: %i, result: %i, actual: %i, execution time = %f\0A\00"
@.str.1 = [29 x i8] c"\1B[0;31mFAKE AND GAY \E2\9C\97\1B[0m\0A\00"
@.str.2 = [34 x i8] c"\1B[0;33mYOU ARE TOO SLOW! \E2\9C\97\1B[0m\0A\00"
@.str.3 = [21 x i8] c"\1B[0;32mGOES \E2\9C\93\1B[0m\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [4 x [2 x i32]]
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = bitcast [4 x [2 x i32]]* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = getelementptr inbounds [4 x [2 x i32]], [4 x [2 x i32]]* %3, i64 0, i64 0, i64 0
%12 = call i32 @ft_add_test_case(i32* %11, i32 5, i32 120)
%13 = getelementptr inbounds [4 x [2 x i32]], [4 x [2 x i32]]* %3, i64 0, i64 1, i64 0
%14 = call i32 @ft_add_test_case(i32* %13, i32 0, i32 1)
%15 = getelementptr inbounds [4 x [2 x i32]], [4 x [2 x i32]]* %3, i64 0, i64 2, i64 0
%16 = call i32 @ft_add_test_case(i32* %15, i32 -42, i32 0)
%17 = getelementptr inbounds [4 x [2 x i32]], [4 x [2 x i32]]* %3, i64 0, i64 3, i64 0
%18 = call i32 @ft_add_test_case(i32* %17, i32 12, i32 479001600)
%19 = call i32 @ft_get_values(i32* %11, i32* %4, i32* %5)
%20 = call i32 @time(i32* %1)
%21 = load i32, i32* %4
%22 = call i32 @ft_recursive_factorial(i32 %21)
%23 = call i32 @time(i32* %2)
%24 = load i32, i32* %2
%25 = load i32, i32* %1
%26 = call double @difftime(i32 %24, i32 %25)
%27 = load i32, i32* %4
%28 = load i32, i32* %5
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %27, i32 %22, i32 %28, double %26)
%30 = load i32, i32* %5
%31 = icmp eq i32 %22, %30
br i1 %31, label %80, label %83
32: ; preds = %80
%33 = call i32 @ft_get_values(i32* %13, i32* %4, i32* %5)
%34 = call i32 @time(i32* %1)
%35 = load i32, i32* %4
%36 = call i32 @ft_recursive_factorial(i32 %35)
%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* %4
%42 = load i32, i32* %5
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %41, i32 %36, i32 %42, double %40)
%44 = load i32, i32* %5
%45 = icmp eq i32 %36, %44
br i1 %45, label %46, label %83
46: ; preds = %32
%47 = fcmp ult double %40, 2.000000e+00
br i1 %47, label %48, label %82
48: ; preds = %46
%49 = call i32 @ft_get_values(i32* %15, i32* %4, i32* %5)
%50 = call i32 @time(i32* %1)
%51 = load i32, i32* %4
%52 = call i32 @ft_recursive_factorial(i32 %51)
%53 = call i32 @time(i32* %2)
%54 = load i32, i32* %2
%55 = load i32, i32* %1
%56 = call double @difftime(i32 %54, i32 %55)
%57 = load i32, i32* %4
%58 = load i32, i32* %5
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %57, i32 %52, i32 %58, double %56)
%60 = load i32, i32* %5
%61 = icmp eq i32 %52, %60
br i1 %61, label %62, label %83
62: ; preds = %48
%63 = fcmp ult double %56, 2.000000e+00
br i1 %63, label %64, label %82
64: ; preds = %62
%65 = call i32 @ft_get_values(i32* %17, i32* %4, i32* %5)
%66 = call i32 @time(i32* %1)
%67 = load i32, i32* %4
%68 = call i32 @ft_recursive_factorial(i32 %67)
%69 = call i32 @time(i32* %2)
%70 = load i32, i32* %2
%71 = load i32, i32* %1
%72 = call double @difftime(i32 %70, i32 %71)
%73 = load i32, i32* %4
%74 = load i32, i32* %5
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %73, i32 %68, i32 %74, double %72)
%76 = load i32, i32* %5
%77 = icmp eq i32 %68, %76
br i1 %77, label %78, label %83
78: ; preds = %64
%79 = fcmp ult double %72, 2.000000e+00
br i1 %79, label %83, label %82
80: ; preds = %0
%81 = fcmp ult double %26, 2.000000e+00
br i1 %81, label %32, label %82
82: ; preds = %78, %62, %46, %80
br label %83
83: ; preds = %0, %32, %48, %64, %78, %82
%84 = phi i8* [ getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), %82 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), %78 ], [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), %64 ], [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), %48 ], [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), %32 ], [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), %0 ]
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %84)
ret i32 %85
}