#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 timeval {
  int tv_sec;
  scalar_t__ tv_usec;
};
typedef int pid_t;
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
int EINTR;
int /*<<< orphan*/ FD_SET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int /*<<< orphan*/ SIGINT;
int /*<<< orphan*/ _exit(int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int errno;
int fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ kill(int, int /*<<< orphan*/);
int /*<<< orphan*/ mkdir(char const *, int);
scalar_t__ pipe(int *);
int /*<<< orphan*/ rmdir(char const *);
int select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, struct timeval *);
int /*<<< orphan*/ stderr;
char *strerror(int);
int /*<<< orphan*/ waitpid(int, int *, int /*<<< orphan*/);
int /*<<< orphan*/ write(int, char *, int);
int hang_check(int option, const char *filename) {
  pid_t pid;
  struct timeval tv;
  int ret;
  int status;
  int pipefd[2];
  fd_set readfds;
  tv.tv_sec = (30);
  tv.tv_usec = 0;
  if (pipe(pipefd) < 0) {
    fprintf(stderr, "pipe error\n");
    return (2);
  }
  pid = fork();
  switch (pid) {
  case -1:
    fprintf(stderr, "failed to fork child\n");
    return (2);
  case 0:
    close(pipefd[0]);
    switch (option) {
    case (0):
      mkdir(filename, 0700);
      break;
    case (1):
      rmdir(filename);
      break;
    default:
      break;
    }
    if (write(pipefd[1], "EXIT", 4) < 0)
      fprintf(stderr, "pipe write failed\n");
    close(pipefd[1]);
    _exit(0);
    break;
  default:
    close(pipefd[1]);
    FD_ZERO(&readfds);
    FD_SET(pipefd[0], &readfds);
    ret = select(pipefd[0] + 1, &readfds, NULL, NULL, &tv);
    close(pipefd[0]);
    switch (ret) {
    case 0:
      fprintf(stderr,
              "Timed out after %d seconds doing %s - possible eCryptfs hang\n",
              (30), option == (0) ? "mkdir()" : "rmdir()");
      kill(pid, SIGINT);
      return (1);
    case -1:
      if (errno != EINTR) {
        fprintf(stderr, "Unexpected return from select(): %d %s\n", errno,
                strerror(errno));
        waitpid(pid, &status, 0);
        return (2);
      } else {
        waitpid(pid, &status, 0);
        return (0);
      }
    default:
      waitpid(pid, &status, 0);
      return (0);
    }
  }
}


x86 assembly (clang, -O0):
<hang_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1e,-0x28(%rbp)
movq   $0x0,-0x20(%rbp)
lea    -0x38(%rbp),%rdi
call   1080 <pipe@plt>
cmp    $0x0,%rax
jge    1234 <hang_check+0x54>
mov    0x2dc0(%rip),%rax
mov    (%rax),%edi
lea    0xddf(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1473 <hang_check+0x293>
xor    %eax,%eax
call   1100 <fork@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x40(%rbp)
sub    $0xffffffff,%eax
je     1262 <hang_check+0x82>
jmp    1252 <hang_check+0x72>
mov    -0x40(%rbp),%eax
test   %eax,%eax
je     1285 <hang_check+0xa5>
jmp    131a <hang_check+0x13a>
mov    0x2d6f(%rip),%rax
mov    (%rax),%edi
lea    0xd9a(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1473 <hang_check+0x293>
mov    -0x38(%rbp),%edi
call   1070 <close@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x44(%rbp)
test   %eax,%eax
je     12b1 <hang_check+0xd1>
jmp    12a0 <hang_check+0xc0>
mov    -0x44(%rbp),%eax
sub    $0x1,%eax
je     12c4 <hang_check+0xe4>
jmp    12d2 <hang_check+0xf2>
mov    -0x10(%rbp),%rdi
mov    $0x1c0,%esi
call   1040 <mkdir@plt>
jmp    12d7 <hang_check+0xf7>
mov    -0x10(%rbp),%rdi
call   1060 <rmdir@plt>
jmp    12d7 <hang_check+0xf7>
jmp    12d7 <hang_check+0xf7>
mov    -0x34(%rbp),%edi
lea    0xd41(%rip),%rsi
mov    $0x4,%edx
call   1050 <write@plt>
cmp    $0x0,%eax
jge    130b <hang_check+0x12b>
mov    0x2cdd(%rip),%rax
mov    (%rax),%edi
lea    0xd23(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x34(%rbp),%edi
call   1070 <close@plt>
xor    %edi,%edi
call   1030 <_exit@plt>
mov    -0x34(%rbp),%edi
call   1070 <close@plt>
lea    -0x3c(%rbp),%rdi
mov    %rdi,-0x50(%rbp)
call   10b0 <FD_ZERO@plt>
mov    -0x50(%rbp),%rsi
mov    -0x38(%rbp),%edi
call   10f0 <FD_SET@plt>
mov    -0x50(%rbp),%rsi
mov    -0x38(%rbp),%edi
add    $0x1,%edi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x28(%rbp),%r8
mov    %rcx,%rdx
call   10c0 <select@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x38(%rbp),%edi
call   1070 <close@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x48(%rbp)
sub    $0xffffffff,%eax
je     13d5 <hang_check+0x1f5>
jmp    1374 <hang_check+0x194>
mov    -0x48(%rbp),%eax
test   %eax,%eax
jne    145e <hang_check+0x27e>
jmp    1384 <hang_check+0x1a4>
mov    0x2c4d(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
lea    0xce9(%rip),%rcx
lea    0xcda(%rip),%rax
cmp    $0x0,%edx
cmove  %rax,%rcx
lea    0xc8e(%rip),%rsi
mov    $0x1e,%edx
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x14(%rbp),%edi
mov    0x2c26(%rip),%rax
mov    (%rax),%esi
call   10a0 <kill@plt>
movl   $0x1,-0x4(%rbp)
jmp    1473 <hang_check+0x293>
mov    0x2bf4(%rip),%rax
mov    (%rax),%eax
mov    0x2be3(%rip),%rcx
cmp    (%rcx),%eax
je     1444 <hang_check+0x264>
mov    0x2be4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x58(%rbp)
mov    0x2bd0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
mov    0x2bc4(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x58(%rbp),%edi
mov    -0x54(%rbp),%edx
mov    %rax,%rcx
lea    0xc65(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
xor    %edx,%edx
call   10d0 <waitpid@plt>
movl   $0x2,-0x4(%rbp)
jmp    1473 <hang_check+0x293>
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
xor    %edx,%edx
call   10d0 <waitpid@plt>
movl   $0x0,-0x4(%rbp)
jmp    1473 <hang_check+0x293>
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
xor    %edx,%edx
call   10d0 <waitpid@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hang_check>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbp
mov    %edi,%r14d
movl   $0x1e,0x10(%rsp)
movq   $0x0,0x18(%rsp)
mov    %rsp,%rdi
call   1080 <pipe@plt>
test   %rax,%rax
js     12c5 <hang_check+0xe5>
xor    %eax,%eax
call   1100 <fork@plt>
cmp    $0xffffffff,%eax
je     12d7 <hang_check+0xf7>
mov    %eax,%ebx
test   %eax,%eax
je     135b <hang_check+0x17b>
mov    0x4(%rsp),%edi
call   1070 <close@plt>
lea    0xc(%rsp),%rbp
mov    %rbp,%rdi
call   10b0 <FD_ZERO@plt>
mov    (%rsp),%edi
mov    %rbp,%rsi
call   10f0 <FD_SET@plt>
mov    (%rsp),%edi
add    $0x1,%edi
lea    0x10(%rsp),%r8
mov    %rbp,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   10c0 <select@plt>
mov    %eax,%ebp
mov    (%rsp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%ebp
je     12fe <hang_check+0x11e>
test   %ebp,%ebp
jne    1312 <hang_check+0x132>
mov    0x2d54(%rip),%rax
mov    (%rax),%edi
test   %r14d,%r14d
lea    0xde8(%rip),%rax
lea    0xde9(%rip),%rcx
cmove  %rax,%rcx
lea    0xd98(%rip),%rsi
mov    $0x1e,%edx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x2d33(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   10a0 <kill@plt>
mov    $0x1,%ebp
jmp    12f3 <hang_check+0x113>
mov    0x2d0c(%rip),%rax
mov    (%rax),%edi
lea    0xd2b(%rip),%rsi
jmp    12e7 <hang_check+0x107>
mov    0x2cfa(%rip),%rax
mov    (%rax),%edi
lea    0xd25(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x2,%ebp
mov    %ebp,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2ccb(%rip),%rax
mov    (%rax),%ebp
mov    0x2cba(%rip),%rax
cmp    (%rax),%ebp
jne    1324 <hang_check+0x144>
lea    0x8(%rsp),%rsi
xor    %ebp,%ebp
mov    %ebx,%edi
xor    %edx,%edx
call   10d0 <waitpid@plt>
jmp    12f3 <hang_check+0x113>
mov    0x2cad(%rip),%rax
mov    (%rax),%r14d
mov    %ebp,%edi
call   10e0 <strerror@plt>
lea    0xd4c(%rip),%rsi
mov    %r14d,%edi
mov    %ebp,%edx
mov    %rax,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
lea    0x8(%rsp),%rsi
mov    %ebx,%edi
xor    %edx,%edx
call   10d0 <waitpid@plt>
jmp    12ee <hang_check+0x10e>
mov    (%rsp),%edi
call   1070 <close@plt>
cmp    $0x1,%r14d
je     137d <hang_check+0x19d>
test   %r14d,%r14d
jne    1385 <hang_check+0x1a5>
mov    %rbp,%rdi
mov    $0x1c0,%esi
call   1040 <mkdir@plt>
jmp    1385 <hang_check+0x1a5>
mov    %rbp,%rdi
call   1060 <rmdir@plt>
mov    0x4(%rsp),%edi
lea    0xc92(%rip),%rsi
mov    $0x4,%edx
call   1050 <write@plt>
test   %eax,%eax
jns    13b5 <hang_check+0x1d5>
mov    0x2c33(%rip),%rax
mov    (%rax),%edi
lea    0xc79(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x4(%rsp),%edi
call   1070 <close@plt>
xor    %edi,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
@stderr = global i32 0
@.str = [12 x i8] c"pipe error\0A\00"
@.str.1 = [22 x i8] c"failed to fork child\0A\00"
@.str.2 = [5 x i8] c"EXIT\00"
@.str.3 = [19 x i8] c"pipe write failed\0A\00"
@.str.4 = [62 x i8] c"Timed out after %d seconds doing %s - possible eCryptfs hang\0A\00"
@.str.5 = [8 x i8] c"mkdir()\00"
@.str.6 = [8 x i8] c"rmdir()\00"
@SIGINT = global i32 0
@errno = global i32 0
@EINTR = global i32 0
@.str.7 = [40 x i8] c"Unexpected return from select(): %d %s\0A\00"
define i32 @hang_check(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca %struct.timeval
%8 = alloca i32
%9 = alloca i32
%10 = alloca [2 x i32]
%11 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 0
store i32 30, i32* %12
%13 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 1
store i64 0, i64* %13
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 0
%15 = call i64 @pipe(i32* %14)
%16 = icmp slt i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %2
%18 = load i32, i32* @stderr
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i32 2, i32* %3
br label %95
20: ; preds = %2
%21 = call i32 (...) @fork()
store i32 %21, i32* %6
%22 = load i32, i32* %6
switch i32 %22, label %51 [
i32 -1, label %23
i32 0, label %26
]
23: ; preds = %20
%24 = load i32, i32* @stderr
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
store i32 2, i32* %3
br label %95
26: ; preds = %20
%27 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 0
%28 = load i32, i32* %27
%29 = call i32 @close(i32 %28)
%30 = load i32, i32* %4
switch i32 %30, label %37 [
i32 0, label %31
i32 1, label %34
]
31: ; preds = %26
%32 = load i8*, i8** %5
%33 = call i32 @mkdir(i8* %32, i32 448)
br label %38
34: ; preds = %26
%35 = load i8*, i8** %5
%36 = call i32 @rmdir(i8* %35)
br label %38
37: ; preds = %26
br label %38
38: ; preds = %37, %34, %31
%39 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 1
%40 = load i32, i32* %39
%41 = call i32 @write(i32 %40, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4)
%42 = icmp slt i32 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %38
%44 = load i32, i32* @stderr
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
br label %46
46: ; preds = %43, %38
%47 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 1
%48 = load i32, i32* %47
%49 = call i32 @close(i32 %48)
%50 = call i32 @_exit(i32 0)
unreachable
51: ; preds = %20
%52 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 1
%53 = load i32, i32* %52
%54 = call i32 @close(i32 %53)
%55 = call i32 @FD_ZERO(i32* %11)
%56 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 0
%57 = load i32, i32* %56
%58 = call i32 @FD_SET(i32 %57, i32* %11)
%59 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 0
%60 = load i32, i32* %59
%61 = add nsw i32 %60, 1
%62 = call i32 @select(i32 %61, i32* %11, i32* null, i32* null, %struct.timeval* %7)
store i32 %62, i32* %8
%63 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 0
%64 = load i32, i32* %63
%65 = call i32 @close(i32 %64)
%66 = load i32, i32* %8
switch i32 %66, label %92 [
i32 0, label %67
i32 -1, label %77
]
67: ; preds = %51
%68 = load i32, i32* @stderr
%69 = load i32, i32* %4
%70 = icmp eq i32 %69, 0
%71 = zext i1 %70 to i64
%72 = select i1 %70, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0)
%73 = call i32 (i32, i8*, ...) @fprintf(i32 %68, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.4, i64 0, i64 0), i32 30, i8* %72)
%74 = load i32, i32* %6
%75 = load i32, i32* @SIGINT
%76 = call i32 @kill(i32 %74, i32 %75)
store i32 1, i32* %3
br label %95
77: ; preds = %51
%78 = load i32, i32* @errno
%79 = load i32, i32* @EINTR
%80 = icmp ne i32 %78, %79
br i1 %80, label %81, label %89
81: ; preds = %77
%82 = load i32, i32* @stderr
%83 = load i32, i32* @errno
%84 = load i32, i32* @errno
%85 = call i8* @strerror(i32 %84)
%86 = call i32 (i32, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0), i32 %83, i8* %85)
%87 = load i32, i32* %6
%88 = call i32 @waitpid(i32 %87, i32* %9, i32 0)
store i32 2, i32* %3
br label %95
89: ; preds = %77
%90 = load i32, i32* %6
%91 = call i32 @waitpid(i32 %90, i32* %9, i32 0)
store i32 0, i32* %3
br label %95
92: ; preds = %51
%93 = load i32, i32* %6
%94 = call i32 @waitpid(i32 %93, i32* %9, i32 0)
store i32 0, i32* %3
br label %95
95: ; preds = %92, %89, %81, %67, %23, %17
%96 = load i32, i32* %3
ret i32 %96
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
@stderr = global i32 0
@.str = [12 x i8] c"pipe error\0A\00"
@.str.1 = [22 x i8] c"failed to fork child\0A\00"
@.str.2 = [5 x i8] c"EXIT\00"
@.str.3 = [19 x i8] c"pipe write failed\0A\00"
@.str.4 = [62 x i8] c"Timed out after %d seconds doing %s - possible eCryptfs hang\0A\00"
@.str.5 = [8 x i8] c"mkdir()\00"
@.str.6 = [8 x i8] c"rmdir()\00"
@SIGINT = global i32 0
@errno = global i32 0
@EINTR = global i32 0
@.str.7 = [40 x i8] c"Unexpected return from select(): %d %s\0A\00"
define i32 @hang_check(i32 %0, i8* nocapture %1) {
%3 = alloca %struct.timeval
%4 = alloca i32
%5 = alloca [2 x i32]
%6 = alloca i32
%7 = bitcast %struct.timeval* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = bitcast [2 x i32]* %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
store i32 30, i32* %11
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
store i64 0, i64* %12
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%14 = call i64 @pipe(i32* %13)
%15 = icmp slt i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %75
19: ; preds = %2
%20 = call i32 (...) @fork()
switch i32 %20, label %43 [
i32 -1, label %21
i32 0, label %24
]
21: ; preds = %19
%22 = load i32, i32* @stderr
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %75
24: ; preds = %19
%25 = load i32, i32* %13
%26 = call i32 @close(i32 %25)
switch i32 %0, label %31 [
i32 0, label %27
i32 1, label %29
]
27: ; preds = %24
%28 = call i32 @mkdir(i8* %1, i32 448)
br label %31
29: ; preds = %24
%30 = call i32 @rmdir(i8* %1)
br label %31
31: ; preds = %24, %29, %27
%32 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
%33 = load i32, i32* %32
%34 = call i32 @write(i32 %33, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4)
%35 = icmp slt i32 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %31
%37 = load i32, i32* @stderr
%38 = call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
br label %39
39: ; preds = %36, %31
%40 = load i32, i32* %32
%41 = call i32 @close(i32 %40)
%42 = call i32 @_exit(i32 0)
unreachable
43: ; preds = %19
%44 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
%45 = load i32, i32* %44
%46 = call i32 @close(i32 %45)
%47 = call i32 @FD_ZERO(i32* %6)
%48 = load i32, i32* %13
%49 = call i32 @FD_SET(i32 %48, i32* %6)
%50 = load i32, i32* %13
%51 = add nsw i32 %50, 1
%52 = call i32 @select(i32 %51, i32* %6, i32* null, i32* null, %struct.timeval* %3)
%53 = load i32, i32* %13
%54 = call i32 @close(i32 %53)
switch i32 %52, label %73 [
i32 0, label %55
i32 -1, label %62
]
55: ; preds = %43
%56 = load i32, i32* @stderr
%57 = icmp eq i32 %0, 0
%58 = select i1 %57, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0)
%59 = call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.4, i64 0, i64 0), i32 30, i8* %58)
%60 = load i32, i32* @SIGINT
%61 = call i32 @kill(i32 %20, i32 %60)
br label %75
62: ; preds = %43
%63 = load i32, i32* @errno
%64 = load i32, i32* @EINTR
%65 = icmp eq i32 %63, %64
br i1 %65, label %71, label %66
66: ; preds = %62
%67 = load i32, i32* @stderr
%68 = call i8* @strerror(i32 %63)
%69 = call i32 (i32, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0), i32 %63, i8* %68)
%70 = call i32 @waitpid(i32 %20, i32* %4, i32 0)
br label %75
71: ; preds = %62
%72 = call i32 @waitpid(i32 %20, i32* %4, i32 0)
br label %75
73: ; preds = %43
%74 = call i32 @waitpid(i32 %20, i32* %4, i32 0)
br label %75
75: ; preds = %73, %71, %66, %55, %21, %16
%76 = phi i32 [ 2, %16 ], [ 0, %73 ], [ 2, %66 ], [ 0, %71 ], [ 1, %55 ], [ 2, %21 ]
ret i32 %76
}