#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 pid_t;

/* Variables and functions */
void *MAP_FAILED;
int /*<<< orphan*/ MAP_PRIVATE;
int O_CREAT;
int O_EXCL;
int O_RDWR;
int PROT_READ;
int PROT_WRITE;
int S_IRUSR;
int S_IWUSR;
int WEXITSTATUS(int);
int /*<<< orphan*/ WIFEXITED(int);
int /*<<< orphan*/ WUNTRACED;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int fork();
int ftruncate(int, size_t);
int getpid();
void *mmap(int /*<<< orphan*/ *, size_t, int, int /*<<< orphan*/, int,
           int /*<<< orphan*/);
int /*<<< orphan*/ munmap(void *, size_t);
int /*<<< orphan*/ printf(char *, ...);
int shm_open(char *, int, int);
int /*<<< orphan*/ shm_unlink(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
char *strerror(int /*<<< orphan*/);
int /*<<< orphan*/ waitpid(int, int *, int /*<<< orphan*/);
int main(void) {
  char tmpfname[256];
  void *pa;
  size_t size = 1024;
  int fd;
  pid_t child;
  int exit_stat;
  snprintf(tmpfname, sizeof(tmpfname), "pts_mmap_7_3_%d", getpid());
  shm_unlink(tmpfname);
  fd = shm_open(tmpfname, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
  if (fd == -1) {
    printf("Error at shm_open(): %s\n", strerror(errno));
    return 2;
  }
  shm_unlink(tmpfname);
  if (ftruncate(fd, size) == -1) {
    printf("Error at ftruncate(): %s\n", strerror(errno));
    return 2;
  }
  pa = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
  if (pa == MAP_FAILED) {
    printf("Error at mmap(): %s\n", strerror(errno));
    return 1;
  }
  *(char *)pa = 'a';
  child = fork();
  switch (child) {
  case 0:
    pa = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
    if (pa == MAP_FAILED) {
      printf("Error at mmap(): %s\n", strerror(errno));
      return 1;
    }
    if (*(char *)pa == 'a') {
      printf("Set flag as MAP_PRIVATE, write reference will "
             "change the underlying shared memory object\n");
      return 1;
    }
    printf("Set flag as MAP_PRIVATE, write reference will "
           "not change the underlying shared memory object\n"
           "Test PASSED\n");
    return 0;
    break;
  case -1:
    printf("Error at fork(): %s\n", strerror(errno));
    return 2;
    break;
  default:
    waitpid(child, &exit_stat, WUNTRACED);
    close(fd);
    munmap(pa, size);
    if (WIFEXITED(exit_stat)) {
      return WEXITSTATUS(exit_stat);
    } else {
      printf("Child has not exit properly\n");
      return 2;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x400,-0x120(%rbp)
lea    -0x110(%rbp),%rax
mov    %rax,-0x138(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x138(%rbp),%rdi
mov    %eax,%ecx
mov    $0x100,%esi
lea    0xdd9(%rip),%rdx
call   1060 <snprintf@plt>
lea    -0x110(%rbp),%rdi
call   10f0 <shm_unlink@plt>
lea    -0x110(%rbp),%rdi
mov    0x2d92(%rip),%rax
mov    (%rax),%esi
mov    0x2da9(%rip),%rax
or     (%rax),%esi
mov    0x2d60(%rip),%rax
or     (%rax),%esi
mov    0x2d3f(%rip),%rax
mov    (%rax),%edx
mov    0x2d66(%rip),%rax
or     (%rax),%edx
call   10d0 <shm_open@plt>
mov    %eax,-0x124(%rbp)
cmpl   $0xffffffff,-0x124(%rbp)
jne    12af <main+0xcf>
mov    0x2d25(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    %rax,%rsi
lea    0xd74(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1528 <main+0x348>
lea    -0x110(%rbp),%rdi
call   10f0 <shm_unlink@plt>
mov    -0x124(%rbp),%edi
mov    -0x120(%rbp),%rsi
call   1070 <ftruncate@plt>
cmp    $0xffffffff,%eax
jne    1301 <main+0x121>
mov    0x2cd3(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    %rax,%rsi
lea    0xd3b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1528 <main+0x348>
mov    -0x120(%rbp),%rsi
mov    0x2ce1(%rip),%rax
mov    (%rax),%edx
mov    0x2c90(%rip),%rax
or     (%rax),%edx
mov    0x2c77(%rip),%rax
mov    (%rax),%ecx
mov    -0x124(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    %rax,-0x118(%rbp)
mov    -0x118(%rbp),%rax
mov    0x2c45(%rip),%rcx
cmp    (%rcx),%rax
jne    137f <main+0x19f>
mov    0x2c55(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    %rax,%rsi
lea    0xcd7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1528 <main+0x348>
mov    -0x118(%rbp),%rax
movb   $0x61,(%rax)
xor    %eax,%eax
call   1100 <fork@plt>
mov    %eax,-0x128(%rbp)
mov    -0x128(%rbp),%eax
mov    %eax,-0x13c(%rbp)
sub    $0xffffffff,%eax
je     1488 <main+0x2a8>
jmp    13b0 <main+0x1d0>
mov    -0x13c(%rbp),%eax
test   %eax,%eax
jne    14b3 <main+0x2d3>
jmp    13c3 <main+0x1e3>
mov    -0x120(%rbp),%rsi
mov    0x2c1f(%rip),%rax
mov    (%rax),%edx
mov    0x2bce(%rip),%rax
or     (%rax),%edx
mov    0x2bb5(%rip),%rax
mov    (%rax),%ecx
mov    -0x124(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    %rax,-0x118(%rbp)
mov    -0x118(%rbp),%rax
mov    0x2b83(%rip),%rcx
cmp    (%rcx),%rax
jne    1441 <main+0x261>
mov    0x2b93(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    %rax,%rsi
lea    0xc15(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1528 <main+0x348>
mov    -0x118(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
jne    146e <main+0x28e>
lea    0xbfd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1528 <main+0x348>
lea    0xc3d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1528 <main+0x348>
mov    0x2b21(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    %rax,%rsi
lea    0xc7c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1528 <main+0x348>
mov    -0x128(%rbp),%edi
mov    0x2b00(%rip),%rax
mov    (%rax),%edx
lea    -0x12c(%rbp),%rsi
call   10b0 <waitpid@plt>
mov    -0x124(%rbp),%edi
call   1080 <close@plt>
mov    -0x118(%rbp),%rdi
mov    -0x120(%rbp),%rsi
call   1090 <munmap@plt>
mov    -0x12c(%rbp),%edi
call   10c0 <WIFEXITED@plt>
cmp    $0x0,%eax
je     1513 <main+0x333>
mov    -0x12c(%rbp),%edi
call   10a0 <WEXITSTATUS@plt>
mov    %eax,-0x4(%rbp)
jmp    1528 <main+0x348>
lea    0xc17(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xdf1(%rip),%rdx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %eax,%ecx
call   1070 <snprintf@plt>
mov    %rbx,%rdi
call   1100 <shm_unlink@plt>
mov    0x2da6(%rip),%rax
mov    0x2dbf(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2d74(%rip),%rax
or     (%rax),%esi
mov    0x2d53(%rip),%rax
mov    0x2d7c(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    %rbx,%rdi
call   10e0 <shm_open@plt>
cmp    $0xffffffff,%eax
je     132a <main+0x13a>
mov    %eax,%ebx
lea    0x10(%rsp),%rdi
call   1100 <shm_unlink@plt>
mov    $0x400,%esi
mov    %ebx,%edi
call   1080 <ftruncate@plt>
cmp    $0xffffffff,%eax
je     1341 <main+0x151>
mov    0x2d5f(%rip),%r15
mov    0x2d10(%rip),%r12
mov    (%r12),%edx
or     (%r15),%edx
mov    0x2cf2(%rip),%r13
mov    0x0(%r13),%ecx
mov    $0x400,%esi
xor    %edi,%edi
mov    %ebx,%r8d
xor    %r9d,%r9d
call   1050 <mmap@plt>
mov    0x2ccd(%rip),%rbp
cmp    0x0(%rbp),%rax
je     1358 <main+0x168>
mov    %rax,%r14
movb   $0x61,(%rax)
xor    %eax,%eax
call   1110 <fork@plt>
cmp    $0xffffffff,%eax
je     137e <main+0x18e>
test   %eax,%eax
jne    13b4 <main+0x1c4>
mov    (%r12),%edx
or     (%r15),%edx
mov    0x0(%r13),%ecx
mov    $0x400,%esi
xor    %edi,%edi
mov    %ebx,%r8d
xor    %r9d,%r9d
call   1050 <mmap@plt>
cmp    0x0(%rbp),%rax
je     1358 <main+0x168>
cmpb   $0x61,(%rax)
jne    1403 <main+0x213>
lea    0xdb8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
jmp    13a2 <main+0x1b2>
mov    0x2c7f(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
lea    0xcd1(%rip),%rdi
jmp    1393 <main+0x1a3>
mov    0x2c68(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
lea    0xcd3(%rip),%rdi
jmp    1393 <main+0x1a3>
mov    0x2c51(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
lea    0xcd6(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%eax
jmp    13a2 <main+0x1b2>
mov    0x2c2b(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
lea    0xcc5(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x2,%eax
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c05(%rip),%rcx
mov    (%rcx),%edx
lea    0xc(%rsp),%rsi
mov    %eax,%edi
call   10c0 <waitpid@plt>
mov    %ebx,%edi
call   1090 <close@plt>
mov    $0x400,%esi
mov    %r14,%rdi
call   10a0 <munmap@plt>
mov    0xc(%rsp),%edi
call   10d0 <WIFEXITED@plt>
test   %eax,%eax
je     13f5 <main+0x205>
mov    0xc(%rsp),%edi
call   10b0 <WEXITSTATUS@plt>
jmp    13a2 <main+0x1b2>
lea    0xd33(%rip),%rdi
call   1030 <puts@plt>
jmp    139d <main+0x1ad>
lea    0xc63(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
jmp    13a2 <main+0x1b2>

LLVM IR (-O0):
@.str = [16 x i8] c"pts_mmap_7_3_%d\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_EXCL = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@.str.1 = [25 x i8] c"Error at shm_open(): %s\0A\00"
@errno = global i32 0
@.str.2 = [26 x i8] c"Error at ftruncate(): %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 = [21 x i8] c"Error at mmap(): %s\0A\00"
@.str.4 = [90 x i8] c"Set flag as MAP_PRIVATE, write reference will change the underlying shared memory object\0A\00"
@.str.5 = [106 x i8] c"Set flag as MAP_PRIVATE, write reference will not change the underlying shared memory object\0ATest PASSED\0A\00"
@.str.6 = [21 x i8] c"Error at fork(): %s\0A\00"
@WUNTRACED = global i32 0
@.str.7 = [29 x i8] c"Child has not exit properly\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i64 1024, i64* %4
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%9 = call i32 (...) @getpid()
%10 = call i32 @snprintf(i8* %8, i32 256, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%12 = call i32 @shm_unlink(i8* %11)
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%14 = load i32, i32* @O_RDWR
%15 = load i32, i32* @O_CREAT
%16 = or i32 %14, %15
%17 = load i32, i32* @O_EXCL
%18 = or i32 %16, %17
%19 = load i32, i32* @S_IRUSR
%20 = load i32, i32* @S_IWUSR
%21 = or i32 %19, %20
%22 = call i32 @shm_open(i8* %13, i32 %18, i32 %21)
store i32 %22, i32* %5
%23 = load i32, i32* %5
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %29
25: ; preds = %0
%26 = load i32, i32* @errno
%27 = call i8* @strerror(i32 %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %27)
store i32 2, i32* %1
br label %104
29: ; preds = %0
%30 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%31 = call i32 @shm_unlink(i8* %30)
%32 = load i32, i32* %5
%33 = load i64, i64* %4
%34 = call i32 @ftruncate(i32 %32, i64 %33)
%35 = icmp eq i32 %34, -1
br i1 %35, label %36, label %40
36: ; preds = %29
%37 = load i32, i32* @errno
%38 = call i8* @strerror(i32 %37)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %38)
store i32 2, i32* %1
br label %104
40: ; preds = %29
%41 = load i64, i64* %4
%42 = load i32, i32* @PROT_READ
%43 = load i32, i32* @PROT_WRITE
%44 = or i32 %42, %43
%45 = load i32, i32* @MAP_PRIVATE
%46 = load i32, i32* %5
%47 = call i8* @mmap(i32* null, i64 %41, i32 %44, i32 %45, i32 %46, i32 0)
store i8* %47, i8** %3
%48 = load i8*, i8** %3
%49 = load i8*, i8** @MAP_FAILED
%50 = icmp eq i8* %48, %49
br i1 %50, label %51, label %55
51: ; preds = %40
%52 = load i32, i32* @errno
%53 = call i8* @strerror(i32 %52)
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %53)
store i32 1, i32* %1
br label %104
55: ; preds = %40
%56 = load i8*, i8** %3
store i8 97, i8* %56
%57 = call i32 (...) @fork()
store i32 %57, i32* %6
%58 = load i32, i32* %6
switch i32 %58, label %87 [
i32 0, label %59
i32 -1, label %83
]
59: ; preds = %55
%60 = load i64, i64* %4
%61 = load i32, i32* @PROT_READ
%62 = load i32, i32* @PROT_WRITE
%63 = or i32 %61, %62
%64 = load i32, i32* @MAP_PRIVATE
%65 = load i32, i32* %5
%66 = call i8* @mmap(i32* null, i64 %60, i32 %63, i32 %64, i32 %65, i32 0)
store i8* %66, i8** %3
%67 = load i8*, i8** %3
%68 = load i8*, i8** @MAP_FAILED
%69 = icmp eq i8* %67, %68
br i1 %69, label %70, label %74
70: ; preds = %59
%71 = load i32, i32* @errno
%72 = call i8* @strerror(i32 %71)
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %72)
store i32 1, i32* %1
br label %104
74: ; preds = %59
%75 = load i8*, i8** %3
%76 = load i8, i8* %75
%77 = sext i8 %76 to i32
%78 = icmp eq i32 %77, 97
br i1 %78, label %79, label %81
79: ; preds = %74
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([90 x i8], [90 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %1
br label %104
81: ; preds = %74
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([106 x i8], [106 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %1
br label %104
83: ; preds = %55
%84 = load i32, i32* @errno
%85 = call i8* @strerror(i32 %84)
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8* %85)
store i32 2, i32* %1
br label %104
87: ; preds = %55
%88 = load i32, i32* %6
%89 = load i32, i32* @WUNTRACED
%90 = call i32 @waitpid(i32 %88, i32* %7, i32 %89)
%91 = load i32, i32* %5
%92 = call i32 @close(i32 %91)
%93 = load i8*, i8** %3
%94 = load i64, i64* %4
%95 = call i32 @munmap(i8* %93, i64 %94)
%96 = load i32, i32* %7
%97 = call i32 @WIFEXITED(i32 %96)
%98 = icmp ne i32 %97, 0
br i1 %98, label %99, label %102
99: ; preds = %87
%100 = load i32, i32* %7
%101 = call i32 @WEXITSTATUS(i32 %100)
store i32 %101, i32* %1
br label %104
102: ; preds = %87
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
store i32 2, i32* %1
br label %104
104: ; preds = %102, %99, %83, %81, %79, %70, %51, %36, %25
%105 = load i32, i32* %1
ret i32 %105
}

LLVM IR (-O2):
@.str = [16 x i8] c"pts_mmap_7_3_%d\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_EXCL = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@.str.1 = [25 x i8] c"Error at shm_open(): %s\0A\00"
@errno = global i32 0
@.str.2 = [26 x i8] c"Error at ftruncate(): %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 = [21 x i8] c"Error at mmap(): %s\0A\00"
@.str.6 = [21 x i8] c"Error at fork(): %s\0A\00"
@WUNTRACED = global i32 0
@str = [105 x i8] c"Set flag as MAP_PRIVATE, write reference will not change the underlying shared memory object\0ATest PASSED\00"
@str.8 = [89 x i8] c"Set flag as MAP_PRIVATE, write reference will change the underlying shared memory object\00"
@str.9 = [28 x i8] c"Child has not exit properly\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (...) @getpid()
%6 = call i32 @snprintf(i8* %3, i32 256, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 @shm_unlink(i8* %3)
%8 = load i32, i32* @O_RDWR
%9 = load i32, i32* @O_CREAT
%10 = or i32 %9, %8
%11 = load i32, i32* @O_EXCL
%12 = or i32 %10, %11
%13 = load i32, i32* @S_IRUSR
%14 = load i32, i32* @S_IWUSR
%15 = or i32 %14, %13
%16 = call i32 @shm_open(i8* %3, i32 %12, i32 %15)
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %22
18: ; preds = %0
%19 = load i32, i32* @errno
%20 = call i8* @strerror(i32 %19)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %20)
br label %80
22: ; preds = %0
%23 = call i32 @shm_unlink(i8* %3)
%24 = call i32 @ftruncate(i32 %16, i64 1024)
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %30
26: ; preds = %22
%27 = load i32, i32* @errno
%28 = call i8* @strerror(i32 %27)
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %28)
br label %80
30: ; preds = %22
%31 = load i32, i32* @PROT_READ
%32 = load i32, i32* @PROT_WRITE
%33 = or i32 %32, %31
%34 = load i32, i32* @MAP_PRIVATE
%35 = call i8* @mmap(i32* null, i64 1024, i32 %33, i32 %34, i32 %16, i32 0)
%36 = load i8*, i8** @MAP_FAILED
%37 = icmp eq i8* %35, %36
br i1 %37, label %38, label %42
38: ; preds = %30
%39 = load i32, i32* @errno
%40 = call i8* @strerror(i32 %39)
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %40)
br label %80
42: ; preds = %30
store i8 97, i8* %35
%43 = call i32 (...) @fork()
switch i32 %43, label %67 [
i32 0, label %44
i32 -1, label %63
]
44: ; preds = %42
%45 = load i32, i32* @PROT_READ
%46 = load i32, i32* @PROT_WRITE
%47 = or i32 %46, %45
%48 = load i32, i32* @MAP_PRIVATE
%49 = call i8* @mmap(i32* null, i64 1024, i32 %47, i32 %48, i32 %16, i32 0)
%50 = load i8*, i8** @MAP_FAILED
%51 = icmp eq i8* %49, %50
br i1 %51, label %52, label %56
52: ; preds = %44
%53 = load i32, i32* @errno
%54 = call i8* @strerror(i32 %53)
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %54)
br label %80
56: ; preds = %44
%57 = load i8, i8* %49
%58 = icmp eq i8 %57, 97
br i1 %58, label %59, label %61
59: ; preds = %56
%60 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([89 x i8], [89 x i8]* @str.8, i64 0, i64 0))
br label %80
61: ; preds = %56
%62 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([105 x i8], [105 x i8]* @str, i64 0, i64 0))
br label %80
63: ; preds = %42
%64 = load i32, i32* @errno
%65 = call i8* @strerror(i32 %64)
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8* %65)
br label %80
67: ; preds = %42
%68 = load i32, i32* @WUNTRACED
%69 = call i32 @waitpid(i32 %43, i32* %2, i32 %68)
%70 = call i32 @close(i32 %16)
%71 = call i32 @munmap(i8* %35, i64 1024)
%72 = load i32, i32* %2
%73 = call i32 @WIFEXITED(i32 %72)
%74 = icmp eq i32 %73, 0
br i1 %74, label %78, label %75
75: ; preds = %67
%76 = load i32, i32* %2
%77 = call i32 @WEXITSTATUS(i32 %76)
br label %80
78: ; preds = %67
%79 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.9, i64 0, i64 0))
br label %80
80: ; preds = %78, %75, %63, %61, %59, %52, %38, %26, %18
%81 = phi i32 [ 2, %18 ], [ 2, %26 ], [ 1, %38 ], [ %77, %75 ], [ 2, %78 ], [ 2, %63 ], [ 1, %52 ], [ 1, %59 ], [ 0, %61 ]
ret i32 %81
}