#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 /*<<< orphan*/ st_size;
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
char *MAP_FAILED;
int /*<<< orphan*/ MAP_PRIVATE;
int /*<<< orphan*/ MAP_SHARED;
int O_CREAT;
int /*<<< orphan*/ O_RDONLY;
int O_RDWR;
int O_TRUNC;
int /*<<< orphan*/ PROT_READ;
int /*<<< orphan*/ PROT_WRITE;
int S_IRGRP;
int S_IROTH;
int S_IRUSR;
int /*<<< orphan*/ S_ISREG(int /*<<< orphan*/);
int S_IWUSR;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ fstat(int, struct stat *);
int ftruncate(int, int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(char *, char *, int /*<<< orphan*/);
scalar_t__ mmap(int /*<<< orphan*/ *, int /*<<< orphan*/, int /*<<< orphan*/,
                int /*<<< orphan*/, int, int /*<<< orphan*/);
int open(char *, int, ...);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  int fd;
  char *ptr;
  struct stat st;
  if (argc != 3) {
    printf("Uso: %s <src> <dst>", argv[0]);
    exit(EXIT_FAILURE);
  }
  fd = open(argv[1], O_RDONLY);
  if (fd == -1) {
    perror("en open");
    exit(EXIT_FAILURE);
  }
  if (fstat(fd, &st)) {
    perror("en stat");
    exit(EXIT_FAILURE);
  }
  if (!S_ISREG(st.st_mode)) {
    printf("No es regular");
    exit(EXIT_FAILURE);
  }
  ptr = (char *)mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
  close(fd);
  if (ptr == MAP_FAILED) {
    perror("En mmap");
    exit(EXIT_FAILURE);
  }
  int copy = open(argv[2], O_RDWR | O_CREAT | O_TRUNC,
                  S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
  if (copy == -1) {
    perror("Creando fichero destino");
    exit(EXIT_FAILURE);
  }
  if (ftruncate(copy, st.st_size) == -1) {
    perror("ftruncate");
    exit(EXIT_FAILURE);
  }
  char *ptr2 = (char *)mmap(NULL, st.st_size, PROT_WRITE, MAP_SHARED, copy, 0);
  if (ptr2 == MAP_FAILED) {
    perror("En mmap");
    exit(EXIT_FAILURE);
  }
  close(copy);
  memcpy(ptr2, ptr, st.st_size);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11e3 <main+0x43>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2dbc(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2dce(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   1090 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1222 <main+0x82>
lea    0xe05(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2d7d(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
call   10c0 <fstat@plt>
cmp    $0x0,%rax
je     1252 <main+0xb2>
lea    0xddd(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2d4d(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x24(%rbp),%edi
call   1080 <S_ISREG@plt>
cmp    $0x0,%eax
jne    127f <main+0xdf>
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d20(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x28(%rbp),%esi
mov    0x2d5f(%rip),%rax
mov    (%rax),%edx
mov    0x2cee(%rip),%rax
mov    (%rax),%ecx
mov    -0x14(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
xor    %r9d,%r9d
call   1030 <mmap@plt>
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
mov    -0x20(%rbp),%rax
mov    0x2cbd(%rip),%rcx
cmp    (%rcx),%rax
jne    12de <main+0x13e>
lea    0xd67(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2cc1(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    0x2cdb(%rip),%rax
mov    (%rax),%esi
mov    0x2d02(%rip),%rax
or     (%rax),%esi
mov    0x2cf1(%rip),%rax
or     (%rax),%esi
mov    0x2c80(%rip),%rax
mov    (%rax),%edx
mov    0x2ca7(%rip),%rax
or     (%rax),%edx
mov    0x2c8e(%rip),%rax
or     (%rax),%edx
mov    0x2c7d(%rip),%rax
or     (%rax),%edx
mov    $0x0,%al
call   1090 <open@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0xffffffff,-0x2c(%rbp)
jne    1353 <main+0x1b3>
lea    0xcfa(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2c4c(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%esi
call   1050 <ftruncate@plt>
cmp    $0xffffffff,%eax
jne    1381 <main+0x1e1>
lea    0xce4(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2c1e(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x28(%rbp),%esi
mov    0x2c05(%rip),%rax
mov    (%rax),%edx
mov    0x2c44(%rip),%rax
mov    (%rax),%ecx
mov    -0x2c(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
xor    %r9d,%r9d
call   1030 <mmap@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    0x2bc3(%rip),%rcx
cmp    (%rcx),%rax
jne    13d8 <main+0x238>
lea    0xc6d(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2bc7(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x2c(%rbp),%edi
call   1060 <close@plt>
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%edx
call   1070 <memcpy@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    11d9 <main+0x39>
mov    0x8(%rbx),%rdi
mov    0x2e01(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
call   1090 <open@plt>
cmp    $0xffffffff,%eax
jne    11ef <main+0x4f>
lea    0xe40(%rip),%rdi
jmp    12e5 <main+0x145>
mov    (%rbx),%rsi
lea    0xe1d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    12ea <main+0x14a>
mov    %eax,%ebp
lea    0x8(%rsp),%rsi
mov    %eax,%edi
call   10c0 <fstat@plt>
test   %rax,%rax
jne    1222 <main+0x82>
mov    0xc(%rsp),%edi
call   1080 <S_ISREG@plt>
test   %eax,%eax
jne    122e <main+0x8e>
lea    0xe0e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    12ea <main+0x14a>
lea    0xdf3(%rip),%rdi
jmp    12e5 <main+0x145>
mov    0x8(%rsp),%r15d
mov    0x2dae(%rip),%rax
mov    (%rax),%edx
mov    0x2d3d(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
mov    %r15d,%esi
mov    %ebp,%r8d
xor    %r9d,%r9d
call   1030 <mmap@plt>
mov    %rax,%r14
mov    %ebp,%edi
call   1060 <close@plt>
mov    0x2d12(%rip),%rbp
cmp    %r14,0x0(%rbp)
jne    1275 <main+0xd5>
lea    0xdbf(%rip),%rdi
jmp    12e5 <main+0x145>
mov    0x2d4c(%rip),%rax
mov    0x2d75(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2d62(%rip),%rax
or     (%rax),%esi
mov    0x2cf1(%rip),%rax
mov    0x2d1a(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2cff(%rip),%rax
or     (%rax),%edx
mov    0x10(%rbx),%rdi
mov    0x2cea(%rip),%rax
or     (%rax),%edx
xor    %eax,%eax
call   1090 <open@plt>
cmp    $0xffffffff,%eax
jne    12cd <main+0x12d>
lea    0xd6f(%rip),%rdi
jmp    12e5 <main+0x145>
mov    %eax,%ebx
mov    %eax,%edi
mov    %r15d,%esi
call   1050 <ftruncate@plt>
cmp    $0xffffffff,%eax
jne    12f8 <main+0x158>
lea    0xd6d(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2ca7(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    0x2c91(%rip),%rax
mov    (%rax),%edx
mov    0x2cd0(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
mov    %r15d,%esi
mov    %ebx,%r8d
xor    %r9d,%r9d
call   1030 <mmap@plt>
cmp    %rax,0x0(%rbp)
je     126c <main+0xcc>
mov    %rax,%r12
mov    %ebx,%edi
call   1060 <close@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1070 <memcpy@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i32, i32 }
@.str = [20 x i8] c"Uso: %s <src> <dst>\00"
@EXIT_FAILURE = global i32 0
@O_RDONLY = global i32 0
@.str.1 = [8 x i8] c"en open\00"
@.str.2 = [8 x i8] c"en stat\00"
@.str.3 = [14 x i8] c"No es regular\00"
@PROT_READ = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_FAILED = global i8* null
@.str.4 = [8 x i8] c"En mmap\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_IRGRP = global i32 0
@S_IROTH = global i32 0
@.str.5 = [24 x i8] c"Creando fichero destino\00"
@.str.6 = [10 x i8] c"ftruncate\00"
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca %struct.stat
%9 = alloca i32
%10 = alloca i8*
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 i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 @exit(i32 %18)
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 = load i32, i32* %6
%27 = icmp eq i32 %26, -1
br i1 %27, label %28, label %32
28: ; preds = %20
%29 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%30 = load i32, i32* @EXIT_FAILURE
%31 = call i32 @exit(i32 %30)
unreachable
32: ; preds = %20
%33 = load i32, i32* %6
%34 = call i64 @fstat(i32 %33, %struct.stat* %8)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %40
36: ; preds = %32
%37 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%38 = load i32, i32* @EXIT_FAILURE
%39 = call i32 @exit(i32 %38)
unreachable
40: ; preds = %32
%41 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 1
%42 = load i32, i32* %41
%43 = call i32 @S_ISREG(i32 %42)
%44 = icmp ne i32 %43, 0
br i1 %44, label %49, label %45
45: ; preds = %40
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%47 = load i32, i32* @EXIT_FAILURE
%48 = call i32 @exit(i32 %47)
unreachable
49: ; preds = %40
%50 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%51 = load i32, i32* %50
%52 = load i32, i32* @PROT_READ
%53 = load i32, i32* @MAP_PRIVATE
%54 = load i32, i32* %6
%55 = call i64 @mmap(i32* null, i32 %51, i32 %52, i32 %53, i32 %54, i32 0)
%56 = inttoptr i64 %55 to i8*
store i8* %56, i8** %7
%57 = load i32, i32* %6
%58 = call i32 @close(i32 %57)
%59 = load i8*, i8** %7
%60 = load i8*, i8** @MAP_FAILED
%61 = icmp eq i8* %59, %60
br i1 %61, label %62, label %66
62: ; preds = %49
%63 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%64 = load i32, i32* @EXIT_FAILURE
%65 = call i32 @exit(i32 %64)
unreachable
66: ; preds = %49
%67 = load i8**, i8*** %5
%68 = getelementptr inbounds i8*, i8** %67, i64 2
%69 = load i8*, i8** %68
%70 = load i32, i32* @O_RDWR
%71 = load i32, i32* @O_CREAT
%72 = or i32 %70, %71
%73 = load i32, i32* @O_TRUNC
%74 = or i32 %72, %73
%75 = load i32, i32* @S_IRUSR
%76 = load i32, i32* @S_IWUSR
%77 = or i32 %75, %76
%78 = load i32, i32* @S_IRGRP
%79 = or i32 %77, %78
%80 = load i32, i32* @S_IROTH
%81 = or i32 %79, %80
%82 = call i32 (i8*, i32, ...) @open(i8* %69, i32 %74, i32 %81)
store i32 %82, i32* %9
%83 = load i32, i32* %9
%84 = icmp eq i32 %83, -1
br i1 %84, label %85, label %89
85: ; preds = %66
%86 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%87 = load i32, i32* @EXIT_FAILURE
%88 = call i32 @exit(i32 %87)
unreachable
89: ; preds = %66
%90 = load i32, i32* %9
%91 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%92 = load i32, i32* %91
%93 = call i32 @ftruncate(i32 %90, i32 %92)
%94 = icmp eq i32 %93, -1
br i1 %94, label %95, label %99
95: ; preds = %89
%96 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%97 = load i32, i32* @EXIT_FAILURE
%98 = call i32 @exit(i32 %97)
unreachable
99: ; preds = %89
%100 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%101 = load i32, i32* %100
%102 = load i32, i32* @PROT_WRITE
%103 = load i32, i32* @MAP_SHARED
%104 = load i32, i32* %9
%105 = call i64 @mmap(i32* null, i32 %101, i32 %102, i32 %103, i32 %104, i32 0)
%106 = inttoptr i64 %105 to i8*
store i8* %106, i8** %10
%107 = load i8*, i8** %10
%108 = load i8*, i8** @MAP_FAILED
%109 = icmp eq i8* %107, %108
br i1 %109, label %110, label %114
110: ; preds = %99
%111 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%112 = load i32, i32* @EXIT_FAILURE
%113 = call i32 @exit(i32 %112)
unreachable
114: ; preds = %99
%115 = load i32, i32* %9
%116 = call i32 @close(i32 %115)
%117 = load i8*, i8** %10
%118 = load i8*, i8** %7
%119 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%120 = load i32, i32* %119
%121 = call i32 @memcpy(i8* %117, i8* %118, i32 %120)
%122 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.stat = type { i32, i32 }
@.str = [20 x i8] c"Uso: %s <src> <dst>\00"
@EXIT_FAILURE = global i32 0
@O_RDONLY = global i32 0
@.str.1 = [8 x i8] c"en open\00"
@.str.2 = [8 x i8] c"en stat\00"
@.str.3 = [14 x i8] c"No es regular\00"
@PROT_READ = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_FAILED = global i8* null
@.str.4 = [8 x i8] c"En mmap\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_IRGRP = global i32 0
@S_IROTH = global i32 0
@.str.5 = [24 x i8] c"Creando fichero destino\00"
@.str.6 = [10 x i8] c"ftruncate\00"
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
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 i8*, i8** %1
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load i32, i32* @EXIT_FAILURE
%10 = tail call i32 @exit(i32 %9)
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 eq i32 %15, -1
br i1 %16, label %17, label %21
17: ; preds = %11
%18 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%19 = load i32, i32* @EXIT_FAILURE
%20 = tail call i32 @exit(i32 %19)
unreachable
21: ; preds = %11
%22 = call i64 @fstat(i32 %15, %struct.stat* %3)
%23 = icmp eq i64 %22, 0
br i1 %23, label %28, label %24
24: ; preds = %21
%25 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%26 = load i32, i32* @EXIT_FAILURE
%27 = tail call i32 @exit(i32 %26)
unreachable
28: ; preds = %21
%29 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 1
%30 = load i32, i32* %29
%31 = tail call i32 @S_ISREG(i32 %30)
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %37
33: ; preds = %28
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%35 = load i32, i32* @EXIT_FAILURE
%36 = tail call i32 @exit(i32 %35)
unreachable
37: ; preds = %28
%38 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%39 = load i32, i32* %38
%40 = load i32, i32* @PROT_READ
%41 = load i32, i32* @MAP_PRIVATE
%42 = tail call i64 @mmap(i32* null, i32 %39, i32 %40, i32 %41, i32 %15, i32 0)
%43 = inttoptr i64 %42 to i8*
%44 = tail call i32 @close(i32 %15)
%45 = load i8*, i8** @MAP_FAILED
%46 = icmp eq i8* %45, %43
br i1 %46, label %47, label %51
47: ; preds = %37
%48 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%49 = load i32, i32* @EXIT_FAILURE
%50 = tail call i32 @exit(i32 %49)
unreachable
51: ; preds = %37
%52 = getelementptr inbounds i8*, i8** %1, i64 2
%53 = load i8*, i8** %52
%54 = load i32, i32* @O_RDWR
%55 = load i32, i32* @O_CREAT
%56 = or i32 %55, %54
%57 = load i32, i32* @O_TRUNC
%58 = or i32 %56, %57
%59 = load i32, i32* @S_IRUSR
%60 = load i32, i32* @S_IWUSR
%61 = or i32 %60, %59
%62 = load i32, i32* @S_IRGRP
%63 = or i32 %61, %62
%64 = load i32, i32* @S_IROTH
%65 = or i32 %63, %64
%66 = tail call i32 (i8*, i32, ...) @open(i8* %53, i32 %58, i32 %65)
%67 = icmp eq i32 %66, -1
br i1 %67, label %68, label %72
68: ; preds = %51
%69 = tail call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%70 = load i32, i32* @EXIT_FAILURE
%71 = tail call i32 @exit(i32 %70)
unreachable
72: ; preds = %51
%73 = tail call i32 @ftruncate(i32 %66, i32 %39)
%74 = icmp eq i32 %73, -1
br i1 %74, label %75, label %79
75: ; preds = %72
%76 = tail call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%77 = load i32, i32* @EXIT_FAILURE
%78 = tail call i32 @exit(i32 %77)
unreachable
79: ; preds = %72
%80 = load i32, i32* @PROT_WRITE
%81 = load i32, i32* @MAP_SHARED
%82 = tail call i64 @mmap(i32* null, i32 %39, i32 %80, i32 %81, i32 %66, i32 0)
%83 = inttoptr i64 %82 to i8*
%84 = load i8*, i8** @MAP_FAILED
%85 = icmp eq i8* %84, %83
br i1 %85, label %86, label %90
86: ; preds = %79
%87 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 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 = tail call i32 @close(i32 %66)
%92 = tail call i32 @memcpy(i8* %83, i8* %43, i32 %39)
%93 = tail call i32 @exit(i32 0)
unreachable
}