#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*/ sigset_t;
typedef int /*<<< orphan*/ c;

/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ SIG_SETMASK;
int /*<<< orphan*/ _exit(int);
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ chdir(char *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ closefrom(int);
int dup2(int, int);
int /*<<< orphan*/ exit(int);
int fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int open(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ process_owner(int);
int receive_message(int, char *, int, int *, int *);
int setsid();
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
int /*<<< orphan*/ sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *,
                               int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int strtol(char *, char **, int);
int /*<<< orphan*/ waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int nullfd;
  char *end;
  int cfd;
  sigset_t empty;
  if (argc != 2 || !argv[1][0])
    goto out_inval;
  cfd = strtol(argv[1], &end, 10);
  if (*end)
    goto out_inval;
  switch (fork()) {
  case -1:
    perror("ulockmgr_server: fork");
    exit(1);
  case 0:
    break;
  default:
    _exit(0);
  }
  if (setsid() == -1) {
    perror("ulockmgr_server: setsid");
    exit(1);
  }
  (void)chdir("/");
  sigemptyset(&empty);
  sigprocmask(SIG_SETMASK, &empty, NULL);
  if (dup2(cfd, 4) == -1) {
    perror("ulockmgr_server: dup2");
    exit(1);
  }
  cfd = 4;
  nullfd = open("/dev/null", O_RDWR, 0644);
  if (nullfd >= 0) {
    dup2(nullfd, 0);
    dup2(nullfd, 1);
  }
  close(3);
  closefrom(5);
  while (1) {
    char c;
    int sock;
    int pid;
    int numfds = 1;
    int res = receive_message(cfd, &c, sizeof(c), &sock, &numfds);
    if (!res)
      break;
    if (res == -1)
      exit(1);
    assert(numfds == 1);
    pid = fork();
    if (pid == -1) {
      perror("ulockmgr_server: fork");
      close(sock);
      continue;
    }
    if (pid == 0) {
      close(cfd);
      pid = fork();
      if (pid == -1) {
        perror("ulockmgr_server: fork");
        _exit(1);
      }
      if (pid == 0)
        process_owner(sock);
      _exit(0);
    }
    waitpid(pid, NULL, 0);
    close(sock);
  }
  return 0;
out_inval:
  fprintf(stderr, "%s should be started by libulockmgr\n", argv[0]);
  return 1;
}


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)
cmpl   $0x2,-0x8(%rbp)
jne    1251 <main+0x31>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
cmpb   $0x0,(%rax)
jne    1256 <main+0x36>
jmp    14a3 <main+0x283>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   10e0 <strtol@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rax
cmpb   $0x0,(%rax)
je     1281 <main+0x61>
jmp    14a3 <main+0x283>
xor    %eax,%eax
call   1140 <fork@plt>
mov    %eax,%ecx
mov    %ecx,-0x40(%rbp)
sub    $0xffffffff,%eax
je     12ab <main+0x8b>
jmp    129b <main+0x7b>
mov    -0x40(%rbp),%eax
test   %eax,%eax
je     12c1 <main+0xa1>
jmp    12c6 <main+0xa6>
lea    0xd4e(%rip),%rdi
call   1120 <perror@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
jmp    12cd <main+0xad>
xor    %edi,%edi
call   1040 <_exit@plt>
mov    $0x0,%al
call   10a0 <setsid@plt>
cmp    $0xffffffff,%eax
jne    12f3 <main+0xd3>
lea    0xd32(%rip),%rdi
call   1120 <perror@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
lea    0xd34(%rip),%rdi
call   1070 <chdir@plt>
lea    -0x28(%rbp),%rdi
call   10d0 <sigemptyset@plt>
mov    0x2cd1(%rip),%rax
mov    (%rax),%edi
lea    -0x28(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigprocmask@plt>
mov    -0x24(%rbp),%edi
mov    $0x4,%esi
call   1080 <dup2@plt>
cmp    $0xffffffff,%eax
jne    134a <main+0x12a>
lea    0xcf5(%rip),%rdi
call   1120 <perror@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
movl   $0x4,-0x24(%rbp)
mov    0x2c90(%rip),%rax
mov    (%rax),%esi
lea    0xce5(%rip),%rdi
mov    $0x1a4,%edx
call   1110 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     138f <main+0x16f>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1080 <dup2@plt>
mov    -0x14(%rbp),%edi
mov    $0x1,%esi
call   1080 <dup2@plt>
mov    $0x3,%edi
call   1090 <close@plt>
mov    $0x5,%edi
call   1050 <closefrom@plt>
movl   $0x1,-0x38(%rbp)
mov    -0x24(%rbp),%edi
lea    -0x29(%rbp),%rsi
mov    $0x1,%edx
lea    -0x30(%rbp),%rcx
lea    -0x38(%rbp),%r8
call   10f0 <receive_message@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jne    13d5 <main+0x1b5>
jmp    1497 <main+0x277>
cmpl   $0xffffffff,-0x3c(%rbp)
jne    13e9 <main+0x1c9>
mov    $0x1,%edi
call   1130 <exit@plt>
cmpl   $0x1,-0x38(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10b0 <assert@plt>
mov    $0x0,%al
call   1140 <fork@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    1427 <main+0x207>
lea    0xbeb(%rip),%rdi
call   1120 <perror@plt>
mov    -0x30(%rbp),%edi
call   1090 <close@plt>
jmp    13a3 <main+0x183>
cmpl   $0x0,-0x34(%rbp)
jne    147c <main+0x25c>
mov    -0x24(%rbp),%edi
call   1090 <close@plt>
mov    $0x0,%al
call   1140 <fork@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    1463 <main+0x243>
lea    0xbac(%rip),%rdi
call   1120 <perror@plt>
mov    $0x1,%edi
call   1040 <_exit@plt>
cmpl   $0x0,-0x34(%rbp)
jne    1475 <main+0x255>
mov    -0x30(%rbp),%edi
call   1060 <process_owner@plt>
xor    %edi,%edi
call   1040 <_exit@plt>
mov    -0x34(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1100 <waitpid@plt>
mov    -0x30(%rbp),%edi
call   1090 <close@plt>
jmp    13a3 <main+0x183>
movl   $0x0,-0x4(%rbp)
jmp    14c6 <main+0x2a6>
mov    0x2b26(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xb96(%rip),%rsi
call   10c0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    1258 <main+0x38>
mov    0x8(%rbx),%rdi
cmpb   $0x0,(%rdi)
je     1258 <main+0x38>
lea    0x10(%rsp),%rsi
mov    $0xa,%edx
call   10e0 <strtol@plt>
mov    %eax,%ebp
mov    0x10(%rsp),%rax
cmpb   $0x0,(%rax)
je     1282 <main+0x62>
mov    0x2d71(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xde5(%rip),%rsi
call   10c0 <fprintf@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
call   1140 <fork@plt>
test   %eax,%eax
jne    1400 <main+0x1e0>
xor    %eax,%eax
call   10a0 <setsid@plt>
cmp    $0xffffffff,%eax
je     140e <main+0x1ee>
lea    0xd86(%rip),%rdi
call   1070 <chdir@plt>
lea    0x1c(%rsp),%rbx
mov    %rbx,%rdi
call   10d0 <sigemptyset@plt>
mov    0x2d1f(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
mov    %ebp,%edi
mov    $0x4,%esi
call   1080 <dup2@plt>
cmp    $0xffffffff,%eax
je     1417 <main+0x1f7>
mov    0x2cff(%rip),%rax
mov    (%rax),%esi
lea    0xd54(%rip),%rdi
mov    $0x1a4,%edx
call   1110 <open@plt>
test   %eax,%eax
js     1317 <main+0xf7>
mov    %eax,%ebx
mov    %eax,%edi
xor    %esi,%esi
call   1080 <dup2@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1080 <dup2@plt>
mov    $0x3,%edi
call   1090 <close@plt>
mov    $0x5,%edi
call   1050 <closefrom@plt>
lea    0x7(%rsp),%r14
lea    0xc(%rsp),%r15
lea    0x8(%rsp),%rbx
lea    0xcbf(%rip),%r12
jmp    1359 <main+0x139>
mov    %r12,%rdi
call   1120 <perror@plt>
nopl   0x0(%rax,%rax,1)
mov    0xc(%rsp),%edi
call   1090 <close@plt>
movl   $0x1,0x8(%rsp)
mov    $0x4,%edi
mov    %r14,%rsi
mov    $0x1,%edx
mov    %r15,%rcx
mov    %rbx,%r8
call   10f0 <receive_message@plt>
test   %eax,%eax
je     13af <main+0x18f>
cmp    $0xffffffff,%eax
je     13b6 <main+0x196>
xor    %edi,%edi
cmpl   $0x1,0x8(%rsp)
sete   %dil
call   10b0 <assert@plt>
xor    %eax,%eax
call   1140 <fork@plt>
cmp    $0xffffffff,%eax
je     1343 <main+0x123>
test   %eax,%eax
je     13c0 <main+0x1a0>
mov    %eax,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1100 <waitpid@plt>
jmp    1350 <main+0x130>
xor    %eax,%eax
jmp    1275 <main+0x55>
mov    $0x1,%edi
call   1130 <exit@plt>
mov    $0x4,%edi
call   1090 <close@plt>
xor    %eax,%eax
call   1140 <fork@plt>
test   %eax,%eax
je     13f0 <main+0x1d0>
cmp    $0xffffffff,%eax
jne    13f9 <main+0x1d9>
lea    0xc1f(%rip),%rdi
call   1120 <perror@plt>
mov    $0x1,%edi
call   1040 <_exit@plt>
mov    0xc(%rsp),%edi
call   1060 <process_owner@plt>
xor    %edi,%edi
call   1040 <_exit@plt>
cmp    $0xffffffff,%eax
jne    13f9 <main+0x1d9>
lea    0xbf4(%rip),%rdi
jmp    141e <main+0x1fe>
lea    0xc01(%rip),%rdi
jmp    141e <main+0x1fe>
lea    0xc12(%rip),%rdi
call   1120 <perror@plt>
mov    $0x1,%edi
call   1130 <exit@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"ulockmgr_server: fork\00"
@.str.1 = [24 x i8] c"ulockmgr_server: setsid\00"
@.str.2 = [2 x i8] c"/\00"
@SIG_SETMASK = global i32 0
@.str.3 = [22 x i8] c"ulockmgr_server: dup2\00"
@.str.4 = [10 x i8] c"/dev/null\00"
@O_RDWR = global i32 0
@stderr = global i32 0
@.str.5 = [37 x i8] c"%s should be started by libulockmgr\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 2
br i1 %16, label %24, label %17
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = getelementptr inbounds i8, i8* %20, i64 0
%22 = load i8, i8* %21
%23 = icmp ne i8 %22, 0
br i1 %23, label %25, label %24
24: ; preds = %17, %2
br label %121
25: ; preds = %17
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32 @strtol(i8* %28, i8** %7, i32 10)
store i32 %29, i32* %8
%30 = load i8*, i8** %7
%31 = load i8, i8* %30
%32 = icmp ne i8 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %25
br label %121
34: ; preds = %25
%35 = call i32 (...) @fork()
switch i32 %35, label %40 [
i32 -1, label %36
i32 0, label %39
]
36: ; preds = %34
%37 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%38 = call i32 @exit(i32 1)
unreachable
39: ; preds = %34
br label %42
40: ; preds = %34
%41 = call i32 @_exit(i32 0)
unreachable
42: ; preds = %39
%43 = call i32 (...) @setsid()
%44 = icmp eq i32 %43, -1
br i1 %44, label %45, label %48
45: ; preds = %42
%46 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%47 = call i32 @exit(i32 1)
unreachable
48: ; preds = %42
%49 = call i32 @chdir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%50 = call i32 @sigemptyset(i32* %9)
%51 = load i32, i32* @SIG_SETMASK
%52 = call i32 @sigprocmask(i32 %51, i32* %9, i32* null)
%53 = load i32, i32* %8
%54 = call i32 @dup2(i32 %53, i32 4)
%55 = icmp eq i32 %54, -1
br i1 %55, label %56, label %59
56: ; preds = %48
%57 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%58 = call i32 @exit(i32 1)
unreachable
59: ; preds = %48
store i32 4, i32* %8
%60 = load i32, i32* @O_RDWR
%61 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %60, i32 420)
store i32 %61, i32* %6
%62 = load i32, i32* %6
%63 = icmp sge i32 %62, 0
br i1 %63, label %64, label %69
64: ; preds = %59
%65 = load i32, i32* %6
%66 = call i32 @dup2(i32 %65, i32 0)
%67 = load i32, i32* %6
%68 = call i32 @dup2(i32 %67, i32 1)
br label %69
69: ; preds = %64, %59
%70 = call i32 @close(i32 3)
%71 = call i32 @closefrom(i32 5)
br label %72
72: ; preds = %69, %91, %115
store i32 1, i32* %13
%73 = load i32, i32* %8
%74 = call i32 @receive_message(i32 %73, i8* %10, i32 1, i32* %11, i32* %13)
store i32 %74, i32* %14
%75 = load i32, i32* %14
%76 = icmp ne i32 %75, 0
br i1 %76, label %78, label %77
77: ; preds = %72
br label %120
78: ; preds = %72
%79 = load i32, i32* %14
%80 = icmp eq i32 %79, -1
br i1 %80, label %81, label %83
81: ; preds = %78
%82 = call i32 @exit(i32 1)
unreachable
83: ; preds = %78
%84 = load i32, i32* %13
%85 = icmp eq i32 %84, 1
%86 = zext i1 %85 to i32
%87 = call i32 @assert(i32 %86)
%88 = call i32 (...) @fork()
store i32 %88, i32* %12
%89 = load i32, i32* %12
%90 = icmp eq i32 %89, -1
br i1 %90, label %91, label %95
91: ; preds = %83
%92 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%93 = load i32, i32* %11
%94 = call i32 @close(i32 %93)
br label %72
95: ; preds = %83
%96 = load i32, i32* %12
%97 = icmp eq i32 %96, 0
br i1 %97, label %98, label %115
98: ; preds = %95
%99 = load i32, i32* %8
%100 = call i32 @close(i32 %99)
%101 = call i32 (...) @fork()
store i32 %101, i32* %12
%102 = load i32, i32* %12
%103 = icmp eq i32 %102, -1
br i1 %103, label %104, label %107
104: ; preds = %98
%105 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%106 = call i32 @_exit(i32 1)
unreachable
107: ; preds = %98
%108 = load i32, i32* %12
%109 = icmp eq i32 %108, 0
br i1 %109, label %110, label %113
110: ; preds = %107
%111 = load i32, i32* %11
%112 = call i32 @process_owner(i32 %111)
br label %113
113: ; preds = %110, %107
%114 = call i32 @_exit(i32 0)
unreachable
115: ; preds = %95
%116 = load i32, i32* %12
%117 = call i32 @waitpid(i32 %116, i32* null, i32 0)
%118 = load i32, i32* %11
%119 = call i32 @close(i32 %118)
br label %72
120: ; preds = %77
store i32 0, i32* %3
br label %127
121: ; preds = %33, %24
%122 = load i32, i32* @stderr
%123 = load i8**, i8*** %5
%124 = getelementptr inbounds i8*, i8** %123, i64 0
%125 = load i8*, i8** %124
%126 = call i32 @fprintf(i32 %122, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i8* %125)
store i32 1, i32* %3
br label %127
127: ; preds = %121, %120
%128 = load i32, i32* %3
ret i32 %128
}

LLVM IR (-O2):
@.str = [22 x i8] c"ulockmgr_server: fork\00"
@.str.1 = [24 x i8] c"ulockmgr_server: setsid\00"
@.str.2 = [2 x i8] c"/\00"
@SIG_SETMASK = global i32 0
@.str.3 = [22 x i8] c"ulockmgr_server: dup2\00"
@.str.4 = [10 x i8] c"/dev/null\00"
@O_RDWR = global i32 0
@stderr = global i32 0
@.str.5 = [37 x i8] c"%s should be started by libulockmgr\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
%6 = alloca i32
%7 = alloca i32
%8 = bitcast i8** %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = icmp eq i32 %0, 2
br i1 %10, label %11, label %85
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %85, label %16
16: ; preds = %11
%17 = call i32 @strtol(i8* %13, i8** %3, i32 10)
%18 = load i8*, i8** %3
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
br i1 %20, label %21, label %85
21: ; preds = %16
%22 = tail call i32 (...) @fork()
switch i32 %22, label %26 [
i32 -1, label %23
i32 0, label %28
]
23: ; preds = %21
%24 = tail call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%25 = tail call i32 @exit(i32 1)
unreachable
26: ; preds = %21
%27 = tail call i32 @_exit(i32 0)
unreachable
28: ; preds = %21
%29 = tail call i32 (...) @setsid()
%30 = icmp eq i32 %29, -1
br i1 %30, label %31, label %34
31: ; preds = %28
%32 = tail call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%33 = tail call i32 @exit(i32 1)
unreachable
34: ; preds = %28
%35 = tail call i32 @chdir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%36 = call i32 @sigemptyset(i32* %4)
%37 = load i32, i32* @SIG_SETMASK
%38 = call i32 @sigprocmask(i32 %37, i32* %4, i32* null)
%39 = call i32 @dup2(i32 %17, i32 4)
%40 = icmp eq i32 %39, -1
br i1 %40, label %41, label %44
41: ; preds = %34
%42 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%43 = call i32 @exit(i32 1)
unreachable
44: ; preds = %34
%45 = load i32, i32* @O_RDWR
%46 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %45, i32 420)
%47 = icmp sgt i32 %46, -1
br i1 %47, label %48, label %51
48: ; preds = %44
%49 = call i32 @dup2(i32 %46, i32 0)
%50 = call i32 @dup2(i32 %46, i32 1)
br label %51
51: ; preds = %48, %44
%52 = call i32 @close(i32 3)
%53 = call i32 @closefrom(i32 5)
%54 = bitcast i32* %6 to i8*
%55 = bitcast i32* %7 to i8*
br label %56
56: ; preds = %82, %51
store i32 1, i32* %7
%57 = call i32 @receive_message(i32 4, i8* %5, i32 1, i32* %6, i32* %7)
switch i32 %57, label %61 [
i32 0, label %58
i32 -1, label %59
]
58: ; preds = %56
br label %89
59: ; preds = %56
%60 = call i32 @exit(i32 1)
unreachable
61: ; preds = %56
%62 = load i32, i32* %7
%63 = icmp eq i32 %62, 1
%64 = zext i1 %63 to i32
%65 = call i32 @assert(i32 %64)
%66 = call i32 (...) @fork()
switch i32 %66, label %80 [
i32 -1, label %67
i32 0, label %69
]
67: ; preds = %61
%68 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %82
69: ; preds = %61
%70 = call i32 @close(i32 4)
%71 = call i32 (...) @fork()
switch i32 %71, label %78 [
i32 -1, label %72
i32 0, label %75
]
72: ; preds = %69
%73 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%74 = call i32 @_exit(i32 1)
unreachable
75: ; preds = %69
%76 = load i32, i32* %6
%77 = call i32 @process_owner(i32 %76)
br label %78
78: ; preds = %69, %75
%79 = call i32 @_exit(i32 0)
unreachable
80: ; preds = %61
%81 = call i32 @waitpid(i32 %66, i32* null, i32 0)
br label %82
82: ; preds = %80, %67
%83 = load i32, i32* %6
%84 = call i32 @close(i32 %83)
br label %56
85: ; preds = %16, %2, %11
%86 = load i32, i32* @stderr
%87 = load i8*, i8** %1
%88 = tail call i32 @fprintf(i32 %86, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i8* %87)
br label %89
89: ; preds = %58, %85
%90 = phi i32 [ 1, %85 ], [ 0, %58 ]
ret i32 %90
}