#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*/ mode_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int *MAP_FAILED;
int /*<<< orphan*/ MAP_SHARED;
int O_CREAT;
int O_RDWR;
int O_TRUNC;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, long double);
int lseek(int, int, int /*<<< orphan*/);
int *mmap(int /*<<< orphan*/, int, int, int /*<<< orphan*/, int,
          int /*<<< orphan*/);
int munmap(int *, int);
int open(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, long double);
unsigned long long rdtsc();
int write(int, char *, int);
int main(int argc, char *argv[]) {
  int i;
  int fd;
  int result;
  int *map;
  unsigned long long x;
  unsigned long long y;
  FILE *fp2;
  int iter = 0;
  for (iter; iter < 100; iter++) {
    fp2 = fopen("/home/george/Documents/C/pipe.txt", "a");
    fd = open("/home/george/Documents/C/mmapped.bin",
              O_RDWR | O_CREAT | O_TRUNC, (mode_t)0600);
    if (fd == -1) {
      perror("Error opening file for writing");
      exit(EXIT_FAILURE);
    }
    result = lseek(fd, ((16) * sizeof(int)) - 1, SEEK_SET);
    if (result == -1) {
      close(fd);
      perror("Error calling lseek() to 'stretch' the file");
      exit(EXIT_FAILURE);
    }
    result = write(fd, "", 1);
    if (result != 1) {
      close(fd);
      perror("Error writing last byte of the file");
      exit(EXIT_FAILURE);
    }
    map = mmap(0, ((16) * sizeof(int)), PROT_READ | PROT_WRITE, MAP_SHARED, fd,
               0);
    if (map == MAP_FAILED) {
      close(fd);
      perror("Error mmapping the file");
      exit(EXIT_FAILURE);
    }
    x = rdtsc();
    for (i = 1; i <= (16); ++i) {
      map[i] = 1;
    }
    map = mmap(0, ((16) * sizeof(int)), PROT_READ, MAP_SHARED, fd, 0);
    if (map == MAP_FAILED) {
      close(fd);
      perror("Error mmapping the file");
      exit(EXIT_FAILURE);
    }
    for (i = 1; i <= (16) - 1; i = i + (16) / 2) {
      printf("%d ", map[i]);
    }
    y = rdtsc();
    long double time = (long double)(y - x) / 2600000000;
    printf("It took this time to do the for-loop: %Lf \n", time);
    map = mmap(0, ((16) * sizeof(int)), PROT_READ | PROT_WRITE, MAP_SHARED, fd,
               0);
    map = mmap(0, ((16) * sizeof(int)), PROT_READ, MAP_SHARED, fd, 0);
    close(fd);
    fprintf(fp2, "%Lf\n", time);
    fflush(fp2);
    if (munmap(map, ((16) * sizeof(int))) == -1) {
      perror("Error un-mmapping the file");
    }
    fclose(fp2);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0x64,-0x44(%rbp)
jge    1562 <main+0x382>
lea    0xdfb(%rip),%rdi
lea    0xe16(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x40(%rbp)
mov    0x2da0(%rip),%rax
mov    (%rax),%esi
mov    0x2dc7(%rip),%rax
or     (%rax),%esi
mov    0x2db6(%rip),%rax
or     (%rax),%esi
lea    0xded(%rip),%rdi
mov    $0x180,%edx
call   10d0 <open@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    1274 <main+0x94>
lea    0xdf4(%rip),%rdi
call   10f0 <perror@plt>
mov    0x2d43(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
mov    -0x18(%rbp),%edi
mov    0x2d3a(%rip),%rax
mov    (%rax),%edx
mov    $0x3f,%esi
call   1070 <lseek@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    12b9 <main+0xd9>
mov    -0x18(%rbp),%edi
call   1090 <close@plt>
lea    0xdce(%rip),%rdi
call   10f0 <perror@plt>
mov    0x2cfe(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
mov    -0x18(%rbp),%edi
lea    0xe48(%rip),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
je     12fc <main+0x11c>
mov    -0x18(%rbp),%edi
call   1090 <close@plt>
lea    0xdb7(%rip),%rdi
call   10f0 <perror@plt>
mov    0x2cbb(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
mov    0x2ce5(%rip),%rax
mov    (%rax),%edx
mov    0x2c9c(%rip),%rax
or     (%rax),%edx
mov    0x2cc3(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%r8d
xor    %r9d,%r9d
mov    $0x40,%esi
mov    %r9d,%edi
call   1050 <mmap@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    0x2c66(%rip),%rcx
cmp    (%rcx),%rax
jne    1365 <main+0x185>
mov    -0x18(%rbp),%edi
call   1090 <close@plt>
lea    0xd72(%rip),%rdi
call   10f0 <perror@plt>
mov    0x2c52(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
mov    $0x0,%al
call   1080 <rdtsc@plt>
mov    %rax,-0x30(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jg     139e <main+0x1be>
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1377 <main+0x197>
mov    0x2c43(%rip),%rax
mov    (%rax),%edx
mov    0x2c2a(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%r8d
xor    %r9d,%r9d
mov    $0x40,%esi
mov    %r9d,%edi
call   1050 <mmap@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    0x2bcd(%rip),%rcx
cmp    (%rcx),%rax
jne    13fe <main+0x21e>
mov    -0x18(%rbp),%edi
call   1090 <close@plt>
lea    0xcd9(%rip),%rdi
call   10f0 <perror@plt>
mov    0x2bb9(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
movl   $0x1,-0x14(%rbp)
cmpl   $0xf,-0x14(%rbp)
jg     143f <main+0x25f>
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x6c(%rbp)
fildl  -0x6c(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xcb0(%rip),%rdi
call   1060 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x14(%rbp)
jmp    1405 <main+0x225>
xor    %eax,%eax
mov    %eax,-0x7c(%rbp)
call   1080 <rdtsc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x30(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x68(%rbp)
sets   %al
movzbl %al,%eax
mov    %eax,%ecx
fildll -0x68(%rbp)
lea    0xb92(%rip),%rax
flds   (%rax,%rcx,4)
faddp  %st,%st(1)
flds   0xb8f(%rip)
fdivrp %st,%st(1)
fstpt  -0x60(%rbp)
fldt   -0x60(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xc53(%rip),%rdi
call   1060 <printf@plt>
mov    -0x7c(%rbp),%r9d
mov    0x2b4b(%rip),%rax
mov    %rax,-0x88(%rbp)
mov    (%rax),%edx
mov    0x2afb(%rip),%rax
mov    (%rax),%eax
or     %eax,%edx
mov    0x2b20(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    (%rax),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x40,%esi
mov    %esi,-0x80(%rbp)
mov    %r9d,%edi
call   1050 <mmap@plt>
mov    -0x88(%rbp),%rcx
mov    -0x80(%rbp),%esi
mov    -0x7c(%rbp),%r9d
mov    %rax,%rdx
mov    -0x78(%rbp),%rax
mov    %rdx,-0x28(%rbp)
mov    (%rcx),%edx
mov    (%rax),%ecx
mov    -0x18(%rbp),%r8d
mov    %r9d,%edi
call   1050 <mmap@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%edi
call   1090 <close@plt>
mov    -0x40(%rbp),%rdi
fldt   -0x60(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xbf2(%rip),%rsi
call   10a0 <fprintf@plt>
mov    -0x40(%rbp),%rdi
call   10b0 <fflush@plt>
mov    -0x28(%rbp),%rdi
mov    $0x40,%esi
call   10c0 <munmap@plt>
cmp    $0xffffffff,%eax
jne    154b <main+0x36b>
lea    0xbcb(%rip),%rdi
call   10f0 <perror@plt>
mov    -0x40(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1200 <main+0x20>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    $0x64,%ebp
mov    0x2dee(%rip),%rbx
mov    0x2da7(%rip),%r14
mov    0x2dd0(%rip),%r15
jmp    1225 <main+0x45>
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1040 <fclose@plt>
mov    0x1c(%rsp),%ebp
add    $0xffffffff,%ebp
je     1426 <main+0x246>
lea    0xdf0(%rip),%rdi
lea    0xe0b(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,%r13
mov    0x2db6(%rip),%rax
mov    (%rax),%esi
mov    0x2d7d(%rip),%rax
or     (%rax),%esi
mov    0x2d9c(%rip),%rax
or     (%rax),%esi
lea    0xde3(%rip),%rdi
mov    $0x180,%edx
call   10d0 <open@plt>
cmp    $0xffffffff,%eax
je     1448 <main+0x268>
mov    %eax,%r12d
mov    0x2d3e(%rip),%rax
mov    (%rax),%edx
mov    %r12d,%edi
mov    $0x3f,%esi
call   1070 <lseek@plt>
cmp    $0xffffffff,%eax
je     1451 <main+0x271>
mov    %ebp,0x1c(%rsp)
mov    %r12d,%edi
lea    0xe7b(%rip),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
cmp    $0x1,%eax
jne    1462 <main+0x282>
mov    %r13,0x28(%rsp)
mov    (%r14),%edx
or     (%rbx),%edx
mov    (%r15),%ecx
xor    %edi,%edi
mov    $0x40,%esi
mov    %r12d,%r8d
xor    %r9d,%r9d
call   1050 <mmap@plt>
mov    0x2cc7(%rip),%r14
cmp    (%r14),%rax
je     1437 <main+0x257>
mov    %rax,%rbp
xor    %eax,%eax
call   1080 <rdtsc@plt>
mov    %rax,%r13
movaps 0xd0a(%rip),%xmm0
movups %xmm0,0x4(%rbp)
movups %xmm0,0x14(%rbp)
movups %xmm0,0x24(%rbp)
movups %xmm0,0x34(%rbp)
mov    (%rbx),%edx
mov    (%r15),%ecx
xor    %edi,%edi
mov    $0x40,%esi
mov    %r12d,%r8d
xor    %r9d,%r9d
call   1050 <mmap@plt>
cmp    (%r14),%rax
je     1437 <main+0x257>
mov    %rax,%rbp
mov    0x4(%rax),%eax
mov    %eax,0x20(%rsp)
fildl  0x20(%rsp)
fstpt  (%rsp)
lea    0xdae(%rip),%r14
mov    %r14,%rdi
call   1060 <printf@plt>
mov    0x24(%rbp),%eax
mov    %eax,0x24(%rsp)
fildl  0x24(%rsp)
fstpt  (%rsp)
mov    %r14,%rdi
call   1060 <printf@plt>
xor    %eax,%eax
call   1080 <rdtsc@plt>
xor    %ecx,%ecx
sub    %r13,%rax
mov    %rax,0x30(%rsp)
sets   %cl
fildll 0x30(%rsp)
lea    0xc95(%rip),%rax
fadds  (%rax,%rcx,4)
fdivs  0xc94(%rip)
fld    %st(0)
fstpt  0x3c(%rsp)
fstpt  (%rsp)
lea    0xd5c(%rip),%rdi
call   1060 <printf@plt>
mov    0x2c08(%rip),%r14
mov    (%r14),%edx
or     (%rbx),%edx
mov    (%r15),%ecx
xor    %edi,%edi
mov    $0x40,%esi
mov    %r12d,%r8d
xor    %r9d,%r9d
call   1050 <mmap@plt>
mov    (%rbx),%edx
mov    (%r15),%ecx
xor    %edi,%edi
mov    $0x40,%esi
mov    %r12d,%r8d
xor    %r9d,%r9d
call   1050 <mmap@plt>
mov    %rax,%r13
mov    %r12d,%edi
call   1090 <close@plt>
fldt   0x3c(%rsp)
fstpt  (%rsp)
mov    0x28(%rsp),%rbp
mov    %rbp,%rdi
lea    0xd2a(%rip),%rsi
call   10a0 <fprintf@plt>
mov    %rbp,%rdi
call   10b0 <fflush@plt>
mov    %r13,%rdi
mov    $0x40,%esi
call   10c0 <munmap@plt>
cmp    $0xffffffff,%eax
jne    1210 <main+0x30>
lea    0xd05(%rip),%rdi
call   10f0 <perror@plt>
jmp    1210 <main+0x30>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r12d,%edi
call   1090 <close@plt>
lea    0xc8e(%rip),%rdi
jmp    1471 <main+0x291>
lea    0xc16(%rip),%rdi
jmp    1471 <main+0x291>
mov    %r12d,%edi
call   1090 <close@plt>
lea    0xc24(%rip),%rdi
jmp    1471 <main+0x291>
mov    %r12d,%edi
call   1090 <close@plt>
lea    0xc3f(%rip),%rdi
call   10f0 <perror@plt>
mov    0x2b33(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"/home/george/Documents/C/pipe.txt\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [37 x i8] c"/home/george/Documents/C/mmapped.bin\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@.str.3 = [31 x i8] c"Error opening file for writing\00"
@EXIT_FAILURE = global i32 0
@SEEK_SET = global i32 0
@.str.4 = [44 x i8] c"Error calling lseek() to 'stretch' the file\00"
@.str.5 = [1 x i8] zeroinitializer
@.str.6 = [36 x i8] c"Error writing last byte of the file\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i32* null
@.str.7 = [24 x i8] c"Error mmapping the file\00"
@.str.8 = [4 x i8] c"%d \00"
@.str.9 = [44 x i8] c"It took this time to do the for-loop: %Lf \0A\00"
@.str.10 = [5 x i8] c"%Lf\0A\00"
@.str.11 = [27 x i8] c"Error un-mmapping the file\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i64
%11 = alloca i64
%12 = alloca i32*
%13 = alloca i32
%14 = alloca x86_fp80
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %13
%15 = load i32, i32* %13
br label %16
16: ; preds = %148, %2
%17 = load i32, i32* %13
%18 = icmp slt i32 %17, 100
br i1 %18, label %19, label %151
19: ; preds = %16
%20 = call i32* @fopen(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %20, i32** %12
%21 = load i32, i32* @O_RDWR
%22 = load i32, i32* @O_CREAT
%23 = or i32 %21, %22
%24 = load i32, i32* @O_TRUNC
%25 = or i32 %23, %24
%26 = call i32 @open(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %25, i32 384)
store i32 %26, i32* %7
%27 = load i32, i32* %7
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %33
29: ; preds = %19
%30 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%31 = load i32, i32* @EXIT_FAILURE
%32 = call i32 @exit(i32 %31)
unreachable
33: ; preds = %19
%34 = load i32, i32* %7
%35 = load i32, i32* @SEEK_SET
%36 = call i32 @lseek(i32 %34, i32 63, i32 %35)
store i32 %36, i32* %8
%37 = load i32, i32* %8
%38 = icmp eq i32 %37, -1
br i1 %38, label %39, label %45
39: ; preds = %33
%40 = load i32, i32* %7
%41 = call i32 @close(i32 %40)
%42 = call i32 @perror(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0))
%43 = load i32, i32* @EXIT_FAILURE
%44 = call i32 @exit(i32 %43)
unreachable
45: ; preds = %33
%46 = load i32, i32* %7
%47 = call i32 @write(i32 %46, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i32 1)
store i32 %47, i32* %8
%48 = load i32, i32* %8
%49 = icmp ne i32 %48, 1
br i1 %49, label %50, label %56
50: ; preds = %45
%51 = load i32, i32* %7
%52 = call i32 @close(i32 %51)
%53 = call i32 @perror(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
%54 = load i32, i32* @EXIT_FAILURE
%55 = call i32 @exit(i32 %54)
unreachable
56: ; preds = %45
%57 = load i32, i32* @PROT_READ
%58 = load i32, i32* @PROT_WRITE
%59 = or i32 %57, %58
%60 = load i32, i32* @MAP_SHARED
%61 = load i32, i32* %7
%62 = call i32* @mmap(i32 0, i32 64, i32 %59, i32 %60, i32 %61, i32 0)
store i32* %62, i32** %9
%63 = load i32*, i32** %9
%64 = load i32*, i32** @MAP_FAILED
%65 = icmp eq i32* %63, %64
br i1 %65, label %66, label %72
66: ; preds = %56
%67 = load i32, i32* %7
%68 = call i32 @close(i32 %67)
%69 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%70 = load i32, i32* @EXIT_FAILURE
%71 = call i32 @exit(i32 %70)
unreachable
72: ; preds = %56
%73 = call i64 (...) @rdtsc()
store i64 %73, i64* %10
store i32 1, i32* %6
br label %74
74: ; preds = %82, %72
%75 = load i32, i32* %6
%76 = icmp sle i32 %75, 16
br i1 %76, label %77, label %85
77: ; preds = %74
%78 = load i32*, i32** %9
%79 = load i32, i32* %6
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds i32, i32* %78, i64 %80
store i32 1, i32* %81
br label %82
82: ; preds = %77
%83 = load i32, i32* %6
%84 = add nsw i32 %83, 1
store i32 %84, i32* %6
br label %74
85: ; preds = %74
%86 = load i32, i32* @PROT_READ
%87 = load i32, i32* @MAP_SHARED
%88 = load i32, i32* %7
%89 = call i32* @mmap(i32 0, i32 64, i32 %86, i32 %87, i32 %88, i32 0)
store i32* %89, i32** %9
%90 = load i32*, i32** %9
%91 = load i32*, i32** @MAP_FAILED
%92 = icmp eq i32* %90, %91
br i1 %92, label %93, label %99
93: ; preds = %85
%94 = load i32, i32* %7
%95 = call i32 @close(i32 %94)
%96 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%97 = load i32, i32* @EXIT_FAILURE
%98 = call i32 @exit(i32 %97)
unreachable
99: ; preds = %85
store i32 1, i32* %6
br label %100
100: ; preds = %111, %99
%101 = load i32, i32* %6
%102 = icmp sle i32 %101, 15
br i1 %102, label %103, label %114
103: ; preds = %100
%104 = load i32*, i32** %9
%105 = load i32, i32* %6
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds i32, i32* %104, i64 %106
%108 = load i32, i32* %107
%109 = sitofp i32 %108 to x86_fp80
%110 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), x86_fp80 %109)
br label %111
111: ; preds = %103
%112 = load i32, i32* %6
%113 = add nsw i32 %112, 8
store i32 %113, i32* %6
br label %100
114: ; preds = %100
%115 = call i64 (...) @rdtsc()
store i64 %115, i64* %11
%116 = load i64, i64* %11
%117 = load i64, i64* %10
%118 = sub i64 %116, %117
%119 = uitofp i64 %118 to x86_fp80
%120 = fdiv x86_fp80 %119, 0xK401E9AF8DA0000000000
store x86_fp80 %120, x86_fp80* %14
%121 = load x86_fp80, x86_fp80* %14
%122 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.9, i64 0, i64 0), x86_fp80 %121)
%123 = load i32, i32* @PROT_READ
%124 = load i32, i32* @PROT_WRITE
%125 = or i32 %123, %124
%126 = load i32, i32* @MAP_SHARED
%127 = load i32, i32* %7
%128 = call i32* @mmap(i32 0, i32 64, i32 %125, i32 %126, i32 %127, i32 0)
store i32* %128, i32** %9
%129 = load i32, i32* @PROT_READ
%130 = load i32, i32* @MAP_SHARED
%131 = load i32, i32* %7
%132 = call i32* @mmap(i32 0, i32 64, i32 %129, i32 %130, i32 %131, i32 0)
store i32* %132, i32** %9
%133 = load i32, i32* %7
%134 = call i32 @close(i32 %133)
%135 = load i32*, i32** %12
%136 = load x86_fp80, x86_fp80* %14
%137 = call i32 @fprintf(i32* %135, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), x86_fp80 %136)
%138 = load i32*, i32** %12
%139 = call i32 @fflush(i32* %138)
%140 = load i32*, i32** %9
%141 = call i32 @munmap(i32* %140, i32 64)
%142 = icmp eq i32 %141, -1
br i1 %142, label %143, label %145
143: ; preds = %114
%144 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0))
br label %145
145: ; preds = %143, %114
%146 = load i32*, i32** %12
%147 = call i32 @fclose(i32* %146)
br label %148
148: ; preds = %145
%149 = load i32, i32* %13
%150 = add nsw i32 %149, 1
store i32 %150, i32* %13
br label %16
151: ; preds = %16
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"/home/george/Documents/C/pipe.txt\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [37 x i8] c"/home/george/Documents/C/mmapped.bin\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@.str.3 = [31 x i8] c"Error opening file for writing\00"
@EXIT_FAILURE = global i32 0
@SEEK_SET = global i32 0
@.str.4 = [44 x i8] c"Error calling lseek() to 'stretch' the file\00"
@.str.5 = [1 x i8] zeroinitializer
@.str.6 = [36 x i8] c"Error writing last byte of the file\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i32* null
@.str.7 = [24 x i8] c"Error mmapping the file\00"
@.str.8 = [4 x i8] c"%d \00"
@.str.9 = [44 x i8] c"It took this time to do the for-loop: %Lf \0A\00"
@.str.10 = [5 x i8] c"%Lf\0A\00"
@.str.11 = [27 x i8] c"Error un-mmapping the file\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %96
%4 = phi i32 [ 0, %2 ], [ %98, %96 ]
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = load i32, i32* @O_RDWR
%7 = load i32, i32* @O_CREAT
%8 = or i32 %7, %6
%9 = load i32, i32* @O_TRUNC
%10 = or i32 %8, %9
%11 = tail call i32 @open(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %10, i32 384)
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %17
13: ; preds = %3
%14 = tail call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%15 = load i32, i32* @EXIT_FAILURE
%16 = tail call i32 @exit(i32 %15)
unreachable
17: ; preds = %3
%18 = load i32, i32* @SEEK_SET
%19 = tail call i32 @lseek(i32 %11, i32 63, i32 %18)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %26
21: ; preds = %17
%22 = tail call i32 @close(i32 %11)
%23 = tail call i32 @perror(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0))
%24 = load i32, i32* @EXIT_FAILURE
%25 = tail call i32 @exit(i32 %24)
unreachable
26: ; preds = %17
%27 = tail call i32 @write(i32 %11, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i32 1)
%28 = icmp eq i32 %27, 1
br i1 %28, label %34, label %29
29: ; preds = %26
%30 = tail call i32 @close(i32 %11)
%31 = tail call i32 @perror(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
%32 = load i32, i32* @EXIT_FAILURE
%33 = tail call i32 @exit(i32 %32)
unreachable
34: ; preds = %26
%35 = load i32, i32* @PROT_READ
%36 = load i32, i32* @PROT_WRITE
%37 = or i32 %36, %35
%38 = load i32, i32* @MAP_SHARED
%39 = tail call i32* @mmap(i32 0, i32 64, i32 %37, i32 %38, i32 %11, i32 0)
%40 = load i32*, i32** @MAP_FAILED
%41 = icmp eq i32* %39, %40
br i1 %41, label %42, label %47
42: ; preds = %34
%43 = tail call i32 @close(i32 %11)
%44 = tail call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%45 = load i32, i32* @EXIT_FAILURE
%46 = tail call i32 @exit(i32 %45)
unreachable
47: ; preds = %34
%48 = tail call i64 (...) @rdtsc()
%49 = getelementptr inbounds i32, i32* %39, i64 1
%50 = bitcast i32* %49 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %50
%51 = getelementptr inbounds i32, i32* %39, i64 5
%52 = bitcast i32* %51 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %52
%53 = getelementptr inbounds i32, i32* %39, i64 9
%54 = bitcast i32* %53 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %54
%55 = getelementptr inbounds i32, i32* %39, i64 13
%56 = bitcast i32* %55 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %56
%57 = load i32, i32* @PROT_READ
%58 = load i32, i32* @MAP_SHARED
%59 = tail call i32* @mmap(i32 0, i32 64, i32 %57, i32 %58, i32 %11, i32 0)
%60 = load i32*, i32** @MAP_FAILED
%61 = icmp eq i32* %59, %60
br i1 %61, label %89, label %62
62: ; preds = %47
%63 = getelementptr inbounds i32, i32* %59, i64 1
%64 = load i32, i32* %63
%65 = sitofp i32 %64 to x86_fp80
%66 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), x86_fp80 %65)
%67 = getelementptr inbounds i32, i32* %59, i64 9
%68 = load i32, i32* %67
%69 = sitofp i32 %68 to x86_fp80
%70 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), x86_fp80 %69)
%71 = tail call i64 (...) @rdtsc()
%72 = sub i64 %71, %48
%73 = uitofp i64 %72 to x86_fp80
%74 = fdiv x86_fp80 %73, 0xK401E9AF8DA0000000000
%75 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.9, i64 0, i64 0), x86_fp80 %74)
%76 = load i32, i32* @PROT_READ
%77 = load i32, i32* @PROT_WRITE
%78 = or i32 %77, %76
%79 = load i32, i32* @MAP_SHARED
%80 = tail call i32* @mmap(i32 0, i32 64, i32 %78, i32 %79, i32 %11, i32 0)
%81 = load i32, i32* @PROT_READ
%82 = load i32, i32* @MAP_SHARED
%83 = tail call i32* @mmap(i32 0, i32 64, i32 %81, i32 %82, i32 %11, i32 0)
%84 = tail call i32 @close(i32 %11)
%85 = tail call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), x86_fp80 %74)
%86 = tail call i32 @fflush(i32* %5)
%87 = tail call i32 @munmap(i32* %83, i32 64)
%88 = icmp eq i32 %87, -1
br i1 %88, label %94, label %96
89: ; preds = %47
%90 = tail call i32 @close(i32 %11)
%91 = tail call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%92 = load i32, i32* @EXIT_FAILURE
%93 = tail call i32 @exit(i32 %92)
unreachable
94: ; preds = %62
%95 = tail call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0))
br label %96
96: ; preds = %94, %62
%97 = tail call i32 @fclose(i32* %5)
%98 = add nuw nsw i32 %4, 1
%99 = icmp eq i32 %98, 100
br i1 %99, label %100, label %3
100: ; preds = %96
ret i32 0
}