#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*/ execlp(char *, char *, char *, char *);
int /*<<< orphan*/ exit(int);
int fork();
int /*<<< orphan*/ sleep(int);
int main(int argc, char *argv[]) {
  int pid;
  int i;
  if (argc < 2) {
    exit(1);
  }
  for (i = 1; i < argc; i++) {
    pid = fork();
    if (pid == 0) {
      execlp("wc", "wc", argv[i], (char *)0);
    }
  }
  sleep(2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    116a <main+0x2a>
mov    $0x1,%edi
call   1030 <exit@plt>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11c3 <main+0x83>
mov    $0x0,%al
call   1060 <fork@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11b0 <main+0x70>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe5c(%rip),%rsi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rsi,%rdi
call   1040 <execlp@plt>
jmp    11b5 <main+0x75>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1171 <main+0x31>
mov    $0x2,%edi
call   1050 <sleep@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     11af <main+0x6f>
mov    %rsi,%r14
mov    %edi,%r12d
mov    $0x1,%ebx
lea    0xea1(%rip),%r15
jmp    1179 <main+0x39>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%r12
je     1197 <main+0x57>
xor    %eax,%eax
call   1060 <fork@plt>
test   %eax,%eax
jne    1170 <main+0x30>
mov    (%r14,%rbx,8),%rdx
mov    %r15,%rdi
mov    %r15,%rsi
xor    %ecx,%ecx
call   1040 <execlp@plt>
jmp    1170 <main+0x30>
mov    $0x2,%edi
call   1050 <sleep@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"wc\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %2
store i32 1, i32* %7
br label %13
13: ; preds = %29, %12
%14 = load i32, i32* %7
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %32
17: ; preds = %13
%18 = call i32 (...) @fork()
store i32 %18, i32* %6
%19 = load i32, i32* %6
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %28
21: ; preds = %17
%22 = load i8**, i8*** %5
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %22, i64 %24
%26 = load i8*, i8** %25
%27 = call i32 @execlp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %26, i8* null)
br label %28
28: ; preds = %21, %17
br label %29
29: ; preds = %28
%30 = load i32, i32* %7
%31 = add nsw i32 %30, 1
store i32 %31, i32* %7
br label %13
32: ; preds = %13
%33 = call i32 @sleep(i32 2)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"wc\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %8
6: ; preds = %2
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %4, %16
%9 = phi i64 [ 1, %4 ], [ %17, %16 ]
%10 = tail call i32 (...) @fork()
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %8
%13 = getelementptr inbounds i8*, i8** %1, i64 %9
%14 = load i8*, i8** %13
%15 = tail call i32 @execlp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %14, i8* null)
br label %16
16: ; preds = %8, %12
%17 = add nuw nsw i64 %9, 1
%18 = icmp eq i64 %17, %5
br i1 %18, label %19, label %8
19: ; preds = %16
%20 = tail call i32 @sleep(i32 2)
ret i32 0
}