#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 st_size;
};
typedef size_t ssize_t;
typedef int off_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
char *MAP_FAILED;
int /*<<< orphan*/ MAP_PRIVATE;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ PROT_READ;
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ _SC_PAGE_SIZE;
void *atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int fstat(int, struct stat *);
char *mmap(int /*<<< orphan*/ *, size_t, int /*<<< orphan*/, int /*<<< orphan*/,
           int, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int sysconf(int /*<<< orphan*/);
size_t write(int /*<<< orphan*/, char *, size_t);
int main(int argc, char *argv[]) {
  char *addr;
  int fd;
  struct stat sb;
  off_t offset, pa_offset;
  size_t length;
  ssize_t s;
  int i, j;
  char c;
  if (argc < 3 || argc > 4) {
    fprintf(stderr, "%s file offset [length]\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  fd = open(argv[1], O_RDONLY);
  if (fd == -1)
    do {
      perror("open");
      exit(EXIT_FAILURE);
    } while (0);
  if (fstat(fd, &sb) == -1)
    do {
      perror("fstat");
      exit(EXIT_FAILURE);
    } while (0);
  offset = atoi(argv[2]);
  pa_offset = offset & ~(sysconf(_SC_PAGE_SIZE) - 1);
  if (offset >= sb.st_size) {
    fprintf(stderr, "offset is past end of file\n");
    exit(EXIT_FAILURE);
  }
  if (argc == 4) {
    length = atoi(argv[3]);
    if (offset + length > sb.st_size)
      length = sb.st_size - offset;
  } else {
    length = sb.st_size - offset;
  }
  addr = mmap(NULL, length + offset - pa_offset, PROT_READ, MAP_PRIVATE, fd,
              pa_offset);
  if (addr == MAP_FAILED)
    do {
      perror("mmap");
      exit(EXIT_FAILURE);
    } while (0);
  i = 0;
  while (i < length) {
    c = (char)addr[i];
    i++;
  }
  s = write(STDOUT_FILENO, addr + offset - pa_offset, length);
  if (s != length) {
    if (s == -1)
      do {
        perror("write");
        exit(EXIT_FAILURE);
      } while (0);
    fprintf(stderr, "partial write");
    exit(EXIT_FAILURE);
  }
  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   $0x3,-0x8(%rbp)
jl     11ba <main+0x2a>
cmpl   $0x4,-0x8(%rbp)
jle    11e6 <main+0x56>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe2f(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2de3(%rip),%rax
mov    (%rax),%esi
call   1060 <open@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    1228 <main+0x98>
jmp    120e <main+0x7e>
lea    0xe04(%rip),%rdi
call   1070 <perror@plt>
mov    0x2d9f(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x1c(%rbp),%edi
lea    -0x20(%rbp),%rsi
call   10b0 <fstat@plt>
cmp    $0xffffffff,%eax
jne    125c <main+0xcc>
jmp    1242 <main+0xb2>
lea    0xdd5(%rip),%rdi
call   1070 <perror@plt>
mov    0x2d6b(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    0x2d3f(%rip),%rax
mov    (%rax),%edi
call   1080 <sysconf@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%eax
sub    $0x1,%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jl     12c1 <main+0x131>
mov    0x2d25(%rip),%rax
mov    (%rax),%edi
lea    0xd78(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2d06(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
cmpl   $0x4,-0x8(%rbp)
jne    1302 <main+0x172>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1090 <atoi@plt>
mov    %rax,-0x30(%rbp)
movslq -0x24(%rbp),%rax
add    -0x30(%rbp),%rax
movslq -0x20(%rbp),%rcx
cmp    %rcx,%rax
jbe    12fd <main+0x16d>
mov    -0x20(%rbp),%eax
sub    -0x24(%rbp),%eax
cltq
mov    %rax,-0x30(%rbp)
jmp    130e <main+0x17e>
mov    -0x20(%rbp),%eax
sub    -0x24(%rbp),%eax
cltq
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rsi
movslq -0x24(%rbp),%rax
add    %rax,%rsi
movslq -0x28(%rbp),%rax
sub    %rax,%rsi
mov    0x2cd1(%rip),%rax
mov    (%rax),%edx
mov    0x2c78(%rip),%rax
mov    (%rax),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x28(%rbp),%r9d
xor    %eax,%eax
mov    %eax,%edi
call   1040 <mmap@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0x2c4e(%rip),%rcx
cmp    (%rcx),%rax
jne    137a <main+0x1ea>
jmp    1360 <main+0x1d0>
lea    0xcd9(%rip),%rdi
call   1070 <perror@plt>
mov    0x2c4d(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
movl   $0x0,-0x3c(%rbp)
movslq -0x3c(%rbp),%rax
cmp    -0x30(%rbp),%rax
jae    13ab <main+0x21b>
mov    -0x18(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x41(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1381 <main+0x1f1>
mov    0x2c36(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rsi
movslq -0x24(%rbp),%rax
add    %rax,%rsi
movslq -0x28(%rbp),%rcx
xor    %eax,%eax
sub    %rcx,%rax
add    %rax,%rsi
mov    -0x30(%rbp),%rdx
call   1030 <write@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x30(%rbp),%rax
je     1435 <main+0x2a5>
cmpq   $0xffffffffffffffff,-0x38(%rbp)
jne    1410 <main+0x280>
jmp    13f6 <main+0x266>
lea    0xc50(%rip),%rdi
call   1070 <perror@plt>
mov    0x2bb7(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    0x2bb1(%rip),%rax
mov    (%rax),%edi
lea    0xc25(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2b92(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    0x2b74(%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
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    -0x5(%rbp),%eax
cmp    $0xfffffffd,%eax
ja     11c4 <main+0x34>
mov    0x2e19(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe45(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    1202 <main+0x72>
mov    0x8(%rbx),%rdi
mov    0x2e09(%rip),%rax
mov    (%rax),%esi
call   1060 <open@plt>
cmp    $0xffffffff,%eax
jne    11e4 <main+0x54>
lea    0xe37(%rip),%rdi
jmp    11fd <main+0x6d>
mov    %eax,%r14d
mov    %rsp,%rsi
mov    %eax,%edi
call   10b0 <fstat@plt>
cmp    $0xffffffff,%eax
jne    1210 <main+0x80>
lea    0xe21(%rip),%rdi
call   1070 <perror@plt>
mov    0x2db7(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    0x10(%rbx),%rdi
call   1090 <atoi@plt>
mov    %rax,%r12
mov    0x2d95(%rip),%rax
mov    (%rax),%edi
call   1080 <sysconf@plt>
movslq (%rsp),%r13
cmp    %r12d,%r13d
jle    1266 <main+0xd6>
mov    %eax,%r15d
neg    %r15d
and    %r12d,%r15d
cmp    $0x4,%ebp
jne    127f <main+0xef>
mov    0x18(%rbx),%rdi
call   1090 <atoi@plt>
mov    %rax,%rbx
movslq %r12d,%rdx
mov    %rdx,%rcx
add    %rdx,%rax
cmp    %r13,%rax
jbe    1261 <main+0xd1>
sub    %r12d,%r13d
movslq %r13d,%rbx
mov    %rcx,%r12
jmp    1288 <main+0xf8>
mov    0x2d5b(%rip),%rax
mov    (%rax),%edi
lea    0xdae(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    1202 <main+0x72>
sub    %r12d,%r13d
movslq %r13d,%rbx
movslq %r12d,%r12
movslq %r15d,%rbp
mov    %r12,%rsi
sub    %rbp,%rsi
add    %rbx,%rsi
mov    0x2d5d(%rip),%rax
mov    (%rax),%edx
mov    0x2d04(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
mov    %r14d,%r8d
mov    %ebp,%r9d
call   1040 <mmap@plt>
mov    0x2ce6(%rip),%rcx
cmp    (%rcx),%rax
jne    12cb <main+0x13b>
lea    0xd7a(%rip),%rdi
jmp    11fd <main+0x6d>
mov    0x2d16(%rip),%rcx
mov    (%rcx),%edi
add    %r12,%rax
sub    %rbp,%rax
mov    %rax,%rsi
mov    %rbx,%rdx
call   1030 <write@plt>
cmp    %rbx,%rax
jne    12f8 <main+0x168>
mov    0x2cbf(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
cmp    $0xffffffffffffffff,%rax
jne    130a <main+0x17a>
lea    0xd48(%rip),%rdi
jmp    11fd <main+0x6d>
mov    0x2cb7(%rip),%rax
mov    (%rax),%edi
lea    0xd2b(%rip),%rsi
jmp    1276 <main+0xe6>

LLVM IR (-O0):
%struct.stat = type { i32 }
@stderr = global i32 0
@.str = [25 x i8] c"%s file offset [length]\0A\00"
@EXIT_FAILURE = global i32 0
@O_RDONLY = global i32 0
@.str.1 = [5 x i8] c"open\00"
@.str.2 = [6 x i8] c"fstat\00"
@_SC_PAGE_SIZE = global i32 0
@.str.3 = [28 x i8] c"offset is past end of file\0A\00"
@PROT_READ = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_FAILED = global i8* null
@.str.4 = [5 x i8] c"mmap\00"
@STDOUT_FILENO = global i32 0
@.str.5 = [6 x i8] c"write\00"
@.str.6 = [14 x i8] c"partial write\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca %struct.stat
%9 = alloca i32
%10 = alloca i32
%11 = alloca i64
%12 = alloca i64
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 3
br i1 %17, label %21, label %18
18: ; preds = %2
%19 = load i32, i32* %4
%20 = icmp sgt i32 %19, 4
br i1 %20, label %21, label %29
21: ; preds = %18, %2
%22 = load i32, i32* @stderr
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %25)
%27 = load i32, i32* @EXIT_FAILURE
%28 = call i32 @exit(i32 %27)
unreachable
29: ; preds = %18
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = load i32, i32* @O_RDONLY
%34 = call i32 @open(i8* %32, i32 %33)
store i32 %34, i32* %7
%35 = load i32, i32* %7
%36 = icmp eq i32 %35, -1
br i1 %36, label %37, label %43
37: ; preds = %29
br label %38
38: ; preds = %37
%39 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%40 = load i32, i32* @EXIT_FAILURE
%41 = call i32 @exit(i32 %40)
unreachable
42: ; No predecessors!
br label %43
43: ; preds = %42, %29
%44 = load i32, i32* %7
%45 = call i32 @fstat(i32 %44, %struct.stat* %8)
%46 = icmp eq i32 %45, -1
br i1 %46, label %47, label %53
47: ; preds = %43
br label %48
48: ; preds = %47
%49 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%50 = load i32, i32* @EXIT_FAILURE
%51 = call i32 @exit(i32 %50)
unreachable
52: ; No predecessors!
br label %53
53: ; preds = %52, %43
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 2
%56 = load i8*, i8** %55
%57 = call i8* @atoi(i8* %56)
%58 = ptrtoint i8* %57 to i32
store i32 %58, i32* %9
%59 = load i32, i32* %9
%60 = load i32, i32* @_SC_PAGE_SIZE
%61 = call i32 @sysconf(i32 %60)
%62 = sub nsw i32 %61, 1
%63 = xor i32 %62, -1
%64 = and i32 %59, %63
store i32 %64, i32* %10
%65 = load i32, i32* %9
%66 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%67 = load i32, i32* %66
%68 = icmp sge i32 %65, %67
br i1 %68, label %69, label %74
69: ; preds = %53
%70 = load i32, i32* @stderr
%71 = call i32 (i32, i8*, ...) @fprintf(i32 %70, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%72 = load i32, i32* @EXIT_FAILURE
%73 = call i32 @exit(i32 %72)
unreachable
74: ; preds = %53
%75 = load i32, i32* %4
%76 = icmp eq i32 %75, 4
br i1 %76, label %77, label %98
77: ; preds = %74
%78 = load i8**, i8*** %5
%79 = getelementptr inbounds i8*, i8** %78, i64 3
%80 = load i8*, i8** %79
%81 = call i8* @atoi(i8* %80)
%82 = ptrtoint i8* %81 to i64
store i64 %82, i64* %11
%83 = load i32, i32* %9
%84 = sext i32 %83 to i64
%85 = load i64, i64* %11
%86 = add i64 %84, %85
%87 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%88 = load i32, i32* %87
%89 = sext i32 %88 to i64
%90 = icmp ugt i64 %86, %89
br i1 %90, label %91, label %97
91: ; preds = %77
%92 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%93 = load i32, i32* %92
%94 = load i32, i32* %9
%95 = sub nsw i32 %93, %94
%96 = sext i32 %95 to i64
store i64 %96, i64* %11
br label %97
97: ; preds = %91, %77
br label %104
98: ; preds = %74
%99 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%100 = load i32, i32* %99
%101 = load i32, i32* %9
%102 = sub nsw i32 %100, %101
%103 = sext i32 %102 to i64
store i64 %103, i64* %11
br label %104
104: ; preds = %98, %97
%105 = load i64, i64* %11
%106 = load i32, i32* %9
%107 = sext i32 %106 to i64
%108 = add i64 %105, %107
%109 = load i32, i32* %10
%110 = sext i32 %109 to i64
%111 = sub i64 %108, %110
%112 = load i32, i32* @PROT_READ
%113 = load i32, i32* @MAP_PRIVATE
%114 = load i32, i32* %7
%115 = load i32, i32* %10
%116 = call i8* @mmap(i32* null, i64 %111, i32 %112, i32 %113, i32 %114, i32 %115)
store i8* %116, i8** %6
%117 = load i8*, i8** %6
%118 = load i8*, i8** @MAP_FAILED
%119 = icmp eq i8* %117, %118
br i1 %119, label %120, label %126
120: ; preds = %104
br label %121
121: ; preds = %120
%122 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%123 = load i32, i32* @EXIT_FAILURE
%124 = call i32 @exit(i32 %123)
unreachable
125: ; No predecessors!
br label %126
126: ; preds = %125, %104
store i32 0, i32* %13
br label %127
127: ; preds = %132, %126
%128 = load i32, i32* %13
%129 = sext i32 %128 to i64
%130 = load i64, i64* %11
%131 = icmp ult i64 %129, %130
br i1 %131, label %132, label %140
132: ; preds = %127
%133 = load i8*, i8** %6
%134 = load i32, i32* %13
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds i8, i8* %133, i64 %135
%137 = load i8, i8* %136
store i8 %137, i8* %15
%138 = load i32, i32* %13
%139 = add nsw i32 %138, 1
store i32 %139, i32* %13
br label %127
140: ; preds = %127
%141 = load i32, i32* @STDOUT_FILENO
%142 = load i8*, i8** %6
%143 = load i32, i32* %9
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds i8, i8* %142, i64 %144
%146 = load i32, i32* %10
%147 = sext i32 %146 to i64
%148 = sub i64 0, %147
%149 = getelementptr inbounds i8, i8* %145, i64 %148
%150 = load i64, i64* %11
%151 = call i64 @write(i32 %141, i8* %149, i64 %150)
store i64 %151, i64* %12
%152 = load i64, i64* %12
%153 = load i64, i64* %11
%154 = icmp ne i64 %152, %153
br i1 %154, label %155, label %169
155: ; preds = %140
%156 = load i64, i64* %12
%157 = icmp eq i64 %156, -1
br i1 %157, label %158, label %164
158: ; preds = %155
br label %159
159: ; preds = %158
%160 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%161 = load i32, i32* @EXIT_FAILURE
%162 = call i32 @exit(i32 %161)
unreachable
163: ; No predecessors!
br label %164
164: ; preds = %163, %155
%165 = load i32, i32* @stderr
%166 = call i32 (i32, i8*, ...) @fprintf(i32 %165, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%167 = load i32, i32* @EXIT_FAILURE
%168 = call i32 @exit(i32 %167)
unreachable
169: ; preds = %140
%170 = load i32, i32* @EXIT_SUCCESS
%171 = call i32 @exit(i32 %170)
unreachable
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@stderr = global i32 0
@.str = [25 x i8] c"%s file offset [length]\0A\00"
@EXIT_FAILURE = global i32 0
@O_RDONLY = global i32 0
@.str.1 = [5 x i8] c"open\00"
@.str.2 = [6 x i8] c"fstat\00"
@_SC_PAGE_SIZE = global i32 0
@.str.3 = [28 x i8] c"offset is past end of file\0A\00"
@PROT_READ = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_FAILED = global i8* null
@.str.4 = [5 x i8] c"mmap\00"
@STDOUT_FILENO = global i32 0
@.str.5 = [6 x i8] c"write\00"
@.str.6 = [14 x i8] c"partial write\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = add i32 %0, -5
%6 = icmp ult i32 %5, -2
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = load i8*, i8** %1
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = load i32, i32* @O_RDONLY
%17 = tail call i32 @open(i8* %15, i32 %16)
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %23
19: ; preds = %13
%20 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%21 = load i32, i32* @EXIT_FAILURE
%22 = tail call i32 @exit(i32 %21)
unreachable
23: ; preds = %13
%24 = call i32 @fstat(i32 %17, %struct.stat* %3)
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %30
26: ; preds = %23
%27 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%28 = load i32, i32* @EXIT_FAILURE
%29 = tail call i32 @exit(i32 %28)
unreachable
30: ; preds = %23
%31 = getelementptr inbounds i8*, i8** %1, i64 2
%32 = load i8*, i8** %31
%33 = tail call i8* @atoi(i8* %32)
%34 = ptrtoint i8* %33 to i64
%35 = trunc i64 %34 to i32
%36 = load i32, i32* @_SC_PAGE_SIZE
%37 = tail call i32 @sysconf(i32 %36)
%38 = sub i32 0, %37
%39 = and i32 %35, %38
%40 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%41 = load i32, i32* %40
%42 = icmp sgt i32 %41, %35
br i1 %42, label %48, label %43
43: ; preds = %30
%44 = load i32, i32* @stderr
%45 = tail call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%46 = load i32, i32* @EXIT_FAILURE
%47 = tail call i32 @exit(i32 %46)
unreachable
48: ; preds = %30
%49 = icmp eq i32 %0, 4
br i1 %49, label %50, label %63
50: ; preds = %48
%51 = getelementptr inbounds i8*, i8** %1, i64 3
%52 = load i8*, i8** %51
%53 = tail call i8* @atoi(i8* %52)
%54 = ptrtoint i8* %53 to i64
%55 = shl i64 %34, 32
%56 = ashr exact i64 %55, 32
%57 = add i64 %56, %54
%58 = sext i32 %41 to i64
%59 = icmp ugt i64 %57, %58
br i1 %59, label %60, label %68
60: ; preds = %50
%61 = sub nsw i32 %41, %35
%62 = sext i32 %61 to i64
br label %68
63: ; preds = %48
%64 = sub nsw i32 %41, %35
%65 = sext i32 %64 to i64
%66 = shl i64 %34, 32
%67 = ashr exact i64 %66, 32
br label %68
68: ; preds = %50, %60, %63
%69 = phi i64 [ %56, %50 ], [ %56, %60 ], [ %67, %63 ]
%70 = phi i64 [ %54, %50 ], [ %62, %60 ], [ %65, %63 ]
%71 = sext i32 %39 to i64
%72 = sub nsw i64 %69, %71
%73 = add i64 %72, %70
%74 = load i32, i32* @PROT_READ
%75 = load i32, i32* @MAP_PRIVATE
%76 = tail call i8* @mmap(i32* null, i64 %73, i32 %74, i32 %75, i32 %17, i32 %39)
%77 = load i8*, i8** @MAP_FAILED
%78 = icmp eq i8* %76, %77
br i1 %78, label %86, label %79
79: ; preds = %68
%80 = sub nsw i64 0, %71
%81 = load i32, i32* @STDOUT_FILENO
%82 = getelementptr inbounds i8, i8* %76, i64 %69
%83 = getelementptr inbounds i8, i8* %82, i64 %80
%84 = tail call i64 @write(i32 %81, i8* %83, i64 %70)
%85 = icmp eq i64 %84, %70
br i1 %85, label %101, label %90
86: ; preds = %68
%87 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%88 = load i32, i32* @EXIT_FAILURE
%89 = tail call i32 @exit(i32 %88)
unreachable
90: ; preds = %79
%91 = icmp eq i64 %84, -1
br i1 %91, label %92, label %96
92: ; preds = %90
%93 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%94 = load i32, i32* @EXIT_FAILURE
%95 = tail call i32 @exit(i32 %94)
unreachable
96: ; preds = %90
%97 = load i32, i32* @stderr
%98 = tail call i32 (i32, i8*, ...) @fprintf(i32 %97, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%99 = load i32, i32* @EXIT_FAILURE
%100 = tail call i32 @exit(i32 %99)
unreachable
101: ; preds = %79
%102 = load i32, i32* @EXIT_SUCCESS
%103 = tail call i32 @exit(i32 %102)
unreachable
}