#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 */

/* Variables and functions */
scalar_t__ fifth_power(int);
int /*<<< orphan*/ printf(char *, float);
float timeit();
int main(int argc, char *argv[]) {
  float start = timeit();
  long fifth_power_digits = 0;
  for (int i = 2; i < 1000000; i++)
    fifth_power_digits += fifth_power(i);
  float stop = timeit();
  printf("Answer: %ld\n", fifth_power_digits);
  printf("Time: %f\n", stop - start);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <timeit@plt>
movss  %xmm0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x2,-0x24(%rbp)
cmpl   $0xf4240,-0x24(%rbp)
jge    118c <main+0x5c>
mov    -0x24(%rbp),%edi
call   1050 <fifth_power@plt>
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1161 <main+0x31>
mov    $0x0,%al
call   1040 <timeit@plt>
movss  %xmm0,-0x28(%rbp)
cvtsi2ssq -0x20(%rbp),%xmm0
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
movss  -0x28(%rbp),%xmm0
subss  -0x14(%rbp),%xmm0
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <timeit@plt>
movss  %xmm0,0x4(%rsp)
mov    $0x2,%ebx
nopl   0x0(%rax)
mov    %ebx,%edi
call   1050 <fifth_power@plt>
add    %rax,%r14
add    $0x1,%ebx
cmp    $0xf4240,%ebx
jne    1150 <main+0x20>
xor    %eax,%eax
call   1040 <timeit@plt>
movss  %xmm0,(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ss %r14,%xmm0
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
movss  (%rsp),%xmm0
subss  0x4(%rsp),%xmm0
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Answer: %ld\0A\00"
@.str.1 = [10 x i8] c"Time: %f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
%7 = alloca i64
%8 = alloca i32
%9 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call float (...) @timeit()
store float %10, float* %6
store i64 0, i64* %7
store i32 2, i32* %8
br label %11
11: ; preds = %19, %2
%12 = load i32, i32* %8
%13 = icmp slt i32 %12, 1000000
br i1 %13, label %14, label %22
14: ; preds = %11
%15 = load i32, i32* %8
%16 = call i64 @fifth_power(i32 %15)
%17 = load i64, i64* %7
%18 = add nsw i64 %17, %16
store i64 %18, i64* %7
br label %19
19: ; preds = %14
%20 = load i32, i32* %8
%21 = add nsw i32 %20, 1
store i32 %21, i32* %8
br label %11
22: ; preds = %11
%23 = call float (...) @timeit()
store float %23, float* %9
%24 = load i64, i64* %7
%25 = sitofp i64 %24 to float
%26 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), float %25)
%27 = load float, float* %9
%28 = load float, float* %6
%29 = fsub float %27, %28
%30 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), float %29)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Answer: %ld\0A\00"
@.str.1 = [10 x i8] c"Time: %f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call float (...) @timeit()
br label %10
4: ; preds = %10
%5 = tail call float (...) @timeit()
%6 = sitofp i64 %14 to float
%7 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), float %6)
%8 = fsub float %5, %3
%9 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), float %8)
ret i32 0
10: ; preds = %2, %10
%11 = phi i64 [ 0, %2 ], [ %14, %10 ]
%12 = phi i32 [ 2, %2 ], [ %15, %10 ]
%13 = tail call i64 @fifth_power(i32 %12)
%14 = add nsw i64 %13, %11
%15 = add nuw nsw i32 %12, 1
%16 = icmp eq i32 %15, 1000000
br i1 %16, label %4, label %10
}