#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 */
struct flock {
  int l_len;
  scalar_t__ l_start;
  int /*<<< orphan*/ l_whence;
  int /*<<< orphan*/ l_type;
};

/* Variables and functions */
int /*<<< orphan*/ F_SETLK;
int /*<<< orphan*/ F_WRLCK;
scalar_t__ MAP_FAILED;
int /*<<< orphan*/ MAP_PRIVATE;
int /*<<< orphan*/ O_RDWR;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ SEEK_SET;
int WEXITSTATUS(int);
int /*<<< orphan*/ WIFEXITED(int);
int WTERMSIG(int);
int /*<<< orphan*/ err(int, char *, ...);
int /*<<< orphan*/ errx(int, char *, ...);
int /*<<< orphan*/ exit(int);
scalar_t__ fcntl(int, int /*<<< orphan*/, struct flock *);
int fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ getpagesize();
scalar_t__ mmap(int /*<<< orphan*/ *, int /*<<< orphan*/, int,
                int /*<<< orphan*/, int, int /*<<< orphan*/);
int open(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int wait(int *);
int main(int argc, char *argv[]) {
  struct flock fl;
  const char *file = "mmap_fcntl_bug.c";
  int fd, status;
  if (!file)
    errx(1, "Usage: %s <normal-file>", argv[0]);
  fd = open(file, O_RDWR);
  if (fd < 0)
    err(1, "Opening %s", file);
  fl.l_type = F_WRLCK;
  fl.l_whence = SEEK_SET;
  fl.l_start = 0;
  fl.l_len = 1;
  if (fcntl(fd, F_SETLK, &fl) != 0)
    err(1, "Locking %s", file);
  if (mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0) ==
      MAP_FAILED)
    err(1, "mmap of %s", file);
  switch (fork()) {
  case 0:
    if (fcntl(fd, F_SETLK, &fl) == 0)
      exit(1);
    exit(0);
  case -1:
    err(1, "Fork failed");
  }
  if (wait(&status) == -1)
    err(1, "Child vanished?");
  if (!WIFEXITED(status))
    errx(1, "Child died with signal %i", WTERMSIG(status));
  switch (WEXITSTATUS(status)) {
  case 1:
    errx(1, "Child got lock, we must have dropped it (TEST FAILED)");
  case 0:
    fprintf(stderr, "Child exited with zero (TEST PASSED).\n");
    return 0;
  default:
    errx(1, "Child weird exit status %i", WEXITSTATUS(status));
  }
}


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)
lea    0xe13(%rip),%rax
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1216 <main+0x46>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    $0x1,%edi
lea    0xe02(%rip),%rsi
mov    $0x0,%al
call   1050 <errx@plt>
mov    -0x30(%rbp),%rdi
mov    0x2dbf(%rip),%rax
mov    (%rax),%esi
call   10a0 <open@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    124c <main+0x7c>
mov    -0x30(%rbp),%rdx
mov    $0x1,%edi
lea    0xde4(%rip),%rsi
mov    $0x0,%al
call   1070 <err@plt>
mov    0x2d5d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    0x2d61(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x1,-0x28(%rbp)
mov    -0x34(%rbp),%edi
mov    0x2d5b(%rip),%rax
mov    (%rax),%esi
lea    -0x28(%rbp),%rdx
call   1030 <fcntl@plt>
cmp    $0x0,%rax
je     12a9 <main+0xd9>
mov    -0x30(%rbp),%rdx
mov    $0x1,%edi
lea    0xd92(%rip),%rsi
mov    $0x0,%al
call   1070 <err@plt>
mov    $0x0,%al
call   10b0 <getpagesize@plt>
mov    %eax,%esi
mov    0x2d3f(%rip),%rax
mov    (%rax),%edx
mov    0x2cf6(%rip),%rax
or     (%rax),%edx
mov    0x2cdd(%rip),%rax
mov    (%rax),%ecx
mov    -0x34(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    0x2cbc(%rip),%rcx
cmp    (%rcx),%rax
jne    1304 <main+0x134>
mov    -0x30(%rbp),%rdx
mov    $0x1,%edi
lea    0xd42(%rip),%rsi
mov    $0x0,%al
call   1070 <err@plt>
xor    %eax,%eax
call   10f0 <fork@plt>
mov    %eax,%ecx
mov    %ecx,-0x3c(%rbp)
sub    $0xffffffff,%eax
je     135e <main+0x18e>
jmp    131e <main+0x14e>
mov    -0x3c(%rbp),%eax
test   %eax,%eax
jne    1371 <main+0x1a1>
jmp    132e <main+0x15e>
mov    -0x34(%rbp),%edi
mov    0x2ca0(%rip),%rax
mov    (%rax),%esi
lea    -0x28(%rbp),%rdx
call   1030 <fcntl@plt>
cmp    $0x0,%rax
jne    1357 <main+0x187>
mov    $0x1,%edi
call   10d0 <exit@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
mov    $0x1,%edi
lea    0xce0(%rip),%rsi
mov    $0x0,%al
call   1070 <err@plt>
lea    -0x38(%rbp),%rdi
call   10e0 <wait@plt>
cmp    $0xffffffff,%eax
jne    1396 <main+0x1c6>
mov    $0x1,%edi
lea    0xcc7(%rip),%rsi
mov    $0x0,%al
call   1070 <err@plt>
mov    -0x38(%rbp),%edi
call   10c0 <WIFEXITED@plt>
cmp    $0x0,%eax
jne    13c4 <main+0x1f4>
mov    -0x38(%rbp),%edi
call   1080 <WTERMSIG@plt>
mov    %eax,%edx
mov    $0x1,%edi
lea    0xca9(%rip),%rsi
mov    $0x0,%al
call   1050 <errx@plt>
mov    -0x38(%rbp),%edi
call   1090 <WEXITSTATUS@plt>
mov    %eax,%ecx
mov    %ecx,-0x40(%rbp)
test   %eax,%eax
je     1402 <main+0x232>
jmp    13de <main+0x20e>
mov    -0x40(%rbp),%eax
sub    $0x1,%eax
jne    1423 <main+0x253>
jmp    13ef <main+0x21f>
mov    $0x1,%edi
lea    0xc85(%rip),%rsi
mov    $0x0,%al
call   1050 <errx@plt>
mov    0x2bbf(%rip),%rax
mov    (%rax),%edi
lea    0xca4(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1440 <main+0x270>
mov    -0x38(%rbp),%edi
call   1090 <WEXITSTATUS@plt>
mov    %eax,%edx
mov    $0x1,%edi
lea    0xca4(%rip),%rsi
mov    $0x0,%al
call   1050 <errx@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    0x2e02(%rip),%rax
mov    (%rax),%esi
lea    0xe19(%rip),%rdi
call   10a0 <open@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    120c <main+0x3c>
lea    0xe18(%rip),%rsi
lea    0xe00(%rip),%rdx
mov    $0x1,%edi
xor    %eax,%eax
call   1070 <err@plt>
mov    0x2d9d(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x24(%rsp)
mov    0x2da0(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x20(%rsp)
movq   $0x0,0x18(%rsp)
movl   $0x1,0x10(%rsp)
mov    0x2d9a(%rip),%r14
mov    (%r14),%esi
lea    0x10(%rsp),%rdx
mov    %ebx,%edi
call   1030 <fcntl@plt>
test   %rax,%rax
je     126c <main+0x9c>
lea    0xdc3(%rip),%rsi
lea    0xda0(%rip),%rdx
mov    $0x1,%edi
xor    %eax,%eax
call   1070 <err@plt>
xor    %eax,%eax
call   10b0 <getpagesize@plt>
mov    0x2d7e(%rip),%rcx
mov    0x2d37(%rip),%rdx
mov    (%rdx),%edx
or     (%rcx),%edx
mov    0x2d1c(%rip),%rcx
mov    (%rcx),%ecx
xor    %edi,%edi
mov    %eax,%esi
mov    %ebx,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    0x2cfc(%rip),%rcx
cmp    (%rcx),%rax
jne    12c3 <main+0xf3>
lea    0xd77(%rip),%rsi
lea    0xd49(%rip),%rdx
mov    $0x1,%edi
xor    %eax,%eax
call   1070 <err@plt>
xor    %eax,%eax
call   10f0 <fork@plt>
cmp    $0xffffffff,%eax
je     12f5 <main+0x125>
test   %eax,%eax
jne    1308 <main+0x138>
mov    (%r14),%esi
lea    0x10(%rsp),%rdx
mov    %ebx,%edi
call   1030 <fcntl@plt>
test   %rax,%rax
jne    13b9 <main+0x1e9>
mov    $0x1,%edi
call   10d0 <exit@plt>
lea    0xd36(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1070 <err@plt>
lea    0xc(%rsp),%rdi
call   10e0 <wait@plt>
cmp    $0xffffffff,%eax
jne    132a <main+0x15a>
lea    0xd20(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1070 <err@plt>
mov    0xc(%rsp),%edi
call   10c0 <WIFEXITED@plt>
test   %eax,%eax
jne    1355 <main+0x185>
mov    0xc(%rsp),%edi
call   1080 <WTERMSIG@plt>
lea    0xd07(%rip),%rsi
mov    $0x1,%edi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <errx@plt>
mov    0xc(%rsp),%edi
call   1090 <WEXITSTATUS@plt>
test   %eax,%eax
je     137a <main+0x1aa>
cmp    $0x1,%eax
jne    1391 <main+0x1c1>
lea    0xcfa(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1050 <errx@plt>
mov    0x2c47(%rip),%rax
mov    (%rax),%edi
lea    0xd14(%rip),%rsi
call   1060 <fprintf@plt>
jmp    13af <main+0x1df>
mov    0xc(%rsp),%edi
call   1090 <WEXITSTATUS@plt>
lea    0xd24(%rip),%rsi
mov    $0x1,%edi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <errx@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret
xor    %edi,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
%struct.flock = type { i32, i64, i32, i32 }
@.str = [17 x i8] c"mmap_fcntl_bug.c\00"
@.str.1 = [24 x i8] c"Usage: %s <normal-file>\00"
@O_RDWR = global i32 0
@.str.2 = [11 x i8] c"Opening %s\00"
@F_WRLCK = global i32 0
@SEEK_SET = global i32 0
@F_SETLK = global i32 0
@.str.3 = [11 x i8] c"Locking %s\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_FAILED = global i64 0
@.str.4 = [11 x i8] c"mmap of %s\00"
@.str.5 = [12 x i8] c"Fork failed\00"
@.str.6 = [16 x i8] c"Child vanished?\00"
@.str.7 = [26 x i8] c"Child died with signal %i\00"
@.str.8 = [54 x i8] c"Child got lock, we must have dropped it (TEST FAILED)\00"
@stderr = global i32 0
@.str.9 = [39 x i8] c"Child exited with zero (TEST PASSED).\0A\00"
@.str.10 = [27 x i8] c"Child weird exit status %i\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.flock
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8** %7
%10 = load i8*, i8** %7
%11 = icmp ne i8* %10, null
br i1 %11, label %17, label %12
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %15)
br label %17
17: ; preds = %12, %2
%18 = load i8*, i8** %7
%19 = load i32, i32* @O_RDWR
%20 = call i32 @open(i8* %18, i32 %19)
store i32 %20, i32* %8
%21 = load i32, i32* %8
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %17
%24 = load i8*, i8** %7
%25 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %24)
br label %26
26: ; preds = %23, %17
%27 = load i32, i32* @F_WRLCK
%28 = getelementptr inbounds %struct.flock, %struct.flock* %6, i32 0, i32 3
store i32 %27, i32* %28
%29 = load i32, i32* @SEEK_SET
%30 = getelementptr inbounds %struct.flock, %struct.flock* %6, i32 0, i32 2
store i32 %29, i32* %30
%31 = getelementptr inbounds %struct.flock, %struct.flock* %6, i32 0, i32 1
store i64 0, i64* %31
%32 = getelementptr inbounds %struct.flock, %struct.flock* %6, i32 0, i32 0
store i32 1, i32* %32
%33 = load i32, i32* %8
%34 = load i32, i32* @F_SETLK
%35 = call i64 @fcntl(i32 %33, i32 %34, %struct.flock* %6)
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %40
37: ; preds = %26
%38 = load i8*, i8** %7
%39 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %38)
br label %40
40: ; preds = %37, %26
%41 = call i32 (...) @getpagesize()
%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* %8
%47 = call i64 @mmap(i32* null, i32 %41, i32 %44, i32 %45, i32 %46, i32 0)
%48 = load i64, i64* @MAP_FAILED
%49 = icmp eq i64 %47, %48
br i1 %49, label %50, label %53
50: ; preds = %40
%51 = load i8*, i8** %7
%52 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %51)
br label %53
53: ; preds = %50, %40
%54 = call i32 (...) @fork()
switch i32 %54, label %66 [
i32 0, label %55
i32 -1, label %64
]
55: ; preds = %53
%56 = load i32, i32* %8
%57 = load i32, i32* @F_SETLK
%58 = call i64 @fcntl(i32 %56, i32 %57, %struct.flock* %6)
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %62
60: ; preds = %55
%61 = call i32 @exit(i32 1)
unreachable
62: ; preds = %55
%63 = call i32 @exit(i32 0)
unreachable
64: ; preds = %53
%65 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
br label %66
66: ; preds = %64, %53
%67 = call i32 @wait(i32* %9)
%68 = icmp eq i32 %67, -1
br i1 %68, label %69, label %71
69: ; preds = %66
%70 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
br label %71
71: ; preds = %69, %66
%72 = load i32, i32* %9
%73 = call i32 @WIFEXITED(i32 %72)
%74 = icmp ne i32 %73, 0
br i1 %74, label %79, label %75
75: ; preds = %71
%76 = load i32, i32* %9
%77 = call i32 @WTERMSIG(i32 %76)
%78 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i32 %77)
br label %79
79: ; preds = %75, %71
%80 = load i32, i32* %9
%81 = call i32 @WEXITSTATUS(i32 %80)
switch i32 %81, label %87 [
i32 1, label %82
i32 0, label %84
]
82: ; preds = %79
%83 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.8, i64 0, i64 0))
br label %84
84: ; preds = %79, %82
%85 = load i32, i32* @stderr
%86 = call i32 @fprintf(i32 %85, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.9, i64 0, i64 0))
store i32 0, i32* %3
br label %91
87: ; preds = %79
%88 = load i32, i32* %9
%89 = call i32 @WEXITSTATUS(i32 %88)
%90 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0), i32 %89)
br label %91
91: ; preds = %84, %87
%92 = load i32, i32* %3
ret i32 %92
}

LLVM IR (-O2):
%struct.flock = type { i32, i64, i32, i32 }
@.str = [17 x i8] c"mmap_fcntl_bug.c\00"
@O_RDWR = global i32 0
@.str.2 = [11 x i8] c"Opening %s\00"
@F_WRLCK = global i32 0
@SEEK_SET = global i32 0
@F_SETLK = global i32 0
@.str.3 = [11 x i8] c"Locking %s\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_FAILED = global i64 0
@.str.4 = [11 x i8] c"mmap of %s\00"
@.str.5 = [12 x i8] c"Fork failed\00"
@.str.6 = [16 x i8] c"Child vanished?\00"
@.str.7 = [26 x i8] c"Child died with signal %i\00"
@.str.8 = [54 x i8] c"Child got lock, we must have dropped it (TEST FAILED)\00"
@stderr = global i32 0
@.str.9 = [39 x i8] c"Child exited with zero (TEST PASSED).\0A\00"
@.str.10 = [27 x i8] c"Child weird exit status %i\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.flock
%4 = alloca i32
%5 = bitcast %struct.flock* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = load i32, i32* @O_RDWR
%8 = tail call i32 @open(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = tail call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %2
%13 = load i32, i32* @F_WRLCK
%14 = getelementptr inbounds %struct.flock, %struct.flock* %3, i64 0, i32 3
store i32 %13, i32* %14
%15 = load i32, i32* @SEEK_SET
%16 = getelementptr inbounds %struct.flock, %struct.flock* %3, i64 0, i32 2
store i32 %15, i32* %16
%17 = getelementptr inbounds %struct.flock, %struct.flock* %3, i64 0, i32 1
store i64 0, i64* %17
%18 = getelementptr inbounds %struct.flock, %struct.flock* %3, i64 0, i32 0
store i32 1, i32* %18
%19 = load i32, i32* @F_SETLK
%20 = call i64 @fcntl(i32 %8, i32 %19, %struct.flock* %3)
%21 = icmp eq i64 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %12
%23 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %24
24: ; preds = %22, %12
%25 = call i32 (...) @getpagesize()
%26 = load i32, i32* @PROT_READ
%27 = load i32, i32* @PROT_WRITE
%28 = or i32 %27, %26
%29 = load i32, i32* @MAP_PRIVATE
%30 = call i64 @mmap(i32* null, i32 %25, i32 %28, i32 %29, i32 %8, i32 0)
%31 = load i64, i64* @MAP_FAILED
%32 = icmp eq i64 %30, %31
br i1 %32, label %33, label %35
33: ; preds = %24
%34 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %35
35: ; preds = %33, %24
%36 = call i32 (...) @fork()
switch i32 %36, label %47 [
i32 0, label %37
i32 -1, label %45
]
37: ; preds = %35
%38 = load i32, i32* @F_SETLK
%39 = call i64 @fcntl(i32 %8, i32 %38, %struct.flock* %3)
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %37
%42 = call i32 @exit(i32 1)
unreachable
43: ; preds = %37
%44 = call i32 @exit(i32 0)
unreachable
45: ; preds = %35
%46 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
br label %47
47: ; preds = %45, %35
%48 = call i32 @wait(i32* %4)
%49 = icmp eq i32 %48, -1
br i1 %49, label %50, label %52
50: ; preds = %47
%51 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
br label %52
52: ; preds = %50, %47
%53 = load i32, i32* %4
%54 = call i32 @WIFEXITED(i32 %53)
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %60
56: ; preds = %52
%57 = load i32, i32* %4
%58 = call i32 @WTERMSIG(i32 %57)
%59 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i32 %58)
br label %60
60: ; preds = %56, %52
%61 = load i32, i32* %4
%62 = call i32 @WEXITSTATUS(i32 %61)
switch i32 %62, label %68 [
i32 1, label %63
i32 0, label %65
]
63: ; preds = %60
%64 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.8, i64 0, i64 0))
br label %65
65: ; preds = %60, %63
%66 = load i32, i32* @stderr
%67 = call i32 @fprintf(i32 %66, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.9, i64 0, i64 0))
br label %72
68: ; preds = %60
%69 = load i32, i32* %4
%70 = call i32 @WEXITSTATUS(i32 %69)
%71 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0), i32 %70)
br label %72
72: ; preds = %68, %65
ret i32 0
}