#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 */

/* Variables and functions */
int WEXITSTATUS(int);
scalar_t__ WIFEXITED(int);
scalar_t__ WIFSIGNALED(int);
scalar_t__ WIFSTOPPED(int);
int WSTOPSIG(int);
int WTERMSIG(int);
int /*<<< orphan*/ exit(int);
int fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int getpid();
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
int wait4(int, int *, int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int pid, wpid, status, i;
  for (i = 0; i < 10; i++)
    if (pid = fork()) {
      fprintf(stderr, "parent: I see kid with pid = %d\n", pid);
      continue;
    } else {
      fprintf(stderr, "child: %d here\n", getpid());
      sleep(5);
      exit(i);
    }
  if (argc > 1) {
    fprintf(stderr, "parent: sleeping to let child exit statuses queue\n");
    sleep(10);
  }
  while (-1 != (wpid = wait4(-1, &status, 0, 0))) {
    fprintf(stderr, "parent: status = 0x%x\n", status);
    if (WIFSIGNALED(status))
      fprintf(stderr, "parent: signaled with %d\n", WTERMSIG(status));
    else if (WIFEXITED(status))
      fprintf(stderr, "parent: exited with status %d\n", WEXITSTATUS(status));
    else if (WIFSTOPPED(status))
      fprintf(stderr, "parent: stopped with %d\n", WSTOPSIG(status));
    else
      fprintf(stderr, "parent: bad status\n");
    i--;
  }
  perror("wait4 failed");
  exit(i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0xa,-0x20(%rbp)
jge    126f <main+0x9f>
mov    $0x0,%al
call   10f0 <fork@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     1229 <main+0x59>
mov    0x2dcf(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xde3(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1261 <main+0x91>
mov    0x2db0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x24(%rbp),%edi
mov    %eax,%edx
lea    0xdd9(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x5,%edi
call   10d0 <sleep@plt>
mov    -0x20(%rbp),%edi
call   10c0 <exit@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11ed <main+0x1d>
cmpl   $0x1,-0x8(%rbp)
jle    129a <main+0xca>
mov    0x2d60(%rip),%rax
mov    (%rax),%edi
lea    0xda8(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0xa,%edi
call   10d0 <sleep@plt>
jmp    129f <main+0xcf>
mov    $0xffffffff,%edi
lea    -0x1c(%rbp),%rsi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1080 <wait4@plt>
mov    %eax,%ecx
mov    %ecx,-0x18(%rbp)
mov    $0xffffffff,%eax
cmp    %ecx,%eax
je     13c6 <main+0x1f6>
mov    0x2d16(%rip),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%edx
lea    0xd8e(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x1c(%rbp),%edi
call   1040 <WIFSIGNALED@plt>
cmp    $0x0,%rax
je     131b <main+0x14b>
mov    0x2cea(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%edi
call   1070 <WTERMSIG@plt>
mov    -0x28(%rbp),%edi
mov    %eax,%edx
lea    0xd6c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    13b8 <main+0x1e8>
mov    -0x1c(%rbp),%edi
call   10b0 <WIFEXITED@plt>
cmp    $0x0,%rax
je     1359 <main+0x189>
mov    0x2cac(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x1c(%rbp),%edi
call   1090 <WEXITSTATUS@plt>
mov    -0x2c(%rbp),%edi
mov    %eax,%edx
lea    0xd48(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    13b3 <main+0x1e3>
mov    -0x1c(%rbp),%edi
call   1060 <WIFSTOPPED@plt>
cmp    $0x0,%rax
je     1397 <main+0x1c7>
mov    0x2c6e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x1c(%rbp),%edi
call   10e0 <WSTOPSIG@plt>
mov    -0x30(%rbp),%edi
mov    %eax,%edx
lea    0xd29(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    13ae <main+0x1de>
mov    0x2c42(%rip),%rax
mov    (%rax),%edi
lea    0xd26(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    13b3 <main+0x1e3>
jmp    13b8 <main+0x1e8>
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    129f <main+0xcf>
lea    0xd14(%rip),%rdi
call   10a0 <perror@plt>
mov    -0x20(%rbp),%edi
call   10c0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %ebp,%ebp
xor    %eax,%eax
call   10f0 <fork@plt>
test   %eax,%eax
je     1344 <main+0x174>
mov    0x2deb(%rip),%r15
mov    (%r15),%edi
lea    0xe01(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
xor    %eax,%eax
call   10f0 <fork@plt>
mov    $0x1,%ebp
test   %eax,%eax
je     1344 <main+0x174>
mov    (%r15),%edi
lea    0xdda(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
xor    %eax,%eax
call   10f0 <fork@plt>
mov    $0x2,%ebp
test   %eax,%eax
je     1344 <main+0x174>
mov    (%r15),%edi
lea    0xdb3(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
xor    %eax,%eax
call   10f0 <fork@plt>
mov    $0x3,%ebp
test   %eax,%eax
je     1344 <main+0x174>
mov    (%r15),%edi
lea    0xd8c(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
xor    %eax,%eax
call   10f0 <fork@plt>
mov    $0x4,%ebp
test   %eax,%eax
je     1344 <main+0x174>
mov    (%r15),%edi
lea    0xd65(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
xor    %eax,%eax
call   10f0 <fork@plt>
mov    $0x5,%ebp
test   %eax,%eax
je     1344 <main+0x174>
mov    (%r15),%edi
lea    0xd3e(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
xor    %eax,%eax
call   10f0 <fork@plt>
mov    $0x6,%ebp
test   %eax,%eax
je     1344 <main+0x174>
mov    (%r15),%edi
lea    0xd1b(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
xor    %eax,%eax
call   10f0 <fork@plt>
mov    $0x7,%ebp
test   %eax,%eax
je     1344 <main+0x174>
mov    (%r15),%edi
lea    0xcf8(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
xor    %eax,%eax
call   10f0 <fork@plt>
mov    $0x8,%ebp
test   %eax,%eax
je     1344 <main+0x174>
mov    (%r15),%edi
lea    0xcd5(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
xor    %eax,%eax
call   10f0 <fork@plt>
mov    $0x9,%ebp
test   %eax,%eax
jne    1377 <main+0x1a7>
mov    0x2c95(%rip),%rax
mov    (%rax),%ebx
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xcc6(%rip),%rsi
mov    %ebx,%edi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x5,%edi
call   10d0 <sleep@plt>
mov    %ebp,%edi
call   10c0 <exit@plt>
mov    (%r15),%edi
lea    0xc7f(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
cmp    $0x1,%ebx
jle    13aa <main+0x1da>
mov    (%r15),%edi
lea    0xc98(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0xa,%edi
call   10d0 <sleep@plt>
lea    0x4(%rsp),%rsi
mov    $0xffffffff,%edi
xor    %edx,%edx
xor    %ecx,%ecx
call   1080 <wait4@plt>
mov    $0xa,%ebx
cmp    $0xffffffff,%eax
jne    13da <main+0x20a>
lea    0xd13(%rip),%rdi
call   10a0 <perror@plt>
mov    %ebx,%edi
call   10c0 <exit@plt>
mov    $0xa,%ebx
lea    0xc7e(%rip),%r14
lea    0x4(%rsp),%r13
lea    0xc89(%rip),%r12
jmp    1433 <main+0x263>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r15),%ebp
mov    0x4(%rsp),%edi
call   1070 <WTERMSIG@plt>
mov    %ebp,%edi
mov    %r12,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
add    $0xffffffff,%ebx
mov    $0xffffffff,%edi
mov    %r13,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   1080 <wait4@plt>
cmp    $0xffffffff,%eax
je     13c7 <main+0x1f7>
mov    (%r15),%edi
mov    0x4(%rsp),%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x4(%rsp),%edi
call   1040 <WIFSIGNALED@plt>
test   %rax,%rax
jne    1400 <main+0x230>
mov    0x4(%rsp),%edi
call   10b0 <WIFEXITED@plt>
test   %rax,%rax
je     1477 <main+0x2a7>
mov    (%r15),%ebp
mov    0x4(%rsp),%edi
call   1090 <WEXITSTATUS@plt>
mov    %ebp,%edi
lea    0xc20(%rip),%rsi
jmp    1411 <main+0x241>
mov    %r12,%rbp
mov    0x4(%rsp),%edi
call   1060 <WIFSTOPPED@plt>
mov    (%r15),%r12d
test   %rax,%rax
je     14a9 <main+0x2d9>
mov    0x4(%rsp),%edi
call   10e0 <WSTOPSIG@plt>
mov    %r12d,%edi
lea    0xc16(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    14ba <main+0x2ea>
mov    %r12d,%edi
lea    0xc1a(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %rbp,%r12
jmp    141a <main+0x24a>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"parent: I see kid with pid = %d\0A\00"
@.str.1 = [16 x i8] c"child: %d here\0A\00"
@.str.2 = [51 x i8] c"parent: sleeping to let child exit statuses queue\0A\00"
@.str.3 = [23 x i8] c"parent: status = 0x%x\0A\00"
@.str.4 = [26 x i8] c"parent: signaled with %d\0A\00"
@.str.5 = [31 x i8] c"parent: exited with status %d\0A\00"
@.str.6 = [25 x i8] c"parent: stopped with %d\0A\00"
@.str.7 = [20 x i8] c"parent: bad status\0A\00"
@.str.8 = [13 x i8] c"wait4 failed\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %9
br label %10
10: ; preds = %27, %2
%11 = load i32, i32* %9
%12 = icmp slt i32 %11, 10
br i1 %12, label %13, label %30
13: ; preds = %10
%14 = call i32 (...) @fork()
store i32 %14, i32* %6
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i32, i32* @stderr
%18 = load i32, i32* %6
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %18)
br label %27
20: ; preds = %13
%21 = load i32, i32* @stderr
%22 = call i32 (...) @getpid()
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = call i32 @sleep(i32 5)
%25 = load i32, i32* %9
%26 = call i32 @exit(i32 %25)
unreachable
27: ; preds = %16
%28 = load i32, i32* %9
%29 = add nsw i32 %28, 1
store i32 %29, i32* %9
br label %10
30: ; preds = %10
%31 = load i32, i32* %4
%32 = icmp sgt i32 %31, 1
br i1 %32, label %33, label %37
33: ; preds = %30
%34 = load i32, i32* @stderr
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
%36 = call i32 @sleep(i32 10)
br label %37
37: ; preds = %33, %30
br label %38
38: ; preds = %76, %37
%39 = call i32 @wait4(i32 -1, i32* %8, i32 0, i32 0)
store i32 %39, i32* %7
%40 = icmp ne i32 -1, %39
br i1 %40, label %41, label %79
41: ; preds = %38
%42 = load i32, i32* @stderr
%43 = load i32, i32* %8
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %43)
%45 = load i32, i32* %8
%46 = call i64 @WIFSIGNALED(i32 %45)
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %53
48: ; preds = %41
%49 = load i32, i32* @stderr
%50 = load i32, i32* %8
%51 = call i32 @WTERMSIG(i32 %50)
%52 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i32 %51)
br label %76
53: ; preds = %41
%54 = load i32, i32* %8
%55 = call i64 @WIFEXITED(i32 %54)
%56 = icmp ne i64 %55, 0
br i1 %56, label %57, label %62
57: ; preds = %53
%58 = load i32, i32* @stderr
%59 = load i32, i32* %8
%60 = call i32 @WEXITSTATUS(i32 %59)
%61 = call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 %60)
br label %75
62: ; preds = %53
%63 = load i32, i32* %8
%64 = call i64 @WIFSTOPPED(i32 %63)
%65 = icmp ne i64 %64, 0
br i1 %65, label %66, label %71
66: ; preds = %62
%67 = load i32, i32* @stderr
%68 = load i32, i32* %8
%69 = call i32 @WSTOPSIG(i32 %68)
%70 = call i32 (i32, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i32 %69)
br label %74
71: ; preds = %62
%72 = load i32, i32* @stderr
%73 = call i32 (i32, i8*, ...) @fprintf(i32 %72, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0))
br label %74
74: ; preds = %71, %66
br label %75
75: ; preds = %74, %57
br label %76
76: ; preds = %75, %48
%77 = load i32, i32* %9
%78 = add nsw i32 %77, -1
store i32 %78, i32* %9
br label %38
79: ; preds = %38
%80 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%81 = load i32, i32* %9
%82 = call i32 @exit(i32 %81)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"parent: I see kid with pid = %d\0A\00"
@.str.1 = [16 x i8] c"child: %d here\0A\00"
@.str.2 = [51 x i8] c"parent: sleeping to let child exit statuses queue\0A\00"
@.str.3 = [23 x i8] c"parent: status = 0x%x\0A\00"
@.str.4 = [26 x i8] c"parent: signaled with %d\0A\00"
@.str.5 = [31 x i8] c"parent: exited with status %d\0A\00"
@.str.6 = [25 x i8] c"parent: stopped with %d\0A\00"
@.str.7 = [20 x i8] c"parent: bad status\0A\00"
@.str.8 = [13 x i8] c"wait4 failed\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 (...) @fork()
%6 = icmp eq i32 %5, 0
br i1 %6, label %56, label %7
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %5)
%10 = tail call i32 (...) @fork()
%11 = icmp eq i32 %10, 0
br i1 %11, label %56, label %12
12: ; preds = %7
%13 = load i32, i32* @stderr
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %10)
%15 = tail call i32 (...) @fork()
%16 = icmp eq i32 %15, 0
br i1 %16, label %56, label %17
17: ; preds = %12
%18 = load i32, i32* @stderr
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %15)
%20 = tail call i32 (...) @fork()
%21 = icmp eq i32 %20, 0
br i1 %21, label %56, label %22
22: ; preds = %17
%23 = load i32, i32* @stderr
%24 = tail call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %20)
%25 = tail call i32 (...) @fork()
%26 = icmp eq i32 %25, 0
br i1 %26, label %56, label %27
27: ; preds = %22
%28 = load i32, i32* @stderr
%29 = tail call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %25)
%30 = tail call i32 (...) @fork()
%31 = icmp eq i32 %30, 0
br i1 %31, label %56, label %32
32: ; preds = %27
%33 = load i32, i32* @stderr
%34 = tail call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %30)
%35 = tail call i32 (...) @fork()
%36 = icmp eq i32 %35, 0
br i1 %36, label %56, label %37
37: ; preds = %32
%38 = load i32, i32* @stderr
%39 = tail call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %35)
%40 = tail call i32 (...) @fork()
%41 = icmp eq i32 %40, 0
br i1 %41, label %56, label %42
42: ; preds = %37
%43 = load i32, i32* @stderr
%44 = tail call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %40)
%45 = tail call i32 (...) @fork()
%46 = icmp eq i32 %45, 0
br i1 %46, label %56, label %47
47: ; preds = %42
%48 = load i32, i32* @stderr
%49 = tail call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %45)
%50 = tail call i32 (...) @fork()
%51 = icmp eq i32 %50, 0
br i1 %51, label %56, label %52
52: ; preds = %47
%53 = load i32, i32* @stderr
%54 = tail call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %50)
%55 = icmp sgt i32 %0, 1
br i1 %55, label %63, label %67
56: ; preds = %47, %42, %37, %32, %27, %22, %17, %12, %7, %2
%57 = phi i32 [ 0, %2 ], [ 1, %7 ], [ 2, %12 ], [ 3, %17 ], [ 4, %22 ], [ 5, %27 ], [ 6, %32 ], [ 7, %37 ], [ 8, %42 ], [ 9, %47 ]
%58 = load i32, i32* @stderr
%59 = tail call i32 (...) @getpid()
%60 = tail call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %59)
%61 = tail call i32 @sleep(i32 5)
%62 = tail call i32 @exit(i32 %57)
unreachable
63: ; preds = %52
%64 = load i32, i32* @stderr
%65 = tail call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
%66 = tail call i32 @sleep(i32 10)
br label %67
67: ; preds = %63, %52
%68 = call i32 @wait4(i32 -1, i32* %3, i32 0, i32 0)
%69 = icmp eq i32 %68, -1
br i1 %69, label %107, label %70
70: ; preds = %67, %103
%71 = phi i32 [ %104, %103 ], [ 10, %67 ]
%72 = load i32, i32* @stderr
%73 = load i32, i32* %3
%74 = call i32 (i32, i8*, ...) @fprintf(i32 %72, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %73)
%75 = load i32, i32* %3
%76 = call i64 @WIFSIGNALED(i32 %75)
%77 = icmp eq i64 %76, 0
br i1 %77, label %83, label %78
78: ; preds = %70
%79 = load i32, i32* @stderr
%80 = load i32, i32* %3
%81 = call i32 @WTERMSIG(i32 %80)
%82 = call i32 (i32, i8*, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i32 %81)
br label %103
83: ; preds = %70
%84 = load i32, i32* %3
%85 = call i64 @WIFEXITED(i32 %84)
%86 = icmp eq i64 %85, 0
br i1 %86, label %92, label %87
87: ; preds = %83
%88 = load i32, i32* @stderr
%89 = load i32, i32* %3
%90 = call i32 @WEXITSTATUS(i32 %89)
%91 = call i32 (i32, i8*, ...) @fprintf(i32 %88, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 %90)
br label %103
92: ; preds = %83
%93 = load i32, i32* %3
%94 = call i64 @WIFSTOPPED(i32 %93)
%95 = icmp eq i64 %94, 0
%96 = load i32, i32* @stderr
br i1 %95, label %101, label %97
97: ; preds = %92
%98 = load i32, i32* %3
%99 = call i32 @WSTOPSIG(i32 %98)
%100 = call i32 (i32, i8*, ...) @fprintf(i32 %96, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i32 %99)
br label %103
101: ; preds = %92
%102 = call i32 (i32, i8*, ...) @fprintf(i32 %96, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0))
br label %103
103: ; preds = %87, %101, %97, %78
%104 = add nsw i32 %71, -1
%105 = call i32 @wait4(i32 -1, i32* %3, i32 0, i32 0)
%106 = icmp eq i32 %105, -1
br i1 %106, label %107, label %70
107: ; preds = %103, %67
%108 = phi i32 [ 10, %67 ], [ %104, %103 ]
%109 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%110 = call i32 @exit(i32 %108)
unreachable
}