#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 */
int /*<<< orphan*/ assert(double *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int, int, int, int);
int read_bin_chunky(char *, double *, int);
int read_bin_iopsy(char *, double *, int);
int read_bin_onego(char *, double *, int);
int read_bin_seeky(char *, double *, int);
int main(int argc, char **argv) {
  double *data;
  int i;
  int contigtime, chunktime, seektime, openclose;
  data = (double *)malloc(1024 * 1024 * 128 * sizeof(double));
  assert(data);
  chunktime = read_bin_chunky("data.dat", data, 1024 * 1024 * 128);
  contigtime = read_bin_onego("data.dat", data, 1024 * 1024 * 128);
  seektime = read_bin_seeky("data.dat", data, 1024 * 1024 * 128);
  openclose = read_bin_iopsy("data.dat", data, 1024 * 1024 * 128);
  printf("Time to read files: One go: %d, Chunky: %d, Seeky: %d, iopsy: %d\n",
         contigtime, chunktime, seektime, openclose);
  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    $0x40000000,%edi
call   1080 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <assert@plt>
mov    -0x18(%rbp),%rsi
lea    0xe58(%rip),%rdi
mov    $0x8000000,%edx
call   1090 <read_bin_chunky@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe40(%rip),%rdi
mov    $0x8000000,%edx
call   1040 <read_bin_onego@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe28(%rip),%rdi
mov    $0x8000000,%edx
call   1030 <read_bin_seeky@plt>
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe10(%rip),%rdi
mov    $0x8000000,%edx
call   1070 <read_bin_iopsy@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    -0x2c(%rbp),%r8d
lea    0xdf8(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0x40000000,%edi
call   1080 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <assert@plt>
lea    0xe6c(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x8000000,%edx
call   1090 <read_bin_chunky@plt>
mov    %eax,%r15d
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x8000000,%edx
call   1040 <read_bin_onego@plt>
mov    %eax,%r12d
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x8000000,%edx
call   1030 <read_bin_seeky@plt>
mov    %eax,%ebp
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x8000000,%edx
call   1070 <read_bin_iopsy@plt>
lea    0xe26(%rip),%rdi
mov    %r12d,%esi
mov    %r15d,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"data.dat\00"
@.str.1 = [66 x i8] c"Time to read files: One go: %d, Chunky: %d, Seeky: %d, iopsy: %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i64 @malloc(i32 1073741824)
%13 = inttoptr i64 %12 to double*
store double* %13, double** %6
%14 = load double*, double** %6
%15 = call i32 @assert(double* %14)
%16 = load double*, double** %6
%17 = call i32 @read_bin_chunky(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), double* %16, i32 134217728)
store i32 %17, i32* %9
%18 = load double*, double** %6
%19 = call i32 @read_bin_onego(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), double* %18, i32 134217728)
store i32 %19, i32* %8
%20 = load double*, double** %6
%21 = call i32 @read_bin_seeky(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), double* %20, i32 134217728)
store i32 %21, i32* %10
%22 = load double*, double** %6
%23 = call i32 @read_bin_iopsy(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), double* %22, i32 134217728)
store i32 %23, i32* %11
%24 = load i32, i32* %8
%25 = load i32, i32* %9
%26 = load i32, i32* %10
%27 = load i32, i32* %11
%28 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), i32 %24, i32 %25, i32 %26, i32 %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"data.dat\00"
@.str.1 = [66 x i8] c"Time to read files: One go: %d, Chunky: %d, Seeky: %d, iopsy: %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @malloc(i32 1073741824)
%4 = inttoptr i64 %3 to double*
%5 = tail call i32 @assert(double* %4)
%6 = tail call i32 @read_bin_chunky(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), double* %4, i32 134217728)
%7 = tail call i32 @read_bin_onego(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), double* %4, i32 134217728)
%8 = tail call i32 @read_bin_seeky(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), double* %4, i32 134217728)
%9 = tail call i32 @read_bin_iopsy(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), double* %4, i32 134217728)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32 %6, i32 %8, i32 %9)
ret i32 0
}