#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 */
struct stat {
  int dummy;
};

/* Variables and functions */
int MAP_ANONYMOUS;
int MAP_PRIVATE;
int MAP_SHARED;
int MCL_CURRENT;
int MS_SYNC;
int O_CREAT;
int /*<<< orphan*/ O_RDONLY;
int O_TRUNC;
int O_WRONLY;
int PROT_EXEC;
int PROT_GROWSDOWN;
int PROT_GROWSUP;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ close(int);
int fstat(int, struct stat *);
int /*<<< orphan*/ lseek(int, int, int /*<<< orphan*/);
int /*<<< orphan*/ mlock(void *, int);
int /*<<< orphan*/ mlockall(int);
void *mmap(void *, int, int, int, int, int);
int /*<<< orphan*/ mprotect(void *, int, int);
void *mremap(void *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ msync(void *, int, int);
int /*<<< orphan*/ munlock(void *, int);
int /*<<< orphan*/ munlockall();
int /*<<< orphan*/ munmap(void *, int);
int open(char *, int, ...);
int /*<<< orphan*/ write(int, char *, int);
int main() {
  int fd, ret;
  struct stat fs;
  void *r;
  fd = open("foobar", O_WRONLY | O_CREAT | O_TRUNC, 0600);
  lseek(fd, 65536, SEEK_SET);
  write(fd, "abcdef", 6);
  close(fd);
  fd = open("foobar", O_RDONLY);
  ret = fstat(fd, &fs);
  r = mmap(NULL, 4096, PROT_READ, MAP_SHARED, fd, 0);
  mlock(r, 4096);
  mlock((void *)-1, 4096);
  mlock(0, -1);
  msync(r, 4096, MS_SYNC);
  msync((void *)-1, 4096, MS_SYNC);
  msync(r, -1, MS_SYNC);
  msync(r, 4096, -1);
  munlock(r, 4096);
  mlockall(MCL_CURRENT);
  mlockall(-1);
  munlockall();
  munmap(r, 4096);
  r = mmap(NULL, 6, PROT_READ, MAP_PRIVATE, fd, 65536);
  munmap(r, 6);
  close(fd);
  r = mmap(NULL, 12288, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1,
           0);
  mprotect(r, 4096, PROT_READ | PROT_EXEC);
  mprotect(r, 4096, PROT_GROWSDOWN | PROT_GROWSUP);
  munmap(r, 12288);
  r = mmap(NULL, 8192, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1,
           0);
  r = mremap(r, 8192, 4096, 0);
  munmap(r, 4096);
  r = mmap((void *)-1, 8192, PROT_READ | PROT_WRITE,
           MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
  munmap(r, 8192);
  r = mmap(NULL, -1, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1,
           0);
  r = mmap(NULL, 8192, -1, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
  munmap(r, 8192);
  r = mmap(NULL, 8192, PROT_READ | PROT_WRITE, -1, -1, 0);
  munmap((void *)-1, 8192);
  munmap(r, -1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2d72(%rip),%rax
mov    (%rax),%esi
mov    0x2df9(%rip),%rax
or     (%rax),%esi
mov    0x2de8(%rip),%rax
or     (%rax),%esi
lea    0xdef(%rip),%rdi
mov    $0x180,%edx
mov    $0x0,%al
call   10e0 <open@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2d76(%rip),%rax
mov    (%rax),%edx
mov    $0x10000,%esi
call   1080 <lseek@plt>
mov    -0x8(%rbp),%edi
lea    0xdc7(%rip),%rsi
mov    $0x6,%edx
call   1050 <write@plt>
mov    -0x8(%rbp),%edi
call   1090 <close@plt>
mov    0x2d67(%rip),%rax
mov    (%rax),%esi
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   10e0 <open@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1100 <fstat@plt>
mov    %eax,-0xc(%rbp)
mov    0x2d66(%rip),%rax
mov    (%rax),%edx
mov    0x2d4d(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
mov    $0x1000,%esi
xor    %r9d,%r9d
call   1070 <mmap@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x1000,%esi
call   1040 <mlock@plt>
mov    $0xffffffffffffffff,%rdi
mov    $0x1000,%esi
call   1040 <mlock@plt>
xor    %eax,%eax
mov    %eax,%edi
mov    $0xffffffff,%esi
call   1040 <mlock@plt>
mov    -0x18(%rbp),%rdi
mov    0x2cba(%rip),%rax
mov    (%rax),%edx
mov    $0x1000,%esi
call   1060 <msync@plt>
mov    0x2ca7(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffffffffffff,%rdi
mov    $0x1000,%esi
call   1060 <msync@plt>
mov    -0x18(%rbp),%rdi
mov    0x2c89(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%esi
call   1060 <msync@plt>
mov    -0x18(%rbp),%rdi
mov    $0x1000,%esi
mov    $0xffffffff,%edx
call   1060 <msync@plt>
mov    -0x18(%rbp),%rdi
mov    $0x1000,%esi
call   1030 <munlock@plt>
mov    0x2c4d(%rip),%rax
mov    (%rax),%edi
call   10c0 <mlockall@plt>
mov    $0xffffffff,%edi
call   10c0 <mlockall@plt>
mov    $0x0,%al
call   10f0 <munlockall@plt>
mov    -0x18(%rbp),%rdi
mov    $0x1000,%esi
call   10b0 <munmap@plt>
mov    0x2c78(%rip),%rax
mov    (%rax),%edx
mov    0x2c07(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
mov    $0x6,%esi
mov    $0x10000,%r9d
call   1070 <mmap@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x6,%esi
call   10b0 <munmap@plt>
mov    -0x8(%rbp),%edi
call   1090 <close@plt>
mov    0x2c34(%rip),%rax
mov    (%rax),%edx
mov    0x2bcb(%rip),%rax
or     (%rax),%edx
mov    0x2bba(%rip),%rax
mov    (%rax),%ecx
mov    0x2be9(%rip),%rax
or     (%rax),%ecx
xor    %eax,%eax
mov    %eax,%edi
mov    $0x3000,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1070 <mmap@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2bf1(%rip),%rax
mov    (%rax),%edx
mov    0x2bb0(%rip),%rax
or     (%rax),%edx
mov    $0x1000,%esi
call   10d0 <mprotect@plt>
mov    -0x18(%rbp),%rdi
mov    0x2b61(%rip),%rax
mov    (%rax),%edx
mov    0x2ba8(%rip),%rax
or     (%rax),%edx
mov    $0x1000,%esi
call   10d0 <mprotect@plt>
mov    -0x18(%rbp),%rdi
mov    $0x3000,%esi
call   10b0 <munmap@plt>
mov    0x2ba7(%rip),%rax
mov    (%rax),%edx
mov    0x2b3e(%rip),%rax
or     (%rax),%edx
mov    0x2b2d(%rip),%rax
mov    (%rax),%ecx
mov    0x2b5c(%rip),%rax
or     (%rax),%ecx
xor    %eax,%eax
mov    %eax,%edi
mov    $0x2000,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1070 <mmap@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x2000,%esi
mov    $0x1000,%edx
xor    %ecx,%ecx
call   10a0 <mremap@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x1000,%esi
call   10b0 <munmap@plt>
mov    0x2b41(%rip),%rax
mov    (%rax),%edx
mov    0x2ad8(%rip),%rax
or     (%rax),%edx
mov    0x2ac7(%rip),%rax
mov    (%rax),%ecx
mov    0x2af6(%rip),%rax
or     (%rax),%ecx
mov    $0xffffffffffffffff,%rdi
mov    $0x2000,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1070 <mmap@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x2000,%esi
call   10b0 <munmap@plt>
mov    0x2af1(%rip),%rax
mov    (%rax),%edx
mov    0x2a88(%rip),%rax
or     (%rax),%edx
mov    0x2a77(%rip),%rax
mov    (%rax),%ecx
mov    0x2aa6(%rip),%rax
or     (%rax),%ecx
xor    %eax,%eax
mov    %eax,%edi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
mov    %r8d,%esi
call   1070 <mmap@plt>
mov    %rax,-0x18(%rbp)
mov    0x2a4c(%rip),%rax
mov    (%rax),%ecx
mov    0x2a7b(%rip),%rax
or     (%rax),%ecx
xor    %eax,%eax
mov    %eax,%edi
mov    $0x2000,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
mov    %r8d,%edx
call   1070 <mmap@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x2000,%esi
call   10b0 <munmap@plt>
mov    0x2a76(%rip),%rax
mov    (%rax),%edx
mov    0x2a0d(%rip),%rax
or     (%rax),%edx
xor    %eax,%eax
mov    %eax,%edi
mov    $0x2000,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
mov    %r8d,%ecx
call   1070 <mmap@plt>
mov    %rax,-0x18(%rbp)
mov    $0xffffffffffffffff,%rdi
mov    $0x2000,%esi
call   10b0 <munmap@plt>
mov    -0x18(%rbp),%rdi
mov    $0xffffffff,%esi
call   10b0 <munmap@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    0x2d75(%rip),%rax
mov    0x2dfe(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2deb(%rip),%rax
or     (%rax),%esi
lea    0xdf2(%rip),%rbx
mov    %rbx,%rdi
mov    $0x180,%edx
xor    %eax,%eax
call   10e0 <open@plt>
mov    %eax,%ebp
mov    0x2d7a(%rip),%rax
mov    (%rax),%edx
mov    %ebp,%edi
mov    $0x10000,%esi
call   1080 <lseek@plt>
lea    0xdcc(%rip),%rsi
mov    %ebp,%edi
mov    $0x6,%edx
call   1050 <write@plt>
mov    %ebp,%edi
call   1090 <close@plt>
mov    0x2d6b(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   10e0 <open@plt>
mov    %eax,%r12d
lea    0x8(%rsp),%rsi
mov    %eax,%edi
call   1100 <fstat@plt>
mov    0x2d71(%rip),%r14
mov    (%r14),%edx
mov    0x2d57(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
mov    $0x1000,%esi
mov    %r12d,%r8d
xor    %r9d,%r9d
call   1070 <mmap@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x1000,%esi
call   1040 <mlock@plt>
mov    $0xffffffffffffffff,%rdi
mov    $0x1000,%esi
call   1040 <mlock@plt>
xor    %edi,%edi
mov    $0xffffffff,%esi
call   1040 <mlock@plt>
mov    0x2ccf(%rip),%rbp
mov    0x0(%rbp),%edx
mov    %rbx,%rdi
mov    $0x1000,%esi
call   1060 <msync@plt>
mov    0x0(%rbp),%edx
mov    $0xffffffffffffffff,%rdi
mov    $0x1000,%esi
call   1060 <msync@plt>
mov    0x0(%rbp),%edx
mov    %rbx,%rdi
mov    $0xffffffff,%esi
call   1060 <msync@plt>
mov    %rbx,%rdi
mov    $0x1000,%esi
mov    $0xffffffff,%edx
call   1060 <msync@plt>
mov    %rbx,%rdi
mov    $0x1000,%esi
call   1030 <munlock@plt>
mov    0x2c6d(%rip),%rax
mov    (%rax),%edi
call   10c0 <mlockall@plt>
mov    $0xffffffff,%edi
call   10c0 <mlockall@plt>
xor    %eax,%eax
call   10f0 <munlockall@plt>
mov    %rbx,%rdi
mov    $0x1000,%esi
call   10b0 <munmap@plt>
mov    (%r14),%edx
mov    0x2c2e(%rip),%r15
mov    (%r15),%ecx
xor    %edi,%edi
mov    $0x6,%esi
mov    %r12d,%r8d
mov    $0x10000,%r9d
call   1070 <mmap@plt>
mov    %rax,%rdi
mov    $0x6,%esi
call   10b0 <munmap@plt>
mov    %r12d,%edi
call   1090 <close@plt>
mov    0x2c02(%rip),%r12
mov    (%r12),%edx
or     (%r14),%edx
mov    0x2c24(%rip),%rbp
mov    0x0(%rbp),%ecx
or     (%r15),%ecx
xor    %edi,%edi
mov    $0x3000,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1070 <mmap@plt>
mov    %rax,%rbx
mov    0x2bf7(%rip),%rax
mov    (%rax),%edx
or     (%r14),%edx
mov    %rbx,%rdi
mov    $0x1000,%esi
call   10d0 <mprotect@plt>
mov    0x2ba6(%rip),%rax
mov    0x2bef(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    %rbx,%rdi
mov    $0x1000,%esi
call   10d0 <mprotect@plt>
mov    %rbx,%rdi
mov    $0x3000,%esi
call   10b0 <munmap@plt>
mov    (%r12),%edx
or     (%r14),%edx
mov    0x0(%rbp),%ecx
or     (%r15),%ecx
xor    %edi,%edi
mov    $0x2000,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1070 <mmap@plt>
mov    %rax,%rdi
mov    $0x2000,%esi
mov    $0x1000,%edx
xor    %ecx,%ecx
call   10a0 <mremap@plt>
mov    %rax,%rdi
mov    $0x1000,%esi
call   10b0 <munmap@plt>
mov    (%r12),%edx
or     (%r14),%edx
mov    0x0(%rbp),%ecx
or     (%r15),%ecx
mov    $0xffffffffffffffff,%rdi
mov    $0x2000,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1070 <mmap@plt>
mov    %rax,%rdi
mov    $0x2000,%esi
call   10b0 <munmap@plt>
mov    (%r12),%edx
or     (%r14),%edx
mov    0x0(%rbp),%ecx
or     (%r15),%ecx
xor    %edi,%edi
mov    $0xffffffff,%esi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1070 <mmap@plt>
mov    0x0(%rbp),%ecx
or     (%r15),%ecx
xor    %edi,%edi
mov    $0x2000,%esi
mov    $0xffffffff,%edx
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1070 <mmap@plt>
mov    %rax,%rdi
mov    $0x2000,%esi
call   10b0 <munmap@plt>
mov    (%r12),%edx
or     (%r14),%edx
xor    %edi,%edi
mov    $0x2000,%esi
mov    $0xffffffff,%ecx
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1070 <mmap@plt>
mov    %rax,%rbx
mov    $0xffffffffffffffff,%rdi
mov    $0x2000,%esi
call   10b0 <munmap@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
call   10b0 <munmap@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [7 x i8] c"foobar\00"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@SEEK_SET = global i32 0
@.str.1 = [7 x i8] c"abcdef\00"
@O_RDONLY = global i32 0
@PROT_READ = global i32 0
@MAP_SHARED = global i32 0
@MS_SYNC = global i32 0
@MCL_CURRENT = global i32 0
@MAP_PRIVATE = global i32 0
@PROT_WRITE = global i32 0
@MAP_ANONYMOUS = global i32 0
@PROT_EXEC = global i32 0
@PROT_GROWSDOWN = global i32 0
@PROT_GROWSUP = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.stat
%5 = alloca i8*
store i32 0, i32* %1
%6 = load i32, i32* @O_WRONLY
%7 = load i32, i32* @O_CREAT
%8 = or i32 %6, %7
%9 = load i32, i32* @O_TRUNC
%10 = or i32 %8, %9
%11 = call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %10, i32 384)
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = load i32, i32* @SEEK_SET
%14 = call i32 @lseek(i32 %12, i32 65536, i32 %13)
%15 = load i32, i32* %2
%16 = call i32 @write(i32 %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
%17 = load i32, i32* %2
%18 = call i32 @close(i32 %17)
%19 = load i32, i32* @O_RDONLY
%20 = call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %19)
store i32 %20, i32* %2
%21 = load i32, i32* %2
%22 = call i32 @fstat(i32 %21, %struct.stat* %4)
store i32 %22, i32* %3
%23 = load i32, i32* @PROT_READ
%24 = load i32, i32* @MAP_SHARED
%25 = load i32, i32* %2
%26 = call i8* @mmap(i8* null, i32 4096, i32 %23, i32 %24, i32 %25, i32 0)
store i8* %26, i8** %5
%27 = load i8*, i8** %5
%28 = call i32 @mlock(i8* %27, i32 4096)
%29 = call i32 @mlock(i8* inttoptr (i64 -1 to i8*), i32 4096)
%30 = call i32 @mlock(i8* null, i32 -1)
%31 = load i8*, i8** %5
%32 = load i32, i32* @MS_SYNC
%33 = call i32 @msync(i8* %31, i32 4096, i32 %32)
%34 = load i32, i32* @MS_SYNC
%35 = call i32 @msync(i8* inttoptr (i64 -1 to i8*), i32 4096, i32 %34)
%36 = load i8*, i8** %5
%37 = load i32, i32* @MS_SYNC
%38 = call i32 @msync(i8* %36, i32 -1, i32 %37)
%39 = load i8*, i8** %5
%40 = call i32 @msync(i8* %39, i32 4096, i32 -1)
%41 = load i8*, i8** %5
%42 = call i32 @munlock(i8* %41, i32 4096)
%43 = load i32, i32* @MCL_CURRENT
%44 = call i32 @mlockall(i32 %43)
%45 = call i32 @mlockall(i32 -1)
%46 = call i32 (...) @munlockall()
%47 = load i8*, i8** %5
%48 = call i32 @munmap(i8* %47, i32 4096)
%49 = load i32, i32* @PROT_READ
%50 = load i32, i32* @MAP_PRIVATE
%51 = load i32, i32* %2
%52 = call i8* @mmap(i8* null, i32 6, i32 %49, i32 %50, i32 %51, i32 65536)
store i8* %52, i8** %5
%53 = load i8*, i8** %5
%54 = call i32 @munmap(i8* %53, i32 6)
%55 = load i32, i32* %2
%56 = call i32 @close(i32 %55)
%57 = load i32, i32* @PROT_READ
%58 = load i32, i32* @PROT_WRITE
%59 = or i32 %57, %58
%60 = load i32, i32* @MAP_PRIVATE
%61 = load i32, i32* @MAP_ANONYMOUS
%62 = or i32 %60, %61
%63 = call i8* @mmap(i8* null, i32 12288, i32 %59, i32 %62, i32 -1, i32 0)
store i8* %63, i8** %5
%64 = load i8*, i8** %5
%65 = load i32, i32* @PROT_READ
%66 = load i32, i32* @PROT_EXEC
%67 = or i32 %65, %66
%68 = call i32 @mprotect(i8* %64, i32 4096, i32 %67)
%69 = load i8*, i8** %5
%70 = load i32, i32* @PROT_GROWSDOWN
%71 = load i32, i32* @PROT_GROWSUP
%72 = or i32 %70, %71
%73 = call i32 @mprotect(i8* %69, i32 4096, i32 %72)
%74 = load i8*, i8** %5
%75 = call i32 @munmap(i8* %74, i32 12288)
%76 = load i32, i32* @PROT_READ
%77 = load i32, i32* @PROT_WRITE
%78 = or i32 %76, %77
%79 = load i32, i32* @MAP_PRIVATE
%80 = load i32, i32* @MAP_ANONYMOUS
%81 = or i32 %79, %80
%82 = call i8* @mmap(i8* null, i32 8192, i32 %78, i32 %81, i32 -1, i32 0)
store i8* %82, i8** %5
%83 = load i8*, i8** %5
%84 = call i8* @mremap(i8* %83, i32 8192, i32 4096, i32 0)
store i8* %84, i8** %5
%85 = load i8*, i8** %5
%86 = call i32 @munmap(i8* %85, i32 4096)
%87 = load i32, i32* @PROT_READ
%88 = load i32, i32* @PROT_WRITE
%89 = or i32 %87, %88
%90 = load i32, i32* @MAP_PRIVATE
%91 = load i32, i32* @MAP_ANONYMOUS
%92 = or i32 %90, %91
%93 = call i8* @mmap(i8* inttoptr (i64 -1 to i8*), i32 8192, i32 %89, i32 %92, i32 -1, i32 0)
store i8* %93, i8** %5
%94 = load i8*, i8** %5
%95 = call i32 @munmap(i8* %94, i32 8192)
%96 = load i32, i32* @PROT_READ
%97 = load i32, i32* @PROT_WRITE
%98 = or i32 %96, %97
%99 = load i32, i32* @MAP_PRIVATE
%100 = load i32, i32* @MAP_ANONYMOUS
%101 = or i32 %99, %100
%102 = call i8* @mmap(i8* null, i32 -1, i32 %98, i32 %101, i32 -1, i32 0)
store i8* %102, i8** %5
%103 = load i32, i32* @MAP_PRIVATE
%104 = load i32, i32* @MAP_ANONYMOUS
%105 = or i32 %103, %104
%106 = call i8* @mmap(i8* null, i32 8192, i32 -1, i32 %105, i32 -1, i32 0)
store i8* %106, i8** %5
%107 = load i8*, i8** %5
%108 = call i32 @munmap(i8* %107, i32 8192)
%109 = load i32, i32* @PROT_READ
%110 = load i32, i32* @PROT_WRITE
%111 = or i32 %109, %110
%112 = call i8* @mmap(i8* null, i32 8192, i32 %111, i32 -1, i32 -1, i32 0)
store i8* %112, i8** %5
%113 = call i32 @munmap(i8* inttoptr (i64 -1 to i8*), i32 8192)
%114 = load i8*, i8** %5
%115 = call i32 @munmap(i8* %114, i32 -1)
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [7 x i8] c"foobar\00"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@SEEK_SET = global i32 0
@.str.1 = [7 x i8] c"abcdef\00"
@O_RDONLY = global i32 0
@PROT_READ = global i32 0
@MAP_SHARED = global i32 0
@MS_SYNC = global i32 0
@MCL_CURRENT = global i32 0
@MAP_PRIVATE = global i32 0
@PROT_WRITE = global i32 0
@MAP_ANONYMOUS = global i32 0
@PROT_EXEC = global i32 0
@PROT_GROWSDOWN = global i32 0
@PROT_GROWSUP = global i32 0
define i32 @main() {
%1 = alloca %struct.stat
%2 = bitcast %struct.stat* %1 to i8*
%3 = load i32, i32* @O_WRONLY
%4 = load i32, i32* @O_CREAT
%5 = or i32 %4, %3
%6 = load i32, i32* @O_TRUNC
%7 = or i32 %5, %6
%8 = tail call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %7, i32 384)
%9 = load i32, i32* @SEEK_SET
%10 = tail call i32 @lseek(i32 %8, i32 65536, i32 %9)
%11 = tail call i32 @write(i32 %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
%12 = tail call i32 @close(i32 %8)
%13 = load i32, i32* @O_RDONLY
%14 = tail call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = call i32 @fstat(i32 %14, %struct.stat* %1)
%16 = load i32, i32* @PROT_READ
%17 = load i32, i32* @MAP_SHARED
%18 = tail call i8* @mmap(i8* null, i32 4096, i32 %16, i32 %17, i32 %14, i32 0)
%19 = tail call i32 @mlock(i8* %18, i32 4096)
%20 = tail call i32 @mlock(i8* inttoptr (i64 -1 to i8*), i32 4096)
%21 = tail call i32 @mlock(i8* null, i32 -1)
%22 = load i32, i32* @MS_SYNC
%23 = tail call i32 @msync(i8* %18, i32 4096, i32 %22)
%24 = load i32, i32* @MS_SYNC
%25 = tail call i32 @msync(i8* inttoptr (i64 -1 to i8*), i32 4096, i32 %24)
%26 = load i32, i32* @MS_SYNC
%27 = tail call i32 @msync(i8* %18, i32 -1, i32 %26)
%28 = tail call i32 @msync(i8* %18, i32 4096, i32 -1)
%29 = tail call i32 @munlock(i8* %18, i32 4096)
%30 = load i32, i32* @MCL_CURRENT
%31 = tail call i32 @mlockall(i32 %30)
%32 = tail call i32 @mlockall(i32 -1)
%33 = tail call i32 (...) @munlockall()
%34 = tail call i32 @munmap(i8* %18, i32 4096)
%35 = load i32, i32* @PROT_READ
%36 = load i32, i32* @MAP_PRIVATE
%37 = tail call i8* @mmap(i8* null, i32 6, i32 %35, i32 %36, i32 %14, i32 65536)
%38 = tail call i32 @munmap(i8* %37, i32 6)
%39 = tail call i32 @close(i32 %14)
%40 = load i32, i32* @PROT_READ
%41 = load i32, i32* @PROT_WRITE
%42 = or i32 %41, %40
%43 = load i32, i32* @MAP_PRIVATE
%44 = load i32, i32* @MAP_ANONYMOUS
%45 = or i32 %44, %43
%46 = tail call i8* @mmap(i8* null, i32 12288, i32 %42, i32 %45, i32 -1, i32 0)
%47 = load i32, i32* @PROT_READ
%48 = load i32, i32* @PROT_EXEC
%49 = or i32 %48, %47
%50 = tail call i32 @mprotect(i8* %46, i32 4096, i32 %49)
%51 = load i32, i32* @PROT_GROWSDOWN
%52 = load i32, i32* @PROT_GROWSUP
%53 = or i32 %52, %51
%54 = tail call i32 @mprotect(i8* %46, i32 4096, i32 %53)
%55 = tail call i32 @munmap(i8* %46, i32 12288)
%56 = load i32, i32* @PROT_READ
%57 = load i32, i32* @PROT_WRITE
%58 = or i32 %57, %56
%59 = load i32, i32* @MAP_PRIVATE
%60 = load i32, i32* @MAP_ANONYMOUS
%61 = or i32 %60, %59
%62 = tail call i8* @mmap(i8* null, i32 8192, i32 %58, i32 %61, i32 -1, i32 0)
%63 = tail call i8* @mremap(i8* %62, i32 8192, i32 4096, i32 0)
%64 = tail call i32 @munmap(i8* %63, i32 4096)
%65 = load i32, i32* @PROT_READ
%66 = load i32, i32* @PROT_WRITE
%67 = or i32 %66, %65
%68 = load i32, i32* @MAP_PRIVATE
%69 = load i32, i32* @MAP_ANONYMOUS
%70 = or i32 %69, %68
%71 = tail call i8* @mmap(i8* inttoptr (i64 -1 to i8*), i32 8192, i32 %67, i32 %70, i32 -1, i32 0)
%72 = tail call i32 @munmap(i8* %71, i32 8192)
%73 = load i32, i32* @PROT_READ
%74 = load i32, i32* @PROT_WRITE
%75 = or i32 %74, %73
%76 = load i32, i32* @MAP_PRIVATE
%77 = load i32, i32* @MAP_ANONYMOUS
%78 = or i32 %77, %76
%79 = tail call i8* @mmap(i8* null, i32 -1, i32 %75, i32 %78, i32 -1, i32 0)
%80 = load i32, i32* @MAP_PRIVATE
%81 = load i32, i32* @MAP_ANONYMOUS
%82 = or i32 %81, %80
%83 = tail call i8* @mmap(i8* null, i32 8192, i32 -1, i32 %82, i32 -1, i32 0)
%84 = tail call i32 @munmap(i8* %83, i32 8192)
%85 = load i32, i32* @PROT_READ
%86 = load i32, i32* @PROT_WRITE
%87 = or i32 %86, %85
%88 = tail call i8* @mmap(i8* null, i32 8192, i32 %87, i32 -1, i32 -1, i32 0)
%89 = tail call i32 @munmap(i8* inttoptr (i64 -1 to i8*), i32 8192)
%90 = tail call i32 @munmap(i8* %88, i32 -1)
ret i32 0
}