#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 {
  scalar_t__ st_size;
};
typedef char *caddr_t;

/* Variables and functions */
int MAP_SHARED;
int O_CREAT;
int /*<<< orphan*/ O_RDONLY;
int O_RDWR;
int O_TRUNC;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ SEEK_SET;
int S_IRUSR;
int S_IWUSR;
int S_IXGRP;
int S_IXOTH;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ fstat(int, struct stat *);
int lseek(int, scalar_t__, int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(char *, char *, scalar_t__);
char *mmap(int /*<<< orphan*/, scalar_t__, int, int, int, int /*<<< orphan*/);
int open(char *, int, ...);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int write(int, char *, int);
int main(int argc, char *argv[]) {
  int fdin, fdout;
  char *src, *dst;
  struct stat statbuf;
  if (argc != 3) {
    fprintf(stderr, "Uso e' %s <arq origem> <arq destino>\n", argv[0]);
    exit(1);
  }
  if ((fdin = open(argv[1], O_RDONLY)) < 0) {
    fprintf(stderr, "Arquivo %s nao pode ser  aberto para reading\n", argv[1]);
    exit(1);
  }
  if ((fdout = open(argv[2], O_RDWR | O_CREAT | O_TRUNC,
                    (S_IRUSR | S_IWUSR | S_IXGRP | S_IXOTH))) < 0) {
    fprintf(stderr, "Arquivo %s nao pode ser  criado para writing \n", argv[2]);
    exit(1);
  }
  if (fstat(fdin, &statbuf) < 0) {
    perror("Erro no fstat");
    exit(1);
  }
  if (lseek(fdout, statbuf.st_size - 1, SEEK_SET) == -1) {
    perror("Erro no lseek");
    exit(1);
  }
  if (write(fdout, "", 1) != 1) {
    perror("Erro no write");
    exit(1);
  }
  if ((src = mmap(0, statbuf.st_size, PROT_READ, 0 | MAP_SHARED, fdin, 0)) ==
      (caddr_t)-1) {
    fprintf(stderr, "Erro no mmap para input");
    exit(1);
  }
  if ((dst = mmap(0, statbuf.st_size, PROT_READ | PROT_WRITE, 0 | MAP_SHARED,
                  fdout, 0)) == (caddr_t)-1) {
    fprintf(stderr, "Erro no mmap para output");
    exit(1);
  }
  memcpy(dst, src, statbuf.st_size);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11d8 <main+0x48>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe39(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2dd1(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   1080 <open@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1225 <main+0x95>
mov    0x2d95(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe12(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    0x2d94(%rip),%rax
mov    (%rax),%esi
mov    0x2dbb(%rip),%rax
or     (%rax),%esi
mov    0x2daa(%rip),%rax
or     (%rax),%esi
mov    0x2d31(%rip),%rax
mov    (%rax),%edx
mov    0x2d58(%rip),%rax
or     (%rax),%edx
mov    0x2d47(%rip),%rax
or     (%rax),%edx
mov    0x2d56(%rip),%rax
or     (%rax),%edx
mov    $0x0,%al
call   1080 <open@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    12a8 <main+0x118>
mov    0x2d12(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xdbd(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   10b0 <fstat@plt>
cmp    $0x0,%rax
jge    12d4 <main+0x144>
lea    0xdbe(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x18(%rbp),%edi
mov    -0x30(%rbp),%rsi
sub    $0x1,%rsi
mov    0x2caa(%rip),%rax
mov    (%rax),%edx
call   1050 <lseek@plt>
cmp    $0xffffffff,%eax
jne    130c <main+0x17c>
lea    0xd94(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x18(%rbp),%edi
lea    0xd6c(%rip),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
cmp    $0x1,%eax
je     133f <main+0x1af>
lea    0xd6f(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x30(%rbp),%rsi
mov    0x2c9e(%rip),%rax
mov    (%rax),%edx
mov    0x2c85(%rip),%rax
mov    (%rax),%ecx
or     $0x0,%ecx
mov    -0x14(%rbp),%r8d
xor    %r9d,%r9d
mov    %r9d,%edi
call   1040 <mmap@plt>
mov    %rax,-0x20(%rbp)
mov    $0xffffffffffffffff,%rcx
cmp    %rcx,%rax
jne    139c <main+0x20c>
mov    0x2c16(%rip),%rax
mov    (%rax),%edi
lea    0xd22(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x30(%rbp),%rsi
mov    0x2c41(%rip),%rax
mov    (%rax),%edx
mov    0x2bd8(%rip),%rax
or     (%rax),%edx
mov    0x2c1f(%rip),%rax
mov    (%rax),%ecx
or     $0x0,%ecx
mov    -0x18(%rbp),%r8d
xor    %r9d,%r9d
mov    %r9d,%edi
call   1040 <mmap@plt>
mov    %rax,-0x28(%rbp)
mov    $0xffffffffffffffff,%rcx
cmp    %rcx,%rax
jne    1402 <main+0x272>
mov    0x2bb0(%rip),%rax
mov    (%rax),%edi
lea    0xcd4(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   1070 <memcpy@plt>
xor    %edi,%edi
call   10a0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbp
cmp    $0x3,%edi
jne    11d2 <main+0x42>
mov    0x8(%rbp),%rdi
mov    0x2e09(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
call   1080 <open@plt>
test   %eax,%eax
jns    11f7 <main+0x67>
mov    0x2dd5(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbp),%rdx
lea    0xe56(%rip),%rsi
jmp    11e6 <main+0x56>
mov    0x2dbf(%rip),%rax
mov    (%rax),%edi
mov    0x0(%rbp),%rdx
lea    0xe1a(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    %eax,%ebx
mov    0x2dc8(%rip),%rax
mov    0x2df1(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2dde(%rip),%rax
or     (%rax),%esi
mov    0x2d65(%rip),%rax
mov    0x2d8e(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2d7b(%rip),%rax
or     (%rax),%edx
mov    0x10(%rbp),%rdi
mov    0x2d86(%rip),%rax
or     (%rax),%edx
xor    %eax,%eax
call   1080 <open@plt>
test   %eax,%eax
jns    125d <main+0xcd>
mov    0x2d4a(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rbp),%rdx
lea    0xdf9(%rip),%rsi
jmp    11e6 <main+0x56>
mov    %eax,%r15d
lea    0x8(%rsp),%rsi
mov    %ebx,%edi
call   10b0 <fstat@plt>
test   %rax,%rax
jns    127d <main+0xed>
lea    0xe0b(%rip),%rdi
jmp    1302 <main+0x172>
mov    0x8(%rsp),%r14
lea    -0x1(%r14),%rsi
mov    0x2d03(%rip),%rax
mov    (%rax),%edx
mov    %r15d,%edi
call   1050 <lseek@plt>
cmp    $0xffffffff,%eax
jne    12a5 <main+0x115>
lea    0xdee(%rip),%rdi
jmp    1302 <main+0x172>
lea    0xdd6(%rip),%rsi
mov    %r15d,%edi
mov    $0x1,%edx
call   1030 <write@plt>
cmp    $0x1,%eax
jne    12fb <main+0x16b>
mov    0x2d23(%rip),%r12
mov    (%r12),%edx
mov    0x2d08(%rip),%rbp
mov    0x0(%rbp),%ecx
xor    %edi,%edi
mov    %r14,%rsi
mov    %ebx,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
cmp    $0xffffffffffffffff,%rax
jne    1311 <main+0x181>
mov    0x2ca8(%rip),%rax
mov    (%rax),%edi
lea    0xdb4(%rip),%rsi
jmp    134a <main+0x1ba>
lea    0xd9d(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    %rax,%rbx
mov    0x2c6d(%rip),%rax
mov    (%rax),%edx
or     (%r12),%edx
mov    0x0(%rbp),%ecx
xor    %edi,%edi
mov    %r14,%rsi
mov    %r15d,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
cmp    $0xffffffffffffffff,%rax
jne    135b <main+0x1cb>
mov    0x2c57(%rip),%rax
mov    (%rax),%edi
lea    0xd7b(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1070 <memcpy@plt>
xor    %edi,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i64 }
@stderr = global i32 0
@.str = [38 x i8] c"Uso e' %s <arq origem> <arq destino>\0A\00"
@O_RDONLY = global i32 0
@.str.1 = [46 x i8] c"Arquivo %s nao pode ser aberto para reading\0A\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IXGRP = global i32 0
@S_IXOTH = global i32 0
@.str.2 = [47 x i8] c"Arquivo %s nao pode ser criado para writing \0A\00"
@.str.3 = [14 x i8] c"Erro no fstat\00"
@SEEK_SET = global i32 0
@.str.4 = [14 x i8] c"Erro no lseek\00"
@.str.5 = [1 x i8] zeroinitializer
@.str.6 = [14 x i8] c"Erro no write\00"
@PROT_READ = global i32 0
@MAP_SHARED = global i32 0
@.str.7 = [24 x i8] c"Erro no mmap para input\00"
@PROT_WRITE = global i32 0
@.str.8 = [25 x i8] c"Erro no mmap para output\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca %struct.stat
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 3
br i1 %12, label %13, label %20
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = load i32, i32* @O_RDONLY
%25 = call i32 (i8*, i32, ...) @open(i8* %23, i32 %24)
store i32 %25, i32* %6
%26 = icmp slt i32 %25, 0
br i1 %26, label %27, label %34
27: ; preds = %20
%28 = load i32, i32* @stderr
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i8* %31)
%33 = call i32 @exit(i32 1)
unreachable
34: ; preds = %20
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 2
%37 = load i8*, i8** %36
%38 = load i32, i32* @O_RDWR
%39 = load i32, i32* @O_CREAT
%40 = or i32 %38, %39
%41 = load i32, i32* @O_TRUNC
%42 = or i32 %40, %41
%43 = load i32, i32* @S_IRUSR
%44 = load i32, i32* @S_IWUSR
%45 = or i32 %43, %44
%46 = load i32, i32* @S_IXGRP
%47 = or i32 %45, %46
%48 = load i32, i32* @S_IXOTH
%49 = or i32 %47, %48
%50 = call i32 (i8*, i32, ...) @open(i8* %37, i32 %42, i32 %49)
store i32 %50, i32* %7
%51 = icmp slt i32 %50, 0
br i1 %51, label %52, label %59
52: ; preds = %34
%53 = load i32, i32* @stderr
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 2
%56 = load i8*, i8** %55
%57 = call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i8* %56)
%58 = call i32 @exit(i32 1)
unreachable
59: ; preds = %34
%60 = load i32, i32* %6
%61 = call i64 @fstat(i32 %60, %struct.stat* %10)
%62 = icmp slt i64 %61, 0
br i1 %62, label %63, label %66
63: ; preds = %59
%64 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%65 = call i32 @exit(i32 1)
unreachable
66: ; preds = %59
%67 = load i32, i32* %7
%68 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%69 = load i64, i64* %68
%70 = sub nsw i64 %69, 1
%71 = load i32, i32* @SEEK_SET
%72 = call i32 @lseek(i32 %67, i64 %70, i32 %71)
%73 = icmp eq i32 %72, -1
br i1 %73, label %74, label %77
74: ; preds = %66
%75 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%76 = call i32 @exit(i32 1)
unreachable
77: ; preds = %66
%78 = load i32, i32* %7
%79 = call i32 @write(i32 %78, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i32 1)
%80 = icmp ne i32 %79, 1
br i1 %80, label %81, label %84
81: ; preds = %77
%82 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%83 = call i32 @exit(i32 1)
unreachable
84: ; preds = %77
%85 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%86 = load i64, i64* %85
%87 = load i32, i32* @PROT_READ
%88 = load i32, i32* @MAP_SHARED
%89 = or i32 0, %88
%90 = load i32, i32* %6
%91 = call i8* @mmap(i32 0, i64 %86, i32 %87, i32 %89, i32 %90, i32 0)
store i8* %91, i8** %8
%92 = icmp eq i8* %91, inttoptr (i64 -1 to i8*)
br i1 %92, label %93, label %97
93: ; preds = %84
%94 = load i32, i32* @stderr
%95 = call i32 (i32, i8*, ...) @fprintf(i32 %94, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%96 = call i32 @exit(i32 1)
unreachable
97: ; preds = %84
%98 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%99 = load i64, i64* %98
%100 = load i32, i32* @PROT_READ
%101 = load i32, i32* @PROT_WRITE
%102 = or i32 %100, %101
%103 = load i32, i32* @MAP_SHARED
%104 = or i32 0, %103
%105 = load i32, i32* %7
%106 = call i8* @mmap(i32 0, i64 %99, i32 %102, i32 %104, i32 %105, i32 0)
store i8* %106, i8** %9
%107 = icmp eq i8* %106, inttoptr (i64 -1 to i8*)
br i1 %107, label %108, label %112
108: ; preds = %97
%109 = load i32, i32* @stderr
%110 = call i32 (i32, i8*, ...) @fprintf(i32 %109, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0))
%111 = call i32 @exit(i32 1)
unreachable
112: ; preds = %97
%113 = load i8*, i8** %9
%114 = load i8*, i8** %8
%115 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%116 = load i64, i64* %115
%117 = call i32 @memcpy(i8* %113, i8* %114, i64 %116)
%118 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.stat = type { i64 }
@stderr = global i32 0
@.str = [38 x i8] c"Uso e' %s <arq origem> <arq destino>\0A\00"
@O_RDONLY = global i32 0
@.str.1 = [46 x i8] c"Arquivo %s nao pode ser aberto para reading\0A\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IXGRP = global i32 0
@S_IXOTH = global i32 0
@.str.2 = [47 x i8] c"Arquivo %s nao pode ser criado para writing \0A\00"
@.str.3 = [14 x i8] c"Erro no fstat\00"
@SEEK_SET = global i32 0
@.str.4 = [14 x i8] c"Erro no lseek\00"
@.str.5 = [1 x i8] zeroinitializer
@.str.6 = [14 x i8] c"Erro no write\00"
@PROT_READ = global i32 0
@MAP_SHARED = global i32 0
@.str.7 = [24 x i8] c"Erro no mmap para input\00"
@PROT_WRITE = global i32 0
@.str.8 = [25 x i8] c"Erro no mmap para output\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = icmp eq i32 %0, 3
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = load i32, i32* @O_RDONLY
%15 = tail call i32 (i8*, i32, ...) @open(i8* %13, i32 %14)
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %11
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %12
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = tail call i32 @exit(i32 1)
unreachable
22: ; preds = %11
%23 = getelementptr inbounds i8*, i8** %1, i64 2
%24 = load i8*, i8** %23
%25 = load i32, i32* @O_RDWR
%26 = load i32, i32* @O_CREAT
%27 = or i32 %26, %25
%28 = load i32, i32* @O_TRUNC
%29 = or i32 %27, %28
%30 = load i32, i32* @S_IRUSR
%31 = load i32, i32* @S_IWUSR
%32 = or i32 %31, %30
%33 = load i32, i32* @S_IXGRP
%34 = or i32 %32, %33
%35 = load i32, i32* @S_IXOTH
%36 = or i32 %34, %35
%37 = tail call i32 (i8*, i32, ...) @open(i8* %24, i32 %29, i32 %36)
%38 = icmp slt i32 %37, 0
br i1 %38, label %39, label %44
39: ; preds = %22
%40 = load i32, i32* @stderr
%41 = load i8*, i8** %23
%42 = tail call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i8* %41)
%43 = tail call i32 @exit(i32 1)
unreachable
44: ; preds = %22
%45 = call i64 @fstat(i32 %15, %struct.stat* %3)
%46 = icmp slt i64 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %44
%48 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%49 = tail call i32 @exit(i32 1)
unreachable
50: ; preds = %44
%51 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%52 = load i64, i64* %51
%53 = add nsw i64 %52, -1
%54 = load i32, i32* @SEEK_SET
%55 = tail call i32 @lseek(i32 %37, i64 %53, i32 %54)
%56 = icmp eq i32 %55, -1
br i1 %56, label %57, label %60
57: ; preds = %50
%58 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%59 = tail call i32 @exit(i32 1)
unreachable
60: ; preds = %50
%61 = tail call i32 @write(i32 %37, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i32 1)
%62 = icmp eq i32 %61, 1
br i1 %62, label %66, label %63
63: ; preds = %60
%64 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%65 = tail call i32 @exit(i32 1)
unreachable
66: ; preds = %60
%67 = load i32, i32* @PROT_READ
%68 = load i32, i32* @MAP_SHARED
%69 = tail call i8* @mmap(i32 0, i64 %52, i32 %67, i32 %68, i32 %15, i32 0)
%70 = icmp eq i8* %69, inttoptr (i64 -1 to i8*)
br i1 %70, label %71, label %75
71: ; preds = %66
%72 = load i32, i32* @stderr
%73 = tail call i32 (i32, i8*, ...) @fprintf(i32 %72, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%74 = tail call i32 @exit(i32 1)
unreachable
75: ; preds = %66
%76 = load i32, i32* @PROT_READ
%77 = load i32, i32* @PROT_WRITE
%78 = or i32 %77, %76
%79 = load i32, i32* @MAP_SHARED
%80 = tail call i8* @mmap(i32 0, i64 %52, i32 %78, i32 %79, i32 %37, i32 0)
%81 = icmp eq i8* %80, inttoptr (i64 -1 to i8*)
br i1 %81, label %82, label %86
82: ; preds = %75
%83 = load i32, i32* @stderr
%84 = tail call i32 (i32, i8*, ...) @fprintf(i32 %83, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0))
%85 = tail call i32 @exit(i32 1)
unreachable
86: ; preds = %75
%87 = tail call i32 @memcpy(i8* %80, i8* %69, i64 %52)
%88 = tail call i32 @exit(i32 0)
unreachable
}