#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*/ mode_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
char *MAP_FAILED;
int /*<<< orphan*/ MAP_SHARED;
int /*<<< orphan*/ MS_SYNC;
int O_CREAT;
int O_RDWR;
int O_TRUNC;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int lseek(int, size_t, int /*<<< orphan*/);
char *mmap(int /*<<< orphan*/, size_t, int, int /*<<< orphan*/, int,
           int /*<<< orphan*/);
int msync(char *, size_t, int /*<<< orphan*/);
int munmap(char *, size_t);
int open(char const *, int, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int strlen(char const *);
int write(int, char *, int);
int main(int argc, const char *argv[]) {
  if (argc < 2) {
    fprintf(stderr, "Need at least one argument to write to the file\n");
    exit(EXIT_FAILURE);
  }
  const char *text = argv[1];
  printf("Will write text '%s'\n", text);
  const char *filepath = "/tmp/mmapped.bin";
  int fd = open(filepath, O_RDWR | O_CREAT | O_TRUNC, (mode_t)0600);
  if (fd == -1) {
    perror("Error opening file for writing");
    exit(EXIT_FAILURE);
  }
  size_t textsize = strlen(text) + 1;
  if (lseek(fd, textsize - 1, SEEK_SET) == -1) {
    close(fd);
    perror("Error calling lseek() to 'stretch' the file");
    exit(EXIT_FAILURE);
  }
  if (write(fd, "", 1) == -1) {
    close(fd);
    perror("Error writing last byte of the file");
    exit(EXIT_FAILURE);
  }
  char *map = mmap(0, textsize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
  if (map == MAP_FAILED) {
    close(fd);
    perror("Error mmapping the file");
    exit(EXIT_FAILURE);
  }
  for (size_t i = 0; i < textsize; i++) {
    printf("Writing character %c at %zu\n", text[i], i);
    map[i] = text[i];
  }
  if (msync(map, textsize, MS_SYNC) == -1) {
    perror("Could not sync the file to disk");
  }
  if (munmap(map, textsize) == -1) {
    close(fd);
    perror("Error un-mmapping the file");
    exit(EXIT_FAILURE);
  }
  close(fd);
  return 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   $0x2,-0x8(%rbp)
jge    1203 <main+0x43>
mov    0x2dd1(%rip),%rax
mov    (%rax),%edi
lea    0xe10(%rip),%rsi
call   10a0 <fprintf@plt>
mov    0x2da4(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xe1f(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    0x2d91(%rip),%rax
mov    (%rax),%esi
mov    0x2db8(%rip),%rax
or     (%rax),%esi
mov    0x2da7(%rip),%rax
or     (%rax),%esi
mov    $0x180,%edx
call   10c0 <open@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0x24(%rbp)
jne    127c <main+0xbc>
lea    0xdef(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2d2b(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x30(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x30(%rbp),%rsi
sub    $0x1,%rsi
mov    0x2d10(%rip),%rax
mov    (%rax),%edx
call   1080 <lseek@plt>
cmp    $0xffffffff,%eax
jne    12d2 <main+0x112>
mov    -0x24(%rbp),%edi
call   1090 <close@plt>
lea    0xdb8(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2cd5(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    -0x24(%rbp),%edi
lea    0xd6a(%rip),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
cmp    $0xffffffff,%eax
jne    1311 <main+0x151>
mov    -0x24(%rbp),%edi
call   1090 <close@plt>
lea    0xda5(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2c96(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    -0x30(%rbp),%rsi
mov    0x2ccc(%rip),%rax
mov    (%rax),%edx
mov    0x2c73(%rip),%rax
or     (%rax),%edx
mov    0x2caa(%rip),%rax
mov    (%rax),%ecx
mov    -0x24(%rbp),%r8d
xor    %r9d,%r9d
mov    %r9d,%edi
call   1060 <mmap@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    0x2c42(%rip),%rcx
cmp    (%rcx),%rax
jne    1379 <main+0x1b9>
mov    -0x24(%rbp),%edi
call   1090 <close@plt>
lea    0xd61(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2c2e(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
movq   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x30(%rbp),%rax
jae    13d4 <main+0x214>
mov    -0x18(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
mov    -0x40(%rbp),%rdx
lea    0xd39(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x18(%rbp),%rax
mov    -0x40(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x38(%rbp),%rax
mov    -0x40(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    1381 <main+0x1c1>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    0x2bc5(%rip),%rax
mov    (%rax),%edx
call   1040 <msync@plt>
cmp    $0xffffffff,%eax
jne    13ff <main+0x23f>
lea    0xd02(%rip),%rdi
call   10d0 <perror@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   10b0 <munmap@plt>
cmp    $0xffffffff,%eax
jne    1437 <main+0x277>
mov    -0x24(%rbp),%edi
call   1090 <close@plt>
lea    0xcf8(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2b70(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    -0x24(%rbp),%edi
call   1090 <close@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x1,%edi
jle    1346 <main+0x186>
mov    0x8(%rsi),%rbx
lea    0xe52(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2dd8(%rip),%rax
mov    0x2e01(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2dee(%rip),%rax
or     (%rax),%esi
lea    0xe3c(%rip),%rdi
mov    $0x180,%edx
call   10c0 <open@plt>
cmp    $0xffffffff,%eax
je     135d <main+0x19d>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <strlen@plt>
movslq %eax,%r15
mov    0x2d7e(%rip),%rax
mov    (%rax),%edx
mov    %ebp,%edi
mov    %r15,%rsi
call   1080 <lseek@plt>
cmp    $0xffffffff,%eax
je     1366 <main+0x1a6>
lea    0xdf8(%rip),%rsi
mov    %ebp,%edi
mov    $0x1,%edx
call   1030 <write@plt>
cmp    $0xffffffff,%eax
je     1376 <main+0x1b6>
add    $0x1,%r15
mov    0x2d7a(%rip),%rax
mov    0x2d23(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2d58(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
mov    %r15,%rsi
mov    %ebp,0x4(%rsp)
mov    %ebp,%r8d
xor    %r9d,%r9d
call   1060 <mmap@plt>
mov    %rax,%r13
mov    0x2cf0(%rip),%rax
cmp    (%rax),%r13
je     1386 <main+0x1c6>
test   %r15d,%r15d
je     12f3 <main+0x133>
cmp    $0x2,%r15
mov    $0x1,%r14d
cmovae %r15,%r14
lea    0xe1c(%rip),%r12
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
movsbl (%rbx,%rbp,1),%esi
mov    %r12,%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
movzbl (%rbx,%rbp,1),%eax
mov    %al,0x0(%r13,%rbp,1)
add    $0x1,%rbp
cmp    %rbp,%r14
jne    12d0 <main+0x110>
mov    0x2cae(%rip),%rax
mov    (%rax),%edx
mov    %r13,%rdi
mov    %r15,%rsi
call   1040 <msync@plt>
cmp    $0xffffffff,%eax
je     1338 <main+0x178>
mov    %r13,%rdi
mov    %r15,%rsi
call   10b0 <munmap@plt>
mov    %eax,%ebx
mov    0x4(%rsp),%edi
call   1090 <close@plt>
cmp    $0xffffffff,%ebx
je     1398 <main+0x1d8>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdbd(%rip),%rdi
call   10d0 <perror@plt>
jmp    130c <main+0x14c>
mov    0x2c6b(%rip),%rax
mov    (%rax),%edi
lea    0xcaa(%rip),%rsi
call   10a0 <fprintf@plt>
jmp    13a4 <main+0x1e4>
lea    0xcf4(%rip),%rdi
jmp    139f <main+0x1df>
mov    %ebp,%edi
call   1090 <close@plt>
lea    0xd03(%rip),%rdi
jmp    139f <main+0x1df>
mov    %ebp,%edi
call   1090 <close@plt>
lea    0xd1f(%rip),%rdi
jmp    139f <main+0x1df>
mov    0x4(%rsp),%edi
call   1090 <close@plt>
lea    0xd31(%rip),%rdi
jmp    139f <main+0x1df>
lea    0xd7d(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2bf5(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [49 x i8] c"Need at least one argument to write to the file\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [22 x i8] c"Will write text '%s'\0A\00"
@.str.2 = [17 x i8] c"/tmp/mmapped.bin\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@.str.3 = [31 x i8] c"Error opening file for writing\00"
@SEEK_SET = global i32 0
@.str.4 = [44 x i8] c"Error calling lseek() to 'stretch' the file\00"
@.str.5 = [1 x i8] zeroinitializer
@.str.6 = [36 x i8] c"Error writing last byte of the file\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i8* null
@.str.7 = [24 x i8] c"Error mmapping the file\00"
@.str.8 = [29 x i8] c"Writing character %c at %zu\0A\00"
@MS_SYNC = global i32 0
@.str.9 = [32 x i8] c"Could not sync the file to disk\00"
@.str.10 = [27 x i8] c"Error un-mmapping the file\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i64
%10 = alloca i8*
%11 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 2
br i1 %13, label %14, label %19
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%17 = load i32, i32* @EXIT_FAILURE
%18 = call i32 @exit(i32 %17)
unreachable
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
store i8* %22, i8** %6
%23 = load i8*, i8** %6
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %23)
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8** %7
%25 = load i8*, i8** %7
%26 = load i32, i32* @O_RDWR
%27 = load i32, i32* @O_CREAT
%28 = or i32 %26, %27
%29 = load i32, i32* @O_TRUNC
%30 = or i32 %28, %29
%31 = call i32 @open(i8* %25, i32 %30, i32 384)
store i32 %31, i32* %8
%32 = load i32, i32* %8
%33 = icmp eq i32 %32, -1
br i1 %33, label %34, label %38
34: ; preds = %19
%35 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%36 = load i32, i32* @EXIT_FAILURE
%37 = call i32 @exit(i32 %36)
unreachable
38: ; preds = %19
%39 = load i8*, i8** %6
%40 = call i32 @strlen(i8* %39)
%41 = add nsw i32 %40, 1
%42 = sext i32 %41 to i64
store i64 %42, i64* %9
%43 = load i32, i32* %8
%44 = load i64, i64* %9
%45 = sub i64 %44, 1
%46 = load i32, i32* @SEEK_SET
%47 = call i32 @lseek(i32 %43, i64 %45, i32 %46)
%48 = icmp eq i32 %47, -1
br i1 %48, label %49, label %55
49: ; preds = %38
%50 = load i32, i32* %8
%51 = call i32 @close(i32 %50)
%52 = call i32 @perror(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0))
%53 = load i32, i32* @EXIT_FAILURE
%54 = call i32 @exit(i32 %53)
unreachable
55: ; preds = %38
%56 = load i32, i32* %8
%57 = call i32 @write(i32 %56, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i32 1)
%58 = icmp eq i32 %57, -1
br i1 %58, label %59, label %65
59: ; preds = %55
%60 = load i32, i32* %8
%61 = call i32 @close(i32 %60)
%62 = call i32 @perror(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
%63 = load i32, i32* @EXIT_FAILURE
%64 = call i32 @exit(i32 %63)
unreachable
65: ; preds = %55
%66 = load i64, i64* %9
%67 = load i32, i32* @PROT_READ
%68 = load i32, i32* @PROT_WRITE
%69 = or i32 %67, %68
%70 = load i32, i32* @MAP_SHARED
%71 = load i32, i32* %8
%72 = call i8* @mmap(i32 0, i64 %66, i32 %69, i32 %70, i32 %71, i32 0)
store i8* %72, i8** %10
%73 = load i8*, i8** %10
%74 = load i8*, i8** @MAP_FAILED
%75 = icmp eq i8* %73, %74
br i1 %75, label %76, label %82
76: ; preds = %65
%77 = load i32, i32* %8
%78 = call i32 @close(i32 %77)
%79 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%80 = load i32, i32* @EXIT_FAILURE
%81 = call i32 @exit(i32 %80)
unreachable
82: ; preds = %65
store i64 0, i64* %11
br label %83
83: ; preds = %102, %82
%84 = load i64, i64* %11
%85 = load i64, i64* %9
%86 = icmp ult i64 %84, %85
br i1 %86, label %87, label %105
87: ; preds = %83
%88 = load i8*, i8** %6
%89 = load i64, i64* %11
%90 = getelementptr inbounds i8, i8* %88, i64 %89
%91 = load i8, i8* %90
%92 = sext i8 %91 to i32
%93 = load i64, i64* %11
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), i32 %92, i64 %93)
%95 = load i8*, i8** %6
%96 = load i64, i64* %11
%97 = getelementptr inbounds i8, i8* %95, i64 %96
%98 = load i8, i8* %97
%99 = load i8*, i8** %10
%100 = load i64, i64* %11
%101 = getelementptr inbounds i8, i8* %99, i64 %100
store i8 %98, i8* %101
br label %102
102: ; preds = %87
%103 = load i64, i64* %11
%104 = add i64 %103, 1
store i64 %104, i64* %11
br label %83
105: ; preds = %83
%106 = load i8*, i8** %10
%107 = load i64, i64* %9
%108 = load i32, i32* @MS_SYNC
%109 = call i32 @msync(i8* %106, i64 %107, i32 %108)
%110 = icmp eq i32 %109, -1
br i1 %110, label %111, label %113
111: ; preds = %105
%112 = call i32 @perror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0))
br label %113
113: ; preds = %111, %105
%114 = load i8*, i8** %10
%115 = load i64, i64* %9
%116 = call i32 @munmap(i8* %114, i64 %115)
%117 = icmp eq i32 %116, -1
br i1 %117, label %118, label %124
118: ; preds = %113
%119 = load i32, i32* %8
%120 = call i32 @close(i32 %119)
%121 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0))
%122 = load i32, i32* @EXIT_FAILURE
%123 = call i32 @exit(i32 %122)
unreachable
124: ; preds = %113
%125 = load i32, i32* %8
%126 = call i32 @close(i32 %125)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [49 x i8] c"Need at least one argument to write to the file\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [22 x i8] c"Will write text '%s'\0A\00"
@.str.2 = [17 x i8] c"/tmp/mmapped.bin\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@.str.3 = [31 x i8] c"Error opening file for writing\00"
@SEEK_SET = global i32 0
@.str.4 = [44 x i8] c"Error calling lseek() to 'stretch' the file\00"
@.str.5 = [1 x i8] zeroinitializer
@.str.6 = [36 x i8] c"Error writing last byte of the file\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i8* null
@.str.7 = [24 x i8] c"Error mmapping the file\00"
@.str.8 = [29 x i8] c"Writing character %c at %zu\0A\00"
@MS_SYNC = global i32 0
@.str.9 = [32 x i8] c"Could not sync the file to disk\00"
@.str.10 = [27 x i8] c"Error un-mmapping the file\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = load i32, i32* @O_RDWR
%14 = load i32, i32* @O_CREAT
%15 = or i32 %14, %13
%16 = load i32, i32* @O_TRUNC
%17 = or i32 %15, %16
%18 = tail call i32 @open(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %17, i32 384)
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %24
20: ; preds = %9
%21 = tail call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%22 = load i32, i32* @EXIT_FAILURE
%23 = tail call i32 @exit(i32 %22)
unreachable
24: ; preds = %9
%25 = tail call i32 @strlen(i8* %11)
%26 = add nsw i32 %25, 1
%27 = sext i32 %26 to i64
%28 = add nsw i64 %27, -1
%29 = load i32, i32* @SEEK_SET
%30 = tail call i32 @lseek(i32 %18, i64 %28, i32 %29)
%31 = icmp eq i32 %30, -1
br i1 %31, label %32, label %37
32: ; preds = %24
%33 = tail call i32 @close(i32 %18)
%34 = tail call i32 @perror(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0))
%35 = load i32, i32* @EXIT_FAILURE
%36 = tail call i32 @exit(i32 %35)
unreachable
37: ; preds = %24
%38 = tail call i32 @write(i32 %18, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i32 1)
%39 = icmp eq i32 %38, -1
br i1 %39, label %40, label %45
40: ; preds = %37
%41 = tail call i32 @close(i32 %18)
%42 = tail call i32 @perror(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
%43 = load i32, i32* @EXIT_FAILURE
%44 = tail call i32 @exit(i32 %43)
unreachable
45: ; preds = %37
%46 = load i32, i32* @PROT_READ
%47 = load i32, i32* @PROT_WRITE
%48 = or i32 %47, %46
%49 = load i32, i32* @MAP_SHARED
%50 = tail call i8* @mmap(i32 0, i64 %27, i32 %48, i32 %49, i32 %18, i32 0)
%51 = load i8*, i8** @MAP_FAILED
%52 = icmp eq i8* %50, %51
br i1 %52, label %57, label %53
53: ; preds = %45
%54 = icmp eq i32 %26, 0
br i1 %54, label %62, label %55
55: ; preds = %53
%56 = call i64 @llvm.umax.i64(i64 %27, i64 1)
br label %66
57: ; preds = %45
%58 = tail call i32 @close(i32 %18)
%59 = tail call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%60 = load i32, i32* @EXIT_FAILURE
%61 = tail call i32 @exit(i32 %60)
unreachable
62: ; preds = %66, %53
%63 = load i32, i32* @MS_SYNC
%64 = tail call i32 @msync(i8* %50, i64 %27, i32 %63)
%65 = icmp eq i32 %64, -1
br i1 %65, label %76, label %78
66: ; preds = %55, %66
%67 = phi i64 [ %74, %66 ], [ 0, %55 ]
%68 = getelementptr inbounds i8, i8* %11, i64 %67
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), i32 %70, i64 %67)
%72 = load i8, i8* %68
%73 = getelementptr inbounds i8, i8* %50, i64 %67
store i8 %72, i8* %73
%74 = add nuw i64 %67, 1
%75 = icmp eq i64 %74, %56
br i1 %75, label %62, label %66
76: ; preds = %62
%77 = tail call i32 @perror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0))
br label %78
78: ; preds = %76, %62
%79 = tail call i32 @munmap(i8* %50, i64 %27)
%80 = icmp eq i32 %79, -1
%81 = tail call i32 @close(i32 %18)
br i1 %80, label %82, label %86
82: ; preds = %78
%83 = tail call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0))
%84 = load i32, i32* @EXIT_FAILURE
%85 = tail call i32 @exit(i32 %84)
unreachable
86: ; preds = %78
ret i32 0
}