#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 /*<<< orphan*/ MAP_SHARED;
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*/ 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];
  int shm_fd;
  void *pa;
  size_t size = 1024;
  pid_t child;
  int exit_stat;
  snprintf(tmpfname, sizeof(tmpfname), "pts_mmap_7_4_%d", getpid());
  shm_unlink(tmpfname);
  shm_fd = shm_open(tmpfname, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
  if (shm_fd == -1) {
    printf("Error at shm_open(): %s\n", strerror(errno));
    return 2;
  }
  shm_unlink(tmpfname);
  if (ftruncate(shm_fd, size) == -1) {
    printf("Error at ftruncate(): %s\n", strerror(errno));
    return 2;
  }
  pa = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, shm_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, shm_fd, 0);
    if (pa == MAP_FAILED) {
      printf("child: Error at mmap: %s\n", strerror(errno));
      return 1;
    }
    if (*(char *)pa == 'a') {
      printf("Test PASSED\n");
      return 0;
    }
    printf("mmap with MAP_SHARED failed to propagate change "
           "into the child\n");
    return 1;
  case -1:
    printf("Error at fork(): %s\n", strerror(errno));
    return 2;
  default:
    waitpid(child, &exit_stat, WUNTRACED);
    munmap(pa, size);
    if (WIFEXITED(exit_stat)) {
      return WEXITSTATUS(exit_stat);
    } else {
      printf("Child exited abnormally\n");
      return 2;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x400,-0x128(%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    0xde9(%rip),%rdx
call   1060 <snprintf@plt>
lea    -0x110(%rbp),%rdi
call   10e0 <shm_unlink@plt>
lea    -0x110(%rbp),%rdi
mov    0x2d9a(%rip),%rax
mov    (%rax),%esi
mov    0x2db9(%rip),%rax
or     (%rax),%esi
mov    0x2d68(%rip),%rax
or     (%rax),%esi
mov    0x2d47(%rip),%rax
mov    (%rax),%edx
mov    0x2d6e(%rip),%rax
or     (%rax),%edx
call   10c0 <shm_open@plt>
mov    %eax,-0x114(%rbp)
cmpl   $0xffffffff,-0x114(%rbp)
jne    129f <main+0xcf>
mov    0x2d2d(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    %rax,%rsi
lea    0xd84(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    150d <main+0x33d>
lea    -0x110(%rbp),%rdi
call   10e0 <shm_unlink@plt>
mov    -0x114(%rbp),%edi
mov    -0x128(%rbp),%rsi
call   1070 <ftruncate@plt>
cmp    $0xffffffff,%eax
jne    12f1 <main+0x121>
mov    0x2cdb(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    %rax,%rsi
lea    0xd4b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    150d <main+0x33d>
mov    -0x128(%rbp),%rsi
mov    0x2cf1(%rip),%rax
mov    (%rax),%edx
mov    0x2c98(%rip),%rax
or     (%rax),%edx
mov    0x2ccf(%rip),%rax
mov    (%rax),%ecx
mov    -0x114(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    %rax,-0x120(%rbp)
mov    -0x120(%rbp),%rax
mov    0x2c4d(%rip),%rcx
cmp    (%rcx),%rax
jne    136f <main+0x19f>
mov    0x2c5d(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    %rax,%rsi
lea    0xcee(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    150d <main+0x33d>
mov    -0x120(%rbp),%rax
movb   $0x61,(%rax)
xor    %eax,%eax
call   10f0 <fork@plt>
mov    %eax,-0x12c(%rbp)
mov    -0x12c(%rbp),%eax
mov    %eax,-0x13c(%rbp)
sub    $0xffffffff,%eax
je     1478 <main+0x2a8>
jmp    13a0 <main+0x1d0>
mov    -0x13c(%rbp),%eax
test   %eax,%eax
jne    14a3 <main+0x2d3>
jmp    13b3 <main+0x1e3>
mov    -0x128(%rbp),%rsi
mov    0x2c2f(%rip),%rax
mov    (%rax),%edx
mov    0x2bd6(%rip),%rax
or     (%rax),%edx
mov    0x2bbd(%rip),%rax
mov    (%rax),%ecx
mov    -0x114(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    %rax,-0x120(%rbp)
mov    -0x120(%rbp),%rax
mov    0x2b8b(%rip),%rcx
cmp    (%rcx),%rax
jne    1431 <main+0x261>
mov    0x2b9b(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    %rax,%rsi
lea    0xc25(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    150d <main+0x33d>
mov    -0x120(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
jne    145e <main+0x28e>
lea    0xc12(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    150d <main+0x33d>
lea    0xc05(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    150d <main+0x33d>
mov    0x2b29(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    %rax,%rsi
lea    0xc1a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    150d <main+0x33d>
mov    -0x12c(%rbp),%edi
mov    0x2b08(%rip),%rax
mov    (%rax),%edx
lea    -0x130(%rbp),%rsi
call   10a0 <waitpid@plt>
mov    -0x120(%rbp),%rdi
mov    -0x128(%rbp),%rsi
call   1080 <munmap@plt>
mov    -0x130(%rbp),%edi
call   10b0 <WIFEXITED@plt>
cmp    $0x0,%eax
je     14f8 <main+0x328>
mov    -0x130(%rbp),%edi
call   1090 <WEXITSTATUS@plt>
mov    %eax,-0x4(%rbp)
jmp    150d <main+0x33d>
lea    0xbc0(%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   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x110,%rsp
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xe02(%rip),%rdx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %eax,%ecx
call   1070 <snprintf@plt>
mov    %rbx,%rdi
call   10f0 <shm_unlink@plt>
mov    0x2daf(%rip),%rax
mov    0x2dd0(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2d7d(%rip),%rax
or     (%rax),%esi
mov    0x2d5c(%rip),%rax
mov    0x2d85(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    %rbx,%rdi
call   10d0 <shm_open@plt>
cmp    $0xffffffff,%eax
je     131d <main+0x13d>
mov    %eax,%ebx
lea    0x10(%rsp),%rdi
call   10f0 <shm_unlink@plt>
mov    $0x400,%esi
mov    %ebx,%edi
call   1080 <ftruncate@plt>
cmp    $0xffffffff,%eax
je     1334 <main+0x154>
mov    0x2d70(%rip),%r15
mov    0x2d19(%rip),%r12
mov    (%r12),%edx
or     (%r15),%edx
mov    0x2d4b(%rip),%rax
mov    (%rax),%ecx
mov    $0x400,%esi
xor    %edi,%edi
mov    %ebx,%r8d
xor    %r9d,%r9d
call   1050 <mmap@plt>
mov    0x2cd8(%rip),%r13
cmp    0x0(%r13),%rax
je     134b <main+0x16b>
mov    %rax,%r14
movb   $0x61,(%rax)
xor    %eax,%eax
call   1100 <fork@plt>
cmp    $0xffffffff,%eax
je     1371 <main+0x191>
test   %eax,%eax
jne    13a6 <main+0x1c6>
mov    (%r12),%edx
or     (%r15),%edx
mov    0x2caa(%rip),%rax
mov    (%rax),%ecx
mov    $0x400,%esi
xor    %edi,%edi
mov    %ebx,%r8d
xor    %r9d,%r9d
call   1050 <mmap@plt>
cmp    0x0(%r13),%rax
je     13e0 <main+0x200>
cmpb   $0x61,(%rax)
jne    1408 <main+0x228>
lea    0xd9d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
jmp    1395 <main+0x1b5>
mov    0x2c84(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xcde(%rip),%rdi
jmp    1386 <main+0x1a6>
mov    0x2c6d(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xce0(%rip),%rdi
jmp    1386 <main+0x1a6>
mov    0x2c56(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xcea(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%eax
jmp    1395 <main+0x1b5>
mov    0x2c30(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xcd7(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x2,%eax
add    $0x110,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
mov    0x2c0b(%rip),%rcx
mov    (%rcx),%edx
lea    0xc(%rsp),%rsi
mov    %eax,%edi
call   10b0 <waitpid@plt>
mov    $0x400,%esi
mov    %r14,%rdi
call   1090 <munmap@plt>
mov    0xc(%rsp),%edi
call   10c0 <WIFEXITED@plt>
test   %eax,%eax
je     13fa <main+0x21a>
mov    0xc(%rsp),%edi
call   10a0 <WEXITSTATUS@plt>
jmp    1395 <main+0x1b5>
mov    0x2bc1(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xc4e(%rip),%rdi
jmp    1360 <main+0x180>
lea    0xcbc(%rip),%rdi
call   1030 <puts@plt>
jmp    1390 <main+0x1b0>
lea    0xc63(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
jmp    1395 <main+0x1b5>

LLVM IR (-O0):
@.str = [16 x i8] c"pts_mmap_7_4_%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_SHARED = global i32 0
@MAP_FAILED = global i8* null
@.str.3 = [19 x i8] c"Error at mmap: %s\0A\00"
@MAP_PRIVATE = global i32 0
@.str.4 = [26 x i8] c"child: Error at mmap: %s\0A\00"
@.str.5 = [13 x i8] c"Test PASSED\0A\00"
@.str.6 = [64 x i8] c"mmap with MAP_SHARED failed to propagate change into the child\0A\00"
@.str.7 = [21 x i8] c"Error at fork(): %s\0A\00"
@WUNTRACED = global i32 0
@.str.8 = [25 x i8] c"Child exited abnormally\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i64 1024, i64* %5
%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* %3
%23 = load i32, i32* %3
%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 %102
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* %3
%33 = load i64, i64* %5
%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 %102
40: ; preds = %29
%41 = load i64, i64* %5
%42 = load i32, i32* @PROT_READ
%43 = load i32, i32* @PROT_WRITE
%44 = or i32 %42, %43
%45 = load i32, i32* @MAP_SHARED
%46 = load i32, i32* %3
%47 = call i8* @mmap(i32* null, i64 %41, i32 %44, i32 %45, i32 %46, i32 0)
store i8* %47, i8** %4
%48 = load i8*, i8** %4
%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 ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %53)
store i32 1, i32* %1
br label %102
55: ; preds = %40
%56 = load i8*, i8** %4
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* %5
%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* %3
%66 = call i8* @mmap(i32* null, i64 %60, i32 %63, i32 %64, i32 %65, i32 0)
store i8* %66, i8** %4
%67 = load i8*, i8** %4
%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 ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %72)
store i32 1, i32* %1
br label %102
74: ; preds = %59
%75 = load i8*, i8** %4
%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 ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %1
br label %102
81: ; preds = %74
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %1
br label %102
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.7, i64 0, i64 0), i8* %85)
store i32 2, i32* %1
br label %102
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 i8*, i8** %4
%92 = load i64, i64* %5
%93 = call i32 @munmap(i8* %91, i64 %92)
%94 = load i32, i32* %7
%95 = call i32 @WIFEXITED(i32 %94)
%96 = icmp ne i32 %95, 0
br i1 %96, label %97, label %100
97: ; preds = %87
%98 = load i32, i32* %7
%99 = call i32 @WEXITSTATUS(i32 %98)
store i32 %99, i32* %1
br label %102
100: ; preds = %87
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0))
store i32 2, i32* %1
br label %102
102: ; preds = %100, %97, %83, %81, %79, %70, %51, %36, %25
%103 = load i32, i32* %1
ret i32 %103
}

LLVM IR (-O2):
@.str = [16 x i8] c"pts_mmap_7_4_%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_SHARED = global i32 0
@MAP_FAILED = global i8* null
@.str.3 = [19 x i8] c"Error at mmap: %s\0A\00"
@MAP_PRIVATE = global i32 0
@.str.4 = [26 x i8] c"child: Error at mmap: %s\0A\00"
@.str.7 = [21 x i8] c"Error at fork(): %s\0A\00"
@WUNTRACED = global i32 0
@str = [63 x i8] c"mmap with MAP_SHARED failed to propagate change into the child\00"
@str.9 = [12 x i8] c"Test PASSED\00"
@str.10 = [24 x i8] c"Child exited abnormally\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 %79
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 %79
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_SHARED
%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 ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %40)
br label %79
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 ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %54)
br label %79
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 ([12 x i8], [12 x i8]* @str.9, i64 0, i64 0))
br label %79
61: ; preds = %56
%62 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str, i64 0, i64 0))
br label %79
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.7, i64 0, i64 0), i8* %65)
br label %79
67: ; preds = %42
%68 = load i32, i32* @WUNTRACED
%69 = call i32 @waitpid(i32 %43, i32* %2, i32 %68)
%70 = call i32 @munmap(i8* %35, i64 1024)
%71 = load i32, i32* %2
%72 = call i32 @WIFEXITED(i32 %71)
%73 = icmp eq i32 %72, 0
br i1 %73, label %77, label %74
74: ; preds = %67
%75 = load i32, i32* %2
%76 = call i32 @WEXITSTATUS(i32 %75)
br label %79
77: ; preds = %67
%78 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.10, i64 0, i64 0))
br label %79
79: ; preds = %77, %74, %63, %61, %59, %52, %38, %26, %18
%80 = phi i32 [ 2, %18 ], [ 2, %26 ], [ 1, %38 ], [ %76, %74 ], [ 2, %77 ], [ 2, %63 ], [ 1, %52 ], [ 0, %59 ], [ 1, %61 ]
ret i32 %80
}