#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();
scalar_t__ 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 = (char *)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 i64 @malloc(i32 %41)
%43 = inttoptr i64 %42 to i8*
store i8* %43, i8** %4
%44 = load i8*, i8** %4
%45 = load i32, i32* %5
%46 = call i32 @memset(i8* %44, i8 signext 97, i32 %45)
%47 = load i32, i32* %10
%48 = load i8*, i8** %4
%49 = load i32, i32* %5
%50 = call i32 @write(i32 %47, i8* %48, i32 %49)
%51 = load i32, i32* %5
%52 = icmp ne i32 %50, %51
br i1 %52, label %53, label %58
53: ; preds = %38
%54 = load i32, i32* @errno
%55 = call i8* @strerror(i32 %54)
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %55)
%57 = call i32 @exit(i32 2)
unreachable
58: ; preds = %38
%59 = load i8*, i8** %4
%60 = call i32 @free(i8* %59)
%61 = load i32, i32* @PROT_READ
%62 = load i32, i32* @PROT_WRITE
%63 = or i32 %61, %62
store i32 %63, i32* %12
%64 = load i32, i32* @MAP_PRIVATE
store i32 %64, i32* %9
%65 = load i8*, i8** %7
%66 = load i64, i64* %8
%67 = load i32, i32* %12
%68 = load i32, i32* %9
%69 = load i32, i32* %10
%70 = load i32, i32* %11
%71 = call i8* @mmap(i8* %65, i64 %66, i32 %67, i32 %68, i32 %69, i32 %70)
store i8* %71, i8** %6
%72 = load i8*, i8** %6
%73 = load i8*, i8** @MAP_FAILED
%74 = icmp eq i8* %72, %73
br i1 %74, label %75, label %80
75: ; preds = %58
%76 = load i32, i32* @errno
%77 = call i8* @strerror(i32 %76)
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i8* %77)
%79 = call i32 @exit(i32 1)
unreachable
80: ; preds = %58
%81 = load i8*, i8** %6
store i8* %81, i8** %13
%82 = load i8*, i8** %13
store i8 98, i8* %82
%83 = load i8*, i8** %6
%84 = load i64, i64* %8
%85 = load i32, i32* @MS_SYNC
%86 = call i32 @msync(i8* %83, i64 %84, i32 %85)
store i32 %86, i32* %2
%87 = icmp ne i32 %86, 0
br i1 %87, label %88, label %93
88: ; preds = %80
%89 = load i32, i32* %2
%90 = call i8* @strerror(i32 %89)
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i8* %90)
%92 = call i32 @exit(i32 2)
unreachable
93: ; preds = %80
%94 = load i8*, i8** %6
%95 = load i64, i64* %8
%96 = call i32 @munmap(i8* %94, i64 %95)
%97 = load i8*, i8** %7
%98 = load i64, i64* %8
%99 = load i32, i32* %12
%100 = load i32, i32* %9
%101 = load i32, i32* %10
%102 = load i32, i32* %11
%103 = call i8* @mmap(i8* %97, i64 %98, i32 %99, i32 %100, i32 %101, i32 %102)
store i8* %103, i8** %6
%104 = load i8*, i8** %6
%105 = load i8*, i8** @MAP_FAILED
%106 = icmp eq i8* %104, %105
br i1 %106, label %107, label %112
107: ; preds = %93
%108 = load i32, i32* @errno
%109 = call i8* @strerror(i32 %108)
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), i8* %109)
%111 = call i32 @exit(i32 1)
unreachable
112: ; preds = %93
%113 = load i8*, i8** %6
store i8* %113, i8** %13
%114 = load i8*, i8** %13
%115 = load i8, i8* %114
%116 = sext i8 %115 to i32
%117 = icmp eq i32 %116, 98
br i1 %117, label %118, label %121
118: ; preds = %112
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%120 = call i32 @exit(i32 1)
unreachable
121: ; preds = %112
%122 = load i32, i32* %10
%123 = call i32 @close(i32 %122)
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.7, i64 0, i64 0))
%125 = 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 i64 @malloc(i32 1024)
%24 = inttoptr i64 %23 to i8*
%25 = call i32 @memset(i8* %24, i8 signext 97, i32 1024)
%26 = call i32 @write(i32 %14, i8* %24, i32 1024)
%27 = icmp eq i32 %26, 1024
br i1 %27, label %33, label %28
28: ; preds = %21
%29 = load i32, i32* @errno
%30 = call i8* @strerror(i32 %29)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %30)
%32 = call i32 @exit(i32 2)
unreachable
33: ; preds = %21
%34 = call i32 @free(i8* %24)
%35 = load i32, i32* @PROT_READ
%36 = load i32, i32* @PROT_WRITE
%37 = or i32 %36, %35
%38 = load i32, i32* @MAP_PRIVATE
%39 = call i8* @mmap(i8* null, i64 1024, i32 %37, i32 %38, i32 %14, i32 0)
%40 = load i8*, i8** @MAP_FAILED
%41 = icmp eq i8* %39, %40
br i1 %41, label %42, label %47
42: ; preds = %33
%43 = load i32, i32* @errno
%44 = call i8* @strerror(i32 %43)
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i8* %44)
%46 = call i32 @exit(i32 1)
unreachable
47: ; preds = %33
store i8 98, i8* %39
%48 = load i32, i32* @MS_SYNC
%49 = call i32 @msync(i8* %39, i64 1024, i32 %48)
%50 = icmp eq i32 %49, 0
br i1 %50, label %55, label %51
51: ; preds = %47
%52 = call i8* @strerror(i32 %49)
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i8* %52)
%54 = call i32 @exit(i32 2)
unreachable
55: ; preds = %47
%56 = call i32 @munmap(i8* %39, i64 1024)
%57 = call i8* @mmap(i8* null, i64 1024, i32 %37, i32 %38, i32 %14, i32 0)
%58 = load i8*, i8** @MAP_FAILED
%59 = icmp eq i8* %57, %58
br i1 %59, label %60, label %65
60: ; preds = %55
%61 = load i32, i32* @errno
%62 = call i8* @strerror(i32 %61)
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), i8* %62)
%64 = call i32 @exit(i32 1)
unreachable
65: ; preds = %55
%66 = load i8, i8* %57
%67 = icmp eq i8 %66, 98
br i1 %67, label %68, label %71
68: ; preds = %65
%69 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.10, i64 0, i64 0))
%70 = call i32 @exit(i32 1)
unreachable
71: ; preds = %65
%72 = call i32 @close(i32 %14)
%73 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
%74 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.9, i64 0, i64 0))
ret i32 0
}