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

/* Variables and functions */
scalar_t__ clock();
int /*<<< orphan*/ read_lines(char **, int /*<<< orphan*/ *);
double average_time(FILE *test, char *line_pointer_array[]) {
  double time_start, time_stop, time_total = 0.0;
  int element;
  for (element = 0; element < 1000000; ++element) {
    time_start = (double)clock();
    read_lines(line_pointer_array, test);
    time_stop = (double)clock();
    time_total += time_stop - time_start;
  }
  return time_total;
}


x86 assembly (clang, -O0):
<average_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0xf4240,-0x2c(%rbp)
jge    119d <average_time+0x7d>
mov    $0x0,%al
call   1030 <clock@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <read_lines@plt>
mov    $0x0,%al
call   1030 <clock@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    113f <average_time+0x1f>
movsd  -0x28(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<average_time>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
mov    $0xf4240,%ebp
cs nopw 0x0(%rax,%rax,1)
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <clock@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <read_lines@plt>
xor    %eax,%eax
call   1030 <clock@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
subsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  (%rsp),%xmm0
add    $0xffffffff,%ebp
jne    1140 <average_time+0x20>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define double @average_time(i32* %0, i8** %1) {
%3 = alloca i32*
%4 = alloca i8**
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca i32
store i32* %0, i32** %3
store i8** %1, i8*** %4
store double 0.000000e+00, double* %7
store i32 0, i32* %8
br label %9
9: ; preds = %25, %2
%10 = load i32, i32* %8
%11 = icmp slt i32 %10, 1000000
br i1 %11, label %12, label %28
12: ; preds = %9
%13 = call i64 (...) @clock()
%14 = sitofp i64 %13 to double
store double %14, double* %5
%15 = load i8**, i8*** %4
%16 = load i32*, i32** %3
%17 = call i32 @read_lines(i8** %15, i32* %16)
%18 = call i64 (...) @clock()
%19 = sitofp i64 %18 to double
store double %19, double* %6
%20 = load double, double* %6
%21 = load double, double* %5
%22 = fsub double %20, %21
%23 = load double, double* %7
%24 = fadd double %23, %22
store double %24, double* %7
br label %25
25: ; preds = %12
%26 = load i32, i32* %8
%27 = add nsw i32 %26, 1
store i32 %27, i32* %8
br label %9
28: ; preds = %9
%29 = load double, double* %7
ret double %29
}

LLVM IR (-O2):
define double @average_time(i32* %0, i8** %1) {
br label %3
3: ; preds = %2, %3
%4 = phi i32 [ 0, %2 ], [ %13, %3 ]
%5 = phi double [ 0.000000e+00, %2 ], [ %12, %3 ]
%6 = tail call i64 (...) @clock()
%7 = sitofp i64 %6 to double
%8 = tail call i32 @read_lines(i8** %1, i32* %0)
%9 = tail call i64 (...) @clock()
%10 = sitofp i64 %9 to double
%11 = fsub double %10, %7
%12 = fadd double %5, %11
%13 = add nuw nsw i32 %4, 1
%14 = icmp eq i32 %13, 1000000
br i1 %14, label %15, label %3
15: ; preds = %3
ret double %12
}