#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 */
int MAP_FILE;
int MAP_SHARED;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fileno(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
unsigned int fread(void *, int, unsigned int, int /*<<< orphan*/);
int getpagesize();
void *mmap(int /*<<< orphan*/, unsigned int, int, int, int /*<<< orphan*/,
           unsigned int);
int sscanf(char *, char *, unsigned int *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
char *strerror(int /*<<< orphan*/);
unsigned int strtoul(char *, char **, int /*<<< orphan*/);
int main(int argc, char **argv) {
  char *fname;
  FILE *f;
  int pagesize = getpagesize();
  unsigned int pos, pos_pg, pos_off;
  unsigned int len, len_pg, len_off;
  void *address;
  char *rest;
  if (argc != 4 || sscanf(argv[2], "%i", &pos) != 1 ||
      sscanf(argv[3], "%i", &len) != 1) {
    fprintf(stderr, "%s: Usage \"%s <file> <offset> <len>\"\n", argv[0],
            argv[0]);
    exit(1);
  }
  pos = strtoul(argv[2], &rest, 0);
  if (rest && *rest) {
    fprintf(stderr, "%s: Usage \"%s <file> <offset> <len>\"\n", argv[0],
            argv[0]);
    exit(1);
  }
  fname = argv[1];
  if (!(f = fopen(fname, "r+"))) {
    fprintf(stderr, "%s: %s: %s\n", argv[0], fname, strerror(errno));
    exit(1);
  }
  pos_pg = pos & ~(pagesize - 1);
  pos_off = pos & (pagesize - 1);
  len_pg = (len + pos_off + pagesize - 1) & ~(pagesize - 1);
  len_off = (len + pos_off) & (pagesize - 1);
  address = mmap(0, len_pg, PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED,
                 fileno(f), pos_pg);
  if (address == (void *)-1) {
    fprintf(stderr, "%s: mmap(): %s\n", argv[0], strerror(errno));
    exit(1);
  }
  fclose(f);
  fprintf(stderr, "mapped \"%s\" from %i to %i (0x%x to 0x%x) \n", fname, pos,
          pos + len, pos_pg, pos_pg + len_pg);
  if (fread(address + pos_off, 1, len, stdin) != len) {
    fprintf(stderr, "%s: short read\n", argv[0]);
    exit(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   10b0 <getpagesize@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x4,-0x8(%rbp)
jne    121f <main+0x6f>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe14(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1080 <sscanf@plt>
cmp    $0x1,%eax
jne    121f <main+0x6f>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xdf3(%rip),%rsi
lea    -0x34(%rbp),%rdx
call   1080 <sscanf@plt>
cmp    $0x1,%eax
je     124e <main+0x9e>
mov    0x2d9a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0xdc6(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    -0x50(%rbp),%rsi
xor    %edx,%edx
call   10a0 <strtoul@plt>
mov    %eax,-0x28(%rbp)
cmpq   $0x0,-0x50(%rbp)
je     12ae <main+0xfe>
mov    -0x50(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     12ae <main+0xfe>
mov    0x2d3a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0xd66(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xd64(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    132b <main+0x17b>
mov    0x2ce1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x60(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    0x2cba(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x64(%rbp),%edi
mov    -0x60(%rbp),%rdx
mov    -0x58(%rbp),%rcx
mov    %rax,%r8
lea    0xd12(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x28(%rbp),%eax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
and    %ecx,%eax
mov    %eax,-0x30(%rbp)
mov    -0x34(%rbp),%eax
add    -0x30(%rbp),%eax
add    -0x24(%rbp),%eax
sub    $0x1,%eax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
add    -0x30(%rbp),%eax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
and    %ecx,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    0x2c76(%rip),%rax
mov    (%rax),%eax
mov    0x2c25(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x6c(%rbp)
mov    0x2c39(%rip),%rax
mov    (%rax),%eax
mov    0x2c48(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x68(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <fileno@plt>
mov    -0x70(%rbp),%esi
mov    -0x6c(%rbp),%edx
mov    -0x68(%rbp),%ecx
mov    %eax,%r8d
mov    -0x2c(%rbp),%r9d
xor    %edi,%edi
call   1050 <mmap@plt>
mov    %rax,-0x48(%rbp)
mov    $0xffffffffffffffff,%rax
cmp    %rax,-0x48(%rbp)
jne    1421 <main+0x271>
mov    0x2bdf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x78(%rbp)
mov    0x2bc0(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x7c(%rbp),%edi
mov    -0x78(%rbp),%rdx
mov    %rax,%rcx
lea    0xc28(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    0x2b8f(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x28(%rbp),%ecx
mov    -0x28(%rbp),%r8d
add    -0x34(%rbp),%r8d
mov    -0x2c(%rbp),%r9d
mov    -0x2c(%rbp),%eax
add    -0x38(%rbp),%eax
lea    0xbf5(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x48(%rbp),%rdi
mov    -0x30(%rbp),%eax
add    %rax,%rdi
mov    -0x34(%rbp),%edx
mov    0x2b67(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
call   1030 <fread@plt>
cmp    -0x34(%rbp),%eax
je     14ae <main+0x2fe>
mov    0x2b33(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xbd6(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbp
mov    %edi,%ebx
xor    %eax,%eax
call   10b0 <getpagesize@plt>
cmp    $0x4,%ebx
jne    1343 <main+0x193>
mov    %eax,%r12d
mov    0x10(%rbp),%rdi
lea    0xe1f(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1080 <sscanf@plt>
cmp    $0x1,%eax
jne    1343 <main+0x193>
mov    0x18(%rbp),%rdi
lea    0xe01(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1080 <sscanf@plt>
cmp    $0x1,%eax
jne    1343 <main+0x193>
mov    0x10(%rbp),%rdi
lea    0x20(%rsp),%rsi
xor    %edx,%edx
call   10a0 <strtoul@plt>
mov    %eax,0xc(%rsp)
mov    0x20(%rsp),%rax
test   %rax,%rax
je     1239 <main+0x89>
cmpb   $0x0,(%rax)
jne    1343 <main+0x193>
mov    %rbp,0x10(%rsp)
mov    0x8(%rbp),%rdi
lea    0xde0(%rip),%rsi
mov    %rdi,0x18(%rsp)
call   1090 <fopen@plt>
test   %rax,%rax
je     135c <main+0x1ac>
mov    %rax,%r13
mov    0xc(%rsp),%r14d
lea    -0x1(%r12),%r15d
mov    %r12d,%eax
neg    %eax
and    %r14d,%r15d
lea    (%r12,%r15,1),%ebx
add    $0xffffffff,%ebx
add    0x8(%rsp),%ebx
and    %eax,%r14d
and    %eax,%ebx
mov    0x2d70(%rip),%rax
mov    0x2d21(%rip),%rcx
mov    (%rcx),%r12d
or     (%rax),%r12d
mov    0x2d34(%rip),%rax
mov    0x2d45(%rip),%rcx
mov    (%rcx),%ebp
or     (%rax),%ebp
mov    %r13,%rdi
call   1070 <fileno@plt>
xor    %edi,%edi
mov    %ebx,%esi
mov    %r12d,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
mov    %r14d,%r9d
call   1050 <mmap@plt>
cmp    $0xffffffffffffffff,%rax
je     13a0 <main+0x1f0>
mov    %rax,%rbp
mov    %r13,%rdi
call   1040 <fclose@plt>
mov    0x2ce1(%rip),%r12
mov    (%r12),%edi
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%r8d
add    %ecx,%r8d
add    %r14d,%ebx
mov    %ebx,(%rsp)
lea    0xd4c(%rip),%rsi
mov    0x18(%rsp),%rdx
mov    %r14d,%r9d
xor    %eax,%eax
call   1060 <fprintf@plt>
add    %r15,%rbp
mov    0x8(%rsp),%edx
mov    0x2cbf(%rip),%rax
mov    (%rax),%ecx
mov    %rbp,%rdi
mov    $0x1,%esi
call   1030 <fread@plt>
cmp    0x8(%rsp),%eax
jne    13df <main+0x22f>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c76(%rip),%rax
mov    (%rax),%edi
mov    0x0(%rbp),%rcx
lea    0xcac(%rip),%rsi
mov    %rcx,%rdx
jmp    13ce <main+0x21e>
mov    0x2c5d(%rip),%rax
mov    (%rax),%ebx
mov    0x10(%rsp),%rax
mov    (%rax),%rbp
mov    0x2c44(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xcaa(%rip),%rsi
mov    %ebx,%edi
mov    %rbp,%rdx
mov    0x18(%rsp),%rcx
mov    %rax,%r8
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    0x2c19(%rip),%rax
mov    (%rax),%ebx
mov    0x10(%rsp),%rax
mov    (%rax),%rbp
mov    0x2c00(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xc72(%rip),%rsi
mov    %ebx,%edi
mov    %rbp,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    (%r12),%edi
mov    0x10(%rsp),%rax
mov    (%rax),%rdx
lea    0xc81(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%i\00"
@stderr = global i32 0
@.str.1 = [38 x i8] c"%s: Usage \22%s <file> <offset> <len>\22\0A\00"
@.str.2 = [3 x i8] c"r+\00"
@.str.3 = [12 x i8] c"%s: %s: %s\0A\00"
@errno = global i32 0
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_FILE = global i32 0
@MAP_SHARED = global i32 0
@.str.4 = [16 x i8] c"%s: mmap(): %s\0A\00"
@.str.5 = [43 x i8] c"mapped \22%s\22 from %i to %i (0x%x to 0x%x) \0A\00"
@stdin = global i32 0
@.str.6 = [16 x i8] c"%s: short read\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = call i32 (...) @getpagesize()
store i32 %17, i32* %8
%18 = load i32, i32* %4
%19 = icmp ne i32 %18, 4
br i1 %19, label %32, label %20
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
%24 = call i32 @sscanf(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%25 = icmp ne i32 %24, 1
br i1 %25, label %32, label %26
26: ; preds = %20
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 3
%29 = load i8*, i8** %28
%30 = call i32 @sscanf(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %12)
%31 = icmp ne i32 %30, 1
br i1 %31, label %32, label %42
32: ; preds = %26, %20, %2
%33 = load i32, i32* @stderr
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 0
%36 = load i8*, i8** %35
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 0
%39 = load i8*, i8** %38
%40 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %36, i8* %39)
%41 = call i32 @exit(i32 1)
unreachable
42: ; preds = %26
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 2
%45 = load i8*, i8** %44
%46 = call i32 @strtoul(i8* %45, i8** %16, i32 0)
store i32 %46, i32* %9
%47 = load i8*, i8** %16
%48 = icmp ne i8* %47, null
br i1 %48, label %49, label %64
49: ; preds = %42
%50 = load i8*, i8** %16
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %64
54: ; preds = %49
%55 = load i32, i32* @stderr
%56 = load i8**, i8*** %5
%57 = getelementptr inbounds i8*, i8** %56, i64 0
%58 = load i8*, i8** %57
%59 = load i8**, i8*** %5
%60 = getelementptr inbounds i8*, i8** %59, i64 0
%61 = load i8*, i8** %60
%62 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %58, i8* %61)
%63 = call i32 @exit(i32 1)
unreachable
64: ; preds = %49, %42
%65 = load i8**, i8*** %5
%66 = getelementptr inbounds i8*, i8** %65, i64 1
%67 = load i8*, i8** %66
store i8* %67, i8** %6
%68 = load i8*, i8** %6
%69 = call i32* @fopen(i8* %68, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %69, i32** %7
%70 = icmp ne i32* %69, null
br i1 %70, label %81, label %71
71: ; preds = %64
%72 = load i32, i32* @stderr
%73 = load i8**, i8*** %5
%74 = getelementptr inbounds i8*, i8** %73, i64 0
%75 = load i8*, i8** %74
%76 = load i8*, i8** %6
%77 = load i32, i32* @errno
%78 = call i8* @strerror(i32 %77)
%79 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %72, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %75, i8* %76, i8* %78)
%80 = call i32 @exit(i32 1)
unreachable
81: ; preds = %64
%82 = load i32, i32* %9
%83 = load i32, i32* %8
%84 = sub nsw i32 %83, 1
%85 = xor i32 %84, -1
%86 = and i32 %82, %85
store i32 %86, i32* %10
%87 = load i32, i32* %9
%88 = load i32, i32* %8
%89 = sub nsw i32 %88, 1
%90 = and i32 %87, %89
store i32 %90, i32* %11
%91 = load i32, i32* %12
%92 = load i32, i32* %11
%93 = add i32 %91, %92
%94 = load i32, i32* %8
%95 = add i32 %93, %94
%96 = sub i32 %95, 1
%97 = load i32, i32* %8
%98 = sub nsw i32 %97, 1
%99 = xor i32 %98, -1
%100 = and i32 %96, %99
store i32 %100, i32* %13
%101 = load i32, i32* %12
%102 = load i32, i32* %11
%103 = add i32 %101, %102
%104 = load i32, i32* %8
%105 = sub nsw i32 %104, 1
%106 = and i32 %103, %105
store i32 %106, i32* %14
%107 = load i32, i32* %13
%108 = load i32, i32* @PROT_READ
%109 = load i32, i32* @PROT_WRITE
%110 = or i32 %108, %109
%111 = load i32, i32* @MAP_FILE
%112 = load i32, i32* @MAP_SHARED
%113 = or i32 %111, %112
%114 = load i32*, i32** %7
%115 = call i32 @fileno(i32* %114)
%116 = load i32, i32* %10
%117 = call i8* @mmap(i32 0, i32 %107, i32 %110, i32 %113, i32 %115, i32 %116)
store i8* %117, i8** %15
%118 = load i8*, i8** %15
%119 = icmp eq i8* %118, inttoptr (i64 -1 to i8*)
br i1 %119, label %120, label %129
120: ; preds = %81
%121 = load i32, i32* @stderr
%122 = load i8**, i8*** %5
%123 = getelementptr inbounds i8*, i8** %122, i64 0
%124 = load i8*, i8** %123
%125 = load i32, i32* @errno
%126 = call i8* @strerror(i32 %125)
%127 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %121, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* %124, i8* %126)
%128 = call i32 @exit(i32 1)
unreachable
129: ; preds = %81
%130 = load i32*, i32** %7
%131 = call i32 @fclose(i32* %130)
%132 = load i32, i32* @stderr
%133 = load i8*, i8** %6
%134 = load i32, i32* %9
%135 = load i32, i32* %9
%136 = load i32, i32* %12
%137 = add i32 %135, %136
%138 = load i32, i32* %10
%139 = load i32, i32* %10
%140 = load i32, i32* %13
%141 = add i32 %139, %140
%142 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %132, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0), i8* %133, i32 %134, i32 %137, i32 %138, i32 %141)
%143 = load i8*, i8** %15
%144 = load i32, i32* %11
%145 = zext i32 %144 to i64
%146 = getelementptr i8, i8* %143, i64 %145
%147 = load i32, i32* %12
%148 = load i32, i32* @stdin
%149 = call i32 @fread(i8* %146, i32 1, i32 %147, i32 %148)
%150 = load i32, i32* %12
%151 = icmp ne i32 %149, %150
br i1 %151, label %152, label %159
152: ; preds = %129
%153 = load i32, i32* @stderr
%154 = load i8**, i8*** %5
%155 = getelementptr inbounds i8*, i8** %154, i64 0
%156 = load i8*, i8** %155
%157 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %153, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %156)
%158 = call i32 @exit(i32 1)
unreachable
159: ; preds = %129
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
@stderr = global i32 0
@.str.1 = [38 x i8] c"%s: Usage \22%s <file> <offset> <len>\22\0A\00"
@.str.2 = [3 x i8] c"r+\00"
@.str.3 = [12 x i8] c"%s: %s: %s\0A\00"
@errno = global i32 0
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_FILE = global i32 0
@MAP_SHARED = global i32 0
@.str.4 = [16 x i8] c"%s: mmap(): %s\0A\00"
@.str.5 = [43 x i8] c"mapped \22%s\22 from %i to %i (0x%x to 0x%x) \0A\00"
@stdin = global i32 0
@.str.6 = [16 x i8] c"%s: short read\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = tail call i32 (...) @getpagesize()
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = bitcast i8** %5 to i8*
%10 = icmp eq i32 %0, 4
br i1 %10, label %11, label %21
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = call i32 @sscanf(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %21
16: ; preds = %11
%17 = getelementptr inbounds i8*, i8** %1, i64 3
%18 = load i8*, i8** %17
%19 = call i32 @sscanf(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%20 = icmp eq i32 %19, 1
br i1 %20, label %26, label %21
21: ; preds = %16, %11, %2
%22 = load i32, i32* @stderr
%23 = load i8*, i8** %1
%24 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %23, i8* %23)
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %16
%27 = load i8*, i8** %12
%28 = call i32 @strtoul(i8* %27, i8** %5, i32 0)
store i32 %28, i32* %3
%29 = load i8*, i8** %5
%30 = icmp eq i8* %29, null
br i1 %30, label %39, label %31
31: ; preds = %26
%32 = load i8, i8* %29
%33 = icmp eq i8 %32, 0
br i1 %33, label %39, label %34
34: ; preds = %31
%35 = load i32, i32* @stderr
%36 = load i8*, i8** %1
%37 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %36, i8* %36)
%38 = call i32 @exit(i32 1)
unreachable
39: ; preds = %31, %26
%40 = getelementptr inbounds i8*, i8** %1, i64 1
%41 = load i8*, i8** %40
%42 = call i32* @fopen(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%43 = icmp eq i32* %42, null
br i1 %43, label %44, label %51
44: ; preds = %39
%45 = load i32, i32* @stderr
%46 = load i8*, i8** %1
%47 = load i32, i32* @errno
%48 = call i8* @strerror(i32 %47)
%49 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %46, i8* %41, i8* %48)
%50 = call i32 @exit(i32 1)
unreachable
51: ; preds = %39
%52 = load i32, i32* %3
%53 = add i32 %6, -1
%54 = sub i32 0, %6
%55 = and i32 %52, %54
%56 = and i32 %52, %53
%57 = load i32, i32* %4
%58 = add i32 %53, %56
%59 = add i32 %58, %57
%60 = and i32 %59, %54
%61 = load i32, i32* @PROT_READ
%62 = load i32, i32* @PROT_WRITE
%63 = or i32 %62, %61
%64 = load i32, i32* @MAP_FILE
%65 = load i32, i32* @MAP_SHARED
%66 = or i32 %65, %64
%67 = call i32 @fileno(i32* %42)
%68 = call i8* @mmap(i32 0, i32 %60, i32 %63, i32 %66, i32 %67, i32 %55)
%69 = icmp eq i8* %68, inttoptr (i64 -1 to i8*)
br i1 %69, label %70, label %77
70: ; preds = %51
%71 = load i32, i32* @stderr
%72 = load i8*, i8** %1
%73 = load i32, i32* @errno
%74 = call i8* @strerror(i32 %73)
%75 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* %72, i8* %74)
%76 = call i32 @exit(i32 1)
unreachable
77: ; preds = %51
%78 = call i32 @fclose(i32* %42)
%79 = load i32, i32* @stderr
%80 = load i32, i32* %3
%81 = load i32, i32* %4
%82 = add i32 %81, %80
%83 = add i32 %60, %55
%84 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0), i8* %41, i32 %80, i32 %82, i32 %55, i32 %83)
%85 = zext i32 %56 to i64
%86 = getelementptr i8, i8* %68, i64 %85
%87 = load i32, i32* %4
%88 = load i32, i32* @stdin
%89 = call i32 @fread(i8* %86, i32 1, i32 %87, i32 %88)
%90 = load i32, i32* %4
%91 = icmp eq i32 %89, %90
br i1 %91, label %97, label %92
92: ; preds = %77
%93 = load i32, i32* @stderr
%94 = load i8*, i8** %1
%95 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %93, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %94)
%96 = call i32 @exit(i32 1)
unreachable
97: ; preds = %77
ret i32 0
}