#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);
int /*<<< orphan*/ ft_get_values(int *, int *, int *, int *);
int ft_iterative_power(int, int);
int printf(char *, ...);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  time_t start_t, end_t;
  double diff_t;
  int data[5][3];
  int nb;
  int power;
  int result;
  int actual;
  int i;
  ft_add_test_case(&data[0][0], -3, 0, 1);
  ft_add_test_case(&data[1][0], -235, -124, 0);
  ft_add_test_case(&data[2][0], 21, 3, 9261);
  ft_add_test_case(&data[3][0], 4, 10, 1048576);
  ft_add_test_case(&data[4][0], 14, 8, 1475789056);
  i = 0;
  while (i < 5) {
    ft_get_values(&data[i][0], &nb, &power, &actual);
    time(&start_t);
    result = ft_iterative_power(nb, power);
    time(&end_t);
    diff_t = difftime(end_t, start_t);
    printf("nb: %i, power: %i, result: %i, actual: %i, execution time = %f\n",
           nb, power, 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    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
mov    $0xfffffffd,%esi
xor    %edx,%edx
mov    $0x1,%ecx
call   1060 <ft_add_test_case@plt>
lea    -0x60(%rbp),%rdi
add    $0xc,%rdi
mov    $0xffffff15,%esi
mov    $0xffffff84,%edx
xor    %ecx,%ecx
call   1060 <ft_add_test_case@plt>
lea    -0x60(%rbp),%rdi
add    $0x18,%rdi
mov    $0x15,%esi
mov    $0x3,%edx
mov    $0x242d,%ecx
call   1060 <ft_add_test_case@plt>
lea    -0x60(%rbp),%rdi
add    $0x24,%rdi
mov    $0x4,%esi
mov    $0xa,%edx
mov    $0x100000,%ecx
call   1060 <ft_add_test_case@plt>
lea    -0x60(%rbp),%rdi
add    $0x30,%rdi
mov    $0xe,%esi
mov    $0x8,%edx
mov    $0x57f6c100,%ecx
call   1060 <ft_add_test_case@plt>
movl   $0x0,-0x74(%rbp)
cmpl   $0x5,-0x74(%rbp)
jge    12d2 <main+0x172>
movslq -0x74(%rbp),%rax
lea    -0x60(%rbp),%rdi
imul   $0xc,%rax,%rax
add    %rax,%rdi
lea    -0x64(%rbp),%rsi
lea    -0x68(%rbp),%rdx
lea    -0x70(%rbp),%rcx
call   1080 <ft_get_values@plt>
lea    -0x8(%rbp),%rdi
call   1050 <time@plt>
mov    -0x64(%rbp),%edi
mov    -0x68(%rbp),%esi
call   1070 <ft_iterative_power@plt>
mov    %eax,-0x6c(%rbp)
lea    -0xc(%rbp),%rdi
call   1050 <time@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <difftime@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x64(%rbp),%esi
mov    -0x68(%rbp),%edx
mov    -0x6c(%rbp),%ecx
mov    -0x70(%rbp),%r8d
movsd  -0x18(%rbp),%xmm0
lea    0xd9a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x6c(%rbp),%eax
cmp    -0x70(%rbp),%eax
je     1297 <main+0x137>
lea    0xdc0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    %eax,-0x4(%rbp)
jmp    12e3 <main+0x183>
movsd  -0x18(%rbp),%xmm0
movsd  0xd5c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12c4 <main+0x164>
lea    0xdb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    %eax,-0x4(%rbp)
jmp    12e3 <main+0x183>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    11fb <main+0x9b>
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
lea    0x20(%rsp),%rdi
xor    %r12d,%r12d
mov    $0xfffffffd,%esi
xor    %edx,%edx
mov    $0x1,%ecx
call   1060 <ft_add_test_case@plt>
lea    0x2c(%rsp),%rdi
mov    $0xffffff15,%esi
mov    $0xffffff84,%edx
xor    %ecx,%ecx
call   1060 <ft_add_test_case@plt>
lea    0x38(%rsp),%rdi
mov    $0x15,%esi
mov    $0x3,%edx
mov    $0x242d,%ecx
call   1060 <ft_add_test_case@plt>
lea    0x44(%rsp),%rdi
mov    $0x4,%esi
mov    $0xa,%edx
mov    $0x100000,%ecx
call   1060 <ft_add_test_case@plt>
lea    0x50(%rsp),%rdi
mov    $0xe,%esi
mov    $0x8,%edx
mov    $0x57f6c100,%ecx
call   1060 <ft_add_test_case@plt>
lea    0x4(%rsp),%r13
lea    0x14(%rsp),%rbx
lea    0x10(%rsp),%rbp
lea    0xe0a(%rip),%r14
xchg   %ax,%ax
lea    (%rsp,%r12,1),%rdi
add    $0x20,%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %r13,%rcx
call   1080 <ft_get_values@plt>
mov    %rbx,%rdi
call   1050 <time@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1070 <ft_iterative_power@plt>
mov    %eax,%r15d
mov    %rbp,%rdi
call   1050 <time@plt>
mov    0x10(%rsp),%edi
mov    0x14(%rsp),%esi
call   1040 <difftime@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    0x4(%rsp),%r8d
mov    %r14,%rdi
mov    %r15d,%ecx
movsd  %xmm0,0x18(%rsp)
mov    $0x1,%al
call   1030 <printf@plt>
cmp    0x4(%rsp),%r15d
jne    1295 <main+0x135>
movsd  0x18(%rsp),%xmm0
ucomisd 0xd84(%rip),%xmm0
jae    129e <main+0x13e>
add    $0xc,%r12
cmp    $0x3c,%r12
jne    1200 <main+0xa0>
lea    0xdf4(%rip),%rdi
jmp    12a5 <main+0x145>
lea    0xdac(%rip),%rdi
jmp    12a5 <main+0x145>
lea    0xdc0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [64 x i8] c"nb: %i, power: %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 [5 x [3 x i32]]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
%11 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %5, i64 0, i64 0
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %11, i64 0, i64 0
%13 = call i32 @ft_add_test_case(i32* %12, i32 -3, i32 0, i32 1)
%14 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %5, i64 0, i64 1
%15 = getelementptr inbounds [3 x i32], [3 x i32]* %14, i64 0, i64 0
%16 = call i32 @ft_add_test_case(i32* %15, i32 -235, i32 -124, i32 0)
%17 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %5, i64 0, i64 2
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 0, i64 0
%19 = call i32 @ft_add_test_case(i32* %18, i32 21, i32 3, i32 9261)
%20 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %5, i64 0, i64 3
%21 = getelementptr inbounds [3 x i32], [3 x i32]* %20, i64 0, i64 0
%22 = call i32 @ft_add_test_case(i32* %21, i32 4, i32 10, i32 1048576)
%23 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %5, i64 0, i64 4
%24 = getelementptr inbounds [3 x i32], [3 x i32]* %23, i64 0, i64 0
%25 = call i32 @ft_add_test_case(i32* %24, i32 14, i32 8, i32 1475789056)
store i32 0, i32* %10
br label %26
26: ; preds = %59, %0
%27 = load i32, i32* %10
%28 = icmp slt i32 %27, 5
br i1 %28, label %29, label %62
29: ; preds = %26
%30 = load i32, i32* %10
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %5, i64 0, i64 %31
%33 = getelementptr inbounds [3 x i32], [3 x i32]* %32, i64 0, i64 0
%34 = call i32 @ft_get_values(i32* %33, i32* %6, i32* %7, i32* %9)
%35 = call i32 @time(i32* %2)
%36 = load i32, i32* %6
%37 = load i32, i32* %7
%38 = call i32 @ft_iterative_power(i32 %36, i32 %37)
store i32 %38, i32* %8
%39 = call i32 @time(i32* %3)
%40 = load i32, i32* %3
%41 = load i32, i32* %2
%42 = call double @difftime(i32 %40, i32 %41)
store double %42, double* %4
%43 = load i32, i32* %6
%44 = load i32, i32* %7
%45 = load i32, i32* %8
%46 = load i32, i32* %9
%47 = load double, double* %4
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i32 %43, i32 %44, i32 %45, i32 %46, double %47)
%49 = load i32, i32* %8
%50 = load i32, i32* %9
%51 = icmp ne i32 %49, %50
br i1 %51, label %52, label %54
52: ; preds = %29
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
store i32 %53, i32* %1
br label %64
54: ; preds = %29
%55 = load double, double* %4
%56 = fcmp oge double %55, 2.000000e+00
br i1 %56, label %57, label %59
57: ; preds = %54
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
store i32 %58, i32* %1
br label %64
59: ; preds = %54
%60 = load i32, i32* %10
%61 = add nsw i32 %60, 1
store i32 %61, i32* %10
br label %26
62: ; preds = %26
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
store i32 %63, i32* %1
br label %64
64: ; preds = %62, %57, %52
%65 = load i32, i32* %1
ret i32 %65
}

LLVM IR (-O2):
@.str = [64 x i8] c"nb: %i, power: %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 [5 x [3 x i32]]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %1 to i8*
%8 = bitcast i32* %2 to i8*
%9 = bitcast [5 x [3 x i32]]* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %3, i64 0, i64 0, i64 0
%14 = call i32 @ft_add_test_case(i32* %13, i32 -3, i32 0, i32 1)
%15 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %3, i64 0, i64 1, i64 0
%16 = call i32 @ft_add_test_case(i32* %15, i32 -235, i32 -124, i32 0)
%17 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %3, i64 0, i64 2, i64 0
%18 = call i32 @ft_add_test_case(i32* %17, i32 21, i32 3, i32 9261)
%19 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %3, i64 0, i64 3, i64 0
%20 = call i32 @ft_add_test_case(i32* %19, i32 4, i32 10, i32 1048576)
%21 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %3, i64 0, i64 4, i64 0
%22 = call i32 @ft_add_test_case(i32* %21, i32 14, i32 8, i32 1475789056)
br label %26
23: ; preds = %44
%24 = add nuw nsw i64 %27, 1
%25 = icmp eq i64 %24, 5
br i1 %25, label %46, label %26
26: ; preds = %0, %23
%27 = phi i64 [ 0, %0 ], [ %24, %23 ]
%28 = getelementptr inbounds [5 x [3 x i32]], [5 x [3 x i32]]* %3, i64 0, i64 %27, i64 0
%29 = call i32 @ft_get_values(i32* %28, i32* %4, i32* %5, i32* %6)
%30 = call i32 @time(i32* %1)
%31 = load i32, i32* %4
%32 = load i32, i32* %5
%33 = call i32 @ft_iterative_power(i32 %31, i32 %32)
%34 = call i32 @time(i32* %2)
%35 = load i32, i32* %2
%36 = load i32, i32* %1
%37 = call double @difftime(i32 %35, i32 %36)
%38 = load i32, i32* %4
%39 = load i32, i32* %5
%40 = load i32, i32* %6
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i32 %38, i32 %39, i32 %33, i32 %40, double %37)
%42 = load i32, i32* %6
%43 = icmp eq i32 %33, %42
br i1 %43, label %44, label %46
44: ; preds = %26
%45 = fcmp ult double %37, 2.000000e+00
br i1 %45, label %23, label %46
46: ; preds = %23, %44, %26
%47 = phi i8* [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), %26 ], [ getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), %44 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), %23 ]
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %47)
ret i32 %48
}