#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 scalar_t__ off_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int MAP_ANONYMOUS;
char *MAP_FAILED;
int MAP_FIXED;
int MAP_PRIVATE;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ PROT_READ;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ _SC_PAGESIZE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ helpAndExit(char *, int /*<<< orphan*/);
scalar_t__ lseek(int, int, int /*<<< orphan*/);
char *mmap(char *, long, int /*<<< orphan*/, int, int, long);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ pexit(char *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
long sysconf(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  if (argc != 2)
    helpAndExit(argv[0], EXIT_FAILURE);
  int fd, i, j;
  long pagesize;
  char *mem, *p, buf[(10) + 1];
  fd = open(argv[1], O_RDONLY);
  if (fd == -1)
    pexit("open");
  pagesize = sysconf(_SC_PAGESIZE);
  if (pagesize == -1)
    pexit("sysconf");
  mem = mmap(NULL, 3 * pagesize, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
  if (mem == MAP_FAILED)
    pexit("mmap");
  if (mmap(mem, pagesize, PROT_READ, MAP_PRIVATE | MAP_FIXED, fd,
           2 * pagesize) == MAP_FAILED)
    pexit("mmap");
  if (mmap(mem + pagesize, pagesize, PROT_READ, MAP_PRIVATE | MAP_FIXED, fd,
           pagesize) == MAP_FAILED)
    pexit("mmap");
  if (mmap(mem + (2 * pagesize), pagesize, PROT_READ, MAP_PRIVATE | MAP_FIXED,
           fd, 0) == MAP_FAILED)
    pexit("mmap");
  printf("On memory mapping:\n");
  for (i = 0; i < 3; i++) {
    p = mem + (i * pagesize);
    printf("Page %d: ", i + 1);
    for (j = 0; j < (10); j++)
      printf("%c", p[j]);
    printf("\n");
  }
  printf("\nOn file:\n");
  for (i = 0; i < 3; i++) {
    if (lseek(fd, i * pagesize, SEEK_SET) == (off_t)-1)
      pexit("lseek");
    if (read(fd, buf, (10)) == -1)
      pexit("read");
    buf[(10)] = '\0';
    printf("Page %d: %s\n", i + 1, buf);
  }
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11c5 <main+0x35>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    0x2dfa(%rip),%rax
mov    (%rax),%esi
call   1090 <helpAndExit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2e0c(%rip),%rax
mov    (%rax),%esi
call   1070 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    11f4 <main+0x64>
lea    0xe11(%rip),%rdi
call   10b0 <pexit@plt>
mov    0x2ddd(%rip),%rax
mov    (%rax),%edi
call   1080 <sysconf@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0xffffffffffffffff,-0x28(%rbp)
jne    121d <main+0x8d>
lea    0xded(%rip),%rdi
call   10b0 <pexit@plt>
imul   $0x3,-0x28(%rbp),%rsi
mov    0x2dcf(%rip),%rax
mov    (%rax),%edx
mov    0x2d76(%rip),%rax
mov    (%rax),%ecx
mov    0x2d95(%rip),%rax
or     (%rax),%ecx
xor    %eax,%eax
mov    %eax,%r9d
xor    %r8d,%r8d
mov    %r9,%rdi
call   1030 <mmap@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    0x2d3c(%rip),%rcx
cmp    (%rcx),%rax
jne    1271 <main+0xe1>
lea    0xda1(%rip),%rdi
call   10b0 <pexit@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    0x2d78(%rip),%rax
mov    (%rax),%edx
mov    0x2d1f(%rip),%rax
mov    (%rax),%ecx
mov    0x2d0e(%rip),%rax
or     (%rax),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x28(%rbp),%r9
shl    $0x1,%r9
call   1030 <mmap@plt>
mov    0x2cec(%rip),%rcx
cmp    (%rcx),%rax
jne    12c1 <main+0x131>
lea    0xd51(%rip),%rdi
call   10b0 <pexit@plt>
mov    -0x30(%rbp),%rdi
add    -0x28(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    0x2d24(%rip),%rax
mov    (%rax),%edx
mov    0x2ccb(%rip),%rax
mov    (%rax),%ecx
mov    0x2cba(%rip),%rax
or     (%rax),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x28(%rbp),%r9
call   1030 <mmap@plt>
mov    0x2c9c(%rip),%rcx
cmp    (%rcx),%rax
jne    1311 <main+0x181>
lea    0xd01(%rip),%rdi
call   10b0 <pexit@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rax
shl    $0x1,%rax
add    %rax,%rdi
mov    -0x28(%rbp),%rsi
mov    0x2ccd(%rip),%rax
mov    (%rax),%edx
mov    0x2c74(%rip),%rax
mov    (%rax),%ecx
mov    0x2c63(%rip),%rax
or     (%rax),%ecx
mov    -0x14(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%r9d
call   1030 <mmap@plt>
mov    0x2c44(%rip),%rcx
cmp    (%rcx),%rax
jne    1369 <main+0x1d9>
lea    0xca9(%rip),%rdi
call   10b0 <pexit@plt>
lea    0xca2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    1405 <main+0x275>
mov    -0x30(%rbp),%rax
movslq -0x18(%rbp),%rcx
imul   -0x28(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%esi
add    $0x1,%esi
lea    0xc7d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0xa,-0x1c(%rbp)
jge    13e9 <main+0x259>
mov    -0x38(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xc5c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    13b7 <main+0x227>
lea    0xc4c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    137e <main+0x1ee>
lea    0xc27(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    14a6 <main+0x316>
mov    -0x14(%rbp),%edi
movslq -0x18(%rbp),%rax
imul   -0x28(%rbp),%rax
mov    %eax,%esi
mov    0x2b87(%rip),%rax
mov    (%rax),%edx
call   1050 <lseek@plt>
cmp    $0xffffffffffffffff,%rax
jne    1456 <main+0x2c6>
lea    0xbed(%rip),%rdi
call   10b0 <pexit@plt>
mov    -0x14(%rbp),%edi
lea    -0x43(%rbp),%rsi
mov    $0xa,%edx
call   1060 <read@plt>
cmp    $0xffffffff,%eax
jne    147c <main+0x2ec>
lea    0xbcd(%rip),%rdi
call   10b0 <pexit@plt>
movb   $0x0,-0x39(%rbp)
mov    -0x18(%rbp),%esi
add    $0x1,%esi
lea    -0x43(%rbp),%rdx
lea    0xbb8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    141a <main+0x28a>
mov    0x2b03(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
je     11d7 <main+0x27>
mov    (%rbx),%rdi
mov    0x2de8(%rip),%rax
mov    (%rax),%esi
call   10b0 <helpAndExit@plt>
mov    0x8(%rbx),%rdi
mov    0x2dfe(%rip),%rax
mov    (%rax),%esi
call   1090 <open@plt>
mov    %eax,%r14d
cmp    $0xffffffff,%eax
jne    11fd <main+0x4d>
lea    0xe08(%rip),%rdi
call   10d0 <pexit@plt>
mov    0x2dd4(%rip),%rax
mov    (%rax),%edi
call   10a0 <sysconf@plt>
mov    %rax,%rbx
cmp    $0xffffffffffffffff,%rax
jne    1220 <main+0x70>
lea    0xdea(%rip),%rdi
call   10d0 <pexit@plt>
lea    (%rbx,%rbx,2),%rsi
mov    0x2dcd(%rip),%rax
mov    (%rax),%edx
mov    0x2d74(%rip),%rdi
mov    0x2d95(%rip),%rax
mov    (%rax),%ecx
or     (%rdi),%ecx
xor    %edi,%edi
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1050 <mmap@plt>
mov    %rax,%rbp
mov    0x2d42(%rip),%r12
cmp    (%r12),%rax
jne    1268 <main+0xb8>
lea    0xdaa(%rip),%rdi
call   10d0 <pexit@plt>
mov    0x2d89(%rip),%rax
mov    (%rax),%edx
mov    0x2d28(%rip),%r13
mov    0x0(%r13),%ecx
mov    0x2d25(%rip),%rax
or     (%rax),%ecx
lea    (%rbx,%rbx,1),%r15
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%r8d
mov    %r15,%r9
call   1050 <mmap@plt>
cmp    (%r12),%rax
jne    12ac <main+0xfc>
lea    0xd66(%rip),%rdi
call   10d0 <pexit@plt>
mov    %rbx,%rdi
add    %rbp,%rdi
mov    0x2d3f(%rip),%rax
mov    (%rax),%edx
mov    0x0(%r13),%ecx
mov    0x2ce2(%rip),%rax
or     (%rax),%ecx
mov    %rbx,%rsi
mov    %r14d,%r8d
mov    %rbx,%r9
call   1050 <mmap@plt>
cmp    (%r12),%rax
jne    12e8 <main+0x138>
lea    0xd2a(%rip),%rdi
call   10d0 <pexit@plt>
mov    %rbp,%rdi
add    %r15,%rdi
mov    0x2d03(%rip),%rax
mov    (%rax),%edx
mov    0x0(%r13),%ecx
mov    0x2ca6(%rip),%rax
or     (%rax),%ecx
mov    %rbx,%rsi
mov    %r14d,%r8d
xor    %r9d,%r9d
call   1050 <mmap@plt>
cmp    (%r12),%rax
jne    1324 <main+0x174>
lea    0xcee(%rip),%rdi
call   10d0 <pexit@plt>
lea    0xd09(%rip),%rdi
call   1040 <puts@plt>
lea    0xcdb(%rip),%r15
mov    %r15,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0x0(%rbp),%edi
call   1030 <putchar@plt>
movsbl 0x1(%rbp),%edi
call   1030 <putchar@plt>
movsbl 0x2(%rbp),%edi
call   1030 <putchar@plt>
movsbl 0x3(%rbp),%edi
call   1030 <putchar@plt>
movsbl 0x4(%rbp),%edi
call   1030 <putchar@plt>
movsbl 0x5(%rbp),%edi
call   1030 <putchar@plt>
movsbl 0x6(%rbp),%edi
call   1030 <putchar@plt>
movsbl 0x7(%rbp),%edi
call   1030 <putchar@plt>
movsbl 0x8(%rbp),%edi
call   1030 <putchar@plt>
movsbl 0x9(%rbp),%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0x0(%rbp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl 0x1(%rbp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl 0x2(%rbp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl 0x3(%rbp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl 0x4(%rbp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl 0x5(%rbp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl 0x6(%rbp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl 0x7(%rbp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl 0x8(%rbp,%rbx,1),%edi
call   1030 <putchar@plt>
movsbl 0x9(%rbp,%rbx,1),%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0x0(%rbp,%rbx,2),%edi
call   1030 <putchar@plt>
movsbl 0x1(%rbp,%rbx,2),%edi
call   1030 <putchar@plt>
movsbl 0x2(%rbp,%rbx,2),%edi
call   1030 <putchar@plt>
movsbl 0x3(%rbp,%rbx,2),%edi
call   1030 <putchar@plt>
movsbl 0x4(%rbp,%rbx,2),%edi
call   1030 <putchar@plt>
movsbl 0x5(%rbp,%rbx,2),%edi
call   1030 <putchar@plt>
movsbl 0x6(%rbp,%rbx,2),%edi
call   1030 <putchar@plt>
movsbl 0x7(%rbp,%rbx,2),%edi
call   1030 <putchar@plt>
movsbl 0x8(%rbp,%rbx,2),%edi
call   1030 <putchar@plt>
movsbl 0x9(%rbp,%rbx,2),%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xb9c(%rip),%rdi
call   1040 <puts@plt>
mov    0x2b09(%rip),%rbp
mov    0x0(%rbp),%edx
mov    %r14d,%edi
xor    %esi,%esi
call   1070 <lseek@plt>
cmp    $0xffffffffffffffff,%rax
jne    14d6 <main+0x326>
lea    0xb4b(%rip),%rdi
call   10d0 <pexit@plt>
lea    0xd(%rsp),%rsi
mov    %r14d,%edi
mov    $0xa,%edx
call   1080 <read@plt>
cmp    $0xffffffff,%eax
jne    14f9 <main+0x349>
lea    0xb2e(%rip),%rdi
call   10d0 <pexit@plt>
movb   $0x0,0x17(%rsp)
lea    0xb22(%rip),%rdi
lea    0xd(%rsp),%rdx
mov    $0x1,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x0(%rbp),%edx
mov    %r14d,%edi
mov    %ebx,%esi
call   1070 <lseek@plt>
cmp    $0xffffffffffffffff,%rax
jne    1535 <main+0x385>
lea    0xaec(%rip),%rdi
call   10d0 <pexit@plt>
lea    0xd(%rsp),%rsi
mov    %r14d,%edi
mov    $0xa,%edx
call   1080 <read@plt>
cmp    $0xffffffff,%eax
jne    1558 <main+0x3a8>
lea    0xacf(%rip),%rdi
call   10d0 <pexit@plt>
movb   $0x0,0x17(%rsp)
lea    0xac3(%rip),%rdi
lea    0xd(%rsp),%rdx
mov    $0x2,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    (%rbx,%rbx,1),%esi
mov    0x0(%rbp),%edx
mov    %r14d,%edi
call   1070 <lseek@plt>
cmp    $0xffffffffffffffff,%rax
jne    1595 <main+0x3e5>
lea    0xa8c(%rip),%rdi
call   10d0 <pexit@plt>
lea    0xd(%rsp),%rsi
mov    %r14d,%edi
mov    $0xa,%edx
call   1080 <read@plt>
cmp    $0xffffffff,%eax
jne    15b8 <main+0x408>
lea    0xa6f(%rip),%rdi
call   10d0 <pexit@plt>
movb   $0x0,0x17(%rsp)
lea    0xa63(%rip),%rdi
lea    0xd(%rsp),%rdx
mov    $0x3,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x29d4(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@O_RDONLY = global i32 0
@.str = [5 x i8] c"open\00"
@_SC_PAGESIZE = global i32 0
@.str.1 = [8 x i8] c"sysconf\00"
@PROT_READ = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_ANONYMOUS = global i32 0
@MAP_FAILED = global i8* null
@.str.2 = [5 x i8] c"mmap\00"
@MAP_FIXED = global i32 0
@.str.3 = [20 x i8] c"On memory mapping:\0A\00"
@.str.4 = [10 x i8] c"Page %d: \00"
@.str.5 = [3 x i8] c"%c\00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [11 x i8] c"\0AOn file:\0A\00"
@SEEK_SET = global i32 0
@.str.8 = [6 x i8] c"lseek\00"
@.str.9 = [5 x i8] c"read\00"
@.str.10 = [13 x i8] c"Page %d: %s\0A\00"
@EXIT_SUCCESS = global i32 0
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 i64
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca [11 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 2
br i1 %14, label %15, label %21
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @helpAndExit(i8* %18, i32 %19)
br label %21
21: ; preds = %15, %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = load i32, i32* @O_RDONLY
%26 = call i32 @open(i8* %24, i32 %25)
store i32 %26, i32* %6
%27 = load i32, i32* %6
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %31
29: ; preds = %21
%30 = call i32 @pexit(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %31
31: ; preds = %29, %21
%32 = load i32, i32* @_SC_PAGESIZE
%33 = call i64 @sysconf(i32 %32)
store i64 %33, i64* %9
%34 = load i64, i64* %9
%35 = icmp eq i64 %34, -1
br i1 %35, label %36, label %38
36: ; preds = %31
%37 = call i32 @pexit(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %38
38: ; preds = %36, %31
%39 = load i64, i64* %9
%40 = mul nsw i64 3, %39
%41 = load i32, i32* @PROT_READ
%42 = load i32, i32* @MAP_PRIVATE
%43 = load i32, i32* @MAP_ANONYMOUS
%44 = or i32 %42, %43
%45 = call i8* @mmap(i8* null, i64 %40, i32 %41, i32 %44, i32 0, i64 0)
store i8* %45, i8** %10
%46 = load i8*, i8** %10
%47 = load i8*, i8** @MAP_FAILED
%48 = icmp eq i8* %46, %47
br i1 %48, label %49, label %51
49: ; preds = %38
%50 = call i32 @pexit(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %51
51: ; preds = %49, %38
%52 = load i8*, i8** %10
%53 = load i64, i64* %9
%54 = load i32, i32* @PROT_READ
%55 = load i32, i32* @MAP_PRIVATE
%56 = load i32, i32* @MAP_FIXED
%57 = or i32 %55, %56
%58 = load i32, i32* %6
%59 = load i64, i64* %9
%60 = mul nsw i64 2, %59
%61 = call i8* @mmap(i8* %52, i64 %53, i32 %54, i32 %57, i32 %58, i64 %60)
%62 = load i8*, i8** @MAP_FAILED
%63 = icmp eq i8* %61, %62
br i1 %63, label %64, label %66
64: ; preds = %51
%65 = call i32 @pexit(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %66
66: ; preds = %64, %51
%67 = load i8*, i8** %10
%68 = load i64, i64* %9
%69 = getelementptr inbounds i8, i8* %67, i64 %68
%70 = load i64, i64* %9
%71 = load i32, i32* @PROT_READ
%72 = load i32, i32* @MAP_PRIVATE
%73 = load i32, i32* @MAP_FIXED
%74 = or i32 %72, %73
%75 = load i32, i32* %6
%76 = load i64, i64* %9
%77 = call i8* @mmap(i8* %69, i64 %70, i32 %71, i32 %74, i32 %75, i64 %76)
%78 = load i8*, i8** @MAP_FAILED
%79 = icmp eq i8* %77, %78
br i1 %79, label %80, label %82
80: ; preds = %66
%81 = call i32 @pexit(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %82
82: ; preds = %80, %66
%83 = load i8*, i8** %10
%84 = load i64, i64* %9
%85 = mul nsw i64 2, %84
%86 = getelementptr inbounds i8, i8* %83, i64 %85
%87 = load i64, i64* %9
%88 = load i32, i32* @PROT_READ
%89 = load i32, i32* @MAP_PRIVATE
%90 = load i32, i32* @MAP_FIXED
%91 = or i32 %89, %90
%92 = load i32, i32* %6
%93 = call i8* @mmap(i8* %86, i64 %87, i32 %88, i32 %91, i32 %92, i64 0)
%94 = load i8*, i8** @MAP_FAILED
%95 = icmp eq i8* %93, %94
br i1 %95, label %96, label %98
96: ; preds = %82
%97 = call i32 @pexit(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %98
98: ; preds = %96, %82
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %7
br label %100
100: ; preds = %129, %98
%101 = load i32, i32* %7
%102 = icmp slt i32 %101, 3
br i1 %102, label %103, label %132
103: ; preds = %100
%104 = load i8*, i8** %10
%105 = load i32, i32* %7
%106 = sext i32 %105 to i64
%107 = load i64, i64* %9
%108 = mul nsw i64 %106, %107
%109 = getelementptr inbounds i8, i8* %104, i64 %108
store i8* %109, i8** %11
%110 = load i32, i32* %7
%111 = add nsw i32 %110, 1
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %111)
store i32 0, i32* %8
br label %113
113: ; preds = %124, %103
%114 = load i32, i32* %8
%115 = icmp slt i32 %114, 10
br i1 %115, label %116, label %127
116: ; preds = %113
%117 = load i8*, i8** %11
%118 = load i32, i32* %8
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds i8, i8* %117, i64 %119
%121 = load i8, i8* %120
%122 = sext i8 %121 to i32
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %122)
br label %124
124: ; preds = %116
%125 = load i32, i32* %8
%126 = add nsw i32 %125, 1
store i32 %126, i32* %8
br label %113
127: ; preds = %113
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %129
129: ; preds = %127
%130 = load i32, i32* %7
%131 = add nsw i32 %130, 1
store i32 %131, i32* %7
br label %100
132: ; preds = %100
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %7
br label %134
134: ; preds = %162, %132
%135 = load i32, i32* %7
%136 = icmp slt i32 %135, 3
br i1 %136, label %137, label %165
137: ; preds = %134
%138 = load i32, i32* %6
%139 = load i32, i32* %7
%140 = sext i32 %139 to i64
%141 = load i64, i64* %9
%142 = mul nsw i64 %140, %141
%143 = trunc i64 %142 to i32
%144 = load i32, i32* @SEEK_SET
%145 = call i64 @lseek(i32 %138, i32 %143, i32 %144)
%146 = icmp eq i64 %145, -1
br i1 %146, label %147, label %149
147: ; preds = %137
%148 = call i32 @pexit(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
br label %149
149: ; preds = %147, %137
%150 = load i32, i32* %6
%151 = getelementptr inbounds [11 x i8], [11 x i8]* %12, i64 0, i64 0
%152 = call i32 @read(i32 %150, i8* %151, i32 10)
%153 = icmp eq i32 %152, -1
br i1 %153, label %154, label %156
154: ; preds = %149
%155 = call i32 @pexit(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
br label %156
156: ; preds = %154, %149
%157 = getelementptr inbounds [11 x i8], [11 x i8]* %12, i64 0, i64 10
store i8 0, i8* %157
%158 = load i32, i32* %7
%159 = add nsw i32 %158, 1
%160 = getelementptr inbounds [11 x i8], [11 x i8]* %12, i64 0, i64 0
%161 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i32 %159, i8* %160)
br label %162
162: ; preds = %156
%163 = load i32, i32* %7
%164 = add nsw i32 %163, 1
store i32 %164, i32* %7
br label %134
165: ; preds = %134
%166 = load i32, i32* @EXIT_SUCCESS
%167 = call i32 @exit(i32 %166)
unreachable
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@O_RDONLY = global i32 0
@.str = [5 x i8] c"open\00"
@_SC_PAGESIZE = global i32 0
@.str.1 = [8 x i8] c"sysconf\00"
@PROT_READ = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_ANONYMOUS = global i32 0
@MAP_FAILED = global i8* null
@.str.2 = [5 x i8] c"mmap\00"
@MAP_FIXED = global i32 0
@.str.4 = [10 x i8] c"Page %d: \00"
@SEEK_SET = global i32 0
@.str.8 = [6 x i8] c"lseek\00"
@.str.9 = [5 x i8] c"read\00"
@.str.10 = [13 x i8] c"Page %d: %s\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [19 x i8] c"On memory mapping:\00"
@str.11 = [10 x i8] c"\0AOn file:\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [11 x i8]
%4 = icmp eq i32 %0, 2
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i8*, i8** %1
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @helpAndExit(i8* %6, i32 %7)
br label %9
9: ; preds = %5, %2
%10 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = load i32, i32* @O_RDONLY
%14 = tail call i32 @open(i8* %12, i32 %13)
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %18
16: ; preds = %9
%17 = tail call i32 @pexit(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %9
%19 = load i32, i32* @_SC_PAGESIZE
%20 = tail call i64 @sysconf(i32 %19)
%21 = icmp eq i64 %20, -1
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = tail call i32 @pexit(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %24
24: ; preds = %22, %18
%25 = mul nsw i64 %20, 3
%26 = load i32, i32* @PROT_READ
%27 = load i32, i32* @MAP_PRIVATE
%28 = load i32, i32* @MAP_ANONYMOUS
%29 = or i32 %28, %27
%30 = tail call i8* @mmap(i8* null, i64 %25, i32 %26, i32 %29, i32 0, i64 0)
%31 = load i8*, i8** @MAP_FAILED
%32 = icmp eq i8* %30, %31
br i1 %32, label %33, label %35
33: ; preds = %24
%34 = tail call i32 @pexit(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %35
35: ; preds = %33, %24
%36 = load i32, i32* @PROT_READ
%37 = load i32, i32* @MAP_PRIVATE
%38 = load i32, i32* @MAP_FIXED
%39 = or i32 %38, %37
%40 = shl nsw i64 %20, 1
%41 = tail call i8* @mmap(i8* %30, i64 %20, i32 %36, i32 %39, i32 %14, i64 %40)
%42 = load i8*, i8** @MAP_FAILED
%43 = icmp eq i8* %41, %42
br i1 %43, label %44, label %46
44: ; preds = %35
%45 = tail call i32 @pexit(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %46
46: ; preds = %44, %35
%47 = getelementptr inbounds i8, i8* %30, i64 %20
%48 = load i32, i32* @PROT_READ
%49 = load i32, i32* @MAP_PRIVATE
%50 = load i32, i32* @MAP_FIXED
%51 = or i32 %50, %49
%52 = tail call i8* @mmap(i8* %47, i64 %20, i32 %48, i32 %51, i32 %14, i64 %20)
%53 = load i8*, i8** @MAP_FAILED
%54 = icmp eq i8* %52, %53
br i1 %54, label %55, label %57
55: ; preds = %46
%56 = tail call i32 @pexit(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %57
57: ; preds = %55, %46
%58 = getelementptr inbounds i8, i8* %30, i64 %40
%59 = load i32, i32* @PROT_READ
%60 = load i32, i32* @MAP_PRIVATE
%61 = load i32, i32* @MAP_FIXED
%62 = or i32 %61, %60
%63 = tail call i8* @mmap(i8* %58, i64 %20, i32 %59, i32 %62, i32 %14, i64 0)
%64 = load i8*, i8** @MAP_FAILED
%65 = icmp eq i8* %63, %64
br i1 %65, label %66, label %68
66: ; preds = %57
%67 = tail call i32 @pexit(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %68
68: ; preds = %66, %57
%69 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%70 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 1)
%71 = load i8, i8* %30
%72 = sext i8 %71 to i32
%73 = tail call i32 @putchar(i32 %72)
%74 = getelementptr inbounds i8, i8* %30, i64 1
%75 = load i8, i8* %74
%76 = sext i8 %75 to i32
%77 = tail call i32 @putchar(i32 %76)
%78 = getelementptr inbounds i8, i8* %30, i64 2
%79 = load i8, i8* %78
%80 = sext i8 %79 to i32
%81 = tail call i32 @putchar(i32 %80)
%82 = getelementptr inbounds i8, i8* %30, i64 3
%83 = load i8, i8* %82
%84 = sext i8 %83 to i32
%85 = tail call i32 @putchar(i32 %84)
%86 = getelementptr inbounds i8, i8* %30, i64 4
%87 = load i8, i8* %86
%88 = sext i8 %87 to i32
%89 = tail call i32 @putchar(i32 %88)
%90 = getelementptr inbounds i8, i8* %30, i64 5
%91 = load i8, i8* %90
%92 = sext i8 %91 to i32
%93 = tail call i32 @putchar(i32 %92)
%94 = getelementptr inbounds i8, i8* %30, i64 6
%95 = load i8, i8* %94
%96 = sext i8 %95 to i32
%97 = tail call i32 @putchar(i32 %96)
%98 = getelementptr inbounds i8, i8* %30, i64 7
%99 = load i8, i8* %98
%100 = sext i8 %99 to i32
%101 = tail call i32 @putchar(i32 %100)
%102 = getelementptr inbounds i8, i8* %30, i64 8
%103 = load i8, i8* %102
%104 = sext i8 %103 to i32
%105 = tail call i32 @putchar(i32 %104)
%106 = getelementptr inbounds i8, i8* %30, i64 9
%107 = load i8, i8* %106
%108 = sext i8 %107 to i32
%109 = tail call i32 @putchar(i32 %108)
%110 = tail call i32 @putchar(i32 10)
%111 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 2)
%112 = load i8, i8* %47
%113 = sext i8 %112 to i32
%114 = tail call i32 @putchar(i32 %113)
%115 = getelementptr inbounds i8, i8* %47, i64 1
%116 = load i8, i8* %115
%117 = sext i8 %116 to i32
%118 = tail call i32 @putchar(i32 %117)
%119 = getelementptr inbounds i8, i8* %47, i64 2
%120 = load i8, i8* %119
%121 = sext i8 %120 to i32
%122 = tail call i32 @putchar(i32 %121)
%123 = getelementptr inbounds i8, i8* %47, i64 3
%124 = load i8, i8* %123
%125 = sext i8 %124 to i32
%126 = tail call i32 @putchar(i32 %125)
%127 = getelementptr inbounds i8, i8* %47, i64 4
%128 = load i8, i8* %127
%129 = sext i8 %128 to i32
%130 = tail call i32 @putchar(i32 %129)
%131 = getelementptr inbounds i8, i8* %47, i64 5
%132 = load i8, i8* %131
%133 = sext i8 %132 to i32
%134 = tail call i32 @putchar(i32 %133)
%135 = getelementptr inbounds i8, i8* %47, i64 6
%136 = load i8, i8* %135
%137 = sext i8 %136 to i32
%138 = tail call i32 @putchar(i32 %137)
%139 = getelementptr inbounds i8, i8* %47, i64 7
%140 = load i8, i8* %139
%141 = sext i8 %140 to i32
%142 = tail call i32 @putchar(i32 %141)
%143 = getelementptr inbounds i8, i8* %47, i64 8
%144 = load i8, i8* %143
%145 = sext i8 %144 to i32
%146 = tail call i32 @putchar(i32 %145)
%147 = getelementptr inbounds i8, i8* %47, i64 9
%148 = load i8, i8* %147
%149 = sext i8 %148 to i32
%150 = tail call i32 @putchar(i32 %149)
%151 = tail call i32 @putchar(i32 10)
%152 = shl nsw i64 %20, 1
%153 = getelementptr inbounds i8, i8* %30, i64 %152
%154 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 3)
%155 = load i8, i8* %153
%156 = sext i8 %155 to i32
%157 = tail call i32 @putchar(i32 %156)
%158 = getelementptr inbounds i8, i8* %153, i64 1
%159 = load i8, i8* %158
%160 = sext i8 %159 to i32
%161 = tail call i32 @putchar(i32 %160)
%162 = getelementptr inbounds i8, i8* %153, i64 2
%163 = load i8, i8* %162
%164 = sext i8 %163 to i32
%165 = tail call i32 @putchar(i32 %164)
%166 = getelementptr inbounds i8, i8* %153, i64 3
%167 = load i8, i8* %166
%168 = sext i8 %167 to i32
%169 = tail call i32 @putchar(i32 %168)
%170 = getelementptr inbounds i8, i8* %153, i64 4
%171 = load i8, i8* %170
%172 = sext i8 %171 to i32
%173 = tail call i32 @putchar(i32 %172)
%174 = getelementptr inbounds i8, i8* %153, i64 5
%175 = load i8, i8* %174
%176 = sext i8 %175 to i32
%177 = tail call i32 @putchar(i32 %176)
%178 = getelementptr inbounds i8, i8* %153, i64 6
%179 = load i8, i8* %178
%180 = sext i8 %179 to i32
%181 = tail call i32 @putchar(i32 %180)
%182 = getelementptr inbounds i8, i8* %153, i64 7
%183 = load i8, i8* %182
%184 = sext i8 %183 to i32
%185 = tail call i32 @putchar(i32 %184)
%186 = getelementptr inbounds i8, i8* %153, i64 8
%187 = load i8, i8* %186
%188 = sext i8 %187 to i32
%189 = tail call i32 @putchar(i32 %188)
%190 = getelementptr inbounds i8, i8* %153, i64 9
%191 = load i8, i8* %190
%192 = sext i8 %191 to i32
%193 = tail call i32 @putchar(i32 %192)
%194 = tail call i32 @putchar(i32 10)
%195 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.11, i64 0, i64 0))
%196 = trunc i64 %20 to i32
%197 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 10
%198 = load i32, i32* @SEEK_SET
%199 = call i64 @lseek(i32 %14, i32 0, i32 %198)
%200 = icmp eq i64 %199, -1
br i1 %200, label %201, label %203
201: ; preds = %68
%202 = call i32 @pexit(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
br label %203
203: ; preds = %201, %68
%204 = call i32 @read(i32 %14, i8* %10, i32 10)
%205 = icmp eq i32 %204, -1
br i1 %205, label %206, label %208
206: ; preds = %203
%207 = call i32 @pexit(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
br label %208
208: ; preds = %206, %203
store i8 0, i8* %197
%209 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i32 1, i8* %10)
%210 = load i32, i32* @SEEK_SET
%211 = call i64 @lseek(i32 %14, i32 %196, i32 %210)
%212 = icmp eq i64 %211, -1
br i1 %212, label %213, label %215
213: ; preds = %208
%214 = call i32 @pexit(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
br label %215
215: ; preds = %213, %208
%216 = call i32 @read(i32 %14, i8* %10, i32 10)
%217 = icmp eq i32 %216, -1
br i1 %217, label %218, label %220
218: ; preds = %215
%219 = call i32 @pexit(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
br label %220
220: ; preds = %218, %215
store i8 0, i8* %197
%221 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i32 2, i8* %10)
%222 = shl i32 %196, 1
%223 = load i32, i32* @SEEK_SET
%224 = call i64 @lseek(i32 %14, i32 %222, i32 %223)
%225 = icmp eq i64 %224, -1
br i1 %225, label %226, label %228
226: ; preds = %220
%227 = call i32 @pexit(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
br label %228
228: ; preds = %226, %220
%229 = call i32 @read(i32 %14, i8* %10, i32 10)
%230 = icmp eq i32 %229, -1
br i1 %230, label %231, label %233
231: ; preds = %228
%232 = call i32 @pexit(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
br label %233
233: ; preds = %231, %228
store i8 0, i8* %197
%234 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i32 3, i8* %10)
%235 = load i32, i32* @EXIT_SUCCESS
%236 = call i32 @exit(i32 %235)
unreachable
}