#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*/ tmpfname;
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
void *MAP_FAILED;
int MAP_PRIVATE;
int /*<<< orphan*/ MS_SYNC;
int O_CREAT;
int O_EXCL;
int O_RDWR;
int PROT_READ;
int PROT_WRITE;
int S_IRUSR;
int S_IWUSR;
int /*<<< orphan*/ close(int);
int errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ free(char *);
int getpid();
char *malloc(int);
int /*<<< orphan*/ memset(char *, char, int);
void *mmap(void *, size_t, int, int, int, int /*<<< orphan*/);
int msync(void *, size_t, int /*<<< orphan*/);
int /*<<< orphan*/ munmap(void *, size_t);
int open(char *, int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
char *strerror(int);
int /*<<< orphan*/ unlink(char *);
int write(int, char *, int);
int main(void) {
  int rc;
  char tmpfname[256];
  char *data;
  int total_size = 1024;
  void *pa = NULL;
  void *addr = NULL;
  size_t size = total_size;
  int flag;
  int fd;
  off_t off = 0;
  int prot;
  char *ch;
  snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_munmap_4_1_%d", getpid());
  unlink(tmpfname);
  fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
  if (fd == -1) {
    printf("munmap/4-1.c"
           " Error at open(): %s\n",
           strerror(errno));
    exit(2);
  }
  unlink(tmpfname);
  data = malloc(total_size);
  memset(data, 'a', total_size);
  if (write(fd, data, total_size) != total_size) {
    printf("munmap/4-1.c"
           "Error at write(): %s\n",
           strerror(errno));
    exit(2);
  }
  free(data);
  prot = PROT_READ | PROT_WRITE;
  flag = MAP_PRIVATE;
  pa = mmap(addr, size, prot, flag, fd, off);
  if (pa == MAP_FAILED) {
    printf("Test Fail: "
           "munmap/4-1.c"
           " Error at mmap: %s\n",
           strerror(errno));
    exit(1);
  }
  ch = pa;
  *ch = 'b';
  if ((rc = msync(pa, size, MS_SYNC)) != 0) {
    printf("munmap/4-1.c"
           " Error at msync(): %s\n",
           strerror(rc));
    exit(2);
  }
  munmap(pa, size);
  pa = mmap(addr, size, prot, flag, fd, off);
  if (pa == MAP_FAILED) {
    printf("Test Fail: "
           "munmap/4-1.c"
           " Error at 2nd mmap: %s\n",
           strerror(errno));
    exit(1);
  }
  ch = pa;
  if (*ch == 'b') {
    printf("Test FAIL\n");
    exit(1);
  }
  close(fd);
  printf("Write referece is discarded when setting MAP_RPIVATE\n");
  printf("Test PASSED\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x400,-0x11c(%rbp)
movq   $0x0,-0x128(%rbp)
movq   $0x0,-0x130(%rbp)
movslq -0x11c(%rbp),%rax
mov    %rax,-0x138(%rbp)
movl   $0x0,-0x144(%rbp)
lea    -0x110(%rbp),%rax
mov    %rax,-0x158(%rbp)
mov    $0x0,%al
call   1060 <getpid@plt>
mov    -0x158(%rbp),%rdi
mov    %eax,%ecx
mov    $0x100,%esi
lea    0xd9c(%rip),%rdx
call   10a0 <snprintf@plt>
lea    -0x110(%rbp),%rdi
call   1040 <unlink@plt>
lea    -0x110(%rbp),%rdi
mov    0x2d75(%rip),%rax
mov    (%rax),%esi
mov    0x2d4c(%rip),%rax
or     (%rax),%esi
mov    0x2d2b(%rip),%rax
or     (%rax),%esi
mov    0x2d02(%rip),%rax
mov    (%rax),%edx
mov    0x2d29(%rip),%rax
or     (%rax),%edx
call   10f0 <open@plt>
mov    %eax,-0x140(%rbp)
cmpl   $0xffffffff,-0x140(%rbp)
jne    12ea <main+0xfa>
mov    0x2cf0(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    %rax,%rsi
lea    0xd3e(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    $0x2,%edi
call   1100 <exit@plt>
lea    -0x110(%rbp),%rdi
call   1040 <unlink@plt>
mov    -0x11c(%rbp),%edi
call   10d0 <malloc@plt>
mov    %rax,-0x118(%rbp)
mov    -0x118(%rbp),%rdi
mov    -0x11c(%rbp),%edx
mov    $0x61,%esi
call   10b0 <memset@plt>
mov    -0x140(%rbp),%edi
mov    -0x118(%rbp),%rsi
mov    -0x11c(%rbp),%edx
call   1050 <write@plt>
cmp    -0x11c(%rbp),%eax
je     136c <main+0x17c>
mov    0x2c6e(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    %rax,%rsi
lea    0xcde(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    $0x2,%edi
call   1100 <exit@plt>
mov    -0x118(%rbp),%rdi
call   1030 <free@plt>
mov    0x2c71(%rip),%rax
mov    (%rax),%eax
mov    0x2c20(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x148(%rbp)
mov    0x2c01(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x13c(%rbp)
mov    -0x130(%rbp),%rdi
mov    -0x138(%rbp),%rsi
mov    -0x148(%rbp),%edx
mov    -0x13c(%rbp),%ecx
mov    -0x140(%rbp),%r8d
mov    -0x144(%rbp),%r9d
call   1080 <mmap@plt>
mov    %rax,-0x128(%rbp)
mov    -0x128(%rbp),%rax
mov    0x2baf(%rip),%rcx
cmp    (%rcx),%rax
jne    1413 <main+0x223>
mov    0x2bc7(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    %rax,%rsi
lea    0xc59(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x128(%rbp),%rax
mov    %rax,-0x150(%rbp)
mov    -0x150(%rbp),%rax
movb   $0x62,(%rax)
mov    -0x128(%rbp),%rdi
mov    -0x138(%rbp),%rsi
mov    0x2b70(%rip),%rax
mov    (%rax),%edx
call   1070 <msync@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     1476 <main+0x286>
mov    -0x8(%rbp),%edi
call   1110 <strerror@plt>
mov    %rax,%rsi
lea    0xc21(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    $0x2,%edi
call   1100 <exit@plt>
mov    -0x128(%rbp),%rdi
mov    -0x138(%rbp),%rsi
call   10e0 <munmap@plt>
mov    -0x130(%rbp),%rdi
mov    -0x138(%rbp),%rsi
mov    -0x148(%rbp),%edx
mov    -0x13c(%rbp),%ecx
mov    -0x140(%rbp),%r8d
mov    -0x144(%rbp),%r9d
call   1080 <mmap@plt>
mov    %rax,-0x128(%rbp)
mov    -0x128(%rbp),%rax
mov    0x2ac5(%rip),%rcx
cmp    (%rcx),%rax
jne    14fd <main+0x30d>
mov    0x2add(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    %rax,%rsi
lea    0xbbd(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x128(%rbp),%rax
mov    %rax,-0x150(%rbp)
mov    -0x150(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x62,%eax
jne    1536 <main+0x346>
lea    0xbb3(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x140(%rbp),%edi
call   10c0 <close@plt>
lea    0xb9b(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xbc3(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
xor    %eax,%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x100,%rsp
xor    %eax,%eax
call   1070 <getpid@plt>
lea    0xde3(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %eax,%ecx
call   10b0 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <unlink@plt>
mov    0x2dba(%rip),%rax
mov    0x2d93(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2d70(%rip),%rax
or     (%rax),%esi
mov    0x2d47(%rip),%rax
mov    0x2d70(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    %rbx,%rdi
call   1100 <open@plt>
cmp    $0xffffffff,%eax
je     1393 <main+0x193>
mov    %eax,%r15d
mov    %rsp,%rdi
call   1040 <unlink@plt>
mov    $0x400,%edi
call   10e0 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x61,%esi
mov    $0x400,%edx
call   10c0 <memset@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1060 <write@plt>
cmp    $0x400,%eax
jne    13aa <main+0x1aa>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x2d27(%rip),%rax
mov    0x2cd8(%rip),%rcx
mov    (%rcx),%ebp
or     (%rax),%ebp
mov    0x2cbd(%rip),%rax
mov    (%rax),%r14d
mov    $0x400,%esi
xor    %edi,%edi
mov    %ebp,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
xor    %r9d,%r9d
call   1090 <mmap@plt>
mov    0x2c94(%rip),%r12
cmp    (%r12),%rax
je     13c1 <main+0x1c1>
mov    %rax,%rbx
movb   $0x62,(%rax)
mov    0x2c9d(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
mov    %rbx,%rdi
call   1080 <msync@plt>
test   %eax,%eax
jne    13d8 <main+0x1d8>
mov    $0x400,%esi
mov    %rbx,%rdi
call   10f0 <munmap@plt>
mov    $0x400,%esi
xor    %edi,%edi
mov    %ebp,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
xor    %r9d,%r9d
call   1090 <mmap@plt>
cmp    (%r12),%rax
je     13fa <main+0x1fa>
cmpb   $0x62,(%rax)
je     1423 <main+0x223>
mov    %r15d,%edi
call   10d0 <close@plt>
lea    0xd68(%rip),%rdi
call   1050 <puts@plt>
lea    0xd91(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c1e(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
lea    0xc6f(%rip),%rdi
jmp    13e6 <main+0x1e6>
mov    0x2c07(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
lea    0xc7a(%rip),%rdi
jmp    13e6 <main+0x1e6>
mov    0x2bf0(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
lea    0xc85(%rip),%rdi
jmp    140f <main+0x20f>
mov    %eax,%edi
call   1120 <strerror@plt>
lea    0xca0(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    $0x2,%edi
call   1110 <exit@plt>
mov    0x2bb7(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
lea    0xc9a(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    0xcef(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1110 <exit@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"/tmp/pts_munmap_4_1_%d\00"
@O_CREAT = global i32 0
@O_RDWR = global i32 0
@O_EXCL = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@.str.1 = [34 x i8] c"munmap/4-1.c Error at open(): %s\0A\00"
@errno = global i32 0
@.str.2 = [34 x i8] c"munmap/4-1.cError at write(): %s\0A\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_FAILED = global i8* null
@.str.3 = [43 x i8] c"Test Fail: munmap/4-1.c Error at mmap: %s\0A\00"
@MS_SYNC = global i32 0
@.str.4 = [35 x i8] c"munmap/4-1.c Error at msync(): %s\0A\00"
@.str.5 = [47 x i8] c"Test Fail: munmap/4-1.c Error at 2nd mmap: %s\0A\00"
@.str.6 = [11 x i8] c"Test FAIL\0A\00"
@.str.7 = [54 x i8] c"Write referece is discarded when setting MAP_RPIVATE\0A\00"
@.str.8 = [13 x i8] c"Test PASSED\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [256 x i8]
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
store i32 0, i32* %1
store i32 1024, i32* %5
store i8* null, i8** %6
store i8* null, i8** %7
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
store i64 %15, i64* %8
store i32 0, i32* %11
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%17 = call i32 (...) @getpid()
%18 = call i32 @snprintf(i8* %16, i32 256, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%20 = call i32 @unlink(i8* %19)
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%22 = load i32, i32* @O_CREAT
%23 = load i32, i32* @O_RDWR
%24 = or i32 %22, %23
%25 = load i32, i32* @O_EXCL
%26 = or i32 %24, %25
%27 = load i32, i32* @S_IRUSR
%28 = load i32, i32* @S_IWUSR
%29 = or i32 %27, %28
%30 = call i32 @open(i8* %21, i32 %26, i32 %29)
store i32 %30, i32* %10
%31 = load i32, i32* %10
%32 = icmp eq i32 %31, -1
br i1 %32, label %33, label %38
33: ; preds = %0
%34 = load i32, i32* @errno
%35 = call i8* @strerror(i32 %34)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* %35)
%37 = call i32 @exit(i32 2)
unreachable
38: ; preds = %0
%39 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%40 = call i32 @unlink(i8* %39)
%41 = load i32, i32* %5
%42 = call i8* @malloc(i32 %41)
store i8* %42, i8** %4
%43 = load i8*, i8** %4
%44 = load i32, i32* %5
%45 = call i32 @memset(i8* %43, i8 signext 97, i32 %44)
%46 = load i32, i32* %10
%47 = load i8*, i8** %4
%48 = load i32, i32* %5
%49 = call i32 @write(i32 %46, i8* %47, i32 %48)
%50 = load i32, i32* %5
%51 = icmp ne i32 %49, %50
br i1 %51, label %52, label %57
52: ; preds = %38
%53 = load i32, i32* @errno
%54 = call i8* @strerror(i32 %53)
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %54)
%56 = call i32 @exit(i32 2)
unreachable
57: ; preds = %38
%58 = load i8*, i8** %4
%59 = call i32 @free(i8* %58)
%60 = load i32, i32* @PROT_READ
%61 = load i32, i32* @PROT_WRITE
%62 = or i32 %60, %61
store i32 %62, i32* %12
%63 = load i32, i32* @MAP_PRIVATE
store i32 %63, i32* %9
%64 = load i8*, i8** %7
%65 = load i64, i64* %8
%66 = load i32, i32* %12
%67 = load i32, i32* %9
%68 = load i32, i32* %10
%69 = load i32, i32* %11
%70 = call i8* @mmap(i8* %64, i64 %65, i32 %66, i32 %67, i32 %68, i32 %69)
store i8* %70, i8** %6
%71 = load i8*, i8** %6
%72 = load i8*, i8** @MAP_FAILED
%73 = icmp eq i8* %71, %72
br i1 %73, label %74, label %79
74: ; preds = %57
%75 = load i32, i32* @errno
%76 = call i8* @strerror(i32 %75)
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i8* %76)
%78 = call i32 @exit(i32 1)
unreachable
79: ; preds = %57
%80 = load i8*, i8** %6
store i8* %80, i8** %13
%81 = load i8*, i8** %13
store i8 98, i8* %81
%82 = load i8*, i8** %6
%83 = load i64, i64* %8
%84 = load i32, i32* @MS_SYNC
%85 = call i32 @msync(i8* %82, i64 %83, i32 %84)
store i32 %85, i32* %2
%86 = icmp ne i32 %85, 0
br i1 %86, label %87, label %92
87: ; preds = %79
%88 = load i32, i32* %2
%89 = call i8* @strerror(i32 %88)
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i8* %89)
%91 = call i32 @exit(i32 2)
unreachable
92: ; preds = %79
%93 = load i8*, i8** %6
%94 = load i64, i64* %8
%95 = call i32 @munmap(i8* %93, i64 %94)
%96 = load i8*, i8** %7
%97 = load i64, i64* %8
%98 = load i32, i32* %12
%99 = load i32, i32* %9
%100 = load i32, i32* %10
%101 = load i32, i32* %11
%102 = call i8* @mmap(i8* %96, i64 %97, i32 %98, i32 %99, i32 %100, i32 %101)
store i8* %102, i8** %6
%103 = load i8*, i8** %6
%104 = load i8*, i8** @MAP_FAILED
%105 = icmp eq i8* %103, %104
br i1 %105, label %106, label %111
106: ; preds = %92
%107 = load i32, i32* @errno
%108 = call i8* @strerror(i32 %107)
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), i8* %108)
%110 = call i32 @exit(i32 1)
unreachable
111: ; preds = %92
%112 = load i8*, i8** %6
store i8* %112, i8** %13
%113 = load i8*, i8** %13
%114 = load i8, i8* %113
%115 = sext i8 %114 to i32
%116 = icmp eq i32 %115, 98
br i1 %116, label %117, label %120
117: ; preds = %111
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%119 = call i32 @exit(i32 1)
unreachable
120: ; preds = %111
%121 = load i32, i32* %10
%122 = call i32 @close(i32 %121)
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.7, i64 0, i64 0))
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"/tmp/pts_munmap_4_1_%d\00"
@O_CREAT = global i32 0
@O_RDWR = global i32 0
@O_EXCL = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@.str.1 = [34 x i8] c"munmap/4-1.c Error at open(): %s\0A\00"
@errno = global i32 0
@.str.2 = [34 x i8] c"munmap/4-1.cError at write(): %s\0A\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_FAILED = global i8* null
@.str.3 = [43 x i8] c"Test Fail: munmap/4-1.c Error at mmap: %s\0A\00"
@MS_SYNC = global i32 0
@.str.4 = [35 x i8] c"munmap/4-1.c Error at msync(): %s\0A\00"
@.str.5 = [47 x i8] c"Test Fail: munmap/4-1.c Error at 2nd mmap: %s\0A\00"
@str = [53 x i8] c"Write referece is discarded when setting MAP_RPIVATE\00"
@str.9 = [12 x i8] c"Test PASSED\00"
@str.10 = [10 x i8] c"Test FAIL\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (...) @getpid()
%4 = call i32 @snprintf(i8* %2, i32 256, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @unlink(i8* %2)
%6 = load i32, i32* @O_CREAT
%7 = load i32, i32* @O_RDWR
%8 = or i32 %7, %6
%9 = load i32, i32* @O_EXCL
%10 = or i32 %8, %9
%11 = load i32, i32* @S_IRUSR
%12 = load i32, i32* @S_IWUSR
%13 = or i32 %12, %11
%14 = call i32 @open(i8* %2, i32 %10, i32 %13)
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %21
16: ; preds = %0
%17 = load i32, i32* @errno
%18 = call i8* @strerror(i32 %17)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%20 = call i32 @exit(i32 2)
unreachable
21: ; preds = %0
%22 = call i32 @unlink(i8* %2)
%23 = call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
%24 = call i32 @memset(i8* %23, i8 signext 97, i32 1024)
%25 = call i32 @write(i32 %14, i8* %23, i32 1024)
%26 = icmp eq i32 %25, 1024
br i1 %26, label %32, label %27
27: ; preds = %21
%28 = load i32, i32* @errno
%29 = call i8* @strerror(i32 %28)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %29)
%31 = call i32 @exit(i32 2)
unreachable
32: ; preds = %21
%33 = call i32 @free(i8* %23)
%34 = load i32, i32* @PROT_READ
%35 = load i32, i32* @PROT_WRITE
%36 = or i32 %35, %34
%37 = load i32, i32* @MAP_PRIVATE
%38 = call i8* @mmap(i8* null, i64 1024, i32 %36, i32 %37, i32 %14, i32 0)
%39 = load i8*, i8** @MAP_FAILED
%40 = icmp eq i8* %38, %39
br i1 %40, label %41, label %46
41: ; preds = %32
%42 = load i32, i32* @errno
%43 = call i8* @strerror(i32 %42)
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i8* %43)
%45 = call i32 @exit(i32 1)
unreachable
46: ; preds = %32
store i8 98, i8* %38
%47 = load i32, i32* @MS_SYNC
%48 = call i32 @msync(i8* %38, i64 1024, i32 %47)
%49 = icmp eq i32 %48, 0
br i1 %49, label %54, label %50
50: ; preds = %46
%51 = call i8* @strerror(i32 %48)
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i8* %51)
%53 = call i32 @exit(i32 2)
unreachable
54: ; preds = %46
%55 = call i32 @munmap(i8* %38, i64 1024)
%56 = call i8* @mmap(i8* null, i64 1024, i32 %36, i32 %37, i32 %14, i32 0)
%57 = load i8*, i8** @MAP_FAILED
%58 = icmp eq i8* %56, %57
br i1 %58, label %59, label %64
59: ; preds = %54
%60 = load i32, i32* @errno
%61 = call i8* @strerror(i32 %60)
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), i8* %61)
%63 = call i32 @exit(i32 1)
unreachable
64: ; preds = %54
%65 = load i8, i8* %56
%66 = icmp eq i8 %65, 98
br i1 %66, label %67, label %70
67: ; preds = %64
%68 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.10, i64 0, i64 0))
%69 = call i32 @exit(i32 1)
unreachable
70: ; preds = %64
%71 = call i32 @close(i32 %14)
%72 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
%73 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.9, i64 0, i64 0))
ret i32 0
}