#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 /*<<< orphan*/ execl(char *, char *, char *);
int /*<<< orphan*/ fork();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ wait();
int main() {
  int i;
  for (i = 0; i < 5; ++i)
    if (!fork())
      execl("/usr/bin/who", "/usr/bin/who", (char *)NULL);
  if (!fork()) {
    execl("/usr/bin/who", "/usr/bin/who", (char *)NULL);
  } else {
    wait();
    printf("PRINTF\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1196 <main+0x56>
mov    $0x0,%al
call   1060 <fork@plt>
cmp    $0x0,%eax
jne    1183 <main+0x43>
lea    0xe89(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    %rsi,%rdi
call   1040 <execl@plt>
jmp    1188 <main+0x48>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1156 <main+0x16>
mov    $0x0,%al
call   1060 <fork@plt>
cmp    $0x0,%eax
jne    11be <main+0x7e>
lea    0xe53(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    %rsi,%rdi
call   1040 <execl@plt>
jmp    11d1 <main+0x91>
mov    $0x0,%al
call   1050 <wait@plt>
lea    0xe41(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <fork@plt>
test   %eax,%eax
jne    115d <main+0x1d>
lea    0xead(%rip),%rdi
mov    %rdi,%rsi
xor    %edx,%edx
call   1040 <execl@plt>
xor    %eax,%eax
call   1060 <fork@plt>
test   %eax,%eax
jne    1179 <main+0x39>
lea    0xe91(%rip),%rdi
mov    %rdi,%rsi
xor    %edx,%edx
call   1040 <execl@plt>
xor    %eax,%eax
call   1060 <fork@plt>
test   %eax,%eax
jne    1195 <main+0x55>
lea    0xe75(%rip),%rdi
mov    %rdi,%rsi
xor    %edx,%edx
call   1040 <execl@plt>
xor    %eax,%eax
call   1060 <fork@plt>
test   %eax,%eax
jne    11b1 <main+0x71>
lea    0xe59(%rip),%rdi
mov    %rdi,%rsi
xor    %edx,%edx
call   1040 <execl@plt>
xor    %eax,%eax
call   1060 <fork@plt>
test   %eax,%eax
jne    11cd <main+0x8d>
lea    0xe3d(%rip),%rdi
mov    %rdi,%rsi
xor    %edx,%edx
call   1040 <execl@plt>
xor    %eax,%eax
call   1060 <fork@plt>
test   %eax,%eax
je     11ed <main+0xad>
xor    %eax,%eax
call   1050 <wait@plt>
lea    0xe27(%rip),%rdi
call   1030 <puts@plt>
jmp    11fe <main+0xbe>
lea    0xe0c(%rip),%rdi
mov    %rdi,%rsi
xor    %edx,%edx
call   1040 <execl@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"/usr/bin/who\00"
@.str.1 = [8 x i8] c"PRINTF\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %12, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 5
br i1 %5, label %6, label %15
6: ; preds = %3
%7 = call i32 (...) @fork()
%8 = icmp ne i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = call i32 @execl(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* null)
br label %11
11: ; preds = %9, %6
br label %12
12: ; preds = %11
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
br label %3
15: ; preds = %3
%16 = call i32 (...) @fork()
%17 = icmp ne i32 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = call i32 @execl(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* null)
br label %23
20: ; preds = %15
%21 = call i32 (...) @wait()
%22 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %23
23: ; preds = %20, %18
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"/usr/bin/who\00"
@str = [7 x i8] c"PRINTF\00"
define i32 @main() {
%1 = tail call i32 (...) @fork()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @execl(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* null)
br label %5
5: ; preds = %0, %3
%6 = tail call i32 (...) @fork()
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @execl(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* null)
br label %10
10: ; preds = %8, %5
%11 = tail call i32 (...) @fork()
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = tail call i32 @execl(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* null)
br label %15
15: ; preds = %13, %10
%16 = tail call i32 (...) @fork()
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = tail call i32 @execl(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* null)
br label %20
20: ; preds = %18, %15
%21 = tail call i32 (...) @fork()
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = tail call i32 @execl(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* null)
br label %25
25: ; preds = %23, %20
%26 = tail call i32 (...) @fork()
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = tail call i32 @execl(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* null)
br label %33
30: ; preds = %25
%31 = tail call i32 (...) @wait()
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
br label %33
33: ; preds = %30, %28
ret i32 0
}