#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 **, char *, int /*<<< orphan*/ *);
double average_time(FILE *test, char *line_pointer_array[],
                    char *lines_buffer) {
  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, lines_buffer, 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    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0xf4240,-0x34(%rbp)
jge    11a5 <average_time+0x85>
mov    $0x0,%al
call   1030 <clock@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x8(%rbp),%rdx
call   1040 <read_lines@plt>
mov    $0x0,%al
call   1030 <clock@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1143 <average_time+0x23>
movsd  -0x30(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

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

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

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